Rename a bunch of things
This commit is contained in:
parent
25c9f2ca06
commit
db638ab968
60 changed files with 538 additions and 566 deletions
|
@ -1,4 +1,4 @@
|
|||
use crate::infcx::SolverDelegate;
|
||||
use crate::delegate::SolverDelegate;
|
||||
use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
|
||||
use rustc_type_ir::inherent::*;
|
||||
use rustc_type_ir::visit::TypeVisitableExt;
|
||||
|
@ -8,37 +8,37 @@ use rustc_type_ir::{self as ty, Interner};
|
|||
// EAGER RESOLUTION
|
||||
|
||||
/// Resolves ty, region, and const vars to their inferred values or their root vars.
|
||||
pub struct EagerResolver<'a, Infcx, I = <Infcx as SolverDelegate>::Interner>
|
||||
pub struct EagerResolver<'a, D, I = <D as SolverDelegate>::Interner>
|
||||
where
|
||||
Infcx: SolverDelegate<Interner = I>,
|
||||
D: SolverDelegate<Interner = I>,
|
||||
I: Interner,
|
||||
{
|
||||
infcx: &'a Infcx,
|
||||
delegate: &'a D,
|
||||
}
|
||||
|
||||
impl<'a, Infcx: SolverDelegate> EagerResolver<'a, Infcx> {
|
||||
pub fn new(infcx: &'a Infcx) -> Self {
|
||||
EagerResolver { infcx }
|
||||
impl<'a, D: SolverDelegate> EagerResolver<'a, D> {
|
||||
pub fn new(delegate: &'a D) -> Self {
|
||||
EagerResolver { delegate }
|
||||
}
|
||||
}
|
||||
|
||||
impl<Infcx: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolver<'_, Infcx> {
|
||||
fn interner(&self) -> I {
|
||||
self.infcx.interner()
|
||||
impl<D: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerResolver<'_, D> {
|
||||
fn cx(&self) -> I {
|
||||
self.delegate.cx()
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, t: I::Ty) -> I::Ty {
|
||||
match t.kind() {
|
||||
ty::Infer(ty::TyVar(vid)) => {
|
||||
let resolved = self.infcx.opportunistic_resolve_ty_var(vid);
|
||||
let resolved = self.delegate.opportunistic_resolve_ty_var(vid);
|
||||
if t != resolved && resolved.has_infer() {
|
||||
resolved.fold_with(self)
|
||||
} else {
|
||||
resolved
|
||||
}
|
||||
}
|
||||
ty::Infer(ty::IntVar(vid)) => self.infcx.opportunistic_resolve_int_var(vid),
|
||||
ty::Infer(ty::FloatVar(vid)) => self.infcx.opportunistic_resolve_float_var(vid),
|
||||
ty::Infer(ty::IntVar(vid)) => self.delegate.opportunistic_resolve_int_var(vid),
|
||||
ty::Infer(ty::FloatVar(vid)) => self.delegate.opportunistic_resolve_float_var(vid),
|
||||
_ => {
|
||||
if t.has_infer() {
|
||||
t.super_fold_with(self)
|
||||
|
@ -51,7 +51,7 @@ impl<Infcx: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerRe
|
|||
|
||||
fn fold_region(&mut self, r: I::Region) -> I::Region {
|
||||
match r.kind() {
|
||||
ty::ReVar(vid) => self.infcx.opportunistic_resolve_lt_var(vid),
|
||||
ty::ReVar(vid) => self.delegate.opportunistic_resolve_lt_var(vid),
|
||||
_ => r,
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ impl<Infcx: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerRe
|
|||
fn fold_const(&mut self, c: I::Const) -> I::Const {
|
||||
match c.kind() {
|
||||
ty::ConstKind::Infer(ty::InferConst::Var(vid)) => {
|
||||
let resolved = self.infcx.opportunistic_resolve_ct_var(vid);
|
||||
let resolved = self.delegate.opportunistic_resolve_ct_var(vid);
|
||||
if c != resolved && resolved.has_infer() {
|
||||
resolved.fold_with(self)
|
||||
} else {
|
||||
|
@ -67,7 +67,7 @@ impl<Infcx: SolverDelegate<Interner = I>, I: Interner> TypeFolder<I> for EagerRe
|
|||
}
|
||||
}
|
||||
ty::ConstKind::Infer(ty::InferConst::EffectVar(vid)) => {
|
||||
self.infcx.opportunistic_resolve_effect_var(vid)
|
||||
self.delegate.opportunistic_resolve_effect_var(vid)
|
||||
}
|
||||
_ => {
|
||||
if c.has_infer() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue