1
Fork 0

In relate_tys, when creating new universes, insert missing universes as other

This commit is contained in:
jackh726 2021-09-09 18:04:59 -04:00
parent 497ee321af
commit 0a3c6bb887
2 changed files with 43 additions and 3 deletions

View file

@ -80,10 +80,15 @@ impl TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx> {
}
fn create_next_universe(&mut self) -> ty::UniverseIndex {
let info_universe =
self.borrowck_context.constraints.universe_causes.push(self.universe_info.clone());
let universe = self.infcx.create_next_universe();
assert_eq!(info_universe, universe);
// FIXME: If we relate tys after normalizing with late-bound regions, there will
// be extra universes. A proper solution would be to somehow track those universes
// during projection, but here we just treat those as "other"
self.borrowck_context
.constraints
.universe_causes
.ensure_contains_elem(universe, || UniverseInfo::other());
self.borrowck_context.constraints.universe_causes[universe] = self.universe_info.clone();
universe
}