Skip to content

Commit a5afeec

Browse files
committed
Bless mir-opt
1 parent 5332531 commit a5afeec

79 files changed

Lines changed: 2496 additions & 2361 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tests/mir-opt/coroutine/async_await.a-{closure#0}.StateTransform.diff

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
- // MIR for `a::{closure#0}` before StateTransform
22
+ // MIR for `a::{closure#0}` after StateTransform
33

4-
- fn a::{closure#0}(_1: {async fn body of a()}, _2: std::future::ResumeTy) -> ()
4+
- fn a::{closure#0}(_1: {static coroutine body of a()}, _2: std::future::ResumeTy) -> ()
55
- yields ()
66
- {
7-
- debug _task_context => _2;
8-
- let mut _0: ();
9-
+ fn a::{closure#0}(_1: Pin<&mut {async fn body of a()}>, _2: &mut Context<'_>) -> Poll<()> {
7+
+ fn a::{closure#0}(_1: Pin<&mut {static coroutine body of a()}>, _2: std::future::ResumeTy) -> CoroutineState<(), ()> {
108
+ coroutine layout {
119
+ variant_fields = {
1210
+ Unresumed(0): [],
@@ -15,26 +13,23 @@
1513
+ }
1614
+ storage_conflicts = BitMatrix(0x0) {}
1715
+ }
18-
+ debug _task_context => _6;
19-
+ let mut _0: std::task::Poll<()>;
16+
debug _task_context => _2;
17+
- let mut _0: ();
18+
+ let mut _0: std::ops::CoroutineState<(), ()>;
2019
+ let mut _3: ();
2120
+ let mut _4: u32;
22-
+ let mut _5: &mut {async fn body of a()};
23-
+ let mut _6: std::future::ResumeTy;
24-
+ let mut _7: std::ptr::NonNull<std::task::Context<'_>>;
21+
+ let mut _5: &mut {static coroutine body of a()};
2522

2623
bb0: {
2724
- _0 = const ();
2825
- drop(_1) -> [return: bb1, unwind: bb2];
29-
+ _7 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
30-
+ _6 = std::future::ResumeTy(move _7);
31-
+ _5 = copy (_1.0: &mut {async fn body of a()});
26+
+ _5 = copy (_1.0: &mut {static coroutine body of a()});
3227
+ _4 = discriminant((*_5));
3328
+ switchInt(move _4) -> [0: bb5, 1: bb3, otherwise: bb4];
3429
}
3530

3631
bb1: {
37-
+ _0 = Poll::<()>::Ready(move _3);
32+
+ _0 = CoroutineState::<(), ()>::Complete(move _3);
3833
+ discriminant((*_5)) = 1;
3934
return;
4035
}

tests/mir-opt/coroutine/async_await.b-{closure#0}.StateTransform.diff

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
- // MIR for `b::{closure#0}` before StateTransform
22
+ // MIR for `b::{closure#0}` after StateTransform
33

4-
- fn b::{closure#0}(_1: {async fn body of b()}, _2: std::future::ResumeTy) -> ()
4+
- fn b::{closure#0}(_1: {static coroutine body of b()}, _2: std::future::ResumeTy) -> ()
55
- yields ()
66
- {
7-
- debug _task_context => _2;
8-
- let mut _0: ();
9-
+ fn b::{closure#0}(_1: Pin<&mut {async fn body of b()}>, _2: &mut Context<'_>) -> Poll<()> {
7+
+ fn b::{closure#0}(_1: Pin<&mut {static coroutine body of b()}>, _2: std::future::ResumeTy) -> CoroutineState<(), ()> {
108
+ coroutine layout {
119
+ field _s0: {async fn body of a()};
1210
+ field _s1: {async fn body of a()};
@@ -19,10 +17,11 @@
1917
+ }
2018
+ storage_conflicts = BitMatrix(2x2) {(_s0, _s0), (_s1, _s1)}
2119
+ }
22-
+ debug _task_context => _40;
20+
debug _task_context => _2;
21+
- let mut _0: ();
2322
+ coroutine debug __awaitee => _s0;
2423
+ coroutine debug __awaitee => _s1;
25-
+ let mut _0: std::task::Poll<()>;
24+
+ let mut _0: std::ops::CoroutineState<(), ()>;
2625
let _3: ();
2726
let mut _4: {async fn body of a()};
2827
let mut _5: {async fn body of a()};
@@ -57,9 +56,7 @@
5756
let mut _36: ();
5857
+ let mut _37: ();
5958
+ let mut _38: u32;
60-
+ let mut _39: &mut {async fn body of b()};
61-
+ let mut _40: std::future::ResumeTy;
62-
+ let mut _41: std::ptr::NonNull<std::task::Context<'_>>;
59+
+ let mut _39: &mut {static coroutine body of b()};
6360
scope 1 {
6461
- debug __awaitee => _6;
6562
+ debug __awaitee => (((*_39) as variant#3).0: {async fn body of a()});
@@ -82,9 +79,7 @@
8279
- StorageLive(_4);
8380
- StorageLive(_5);
8481
- _5 = a() -> [return: bb1, unwind: bb47];
85-
+ _41 = move _2 as std::ptr::NonNull<std::task::Context<'_>> (Transmute);
86-
+ _40 = std::future::ResumeTy(move _41);
87-
+ _39 = copy (_1.0: &mut {async fn body of b()});
82+
+ _39 = copy (_1.0: &mut {static coroutine body of b()});
8883
+ _38 = discriminant((*_39));
8984
+ switchInt(move _38) -> [0: bb47, 1: bb46, 2: bb45, 3: bb43, 4: bb44, otherwise: bb7];
9085
}
@@ -122,9 +117,8 @@
122117
StorageLive(_13);
123118
StorageLive(_14);
124119
StorageLive(_15);
125-
- _15 = copy _2;
120+
_15 = copy _2;
126121
- _14 = std::future::get_context::<'_, '_>(move _15) -> [return: bb5, unwind: bb41];
127-
+ _15 = copy _40;
128122
+ _14 = copy (_15.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
129123
+ goto -> bb5;
130124
}
@@ -158,7 +152,7 @@
158152
StorageLive(_20);
159153
_20 = ();
160154
- _19 = yield(move _20) -> [resume: bb10, drop: bb28];
161-
+ _0 = Poll::<()>::Pending;
155+
+ _0 = CoroutineState::<(), ()>::Yielded(move _20);
162156
+ StorageDead(_3);
163157
+ StorageDead(_4);
164158
+ StorageDead(_19);
@@ -182,8 +176,7 @@
182176

183177
bb10: {
184178
StorageDead(_20);
185-
- _2 = move _19;
186-
+ _40 = move _19;
179+
_2 = move _19;
187180
StorageDead(_19);
188181
_7 = const ();
189182
goto -> bb3;
@@ -237,9 +230,8 @@
237230
StorageLive(_29);
238231
StorageLive(_30);
239232
StorageLive(_31);
240-
- _31 = copy _2;
233+
_31 = copy _2;
241234
- _30 = std::future::get_context::<'_, '_>(move _31) -> [return: bb17, unwind: bb33];
242-
+ _31 = copy _40;
243235
+ _30 = copy (_31.0: std::ptr::NonNull<std::task::Context<'_>>) as &mut std::task::Context<'_> (Transmute);
244236
+ goto -> bb17;
245237
}
@@ -269,7 +261,7 @@
269261
StorageLive(_36);
270262
_36 = ();
271263
- _35 = yield(move _36) -> [resume: bb21, drop: bb25];
272-
+ _0 = Poll::<()>::Pending;
264+
+ _0 = CoroutineState::<(), ()>::Yielded(move _36);
273265
+ StorageDead(_21);
274266
+ StorageDead(_35);
275267
+ StorageDead(_36);
@@ -293,8 +285,7 @@
293285

294286
bb21: {
295287
StorageDead(_36);
296-
- _2 = move _35;
297-
+ _40 = move _35;
288+
_2 = move _35;
298289
StorageDead(_35);
299290
_7 = const ();
300291
goto -> bb15;
@@ -313,7 +304,7 @@
313304
}
314305

315306
bb24: {
316-
+ _0 = Poll::<()>::Ready(move _37);
307+
+ _0 = CoroutineState::<(), ()>::Complete(move _37);
317308
+ discriminant((*_39)) = 1;
318309
return;
319310
}
@@ -506,7 +497,7 @@
506497
+ StorageLive(_4);
507498
+ StorageLive(_19);
508499
+ StorageLive(_20);
509-
+ _19 = move _40;
500+
+ _19 = move _2;
510501
+ goto -> bb10;
511502
}
512503

@@ -517,7 +508,7 @@
517508
+ StorageLive(_21);
518509
+ StorageLive(_35);
519510
+ StorageLive(_36);
520-
+ _35 = move _40;
511+
+ _35 = move _2;
521512
+ goto -> bb21;
522513
}
523514

tests/mir-opt/coroutine/async_await.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
// EMIT_MIR async_await.a-{closure#0}.StateTransform.diff
1212
async fn a() {
1313
// CHECK-LABEL: fn a::{closure#0}(
14-
// CHECK-SAME: _1: Pin<&mut {async fn body of a()}>
15-
// CHECK-SAME: _2: &mut Context<'_>
16-
// CHECK-SAME: -> Poll<()>
14+
// CHECK-SAME: _1: Pin<&mut {static coroutine body of a()}>
15+
// CHECK-SAME: _2: std::future::ResumeTy
16+
// CHECK-SAME: -> CoroutineState<(), ()>
1717
// CHECK-NOT: get_context
1818
}
1919

2020
// EMIT_MIR async_await.b-{closure#0}.StateTransform.diff
2121
pub async fn b() {
2222
// CHECK-LABEL: fn b::{closure#0}(
23-
// CHECK-SAME: _1: Pin<&mut {async fn body of b()}>
24-
// CHECK-SAME: _2: &mut Context<'_>
25-
// CHECK-SAME: -> Poll<()>
23+
// CHECK-SAME: _1: Pin<&mut {static coroutine body of b()}>
24+
// CHECK-SAME: _2: std::future::ResumeTy
25+
// CHECK-SAME: -> CoroutineState<(), ()>
2626
// CHECK-NOT: get_context
2727
a().await;
2828
a().await

tests/mir-opt/coroutine/async_closure_fake_read_for_by_move.foo-{closure#0}-{closure#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `foo::{closure#0}::{closure#0}` after built
22

3-
fn foo::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: std::future::ResumeTy) -> ()
3+
fn foo::{closure#0}::{closure#0}(_1: {static coroutine@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

tests/mir-opt/coroutine/async_closure_fake_read_for_by_move.foo-{closure#0}-{synthetic#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `foo::{closure#0}::{synthetic#0}` after built
22

3-
fn foo::{closure#0}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: std::future::ResumeTy) -> ()
3+
fn foo::{closure#0}::{synthetic#0}(_1: {static coroutine@$DIR/async_closure_fake_read_for_by_move.rs:12:27: 15:6}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

tests/mir-opt/coroutine/async_closure_shims.main-{closure#0}-{closure#0}-{closure#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}::{closure#0}::{closure#0}` after built
22

3-
fn main::{closure#0}::{closure#0}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: std::future::ResumeTy) -> ()
3+
fn main::{closure#0}::{closure#0}::{closure#0}(_1: {static coroutine@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

tests/mir-opt/coroutine/async_closure_shims.main-{closure#0}-{closure#0}-{synthetic#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}::{closure#0}::{synthetic#0}` after built
22

3-
fn main::{closure#0}::{closure#0}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: std::future::ResumeTy) -> ()
3+
fn main::{closure#0}::{closure#0}::{synthetic#0}(_1: {static coroutine@$DIR/async_closure_shims.rs:53:53: 56:10}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

tests/mir-opt/coroutine/async_closure_shims.main-{closure#0}-{closure#0}.coroutine_closure_by_move.0.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// MIR for `main::{closure#0}::{closure#0}` 0 coroutine_closure_by_move
22

3-
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} {
4-
let mut _0: {async closure body@$DIR/async_closure_shims.rs:53:53: 56:10};
3+
fn main::{closure#0}::{closure#0}(_1: {async closure@$DIR/async_closure_shims.rs:53:33: 53:52}, _2: i32) -> {static coroutine@$DIR/async_closure_shims.rs:53:53: 56:10} {
4+
let mut _0: {static coroutine@$DIR/async_closure_shims.rs:53:53: 56:10};
55

66
bb0: {
77
_0 = {coroutine@$DIR/async_closure_shims.rs:53:53: 56:10 (#0)} { a: move _2, b: move (_1.0: i32) };

tests/mir-opt/coroutine/async_closure_shims.main-{closure#0}-{closure#1}-{closure#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}::{closure#1}::{closure#0}` after built
22

3-
fn main::{closure#0}::{closure#1}::{closure#0}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: std::future::ResumeTy) -> ()
3+
fn main::{closure#0}::{closure#1}::{closure#0}(_1: {static coroutine@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

tests/mir-opt/coroutine/async_closure_shims.main-{closure#0}-{closure#1}-{synthetic#0}.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}::{closure#1}::{synthetic#0}` after built
22

3-
fn main::{closure#0}::{closure#1}::{synthetic#0}(_1: {async closure body@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: std::future::ResumeTy) -> ()
3+
fn main::{closure#0}::{closure#1}::{synthetic#0}(_1: {static coroutine@$DIR/async_closure_shims.rs:62:48: 65:10}, _2: std::future::ResumeTy) -> ()
44
yields ()
55
{
66
debug _task_context => _2;

0 commit comments

Comments
 (0)