@@ -48,9 +48,6 @@ pub struct RegionInferenceContext<'tcx> {
4848 /// from as well as its final inferred value.
4949 definitions : IndexVec < RegionVid , RegionDefinition < ' tcx > > ,
5050
51- /// Maps from points/universal-regions to a `RegionElementIndex`.
52- elements : Rc < RegionValueElements > ,
53-
5451 /// The liveness constraints added to each region. For most
5552 /// regions, these start out empty and steadily grow, though for
5653 /// each universally quantified region R they start out containing
@@ -219,14 +216,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
219216
220217 let mut scc_values = RegionValues :: new ( elements) ;
221218
222- for ( region, location_set ) in liveness_constraints. iter_enumerated ( ) {
219+ for region in liveness_constraints. regions_with_points ( ) {
223220 let scc = constraint_sccs. scc ( region) ;
224- scc_values. merge_into ( scc, location_set ) ;
221+ scc_values. merge_row ( scc, region , & liveness_constraints ) ;
225222 }
226223
227224 let mut result = Self {
228225 definitions,
229- elements : elements. clone ( ) ,
230226 liveness_constraints,
231227 constraints,
232228 constraint_graph,
@@ -273,7 +269,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
273269 }
274270
275271 // For each universally quantified region X:
276- let elements = self . elements . clone ( ) ;
277272 let universal_regions = self . universal_regions . clone ( ) ;
278273 for variable in universal_regions. universal_regions ( ) {
279274 // These should be free-region variables.
@@ -283,9 +278,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
283278 } ) ;
284279
285280 // 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 ) ;
289284
290285 // Add `end(X)` into the set for X.
291286 self . add_live_element ( variable, variable) ;
@@ -782,7 +777,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
782777 // now). Therefore, the sup-region outlives the sub-region if,
783778 // for each universal region R1 in the sub-region, there
784779 // 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
786782 . universal_regions_outlived_by ( sub_region_scc)
787783 . all ( |r1| {
788784 self . scc_values
0 commit comments