struct MapAndCompressBoundVars<'db> {
tcx: DbInterner<'db>,
binder: DebruijnIndex,
still_bound_vars: Vec<BoundVariableKind<'db>>,
mapping: FxIndexMap<BoundVar, GenericArg<'db>>,
}Expand description
Given some where clause like for<'b, 'c> <Self as Trait<'a_identity>>::Gat<'b>: Bound<'c>,
the mapping will map 'b back to the GAT’s 'b_identity. Then we need to compress the
remaining bound var 'c to index 0.
This folder gives us: for<'c> <Self as Trait<'a_identity>>::Gat<'b_identity>: Bound<'c>,
which is sufficient for an item bound for Gat, since all of the GAT’s args are identity.
Fields§
§tcx: DbInterner<'db>§binder: DebruijnIndexHow deep are we? Makes sure we don’t touch the vars of nested binders.
still_bound_vars: Vec<BoundVariableKind<'db>>List of bound vars that remain unsubstituted because they were not mentioned in the GAT’s args.
mapping: FxIndexMap<BoundVar, GenericArg<'db>>Subtle invariant: If the GenericArg is bound, then it should be
stored with the debruijn index of INNERMOST so it can be shifted
correctly during substitution.
Trait Implementations§
Source§impl<'db> TypeFolder<DbInterner<'db>> for MapAndCompressBoundVars<'db>
impl<'db> TypeFolder<DbInterner<'db>> for MapAndCompressBoundVars<'db>
fn cx(&self) -> DbInterner<'db>
fn fold_binder<T>(&mut self, t: Binder<'db, T>) -> Binder<'db, T>where
Binder<'db, T>: TypeSuperFoldable<DbInterner<'db>>,
fn fold_ty(&mut self, ty: Ty<'db>) -> Ty<'db>
fn fold_region(&mut self, re: Region<'db>) -> Region<'db>
fn fold_const(&mut self, ct: Const<'db>) -> Const<'db>
fn fold_predicate(&mut self, p: Predicate<'db>) -> Predicate<'db>
fn fold_clauses( &mut self, c: <I as Interner>::Clauses, ) -> <I as Interner>::Clauses
Auto Trait Implementations§
impl<'db> !RefUnwindSafe for MapAndCompressBoundVars<'db>
impl<'db> !UnwindSafe for MapAndCompressBoundVars<'db>
impl<'db> Freeze for MapAndCompressBoundVars<'db>
impl<'db> Send for MapAndCompressBoundVars<'db>
impl<'db> Sync for MapAndCompressBoundVars<'db>
impl<'db> Unpin for MapAndCompressBoundVars<'db>
impl<'db> UnsafeUnpin for MapAndCompressBoundVars<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more