about summary refs log tree commit diff
path: root/compiler/rustc_borrowck
diff options
context:
space:
mode:
authorjackh726 <jack.huey@umassmed.edu>2021-09-09 18:04:59 -0400
committerjackh726 <jack.huey@umassmed.edu>2021-09-09 18:04:59 -0400
commit0a3c6bb887dcd06730b0fe635d1c40067bf0e852 (patch)
tree9043e0e49c0179bc5ef108e9c8e0b86805843c0c /compiler/rustc_borrowck
parent497ee321af3b8496eaccd7af7b437f18bab81abf (diff)
downloadrust-0a3c6bb887dcd06730b0fe635d1c40067bf0e852.tar.gz
rust-0a3c6bb887dcd06730b0fe635d1c40067bf0e852.zip
In relate_tys, when creating new universes, insert missing universes as other
Diffstat (limited to 'compiler/rustc_borrowck')
-rw-r--r--compiler/rustc_borrowck/src/type_check/relate_tys.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
index 0b9c33ccb77..827e3814259 100644
--- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs
+++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs
@@ -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
     }