1
1
use rustc_data_structures:: frozen:: Frozen ;
2
+ use rustc_data_structures:: fx:: FxIndexSet ;
2
3
use rustc_data_structures:: transitive_relation:: { TransitiveRelation , TransitiveRelationBuilder } ;
3
4
use rustc_hir:: def:: DefKind ;
4
5
use rustc_infer:: infer:: canonical:: QueryRegionConstraints ;
@@ -42,7 +43,7 @@ type NormalizedInputsAndOutput<'tcx> = Vec<Ty<'tcx>>;
42
43
43
44
pub ( crate ) struct CreateResult < ' tcx > {
44
45
pub ( crate ) universal_region_relations : Frozen < UniversalRegionRelations < ' tcx > > ,
45
- pub ( crate ) known_type_outlives : Vec < ty:: PolyTypeOutlivesPredicate < ' tcx > > ,
46
+ pub ( crate ) known_type_outlives : FxIndexSet < ty:: PolyTypeOutlivesPredicate < ' tcx > > ,
46
47
pub ( crate ) normalized_inputs_and_output : NormalizedInputsAndOutput < ' tcx > ,
47
48
}
48
49
@@ -59,7 +60,7 @@ pub(crate) fn create<'tcx>(
59
60
implicit_region_bound,
60
61
constraints,
61
62
universal_regions,
62
- known_type_outlives : vec ! [ ] ,
63
+ known_type_outlives : FxIndexSet :: default ( ) ,
63
64
outlives : Default :: default ( ) ,
64
65
inverse_outlives : Default :: default ( ) ,
65
66
}
@@ -186,7 +187,7 @@ struct UniversalRegionRelationsBuilder<'a, 'tcx> {
186
187
187
188
// outputs:
188
189
outlives : TransitiveRelationBuilder < RegionVid > ,
189
- known_type_outlives : Vec < ty:: PolyTypeOutlivesPredicate < ' tcx > > ,
190
+ known_type_outlives : FxIndexSet < ty:: PolyTypeOutlivesPredicate < ' tcx > > ,
190
191
inverse_outlives : TransitiveRelationBuilder < RegionVid > ,
191
192
}
192
193
@@ -370,7 +371,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
370
371
}
371
372
}
372
373
373
- self . known_type_outlives . push ( outlives) ;
374
+ self . known_type_outlives . insert ( outlives) ;
374
375
}
375
376
376
377
/// Update the type of a single local, which should represent
@@ -416,14 +417,14 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> {
416
417
}
417
418
418
419
OutlivesBound :: RegionSubParam ( r_a, param_b) => {
419
- self . known_type_outlives . push ( ty:: Binder :: dummy ( ty:: OutlivesPredicate (
420
+ self . known_type_outlives . insert ( ty:: Binder :: dummy ( ty:: OutlivesPredicate (
420
421
Ty :: new_param ( self . infcx . tcx , param_b. index , param_b. name ) ,
421
422
r_a,
422
423
) ) ) ;
423
424
}
424
425
425
426
OutlivesBound :: RegionSubAlias ( r_a, alias_b) => {
426
- self . known_type_outlives . push ( ty:: Binder :: dummy ( ty:: OutlivesPredicate (
427
+ self . known_type_outlives . insert ( ty:: Binder :: dummy ( ty:: OutlivesPredicate (
427
428
Ty :: new_alias ( self . infcx . tcx , alias_b. kind ( self . infcx . tcx ) , alias_b) ,
428
429
r_a,
429
430
) ) ) ;
0 commit comments