diff options
| author | Michael Goulet <michael@errs.io> | 2024-08-28 18:27:41 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-09-04 06:28:32 -0400 |
| commit | 8860008e7f3bf67c420d2d1ce4bc333c08886eb2 (patch) | |
| tree | c1f56e1cf45a3cd35edf0b8c06533d229f3e96e0 /compiler/rustc_mir_transform/src | |
| parent | 5525043ac8b2b84239198778e6bb87f4dba98a7b (diff) | |
| download | rust-8860008e7f3bf67c420d2d1ce4bc333c08886eb2.tar.gz rust-8860008e7f3bf67c420d2d1ce4bc333c08886eb2.zip | |
Re-parent the by-move body
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/coroutine/by_move_body.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs index 79cdca5d937..cf39c136b01 100644 --- a/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs +++ b/compiler/rustc_mir_transform/src/coroutine/by_move_body.rs @@ -208,7 +208,8 @@ pub fn coroutine_by_move_body_def_id<'tcx>( let mut by_move_body = body.clone(); MakeByMoveBody { tcx, field_remapping, by_move_coroutine_ty }.visit_body(&mut by_move_body); - let body_def = tcx.create_def(coroutine_def_id, kw::Empty, DefKind::SyntheticCoroutineBody); + // This will always be `{closure#1}`, since the original coroutine is `{closure#0}`. + let body_def = tcx.create_def(parent_def_id, kw::Empty, DefKind::SyntheticCoroutineBody); by_move_body.source = mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id())); dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(())); |
