@@ -1342,6 +1342,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1342
1342
let sub_region_scc = self . constraint_sccs . scc ( sub_region) ;
1343
1343
let sup_region_scc = self . constraint_sccs . scc ( sup_region) ;
1344
1344
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
+
1345
1357
// Both the `sub_region` and `sup_region` consist of the union
1346
1358
// of some number of universal regions (along with the union
1347
1359
// of various points in the CFG; ignore those points for
@@ -1356,6 +1368,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1356
1368
} ) ;
1357
1369
1358
1370
if !universal_outlives {
1371
+ debug ! (
1372
+ "eval_outlives: returning false because sub region contains a universal region not present in super"
1373
+ ) ;
1359
1374
return false ;
1360
1375
}
1361
1376
@@ -1364,10 +1379,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1364
1379
1365
1380
if self . universal_regions . is_universal_region ( sup_region) {
1366
1381
// Micro-opt: universal regions contain all points.
1382
+ debug ! (
1383
+ "eval_outlives: returning true because super is universal and hence contains all points"
1384
+ ) ;
1367
1385
return true ;
1368
1386
}
1369
1387
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
1371
1394
}
1372
1395
1373
1396
/// Once regions have been propagated, this method is used to see
0 commit comments