@@ -38,7 +38,7 @@ pub(crate) enum RegionElement {
3838/// an interval matrix storing liveness ranges for each region-vid.
3939pub ( crate ) struct LivenessValues {
4040 /// The map from locations to points.
41- elements : Rc < DenseLocationMap > ,
41+ location_map : Rc < DenseLocationMap > ,
4242
4343 /// Which regions are live. This is exclusive with the fine-grained tracking in `points`, and
4444 /// currently only used for validating promoteds (which don't care about more precise tracking).
@@ -77,11 +77,11 @@ impl LiveLoans {
7777
7878impl LivenessValues {
7979 /// Create an empty map of regions to locations where they're live.
80- pub ( crate ) fn with_specific_points ( elements : Rc < DenseLocationMap > ) -> Self {
80+ pub ( crate ) fn with_specific_points ( location_map : Rc < DenseLocationMap > ) -> Self {
8181 LivenessValues {
8282 live_regions : None ,
83- points : Some ( SparseIntervalMatrix :: new ( elements . num_points ( ) ) ) ,
84- elements ,
83+ points : Some ( SparseIntervalMatrix :: new ( location_map . num_points ( ) ) ) ,
84+ location_map ,
8585 loans : None ,
8686 }
8787 }
@@ -90,11 +90,11 @@ impl LivenessValues {
9090 ///
9191 /// Unlike `with_specific_points`, does not track exact locations where something is live, only
9292 /// which regions are live.
93- pub ( crate ) fn without_specific_points ( elements : Rc < DenseLocationMap > ) -> Self {
93+ pub ( crate ) fn without_specific_points ( location_map : Rc < DenseLocationMap > ) -> Self {
9494 LivenessValues {
9595 live_regions : Some ( Default :: default ( ) ) ,
9696 points : None ,
97- elements ,
97+ location_map ,
9898 loans : None ,
9999 }
100100 }
@@ -122,11 +122,11 @@ impl LivenessValues {
122122
123123 /// Records `region` as being live at the given `location`.
124124 pub ( crate ) fn add_location ( & mut self , region : RegionVid , location : Location ) {
125- let point = self . elements . point_from_location ( location) ;
125+ let point = self . location_map . point_from_location ( location) ;
126126 debug ! ( "LivenessValues::add_location(region={:?}, location={:?})" , region, location) ;
127127 if let Some ( points) = & mut self . points {
128128 points. insert ( region, point) ;
129- } else if self . elements . point_in_range ( point) {
129+ } else if self . location_map . point_in_range ( point) {
130130 self . live_regions . as_mut ( ) . unwrap ( ) . insert ( region) ;
131131 }
132132
@@ -143,7 +143,7 @@ impl LivenessValues {
143143 debug ! ( "LivenessValues::add_points(region={:?}, points={:?})" , region, points) ;
144144 if let Some ( this) = & mut self . points {
145145 this. union_row ( region, points) ;
146- } else if points. iter ( ) . any ( |point| self . elements . point_in_range ( point) ) {
146+ } else if points. iter ( ) . any ( |point| self . location_map . point_in_range ( point) ) {
147147 self . live_regions . as_mut ( ) . unwrap ( ) . insert ( region) ;
148148 }
149149
@@ -170,7 +170,7 @@ impl LivenessValues {
170170
171171 /// Returns whether `region` is marked live at the given `location`.
172172 pub ( crate ) fn is_live_at ( & self , region : RegionVid , location : Location ) -> bool {
173- let point = self . elements . point_from_location ( location) ;
173+ let point = self . location_map . point_from_location ( location) ;
174174 if let Some ( points) = & self . points {
175175 points. row ( region) . is_some_and ( |r| r. contains ( point) )
176176 } else {
@@ -191,25 +191,26 @@ impl LivenessValues {
191191 . row ( region)
192192 . into_iter ( )
193193 . flat_map ( |set| set. iter ( ) )
194- . take_while ( |& p| self . elements . point_in_range ( p) )
194+ . take_while ( |& p| self . location_map . point_in_range ( p) )
195195 }
196196
197197 /// For debugging purposes, returns a pretty-printed string of the points where the `region` is
198198 /// live.
199199 pub ( crate ) fn pretty_print_live_points ( & self , region : RegionVid ) -> String {
200200 pretty_print_region_elements (
201- self . live_points ( region) . map ( |p| RegionElement :: Location ( self . elements . to_location ( p) ) ) ,
201+ self . live_points ( region)
202+ . map ( |p| RegionElement :: Location ( self . location_map . to_location ( p) ) ) ,
202203 )
203204 }
204205
205206 #[ inline]
206207 pub ( crate ) fn point_from_location ( & self , location : Location ) -> PointIndex {
207- self . elements . point_from_location ( location)
208+ self . location_map . point_from_location ( location)
208209 }
209210
210211 #[ inline]
211212 pub ( crate ) fn location_from_point ( & self , point : PointIndex ) -> Location {
212- self . elements . to_location ( point)
213+ self . location_map . to_location ( point)
213214 }
214215
215216 /// When using `-Zpolonius=next`, returns whether the `loan_idx` is live at the given `point`.
@@ -272,7 +273,7 @@ impl PlaceholderIndices {
272273/// because (since it is returned) it must live for at least `'a`. But
273274/// it would also contain various points from within the function.
274275pub ( crate ) struct RegionValues < N : Idx > {
275- elements : Rc < DenseLocationMap > ,
276+ location_map : Rc < DenseLocationMap > ,
276277 placeholder_indices : PlaceholderIndices ,
277278 points : SparseIntervalMatrix < N , PointIndex > ,
278279 free_regions : SparseBitMatrix < N , RegionVid > ,
@@ -287,14 +288,14 @@ impl<N: Idx> RegionValues<N> {
287288 /// Each of the regions in num_region_variables will be initialized with an
288289 /// empty set of points and no causal information.
289290 pub ( crate ) fn new (
290- elements : Rc < DenseLocationMap > ,
291+ location_map : Rc < DenseLocationMap > ,
291292 num_universal_regions : usize ,
292293 placeholder_indices : PlaceholderIndices ,
293294 ) -> Self {
294- let num_points = elements . num_points ( ) ;
295+ let num_points = location_map . num_points ( ) ;
295296 let num_placeholders = placeholder_indices. len ( ) ;
296297 Self {
297- elements ,
298+ location_map ,
298299 points : SparseIntervalMatrix :: new ( num_points) ,
299300 placeholder_indices,
300301 free_regions : SparseBitMatrix :: new ( num_universal_regions) ,
@@ -336,7 +337,7 @@ impl<N: Idx> RegionValues<N> {
336337 end : usize ,
337338 ) -> Option < usize > {
338339 let row = self . points . row ( r) ?;
339- let block = self . elements . entry_point ( block) ;
340+ let block = self . location_map . entry_point ( block) ;
340341 let start = block. plus ( start) ;
341342 let end = block. plus ( end) ;
342343 let first_unset = row. first_unset_in ( start..=end) ?;
@@ -375,8 +376,8 @@ impl<N: Idx> RegionValues<N> {
375376 pub ( crate ) fn locations_outlived_by < ' a > ( & ' a self , r : N ) -> impl Iterator < Item = Location > + ' a {
376377 self . points . row ( r) . into_iter ( ) . flat_map ( move |set| {
377378 set. iter ( )
378- . take_while ( move |& p| self . elements . point_in_range ( p) )
379- . map ( move |p| self . elements . to_location ( p) )
379+ . take_while ( move |& p| self . location_map . point_in_range ( p) )
380+ . map ( move |p| self . location_map . to_location ( p) )
380381 } )
381382 }
382383
@@ -430,12 +431,12 @@ pub(crate) trait ToElementIndex: Debug + Copy {
430431
431432impl ToElementIndex for Location {
432433 fn add_to_row < N : Idx > ( self , values : & mut RegionValues < N > , row : N ) -> bool {
433- let index = values. elements . point_from_location ( self ) ;
434+ let index = values. location_map . point_from_location ( self ) ;
434435 values. points . insert ( row, index)
435436 }
436437
437438 fn contained_in_row < N : Idx > ( self , values : & RegionValues < N > , row : N ) -> bool {
438- let index = values. elements . point_from_location ( self ) ;
439+ let index = values. location_map . point_from_location ( self ) ;
439440 values. points . contains ( row, index)
440441 }
441442}
@@ -464,14 +465,14 @@ impl ToElementIndex for ty::PlaceholderRegion {
464465
465466/// For debugging purposes, returns a pretty-printed string of the given points.
466467pub ( crate ) fn pretty_print_points (
467- elements : & DenseLocationMap ,
468+ location_map : & DenseLocationMap ,
468469 points : impl IntoIterator < Item = PointIndex > ,
469470) -> String {
470471 pretty_print_region_elements (
471472 points
472473 . into_iter ( )
473- . take_while ( |& p| elements . point_in_range ( p) )
474- . map ( |p| elements . to_location ( p) )
474+ . take_while ( |& p| location_map . point_in_range ( p) )
475+ . map ( |p| location_map . to_location ( p) )
475476 . map ( RegionElement :: Location ) ,
476477 )
477478}
0 commit comments