@@ -2,6 +2,7 @@ use rustc_data_structures::frozen::Frozen;
2
2
use rustc_data_structures:: transitive_relation:: TransitiveRelation ;
3
3
use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
4
4
use rustc_infer:: infer:: outlives;
5
+ use rustc_infer:: infer:: outlives:: env:: RegionBoundPairs ;
5
6
use rustc_infer:: infer:: region_constraints:: GenericKind ;
6
7
use rustc_infer:: infer:: InferCtxt ;
7
8
use rustc_middle:: mir:: ConstraintCategory ;
@@ -34,18 +35,6 @@ pub(crate) struct UniversalRegionRelations<'tcx> {
34
35
inverse_outlives : TransitiveRelation < RegionVid > ,
35
36
}
36
37
37
- /// Each RBP `('a, GK)` indicates that `GK: 'a` can be assumed to
38
- /// be true. These encode relationships like `T: 'a` that are
39
- /// added via implicit bounds.
40
- ///
41
- /// Each region here is guaranteed to be a key in the `indices`
42
- /// map. We use the "original" regions (i.e., the keys from the
43
- /// map, and not the values) because the code in
44
- /// `process_registered_region_obligations` has some special-cased
45
- /// logic expecting to see (e.g.) `ReStatic`, and if we supplied
46
- /// our special inference variable there, we would mess that up.
47
- type RegionBoundPairs < ' tcx > = Vec < ( ty:: Region < ' tcx > , GenericKind < ' tcx > ) > ;
48
-
49
38
/// As part of computing the free region relations, we also have to
50
39
/// normalize the input-output types, which we then need later. So we
51
40
/// return those. This vector consists of first the input types and
@@ -71,7 +60,7 @@ pub(crate) fn create<'tcx>(
71
60
implicit_region_bound,
72
61
constraints,
73
62
universal_regions : universal_regions. clone ( ) ,
74
- region_bound_pairs : Vec :: new ( ) ,
63
+ region_bound_pairs : Default :: default ( ) ,
75
64
relations : UniversalRegionRelations {
76
65
universal_regions : universal_regions. clone ( ) ,
77
66
outlives : Default :: default ( ) ,
@@ -371,11 +360,13 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
371
360
}
372
361
373
362
OutlivesBound :: RegionSubParam ( r_a, param_b) => {
374
- self . region_bound_pairs . push ( ( r_a, GenericKind :: Param ( param_b) ) ) ;
363
+ self . region_bound_pairs
364
+ . insert ( ty:: OutlivesPredicate ( GenericKind :: Param ( param_b) , r_a) ) ;
375
365
}
376
366
377
367
OutlivesBound :: RegionSubProjection ( r_a, projection_b) => {
378
- self . region_bound_pairs . push ( ( r_a, GenericKind :: Projection ( projection_b) ) ) ;
368
+ self . region_bound_pairs
369
+ . insert ( ty:: OutlivesPredicate ( GenericKind :: Projection ( projection_b) , r_a) ) ;
379
370
}
380
371
}
381
372
}
0 commit comments