@@ -179,12 +179,12 @@ impl ToElementIndex for RegionElementIndex {
179179/// variable. The columns consist of either universal regions or
180180/// points in the CFG.
181181#[ derive( Clone ) ]
182- pub ( super ) struct RegionValues {
182+ pub ( super ) struct RegionValues < N : Idx > {
183183 elements : Rc < RegionValueElements > ,
184- matrix : SparseBitMatrix < RegionVid , RegionElementIndex > ,
184+ matrix : SparseBitMatrix < N , RegionElementIndex > ,
185185}
186186
187- impl RegionValues {
187+ impl < N : Idx > RegionValues < N > {
188188 /// Creates a new set of "region values" that tracks causal information.
189189 /// Each of the regions in num_region_variables will be initialized with an
190190 /// empty set of points and no causal information.
@@ -197,35 +197,35 @@ impl RegionValues {
197197 Self {
198198 elements : elements. clone ( ) ,
199199 matrix : SparseBitMatrix :: new (
200- RegionVid :: new ( num_region_variables) ,
200+ N :: new ( num_region_variables) ,
201201 RegionElementIndex :: new ( elements. num_elements ( ) ) ,
202202 ) ,
203203 }
204204 }
205205
206206 /// Adds the given element to the value for the given region. Returns true if
207207 /// the element is newly added (i.e., was not already present).
208- pub ( super ) fn add_element < E : ToElementIndex > ( & mut self , r : RegionVid , elem : E ) -> bool {
208+ pub ( super ) fn add_element < E : ToElementIndex > ( & mut self , r : N , elem : E ) -> bool {
209209 let i = self . elements . index ( elem) ;
210210 debug ! ( "add(r={:?}, elem={:?})" , r, elem) ;
211211 self . matrix . add ( r, i)
212212 }
213213
214214 /// Add all elements in `r_from` to `r_to` (because e.g. `r_to:
215215 /// r_from`).
216- pub ( super ) fn add_region ( & mut self , r_to : RegionVid , r_from : RegionVid ) -> bool {
216+ pub ( super ) fn add_region ( & mut self , r_to : N , r_from : N ) -> bool {
217217 self . matrix . merge ( r_from, r_to)
218218 }
219219
220220 /// True if the region `r` contains the given element.
221- pub ( super ) fn contains < E : ToElementIndex > ( & self , r : RegionVid , elem : E ) -> bool {
221+ pub ( super ) fn contains < E : ToElementIndex > ( & self , r : N , elem : E ) -> bool {
222222 let i = self . elements . index ( elem) ;
223223 self . matrix . contains ( r, i)
224224 }
225225
226226 /// True if `sup_region` contains all the CFG points that
227227 /// `sub_region` contains. Ignores universal regions.
228- pub ( super ) fn contains_points ( & self , sup_region : RegionVid , sub_region : RegionVid ) -> bool {
228+ pub ( super ) fn contains_points ( & self , sup_region : N , sub_region : N ) -> bool {
229229 // This could be done faster by comparing the bitsets. But I
230230 // am lazy.
231231 self . element_indices_contained_in ( sub_region)
@@ -238,15 +238,15 @@ impl RegionValues {
238238 /// `elements_contained_in`.
239239 pub ( super ) fn element_indices_contained_in < ' a > (
240240 & ' a self ,
241- r : RegionVid ,
241+ r : N ,
242242 ) -> impl Iterator < Item = RegionElementIndex > + ' a {
243243 self . matrix . iter ( r) . map ( move |i| i)
244244 }
245245
246246 /// Returns just the universal regions that are contained in a given region's value.
247247 pub ( super ) fn universal_regions_outlived_by < ' a > (
248248 & ' a self ,
249- r : RegionVid ,
249+ r : N ,
250250 ) -> impl Iterator < Item = RegionVid > + ' a {
251251 self . element_indices_contained_in ( r)
252252 . map ( move |i| self . elements . to_universal_region ( i) )
@@ -257,14 +257,14 @@ impl RegionValues {
257257 /// Returns all the elements contained in a given region's value.
258258 pub ( super ) fn elements_contained_in < ' a > (
259259 & ' a self ,
260- r : RegionVid ,
260+ r : N ,
261261 ) -> impl Iterator < Item = RegionElement > + ' a {
262262 self . element_indices_contained_in ( r)
263263 . map ( move |r| self . elements . to_element ( r) )
264264 }
265265
266266 /// Returns a "pretty" string value of the region. Meant for debugging.
267- pub ( super ) fn region_value_str ( & self , r : RegionVid ) -> String {
267+ pub ( super ) fn region_value_str ( & self , r : N ) -> String {
268268 let mut result = String :: new ( ) ;
269269 result. push_str ( "{" ) ;
270270
0 commit comments