Function rustc_traits::chalk::lowering::collect_bound_vars
source · pub(crate) fn collect_bound_vars<'tcx, T: TypeFoldable<'tcx>>(
interner: RustInterner<'tcx>,
tcx: TyCtxt<'tcx>,
ty: Binder<'tcx, T>
) -> (T, VariableKinds<RustInterner<'tcx>>, BTreeMap<DefId, u32>)
Expand description
To collect bound vars, we have to do two passes. In the first pass, we
collect all BoundRegionKind
s and ty::Bound
s. In the second pass, we then
replace BrNamed
into BrAnon
. The two separate passes are important,
since we can only replace BrNamed
with BrAnon
s with indices after all
“real” BrAnon
s.
It’s important to note that because of prior substitution, we may have late-bound regions, even outside of fn contexts, since this is the best way to prep types for chalk lowering.