@@ -15,12 +15,15 @@ use rustc::mir::{Mir, Location, Rvalue, BasicBlock, Statement, StatementKind};
1515use rustc:: mir:: visit:: { MutVisitor , Lookup } ;
1616use rustc:: mir:: transform:: { MirPass , MirSource } ;
1717use rustc:: infer:: { self , InferCtxt } ;
18+ use rustc:: util:: nodemap:: FxHashSet ;
19+ use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
1820use syntax_pos:: DUMMY_SP ;
1921use std:: collections:: HashMap ;
2022
2123#[ allow( dead_code) ]
2224struct NLLVisitor < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
2325 lookup_map : HashMap < RegionVid , Lookup > ,
26+ regions : IndexVec < RegionIndex , Region > ,
2427 infcx : InferCtxt < ' a , ' gcx , ' tcx > ,
2528}
2629
@@ -29,15 +32,17 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
2932 NLLVisitor {
3033 infcx,
3134 lookup_map : HashMap :: new ( ) ,
35+ regions : IndexVec :: new ( ) ,
3236 }
3337 }
3438
3539 pub fn into_results ( self ) -> HashMap < RegionVid , Lookup > {
3640 self . lookup_map
3741 }
3842
39- fn renumber_regions < T > ( & self , value : & T ) -> T where T : TypeFoldable < ' tcx > {
43+ fn renumber_regions < T > ( & mut self , value : & T ) -> T where T : TypeFoldable < ' tcx > {
4044 self . infcx . tcx . fold_regions ( value, & mut false , |_region, _depth| {
45+ self . regions . push ( Region :: default ( ) ) ;
4146 self . infcx . next_region_var ( infer:: MiscVariable ( DUMMY_SP ) )
4247 } )
4348 }
@@ -143,4 +148,11 @@ impl MirPass for NLL {
143148 let _results = visitor. into_results ( ) ;
144149 } )
145150 }
146- }
151+ }
152+
153+ #[ derive( Clone , Debug , Default , PartialEq , Eq ) ]
154+ struct Region {
155+ points : FxHashSet < Location > ,
156+ }
157+
158+ newtype_index ! ( RegionIndex ) ;
0 commit comments