Re-parent the by-move body
This commit is contained in:
parent
5525043ac8
commit
8860008e7f
@ -208,7 +208,8 @@ pub fn coroutine_by_move_body_def_id<'tcx>(
|
|||||||
let mut by_move_body = body.clone();
|
let mut by_move_body = body.clone();
|
||||||
MakeByMoveBody { tcx, field_remapping, by_move_coroutine_ty }.visit_body(&mut by_move_body);
|
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 =
|
by_move_body.source =
|
||||||
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
|
mir::MirSource::from_instance(InstanceKind::Item(body_def.def_id().to_def_id()));
|
||||||
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));
|
dump_mir(tcx, false, "built", &"after", &by_move_body, |_, _| Ok(()));
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#0}::{closure#0}` after built
|
// MIR for `main::{closure#0}::{closure#0}::{closure#0}` after built
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:55:53: 58:10}, _2: ResumeTy) -> ()
|
fn main::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10}, _2: ResumeTy) -> ()
|
||||||
yields ()
|
yields ()
|
||||||
{
|
{
|
||||||
debug _task_context => _2;
|
debug _task_context => _2;
|
@ -1,6 +1,6 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#0}::{closure#0}::{closure#0}` after built
|
// MIR for `main::{closure#0}::{closure#0}::{closure#1}` after built
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:55:53: 58:10}, _2: ResumeTy) -> ()
|
fn main::{closure#0}::{closure#0}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10}, _2: ResumeTy) -> ()
|
||||||
yields ()
|
yields ()
|
||||||
{
|
{
|
||||||
debug _task_context => _2;
|
debug _task_context => _2;
|
@ -1,10 +1,10 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#0}` 0 coroutine_closure_by_move
|
// MIR for `main::{closure#0}::{closure#0}` 0 coroutine_closure_by_move
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:53:33: 53:52}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10} {
|
fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:54:33: 54:52}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10} {
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10};
|
let mut _0: {async closure body@$DIR/async_closure_shims.rs:54:53: 57:10};
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:53:53: 56:10 (#0)} { a: move _2, b: move (_1.0: i32) };
|
_0 = {coroutine@$DIR/async_closure_shims.rs:54:53: 57:10 (#0)} { a: move _2, b: move (_1.0: i32) };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +0,0 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#0}` 0 coroutine_closure_by_move
|
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:55:33: 55:52}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:55:53: 58:10} {
|
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:55:53: 58:10};
|
|
||||||
|
|
||||||
bb0: {
|
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:55:53: 58:10 (#0)} { a: move _2, b: move (_1.0: i32) };
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}::{closure#0}` after built
|
// MIR for `main::{closure#0}::{closure#1}::{closure#0}` after built
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10}, _2: ResumeTy) -> ()
|
fn main::{closure#0}::{closure#1}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}, _2: ResumeTy) -> ()
|
||||||
yields ()
|
yields ()
|
||||||
{
|
{
|
||||||
debug _task_context => _2;
|
debug _task_context => _2;
|
@ -1,6 +1,6 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}::{closure#0}::{closure#0}` after built
|
// MIR for `main::{closure#0}::{closure#1}::{closure#1}` after built
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10}, _2: ResumeTy) -> ()
|
fn main::{closure#0}::{closure#1}::{closure#1}(_1: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10}, _2: ResumeTy) -> ()
|
||||||
yields ()
|
yields ()
|
||||||
{
|
{
|
||||||
debug _task_context => _2;
|
debug _task_context => _2;
|
@ -1,10 +1,10 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_move
|
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_move
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}(_1: {async closure@$DIR/async_closure_shims.rs:62:33: 62:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10} {
|
fn main::{closure#0}::{closure#1}(_1: {async closure@$DIR/async_closure_shims.rs:63:33: 63:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10} {
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10};
|
let mut _0: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10};
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: move (_1.0: &i32) };
|
_0 = {coroutine@$DIR/async_closure_shims.rs:63:48: 66:10 (#0)} { a: move _2, b: move (_1.0: &i32) };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +0,0 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_move
|
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}(_1: {async closure@$DIR/async_closure_shims.rs:64:33: 64:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10} {
|
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10};
|
|
||||||
|
|
||||||
bb0: {
|
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:64:48: 67:10 (#0)} { a: move _2, b: move (_1.0: &i32) };
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_ref
|
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_ref
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.rs:62:33: 62:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10} {
|
fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.rs:63:33: 63:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10} {
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10};
|
let mut _0: {async closure body@$DIR/async_closure_shims.rs:63:48: 66:10};
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:62:48: 65:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) };
|
_0 = {coroutine@$DIR/async_closure_shims.rs:63:48: 66:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) };
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,10 +0,0 @@
|
|||||||
// MIR for `main::{closure#0}::{closure#1}` 0 coroutine_closure_by_ref
|
|
||||||
|
|
||||||
fn main::{closure#0}::{closure#1}(_1: &{async closure@$DIR/async_closure_shims.rs:64:33: 64:47}, _2: i32) -> {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10} {
|
|
||||||
let mut _0: {async closure body@$DIR/async_closure_shims.rs:64:48: 67:10};
|
|
||||||
|
|
||||||
bb0: {
|
|
||||||
_0 = {coroutine@$DIR/async_closure_shims.rs:64:48: 67:10 (#0)} { a: move _2, b: copy ((*_1).0: &i32) };
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
//@ edition:2021
|
//@ edition:2021
|
||||||
// skip-filecheck
|
// skip-filecheck
|
||||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
||||||
|
|
||||||
#![feature(async_closure, noop_waker, async_fn_traits)]
|
#![feature(async_closure, noop_waker, async_fn_traits)]
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
@ -44,11 +43,11 @@ async fn call_normal_mut<F: Future<Output = ()>>(f: &mut impl FnMut(i32) -> F) {
|
|||||||
|
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}-{closure#0}.built.after.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#0}-{closure#1}.built.after.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_ref.0.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}.coroutine_closure_by_move.0.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir
|
||||||
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}-{closure#0}.built.after.mir
|
// EMIT_MIR async_closure_shims.main-{closure#0}-{closure#1}-{closure#1}.built.after.mir
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
block_on(async {
|
block_on(async {
|
||||||
let b = 2i32;
|
let b = 2i32;
|
||||||
|
Loading…
Reference in New Issue
Block a user