@@ -15,12 +15,14 @@ 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 ;
18
19
use syntax_pos:: DUMMY_SP ;
19
20
use std:: collections:: HashMap ;
20
21
21
22
#[ allow( dead_code) ]
22
23
struct NLLVisitor < ' a , ' gcx : ' a + ' tcx , ' tcx : ' a > {
23
24
lookup_map : HashMap < RegionVid , Lookup > ,
25
+ regions : Vec < Region > ,
24
26
infcx : InferCtxt < ' a , ' gcx , ' tcx > ,
25
27
}
26
28
@@ -29,15 +31,17 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
29
31
NLLVisitor {
30
32
infcx,
31
33
lookup_map : HashMap :: new ( ) ,
34
+ regions : vec ! [ ] ,
32
35
}
33
36
}
34
37
35
38
pub fn into_results ( self ) -> HashMap < RegionVid , Lookup > {
36
39
self . lookup_map
37
40
}
38
41
39
- fn renumber_regions < T > ( & self , value : & T ) -> T where T : TypeFoldable < ' tcx > {
42
+ fn renumber_regions < T > ( & mut self , value : & T ) -> T where T : TypeFoldable < ' tcx > {
40
43
self . infcx . tcx . fold_regions ( value, & mut false , |_region, _depth| {
44
+ self . regions . push ( Region :: default ( ) ) ;
41
45
self . infcx . next_region_var ( infer:: MiscVariable ( DUMMY_SP ) )
42
46
} )
43
47
}
@@ -143,4 +147,9 @@ impl MirPass for NLL {
143
147
let _results = visitor. into_results ( ) ;
144
148
} )
145
149
}
146
- }
150
+ }
151
+
152
+ #[ derive( Clone , Debug , Default , PartialEq , Eq ) ]
153
+ struct Region {
154
+ points : FxHashSet < Location > ,
155
+ }
0 commit comments