11
11
use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
12
12
use rustc:: ty:: subst:: Substs ;
13
13
use rustc:: ty:: { self , ClosureSubsts , RegionVid , Ty , TypeFoldable } ;
14
- use rustc:: mir:: { BasicBlock , Local , Location , Mir , Rvalue , Statement , StatementKind } ;
14
+ use rustc:: mir:: { BasicBlock , Local , Location , Mir , Statement , StatementKind } ;
15
15
use rustc:: mir:: visit:: { MutVisitor , TyContext } ;
16
16
use rustc:: infer:: { InferCtxt , NLLRegionVariableOrigin } ;
17
17
@@ -36,6 +36,10 @@ pub fn renumber_mir<'a, 'gcx, 'tcx>(
36
36
} )
37
37
. collect ( ) ;
38
38
39
+ debug ! ( "renumber_mir()" ) ;
40
+ debug ! ( "renumber_mir: free_regions={:#?}" , free_regions) ;
41
+ debug ! ( "renumber_mir: mir.arg_count={:?}" , mir. arg_count) ;
42
+
39
43
let mut visitor = NLLVisitor {
40
44
infcx,
41
45
free_regions,
@@ -60,6 +64,8 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
60
64
where
61
65
T : TypeFoldable < ' tcx > ,
62
66
{
67
+ debug ! ( "renumber_regions(value={:?})" , value) ;
68
+
63
69
self . infcx
64
70
. tcx
65
71
. fold_regions ( value, & mut false , |_region, _depth| {
@@ -74,6 +80,8 @@ impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> {
74
80
where
75
81
T : TypeFoldable < ' tcx > ,
76
82
{
83
+ debug ! ( "renumber_free_regions(value={:?})" , value) ;
84
+
77
85
self . infcx
78
86
. tcx
79
87
. fold_regions ( value, & mut false , |region, _depth| {
@@ -112,36 +120,35 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> {
112
120
}
113
121
114
122
fn visit_substs ( & mut self , substs : & mut & ' tcx Substs < ' tcx > , location : Location ) {
123
+ debug ! ( "visit_substs(substs={:?}, location={:?})" , substs, location) ;
124
+
115
125
let ty_context = TyContext :: Location ( location) ;
116
126
* substs = self . renumber_regions ( ty_context, & { * substs } ) ;
127
+
128
+ debug ! ( "visit_substs: substs={:?}" , substs) ;
117
129
}
118
130
119
- fn visit_rvalue ( & mut self , rvalue : & mut Rvalue < ' tcx > , location : Location ) {
120
- match * rvalue {
121
- Rvalue :: Ref ( ref mut r, _, _) => {
122
- let old_r = * r;
123
- let ty_context = TyContext :: Location ( location) ;
124
- * r = self . renumber_regions ( ty_context, & old_r) ;
125
- }
126
- Rvalue :: Use ( ..) |
127
- Rvalue :: Repeat ( ..) |
128
- Rvalue :: Len ( ..) |
129
- Rvalue :: Cast ( ..) |
130
- Rvalue :: BinaryOp ( ..) |
131
- Rvalue :: CheckedBinaryOp ( ..) |
132
- Rvalue :: UnaryOp ( ..) |
133
- Rvalue :: Discriminant ( ..) |
134
- Rvalue :: NullaryOp ( ..) |
135
- Rvalue :: Aggregate ( ..) => {
136
- // These variants don't contain regions.
137
- }
138
- }
139
- self . super_rvalue ( rvalue, location) ;
131
+ fn visit_region ( & mut self , region : & mut ty:: Region < ' tcx > , location : Location ) {
132
+ debug ! ( "visit_region(region={:?}, location={:?})" , region, location) ;
133
+
134
+ let old_region = * region;
135
+ let ty_context = TyContext :: Location ( location) ;
136
+ * region = self . renumber_regions ( ty_context, & old_region) ;
137
+
138
+ debug ! ( "visit_region: region={:?}" , region) ;
140
139
}
141
140
142
141
fn visit_closure_substs ( & mut self , substs : & mut ClosureSubsts < ' tcx > , location : Location ) {
142
+ debug ! (
143
+ "visit_closure_substs(substs={:?}, location={:?})" ,
144
+ substs,
145
+ location
146
+ ) ;
147
+
143
148
let ty_context = TyContext :: Location ( location) ;
144
149
* substs = self . renumber_regions ( ty_context, substs) ;
150
+
151
+ debug ! ( "visit_closure_substs: substs={:?}" , substs) ;
145
152
}
146
153
147
154
fn visit_statement (
0 commit comments