@@ -1342,6 +1342,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13421342 let sub_region_scc = self . constraint_sccs . scc ( sub_region) ;
13431343 let sup_region_scc = self . constraint_sccs . scc ( sup_region) ;
13441344
1345+ // If we are checking that `'sup: 'sub`, and `'sub` contains
1346+ // some placeholder that `'sup` cannot name, then this is only
1347+ // true if `'sup` outlives static.
1348+ if !self . universe_compatible ( sub_region_scc, sup_region_scc) {
1349+ debug ! (
1350+ "eval_outlives: sub universe `{sub_region_scc:?}` is not nameable \
1351+ by super `{sup_region_scc:?}`, promoting to static",
1352+ ) ;
1353+
1354+ return self . eval_outlives ( sup_region, self . universal_regions . fr_static ) ;
1355+ }
1356+
13451357 // Both the `sub_region` and `sup_region` consist of the union
13461358 // of some number of universal regions (along with the union
13471359 // of various points in the CFG; ignore those points for
@@ -1356,6 +1368,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13561368 } ) ;
13571369
13581370 if !universal_outlives {
1371+ debug ! (
1372+ "eval_outlives: returning false because sub region contains a universal region not present in super"
1373+ ) ;
13591374 return false ;
13601375 }
13611376
@@ -1364,10 +1379,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
13641379
13651380 if self . universal_regions . is_universal_region ( sup_region) {
13661381 // Micro-opt: universal regions contain all points.
1382+ debug ! (
1383+ "eval_outlives: returning true because super is universal and hence contains all points"
1384+ ) ;
13671385 return true ;
13681386 }
13691387
1370- self . scc_values . contains_points ( sup_region_scc, sub_region_scc)
1388+ let result = self . scc_values . contains_points ( sup_region_scc, sub_region_scc) ;
1389+ debug ! (
1390+ "eval_outlives: returning {} because of comparison between points in sup/sub" ,
1391+ result
1392+ ) ;
1393+ result
13711394 }
13721395
13731396 /// Once regions have been propagated, this method is used to see
0 commit comments