File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/librustc_mir/transform Expand file tree Collapse file tree 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 {
11871187 let new_ret_local = replace_local ( RETURN_PLACE , ret_ty, body, tcx) ;
11881188
11891189 // 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.
11921193 let resume_local = Local :: new ( 2 ) ;
11931194 let new_resume_local =
11941195 replace_local ( resume_local, body. local_decls [ resume_local] . ty , body, tcx) ;
You can’t perform that action at this time.
0 commit comments