Re-parent the by-move body · rust-lang/rust@8860008 (original) (raw)

Original file line number Diff line number Diff line change
@@ -208,7 +208,8 @@ pub fn coroutine_by_move_body_def_id<'tcx>(
208 208 let mut by_move_body = body.clone();
209 209 MakeByMoveBody { tcx, field_remapping, by_move_coroutine_ty }.visit_body(&mut by_move_body);
210 210
211 -let body_def = tcx.create_def(coroutine_def_id, kw::Empty, DefKind::SyntheticCoroutineBody);
211 +// This will always be `{closure#1}`, since the original coroutine is `{closure#0}`.
212 +let body_def = tcx.create_def(parent_def_id, kw::Empty, DefKind::SyntheticCoroutineBody);
212 213 by_move_body.source =
213 214 mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
214 215 dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _