1
Fork 0

Auto merge of #120544 - BoxyUwU:enter_forall, r=lcnr

Introduce `enter_forall` to supercede `instantiate_binder_with_placeholders`

r? `@lcnr`

Long term we'd like to experiment with decrementing the universe count after "exiting" binders so that we do not end up creating infer vars in non-root universes even when they logically reside in the root universe. The fact that we dont do this currently results in a number of issues in the new trait solver where we consider goals to be ambiguous because otherwise it would require lowering the universe of an infer var. i.e. the goal  `?x.0 eq <T as Trait<?y.1>>::Assoc` where the alias is rigid would not be able to instantiate `?x` with the alias as there would be a universe error.

This PR is the first-ish sort of step towards being able to implement this as eventually we would want to decrement the universe in `enter_forall`. Unfortunately its Difficult to actually implement decrementing universes nicely so this is a separate step which moves us closer to the long term goal 
This commit is contained in:
bors 2024-02-08 16:42:56 +00:00
commit c29082fe7d
21 changed files with 629 additions and 549 deletions

View file

@ -1052,6 +1052,7 @@ impl<'tcx, T> Binder<'tcx, T> {
where
T: TypeVisitable<TyCtxt<'tcx>>,
{
// `self.value` is equivalent to `self.skip_binder()`
if self.value.has_escaping_bound_vars() { None } else { Some(self.skip_binder()) }
}