File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
compiler/rustc_borrowck/src/region_infer Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1360,6 +1360,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1360
1360
return self . eval_outlives ( sup_region, self . universal_regions . fr_static ) ;
1361
1361
}
1362
1362
1363
+ // Check `sup_region` contains all the placeholder regions in `sub_region`.
1364
+ if !self . scc_values . contains_placeholders ( sup_region_scc, sub_region_scc) {
1365
+ debug ! (
1366
+ "eval_outlives: returning false because sub region contains a placeholder region not present in super"
1367
+ ) ;
1368
+ return false ;
1369
+ }
1370
+
1363
1371
// Both the `sub_region` and `sup_region` consist of the union
1364
1372
// of some number of universal regions (along with the union
1365
1373
// of various points in the CFG; ignore those points for
Original file line number Diff line number Diff line change @@ -303,6 +303,22 @@ impl<N: Idx> RegionValues<N> {
303
303
}
304
304
}
305
305
306
+ /// Returns `true` if `sup_region` contains all the placeholder elements that
307
+ /// `sub_region` contains.
308
+ pub ( crate ) fn contains_placeholders ( & self , sup_region : N , sub_region : N ) -> bool {
309
+ if let Some ( sub_row) = self . placeholders . row ( sub_region) {
310
+ if let Some ( sup_row) = self . placeholders . row ( sup_region) {
311
+ sup_row. superset ( sub_row)
312
+ } else {
313
+ // sup row is empty, so sub row must be empty
314
+ sub_row. is_empty ( )
315
+ }
316
+ } else {
317
+ // sub row is empty, always true
318
+ true
319
+ }
320
+ }
321
+
306
322
/// Returns the locations contained within a given region `r`.
307
323
pub ( crate ) fn locations_outlived_by < ' a > ( & ' a self , r : N ) -> impl Iterator < Item = Location > + ' a {
308
324
self . points . row ( r) . into_iter ( ) . flat_map ( move |set| {
You can’t perform that action at this time.
0 commit comments