@@ -158,7 +158,9 @@ macro_rules! make_value_visitor {
158
158
) -> EvalResult <' tcx> {
159
159
self . walk_aggregate( v, fields)
160
160
}
161
- /// Called each time we recurse down to a field, passing in old and new value.
161
+
162
+ /// Called each time we recurse down to a field of a "product-like" aggregate
163
+ /// (structs, tuples, arrays and the like, but not enums), passing in old and new value.
162
164
/// This gives the visitor the chance to track the stack of nested fields that
163
165
/// we are descending through.
164
166
#[ inline( always) ]
@@ -171,6 +173,19 @@ macro_rules! make_value_visitor {
171
173
self . visit_value( new_val)
172
174
}
173
175
176
+ /// Called for recursing into the field of a generator. These are not known to be
177
+ /// initialized, so we treat them like unions.
178
+ #[ inline( always) ]
179
+ fn visit_generator_field(
180
+ & mut self ,
181
+ _old_val: Self :: V ,
182
+ _field: usize ,
183
+ new_val: Self :: V ,
184
+ ) -> EvalResult <' tcx> {
185
+ self . visit_union( new_val)
186
+ }
187
+
188
+ /// Called when recursing into an enum variant.
174
189
#[ inline( always) ]
175
190
fn visit_variant(
176
191
& mut self ,
@@ -300,7 +315,12 @@ macro_rules! make_value_visitor {
300
315
match v. layout( ) . ty. sty {
301
316
ty:: Generator ( ..) => {
302
317
let field = v. project_field( self . ecx( ) , 0 ) ?;
303
- self . visit_aggregate( v, std:: iter:: once( Ok ( field) ) )
318
+ self . visit_aggregate( v, std:: iter:: once( Ok ( field) ) ) ?;
319
+ for i in 1 ..offsets. len( ) {
320
+ let field = v. project_field( self . ecx( ) , i as u64 ) ?;
321
+ self . visit_generator_field( v, i, field) ?;
322
+ }
323
+ Ok ( ( ) )
304
324
}
305
325
_ => {
306
326
// FIXME: We collect in a vec because otherwise there are lifetime
0 commit comments