@@ -48,9 +48,6 @@ pub struct RegionInferenceContext<'tcx> {
48
48
/// from as well as its final inferred value.
49
49
definitions : IndexVec < RegionVid , RegionDefinition < ' tcx > > ,
50
50
51
- /// Maps from points/universal-regions to a `RegionElementIndex`.
52
- elements : Rc < RegionValueElements > ,
53
-
54
51
/// The liveness constraints added to each region. For most
55
52
/// regions, these start out empty and steadily grow, though for
56
53
/// each universally quantified region R they start out containing
@@ -219,14 +216,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
219
216
220
217
let mut scc_values = RegionValues :: new ( elements) ;
221
218
222
- for ( region, location_set ) in liveness_constraints. iter_enumerated ( ) {
219
+ for region in liveness_constraints. regions_with_points ( ) {
223
220
let scc = constraint_sccs. scc ( region) ;
224
- scc_values. merge_into ( scc, location_set ) ;
221
+ scc_values. merge_row ( scc, region , & liveness_constraints ) ;
225
222
}
226
223
227
224
let mut result = Self {
228
225
definitions,
229
- elements : elements. clone ( ) ,
230
226
liveness_constraints,
231
227
constraints,
232
228
constraint_graph,
@@ -273,7 +269,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
273
269
}
274
270
275
271
// For each universally quantified region X:
276
- let elements = self . elements . clone ( ) ;
277
272
let universal_regions = self . universal_regions . clone ( ) ;
278
273
for variable in universal_regions. universal_regions ( ) {
279
274
// These should be free-region variables.
@@ -283,9 +278,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
283
278
} ) ;
284
279
285
280
// Add all nodes in the CFG to liveness constraints
286
- for point_index in elements . all_point_indices ( ) {
287
- self . add_live_element ( variable, point_index ) ;
288
- }
281
+ let variable_scc = self . constraint_sccs . scc ( variable ) ;
282
+ self . liveness_constraints . add_all_points ( variable) ;
283
+ self . scc_values . add_all_points ( variable_scc ) ;
289
284
290
285
// Add `end(X)` into the set for X.
291
286
self . add_live_element ( variable, variable) ;
@@ -782,7 +777,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
782
777
// now). Therefore, the sup-region outlives the sub-region if,
783
778
// for each universal region R1 in the sub-region, there
784
779
// exists some region R2 in the sup-region that outlives R1.
785
- let universal_outlives = self . scc_values
780
+ let universal_outlives = self
781
+ . scc_values
786
782
. universal_regions_outlived_by ( sub_region_scc)
787
783
. all ( |r1| {
788
784
self . scc_values
0 commit comments