File tree 1 file changed +7
-7
lines changed
src/librustc_mir/borrow_check/nll/region_infer
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
251
251
var_infos : VarInfos ,
252
252
universal_regions : UniversalRegions < ' tcx > ,
253
253
mir : & Mir < ' tcx > ,
254
- outlives_constraints : Vec < OutlivesConstraint > ,
254
+ mut outlives_constraints : Vec < OutlivesConstraint > ,
255
255
type_tests : Vec < TypeTest < ' tcx > > ,
256
256
) -> Self {
257
257
// The `next` field should not yet have been initialized:
@@ -268,22 +268,22 @@ impl<'tcx> RegionInferenceContext<'tcx> {
268
268
. map ( |info| RegionDefinition :: new ( info. origin ) )
269
269
. collect ( ) ;
270
270
271
+ let mut seen_constraints: FxHashSet < ( RegionVid , RegionVid ) > = Default :: default ( ) ;
272
+
273
+ outlives_constraints. retain ( |c| c. sup != c. sub && seen_constraints. insert ( c. dedup_key ( ) ) ) ;
274
+
271
275
let mut result = Self {
272
276
definitions,
273
277
elements : elements. clone ( ) ,
274
278
liveness_constraints : RegionValues :: new ( elements, num_region_variables) ,
275
279
inferred_values : None ,
276
280
dependency_map : None ,
277
- constraints : Default :: default ( ) ,
278
- seen_constraints : Default :: default ( ) ,
281
+ constraints : IndexVec :: from_raw ( outlives_constraints ) ,
282
+ seen_constraints,
279
283
type_tests,
280
284
universal_regions,
281
285
} ;
282
286
283
- for c in outlives_constraints {
284
- result. add_outlives_iner ( c) ;
285
- }
286
-
287
287
result. init_universal_regions ( ) ;
288
288
289
289
result
You can’t perform that action at this time.
0 commit comments