about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2023-08-25 18:03:04 -0300
committerSantiago Pastorino <spastorino@gmail.com>2023-08-25 18:14:00 -0300
commite2efb6ab29b58edf84ebeec1160f14bd160ae895 (patch)
tree7f6813050e2ce0b2dfbfa6a9a4be1ac1ad6a3fa0
parent78da436cbbc3571a4283d8b31c5099b940a0651d (diff)
downloadrust-e2efb6ab29b58edf84ebeec1160f14bd160ae895.tar.gz
rust-e2efb6ab29b58edf84ebeec1160f14bd160ae895.zip
Check that universe can name other universe instead of equality
-rw-r--r--compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
index e44f1c81f4d..de8cc31be79 100644
--- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
+++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
@@ -215,11 +215,12 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
                             }
                             VarValue::Value(cur_region) => {
                                 let lub = match *cur_region {
-                                    // If the empty and placeholder regions are in the same universe,
-                                    // then the LUB is the Placeholder region (which is the cur_region).
-                                    // If they are not in the same universe, the LUB is the Static lifetime.
+                                    // If this empty region is from a universe that can name the
+                                    // placeholder universe, then the LUB is the Placeholder region
+                                    // (which is the cur_region). Otherwise, the LUB is the Static
+                                    // lifetime.
                                     RePlaceholder(placeholder)
-                                        if a_universe != placeholder.universe =>
+                                        if !a_universe.can_name(placeholder.universe) =>
                                     {
                                         self.tcx().lifetimes.re_static
                                     }