@@ -2,6 +2,7 @@ use rustc_data_structures::frozen::Frozen;
22use rustc_data_structures:: transitive_relation:: TransitiveRelation ;
33use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
44use rustc_infer:: infer:: outlives;
5+ use rustc_infer:: infer:: outlives:: env:: RegionBoundPairs ;
56use rustc_infer:: infer:: region_constraints:: GenericKind ;
67use rustc_infer:: infer:: InferCtxt ;
78use rustc_middle:: mir:: ConstraintCategory ;
@@ -34,18 +35,6 @@ pub(crate) struct UniversalRegionRelations<'tcx> {
3435 inverse_outlives : TransitiveRelation < RegionVid > ,
3536}
3637
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-
4938/// As part of computing the free region relations, we also have to
5039/// normalize the input-output types, which we then need later. So we
5140/// return those. This vector consists of first the input types and
@@ -71,7 +60,7 @@ pub(crate) fn create<'tcx>(
7160 implicit_region_bound,
7261 constraints,
7362 universal_regions : universal_regions. clone ( ) ,
74- region_bound_pairs : Vec :: new ( ) ,
63+ region_bound_pairs : Default :: default ( ) ,
7564 relations : UniversalRegionRelations {
7665 universal_regions : universal_regions. clone ( ) ,
7766 outlives : Default :: default ( ) ,
@@ -371,11 +360,13 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
371360 }
372361
373362 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) ) ;
375365 }
376366
377367 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) ) ;
379370 }
380371 }
381372 }
0 commit comments