File tree 1 file changed +3
-2
lines changed
src/librustc_mir/transform
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1187,8 +1187,9 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
1187
1187
let new_ret_local = replace_local ( RETURN_PLACE , ret_ty, body, tcx) ;
1188
1188
1189
1189
// We also replace the resume argument and insert an `Assign`.
1190
- // This is needed because the resume argument might be live across a `yield`, and the
1191
- // transform assumes that any local live across a `yield` is assigned to before that.
1190
+ // This is needed because the resume argument `_2` might be live across a `yield`, in which
1191
+ // case there is no `Assign` to it that the transform can turn into a store to the generator
1192
+ // state. After the yield the slot in the generator state would then be uninitialized.
1192
1193
let resume_local = Local :: new ( 2 ) ;
1193
1194
let new_resume_local =
1194
1195
replace_local ( resume_local, body. local_decls [ resume_local] . ty , body, tcx) ;
You can’t perform that action at this time.
0 commit comments