@@ -15,12 +15,15 @@ use rustc::mir::{Mir, Location, Rvalue, BasicBlock, Statement, StatementKind};
15
15
use rustc:: mir:: visit:: { MutVisitor , Lookup } ;
16
16
use rustc:: mir:: transform:: { MirPass , MirSource } ;
17
17
use rustc:: infer:: { self , InferCtxt } ;
18
+ use rustc:: util:: nodemap:: FxHashSet ;
19
+ use rustc_data_structures:: indexed_vec:: { IndexVec , Idx } ;
18
20
use syntax_pos:: DUMMY_SP ;
19
21
use std:: collections:: HashMap ;
20
22
21
23
#[ allow( dead_code) ]
22
24
struct NLLVisitor < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
23
25
lookup_map : HashMap < RegionVid , Lookup > ,
26
+ regions : IndexVec < RegionIndex , Region > ,
24
27
infcx : InferCtxt < ' a , ' gcx , ' tcx > ,
25
28
}
26
29
@@ -29,15 +32,17 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
29
32
NLLVisitor {
30
33
infcx,
31
34
lookup_map : HashMap :: new ( ) ,
35
+ regions : IndexVec :: new ( ) ,
32
36
}
33
37
}
34
38
35
39
pub fn into_results ( self ) -> HashMap < RegionVid , Lookup > {
36
40
self . lookup_map
37
41
}
38
42
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 > {
40
44
self . infcx . tcx . fold_regions ( value, & mut false , |_region, _depth| {
45
+ self . regions . push ( Region :: default ( ) ) ;
41
46
self . infcx . next_region_var ( infer:: MiscVariable ( DUMMY_SP ) )
42
47
} )
43
48
}
@@ -143,4 +148,11 @@ impl MirPass for NLL {
143
148
let _results = visitor. into_results ( ) ;
144
149
} )
145
150
}
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