@@ -33,7 +33,9 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> {
33
33
}
34
34
35
35
fn start_block_effect ( & self , _on_entry : & mut BitSet < Local > ) {
36
- // Nothing is live on function entry
36
+ // Nothing is live on function entry (generators only have a self
37
+ // argument, and we don't care about that)
38
+ assert_eq ! ( 1 , self . body. arg_count) ;
37
39
}
38
40
39
41
fn statement_effect ( & self ,
@@ -72,16 +74,16 @@ impl<'a, 'tcx> BottomValue for MaybeStorageLive<'a, 'tcx> {
72
74
73
75
/// Dataflow analysis that determines whether each local requires storage at a
74
76
/// given location; i.e. whether its storage can go away without being observed.
75
- pub struct RequiresStorage < ' mir , ' tcx , ' b > {
77
+ pub struct RequiresStorage < ' mir , ' tcx > {
76
78
body : & ' mir Body < ' tcx > ,
77
79
borrowed_locals :
78
- RefCell < DataflowResultsRefCursor < ' mir , ' tcx , ' b , HaveBeenBorrowedLocals < ' mir , ' tcx > > > ,
80
+ RefCell < DataflowResultsRefCursor < ' mir , ' tcx , HaveBeenBorrowedLocals < ' mir , ' tcx > > > ,
79
81
}
80
82
81
- impl < ' mir , ' tcx : ' mir , ' b > RequiresStorage < ' mir , ' tcx , ' b > {
83
+ impl < ' mir , ' tcx : ' mir > RequiresStorage < ' mir , ' tcx > {
82
84
pub fn new (
83
85
body : & ' mir Body < ' tcx > ,
84
- borrowed_locals : & ' b DataflowResults < ' tcx , HaveBeenBorrowedLocals < ' mir , ' tcx > > ,
86
+ borrowed_locals : & ' mir DataflowResults < ' tcx , HaveBeenBorrowedLocals < ' mir , ' tcx > > ,
85
87
) -> Self {
86
88
RequiresStorage {
87
89
body,
@@ -94,15 +96,17 @@ impl<'mir, 'tcx: 'mir, 'b> RequiresStorage<'mir, 'tcx, 'b> {
94
96
}
95
97
}
96
98
97
- impl < ' mir , ' tcx , ' b > BitDenotation < ' tcx > for RequiresStorage < ' mir , ' tcx , ' b > {
99
+ impl < ' mir , ' tcx > BitDenotation < ' tcx > for RequiresStorage < ' mir , ' tcx > {
98
100
type Idx = Local ;
99
101
fn name ( ) -> & ' static str { "requires_storage" }
100
102
fn bits_per_block ( & self ) -> usize {
101
103
self . body . local_decls . len ( )
102
104
}
103
105
104
106
fn start_block_effect ( & self , _sets : & mut BitSet < Local > ) {
105
- // Nothing is live on function entry
107
+ // Nothing is live on function entry (generators only have a self
108
+ // argument, and we don't care about that)
109
+ assert_eq ! ( 1 , self . body. arg_count) ;
106
110
}
107
111
108
112
fn statement_effect ( & self ,
@@ -146,7 +150,7 @@ impl<'mir, 'tcx, 'b> BitDenotation<'tcx> for RequiresStorage<'mir, 'tcx, 'b> {
146
150
}
147
151
}
148
152
149
- impl < ' mir , ' tcx , ' b > RequiresStorage < ' mir , ' tcx , ' b > {
153
+ impl < ' mir , ' tcx > RequiresStorage < ' mir , ' tcx > {
150
154
/// Kill locals that are fully moved and have not been borrowed.
151
155
fn check_for_move ( & self , sets : & mut GenKillSet < Local > , loc : Location ) {
152
156
let mut visitor = MoveVisitor {
@@ -165,18 +169,18 @@ impl<'mir, 'tcx, 'b> RequiresStorage<'mir, 'tcx, 'b> {
165
169
}
166
170
}
167
171
168
- impl < ' mir , ' tcx , ' b > BottomValue for RequiresStorage < ' mir , ' tcx , ' b > {
172
+ impl < ' mir , ' tcx > BottomValue for RequiresStorage < ' mir , ' tcx > {
169
173
/// bottom = dead
170
174
const BOTTOM_VALUE : bool = false ;
171
175
}
172
176
173
- struct MoveVisitor < ' a , ' b , ' mir , ' tcx > {
177
+ struct MoveVisitor < ' a , ' mir , ' tcx > {
174
178
borrowed_locals :
175
- & ' a RefCell < DataflowResultsRefCursor < ' mir , ' tcx , ' b , HaveBeenBorrowedLocals < ' mir , ' tcx > > > ,
179
+ & ' a RefCell < DataflowResultsRefCursor < ' mir , ' tcx , HaveBeenBorrowedLocals < ' mir , ' tcx > > > ,
176
180
sets : & ' a mut GenKillSet < Local > ,
177
181
}
178
182
179
- impl < ' a , ' b , ' mir : ' a , ' tcx > Visitor < ' tcx > for MoveVisitor < ' a , ' b , ' mir , ' tcx > {
183
+ impl < ' a , ' mir : ' a , ' tcx > Visitor < ' tcx > for MoveVisitor < ' a , ' mir , ' tcx > {
180
184
fn visit_local ( & mut self , local : & Local , context : PlaceContext , loc : Location ) {
181
185
if PlaceContext :: NonMutatingUse ( NonMutatingUseContext :: Move ) == context {
182
186
let mut borrowed_locals = self . borrowed_locals . borrow_mut ( ) ;
0 commit comments