From cec1877e180393eba0f6ddb0cf97bf3a791631c7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:42 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- ...sync_await.a-{closure#0}.coroutine_resume.0.mir | 47 +++ ...sync_await.a-{closure#0}.generator_resume.0.mir | 47 --- ...sync_await.b-{closure#0}.coroutine_resume.0.mir | 347 +++++++++++++++++++++ ...sync_await.b-{closure#0}.generator_resume.0.mir | 343 -------------------- tests/mir-opt/building/async_await.rs | 7 +- tests/mir-opt/building/custom/aggregate_exprs.rs | 1 + tests/mir-opt/building/custom/arbitrary_let.rs | 1 + tests/mir-opt/building/custom/arrays.rs | 1 + tests/mir-opt/building/custom/as_cast.rs | 1 + tests/mir-opt/building/custom/composite_return.rs | 1 + tests/mir-opt/building/custom/consts.rs | 1 + .../building/custom/consts.statics.built.after.mir | 8 +- tests/mir-opt/building/custom/debuginfo.rs | 1 + tests/mir-opt/building/custom/enums.rs | 1 + tests/mir-opt/building/custom/operators.rs | 1 + tests/mir-opt/building/custom/projections.rs | 1 + tests/mir-opt/building/custom/references.rs | 1 + tests/mir-opt/building/custom/simple_assign.rs | 1 + tests/mir-opt/building/custom/terminators.rs | 1 + tests/mir-opt/building/enum_cast.rs | 1 + .../building/issue_101867.main.built.after.mir | 6 +- tests/mir-opt/building/issue_101867.rs | 1 + tests/mir-opt/building/issue_110508.rs | 1 + .../issue_110508.{impl#0}-BAR.built.after.mir | 4 +- .../issue_110508.{impl#0}-SELF_BAR.built.after.mir | 4 +- .../building/issue_49232.main.built.after.mir | 2 +- tests/mir-opt/building/issue_49232.rs | 1 + .../mir-opt/building/logical_or_in_conditional.rs | 1 + ..._or_in_conditional.test_complex.built.after.mir | 4 +- ...h_false_edges.full_tested_match.built.after.mir | 3 +- ..._false_edges.full_tested_match2.built.after.mir | 3 +- .../match_false_edges.main.built.after.mir | 2 +- tests/mir-opt/building/match_false_edges.rs | 1 + .../receiver_ptr_mutability.main.built.after.mir | 8 +- tests/mir-opt/building/receiver_ptr_mutability.rs | 1 + tests/mir-opt/building/shifts.rs | 1 + .../simple_match.match_bool.built.after.mir | 2 +- tests/mir-opt/building/simple_match.rs | 1 + .../building/storage_live_dead_in_statics.rs | 1 + tests/mir-opt/building/uniform_array_move_out.rs | 1 + tests/mir-opt/building/while_storage.rs | 60 ++++ ...age.while_loop.PreCodegen.after.panic-abort.mir | 70 +++++ ...ge.while_loop.PreCodegen.after.panic-unwind.mir | 70 +++++ 43 files changed, 646 insertions(+), 415 deletions(-) create mode 100644 tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir delete mode 100644 tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir create mode 100644 tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir delete mode 100644 tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir create mode 100644 tests/mir-opt/building/while_storage.rs create mode 100644 tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir create mode 100644 tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir (limited to 'tests/mir-opt/building') diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir new file mode 100644 index 000000000..8b22743d2 --- /dev/null +++ b/tests/mir-opt/building/async_await.a-{closure#0}.coroutine_resume.0.mir @@ -0,0 +1,47 @@ +// MIR for `a::{closure#0}` 0 coroutine_resume +/* coroutine_layout = CoroutineLayout { + field_tys: {}, + variant_fields: { + Unresumed(0): [], + Returned (1): [], + Panicked (2): [], + }, + storage_conflicts: BitMatrix(0x0) {}, +} */ + +fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>, _2: &mut Context<'_>) -> Poll<()> { + debug _task_context => _4; + let mut _0: std::task::Poll<()>; + let mut _3: (); + let mut _4: &mut std::task::Context<'_>; + let mut _5: u32; + + bb0: { + _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}))); + switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5]; + } + + bb1: { + _4 = move _2; + _3 = const (); + goto -> bb3; + } + + bb2: { + _0 = Poll::<()>::Ready(move _3); + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}))) = 1; + return; + } + + bb3: { + goto -> bb2; + } + + bb4: { + assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable]; + } + + bb5: { + unreachable; + } +} diff --git a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir deleted file mode 100644 index 98b1befc3..000000000 --- a/tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir +++ /dev/null @@ -1,47 +0,0 @@ -// MIR for `a::{closure#0}` 0 generator_resume -/* generator_layout = GeneratorLayout { - field_tys: {}, - variant_fields: { - Unresumed(0): [], - Returned (1): [], - Panicked (2): [], - }, - storage_conflicts: BitMatrix(0x0) {}, -} */ - -fn a::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>, _2: &mut Context<'_>) -> Poll<()> { - debug _task_context => _4; - let mut _0: std::task::Poll<()>; - let mut _3: (); - let mut _4: &mut std::task::Context<'_>; - let mut _5: u32; - - bb0: { - _5 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))); - switchInt(move _5) -> [0: bb1, 1: bb4, otherwise: bb5]; - } - - bb1: { - _4 = move _2; - _3 = const (); - goto -> bb3; - } - - bb2: { - _0 = Poll::<()>::Ready(move _3); - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}))) = 1; - return; - } - - bb3: { - goto -> bb2; - } - - bb4: { - assert(const false, "`async fn` resumed after completion") -> [success: bb4, unwind unreachable]; - } - - bb5: { - unreachable; - } -} diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir new file mode 100644 index 000000000..396e4a378 --- /dev/null +++ b/tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir @@ -0,0 +1,347 @@ +// MIR for `b::{closure#0}` 0 coroutine_resume +/* coroutine_layout = CoroutineLayout { + field_tys: { + _0: CoroutineSavedTy { + ty: Coroutine( + DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + [ + std::future::ResumeTy, + (), + (), + CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []), + (), + ], + Static, + ), + source_info: SourceInfo { + span: $DIR/async_await.rs:16:9: 16:14 (#8), + scope: scope[0], + }, + ignore_for_traits: false, + }, + _1: CoroutineSavedTy { + ty: Coroutine( + DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), + [ + std::future::ResumeTy, + (), + (), + CoroutineWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []), + (), + ], + Static, + ), + source_info: SourceInfo { + span: $DIR/async_await.rs:17:9: 17:14 (#10), + scope: scope[0], + }, + ignore_for_traits: false, + }, + }, + variant_fields: { + Unresumed(0): [], + Returned (1): [], + Panicked (2): [], + Suspend0 (3): [_0], + Suspend1 (4): [_1], + }, + storage_conflicts: BitMatrix(2x2) { + (_0, _0), + (_1, _1), + }, +} */ + +fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:15:18: 18:2}>, _2: &mut Context<'_>) -> Poll<()> { + debug _task_context => _38; + let mut _0: std::task::Poll<()>; + let _3: (); + let mut _4: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _5: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _6: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _7: (); + let _8: (); + let mut _9: std::task::Poll<()>; + let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>; + let mut _11: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _12: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _13: &mut std::task::Context<'_>; + let mut _14: &mut std::task::Context<'_>; + let mut _15: &mut std::task::Context<'_>; + let mut _16: isize; + let mut _18: !; + let mut _19: &mut std::task::Context<'_>; + let mut _20: (); + let mut _21: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _22: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _23: {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let _24: (); + let mut _25: std::task::Poll<()>; + let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>; + let mut _27: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _28: &mut {async fn body@$DIR/async_await.rs:12:14: 12:16}; + let mut _29: &mut std::task::Context<'_>; + let mut _30: &mut std::task::Context<'_>; + let mut _31: &mut std::task::Context<'_>; + let mut _32: isize; + let mut _34: !; + let mut _35: &mut std::task::Context<'_>; + let mut _36: (); + let mut _37: (); + let mut _38: &mut std::task::Context<'_>; + let mut _39: u32; + scope 1 { + debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); + let _17: (); + scope 2 { + } + scope 3 { + debug result => _17; + } + } + scope 4 { + debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); + let _33: (); + scope 5 { + } + scope 6 { + debug result => _33; + } + } + + bb0: { + _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))); + switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30]; + } + + bb1: { + _38 = move _2; + StorageLive(_3); + StorageLive(_4); + StorageLive(_5); + _5 = a() -> [return: bb2, unwind unreachable]; + } + + bb2: { + _4 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; + } + + bb3: { + StorageDead(_5); + PlaceMention(_4); + nop; + (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _4; + goto -> bb4; + } + + bb4: { + StorageLive(_8); + StorageLive(_9); + StorageLive(_10); + StorageLive(_11); + StorageLive(_12); + _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); + _11 = &mut (*_12); + _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; + } + + bb5: { + StorageDead(_11); + StorageLive(_13); + StorageLive(_14); + StorageLive(_15); + _15 = _38; + _14 = move _15; + goto -> bb6; + } + + bb6: { + _13 = &mut (*_14); + StorageDead(_15); + _9 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; + } + + bb7: { + StorageDead(_13); + StorageDead(_10); + PlaceMention(_9); + _16 = discriminant(_9); + switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; + } + + bb8: { + _8 = const (); + StorageDead(_14); + StorageDead(_12); + StorageDead(_9); + StorageDead(_8); + StorageLive(_19); + StorageLive(_20); + _20 = (); + _0 = Poll::<()>::Pending; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 3; + return; + } + + bb9: { + unreachable; + } + + bb10: { + StorageLive(_17); + _17 = ((_9 as Ready).0: ()); + _3 = _17; + StorageDead(_17); + StorageDead(_14); + StorageDead(_12); + StorageDead(_9); + StorageDead(_8); + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb12, unwind unreachable]; + } + + bb11: { + StorageDead(_20); + _38 = move _19; + StorageDead(_19); + _7 = const (); + goto -> bb4; + } + + bb12: { + nop; + goto -> bb13; + } + + bb13: { + StorageDead(_4); + StorageDead(_3); + StorageLive(_21); + StorageLive(_22); + _22 = a() -> [return: bb14, unwind unreachable]; + } + + bb14: { + _21 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; + } + + bb15: { + StorageDead(_22); + PlaceMention(_21); + nop; + (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}) = move _21; + goto -> bb16; + } + + bb16: { + StorageLive(_24); + StorageLive(_25); + StorageLive(_26); + StorageLive(_27); + StorageLive(_28); + _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16}); + _27 = &mut (*_28); + _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:12:14: 12:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; + } + + bb17: { + StorageDead(_27); + StorageLive(_29); + StorageLive(_30); + StorageLive(_31); + _31 = _38; + _30 = move _31; + goto -> bb18; + } + + bb18: { + _29 = &mut (*_30); + StorageDead(_31); + _25 = <{async fn body@$DIR/async_await.rs:12:14: 12:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; + } + + bb19: { + StorageDead(_29); + StorageDead(_26); + PlaceMention(_25); + _32 = discriminant(_25); + switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; + } + + bb20: { + _24 = const (); + StorageDead(_30); + StorageDead(_28); + StorageDead(_25); + StorageDead(_24); + StorageLive(_35); + StorageLive(_36); + _36 = (); + _0 = Poll::<()>::Pending; + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 4; + return; + } + + bb21: { + StorageLive(_33); + _33 = ((_25 as Ready).0: ()); + _37 = _33; + StorageDead(_33); + StorageDead(_30); + StorageDead(_28); + StorageDead(_25); + StorageDead(_24); + drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:12:14: 12:16})) -> [return: bb23, unwind unreachable]; + } + + bb22: { + StorageDead(_36); + _38 = move _35; + StorageDead(_35); + _7 = const (); + goto -> bb16; + } + + bb23: { + nop; + goto -> bb24; + } + + bb24: { + StorageDead(_21); + goto -> bb26; + } + + bb25: { + _0 = Poll::<()>::Ready(move _37); + discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:15:18: 18:2}))) = 1; + return; + } + + bb26: { + goto -> bb25; + } + + bb27: { + StorageLive(_3); + StorageLive(_4); + StorageLive(_19); + StorageLive(_20); + _19 = move _2; + goto -> bb11; + } + + bb28: { + StorageLive(_21); + StorageLive(_35); + StorageLive(_36); + _35 = move _2; + goto -> bb22; + } + + bb29: { + assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable]; + } + + bb30: { + unreachable; + } +} diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir deleted file mode 100644 index 15330b13c..000000000 --- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir +++ /dev/null @@ -1,343 +0,0 @@ -// MIR for `b::{closure#0}` 0 generator_resume -/* generator_layout = GeneratorLayout { - field_tys: { - _0: GeneratorSavedTy { - ty: Generator( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), - [ - std::future::ResumeTy, - (), - (), - GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []), - (), - ], - Static, - ), - source_info: SourceInfo { - span: $DIR/async_await.rs:15:9: 15:14 (#8), - scope: scope[0], - }, - ignore_for_traits: false, - }, - _1: GeneratorSavedTy { - ty: Generator( - DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), - [ - std::future::ResumeTy, - (), - (), - GeneratorWitness(DefId(0:4 ~ async_await[ccf8]::a::{closure#0}), []), - (), - ], - Static, - ), - source_info: SourceInfo { - span: $DIR/async_await.rs:16:9: 16:14 (#10), - scope: scope[0], - }, - ignore_for_traits: false, - }, - }, - variant_fields: { - Unresumed(0): [], - Returned (1): [], - Panicked (2): [], - Suspend0 (3): [_0], - Suspend1 (4): [_1], - }, - storage_conflicts: BitMatrix(2x2) { - (_0, _0), - (_1, _1), - }, -} */ - -fn b::{closure#0}(_1: Pin<&mut {async fn body@$DIR/async_await.rs:14:18: 17:2}>, _2: &mut Context<'_>) -> Poll<()> { - debug _task_context => _38; - let mut _0: std::task::Poll<()>; - let _3: (); - let mut _4: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _5: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _6: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _7: (); - let _8: (); - let mut _9: std::task::Poll<()>; - let mut _10: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>; - let mut _11: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _12: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _13: &mut std::task::Context<'_>; - let mut _14: &mut std::task::Context<'_>; - let mut _15: &mut std::task::Context<'_>; - let mut _16: isize; - let mut _18: !; - let mut _19: &mut std::task::Context<'_>; - let mut _20: (); - let mut _21: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _22: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _23: {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let _24: (); - let mut _25: std::task::Poll<()>; - let mut _26: std::pin::Pin<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>; - let mut _27: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _28: &mut {async fn body@$DIR/async_await.rs:11:14: 11:16}; - let mut _29: &mut std::task::Context<'_>; - let mut _30: &mut std::task::Context<'_>; - let mut _31: &mut std::task::Context<'_>; - let mut _32: isize; - let mut _34: !; - let mut _35: &mut std::task::Context<'_>; - let mut _36: (); - let mut _37: (); - let mut _38: &mut std::task::Context<'_>; - let mut _39: u32; - scope 1 { - debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); - let _17: (); - scope 2 { - } - scope 3 { - debug result => _17; - } - } - scope 4 { - debug __awaitee => (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); - let _33: (); - scope 5 { - } - scope 6 { - debug result => _33; - } - } - - bb0: { - _39 = discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))); - switchInt(move _39) -> [0: bb1, 1: bb29, 3: bb27, 4: bb28, otherwise: bb30]; - } - - bb1: { - _38 = move _2; - StorageLive(_3); - StorageLive(_4); - StorageLive(_5); - _5 = a() -> [return: bb2, unwind unreachable]; - } - - bb2: { - _4 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; - } - - bb3: { - StorageDead(_5); - nop; - (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _4; - goto -> bb4; - } - - bb4: { - StorageLive(_8); - StorageLive(_9); - StorageLive(_10); - StorageLive(_11); - StorageLive(_12); - _12 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); - _11 = &mut (*_12); - _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; - } - - bb5: { - StorageDead(_11); - StorageLive(_13); - StorageLive(_14); - StorageLive(_15); - _15 = _38; - _14 = move _15; - goto -> bb6; - } - - bb6: { - _13 = &mut (*_14); - StorageDead(_15); - _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; - } - - bb7: { - StorageDead(_13); - StorageDead(_10); - _16 = discriminant(_9); - switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; - } - - bb8: { - _8 = const (); - StorageDead(_14); - StorageDead(_12); - StorageDead(_9); - StorageDead(_8); - StorageLive(_19); - StorageLive(_20); - _20 = (); - _0 = Poll::<()>::Pending; - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3; - return; - } - - bb9: { - unreachable; - } - - bb10: { - StorageLive(_17); - _17 = ((_9 as Ready).0: ()); - _3 = _17; - StorageDead(_17); - StorageDead(_14); - StorageDead(_12); - StorageDead(_9); - StorageDead(_8); - drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#3).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb12, unwind unreachable]; - } - - bb11: { - StorageDead(_20); - _38 = move _19; - StorageDead(_19); - _7 = const (); - goto -> bb4; - } - - bb12: { - nop; - goto -> bb13; - } - - bb13: { - StorageDead(_4); - StorageDead(_3); - StorageLive(_21); - StorageLive(_22); - _22 = a() -> [return: bb14, unwind unreachable]; - } - - bb14: { - _21 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; - } - - bb15: { - StorageDead(_22); - nop; - (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}) = move _21; - goto -> bb16; - } - - bb16: { - StorageLive(_24); - StorageLive(_25); - StorageLive(_26); - StorageLive(_27); - StorageLive(_28); - _28 = &mut (((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16}); - _27 = &mut (*_28); - _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; - } - - bb17: { - StorageDead(_27); - StorageLive(_29); - StorageLive(_30); - StorageLive(_31); - _31 = _38; - _30 = move _31; - goto -> bb18; - } - - bb18: { - _29 = &mut (*_30); - StorageDead(_31); - _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; - } - - bb19: { - StorageDead(_29); - StorageDead(_26); - _32 = discriminant(_25); - switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; - } - - bb20: { - _24 = const (); - StorageDead(_30); - StorageDead(_28); - StorageDead(_25); - StorageDead(_24); - StorageLive(_35); - StorageLive(_36); - _36 = (); - _0 = Poll::<()>::Pending; - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4; - return; - } - - bb21: { - StorageLive(_33); - _33 = ((_25 as Ready).0: ()); - _37 = _33; - StorageDead(_33); - StorageDead(_30); - StorageDead(_28); - StorageDead(_25); - StorageDead(_24); - drop((((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2})) as variant#4).0: {async fn body@$DIR/async_await.rs:11:14: 11:16})) -> [return: bb23, unwind unreachable]; - } - - bb22: { - StorageDead(_36); - _38 = move _35; - StorageDead(_35); - _7 = const (); - goto -> bb16; - } - - bb23: { - nop; - goto -> bb24; - } - - bb24: { - StorageDead(_21); - goto -> bb26; - } - - bb25: { - _0 = Poll::<()>::Ready(move _37); - discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 1; - return; - } - - bb26: { - goto -> bb25; - } - - bb27: { - StorageLive(_3); - StorageLive(_4); - StorageLive(_19); - StorageLive(_20); - _19 = move _2; - goto -> bb11; - } - - bb28: { - StorageLive(_21); - StorageLive(_35); - StorageLive(_36); - _35 = move _2; - goto -> bb22; - } - - bb29: { - assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable]; - } - - bb30: { - unreachable; - } -} diff --git a/tests/mir-opt/building/async_await.rs b/tests/mir-opt/building/async_await.rs index 0b991e3b8..abdeafef6 100644 --- a/tests/mir-opt/building/async_await.rs +++ b/tests/mir-opt/building/async_await.rs @@ -1,4 +1,5 @@ -// This test makes sure that the generator MIR pass eliminates all calls to +// skip-filecheck +// This test makes sure that the coroutine MIR pass eliminates all calls to // `get_context`, and that the MIR argument type for an async fn and all locals // related to `yield` are `&mut Context`, and its return type is `Poll`. @@ -7,10 +8,10 @@ #![crate_type = "lib"] -// EMIT_MIR async_await.a-{closure#0}.generator_resume.0.mir +// EMIT_MIR async_await.a-{closure#0}.coroutine_resume.0.mir async fn a() {} -// EMIT_MIR async_await.b-{closure#0}.generator_resume.0.mir +// EMIT_MIR async_await.b-{closure#0}.coroutine_resume.0.mir pub async fn b() { a().await; a().await diff --git a/tests/mir-opt/building/custom/aggregate_exprs.rs b/tests/mir-opt/building/custom/aggregate_exprs.rs index 554c9c03b..d58188624 100644 --- a/tests/mir-opt/building/custom/aggregate_exprs.rs +++ b/tests/mir-opt/building/custom/aggregate_exprs.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/arbitrary_let.rs b/tests/mir-opt/building/custom/arbitrary_let.rs index 776df3151..f8ee8504e 100644 --- a/tests/mir-opt/building/custom/arbitrary_let.rs +++ b/tests/mir-opt/building/custom/arbitrary_let.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/arrays.rs b/tests/mir-opt/building/custom/arrays.rs index 8e0a1fd7a..fe6abc546 100644 --- a/tests/mir-opt/building/custom/arrays.rs +++ b/tests/mir-opt/building/custom/arrays.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics, inline_const)] extern crate core; diff --git a/tests/mir-opt/building/custom/as_cast.rs b/tests/mir-opt/building/custom/as_cast.rs index b4b5ac6aa..92aea64db 100644 --- a/tests/mir-opt/building/custom/as_cast.rs +++ b/tests/mir-opt/building/custom/as_cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/composite_return.rs b/tests/mir-opt/building/custom/composite_return.rs index 701d6b1ab..33c903fa0 100644 --- a/tests/mir-opt/building/custom/composite_return.rs +++ b/tests/mir-opt/building/custom/composite_return.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/consts.rs b/tests/mir-opt/building/custom/consts.rs index 16d10eb59..42abf5019 100644 --- a/tests/mir-opt/building/custom/consts.rs +++ b/tests/mir-opt/building/custom/consts.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics, inline_const)] extern crate core; diff --git a/tests/mir-opt/building/custom/consts.statics.built.after.mir b/tests/mir-opt/building/custom/consts.statics.built.after.mir index ea394c5b7..a5cb6ff99 100644 --- a/tests/mir-opt/building/custom/consts.statics.built.after.mir +++ b/tests/mir-opt/building/custom/consts.statics.built.after.mir @@ -6,16 +6,16 @@ fn statics() -> () { let mut _2: *mut i32; bb0: { - _1 = const {alloc1: &i32}; - _2 = const {alloc2: *mut i32}; + _1 = const {ALLOC0: &i32}; + _2 = const {ALLOC1: *mut i32}; return; } } -alloc2 (static: T, size: 4, align: 4) { +ALLOC1 (static: T, size: 4, align: 4) { 0a 0a 0a 0a │ .... } -alloc1 (static: S, size: 4, align: 4) { +ALLOC0 (static: S, size: 4, align: 4) { 05 05 05 05 │ .... } diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs index bfdc3d3ea..3671a1ef0 100644 --- a/tests/mir-opt/building/custom/debuginfo.rs +++ b/tests/mir-opt/building/custom/debuginfo.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/enums.rs b/tests/mir-opt/building/custom/enums.rs index eca5b792e..6aab1503c 100644 --- a/tests/mir-opt/building/custom/enums.rs +++ b/tests/mir-opt/building/custom/enums.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/operators.rs b/tests/mir-opt/building/custom/operators.rs index db7a48317..91bdf2b91 100644 --- a/tests/mir-opt/building/custom/operators.rs +++ b/tests/mir-opt/building/custom/operators.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: --crate-type=lib #![feature(custom_mir, core_intrinsics, inline_const)] use std::intrinsics::mir::*; diff --git a/tests/mir-opt/building/custom/projections.rs b/tests/mir-opt/building/custom/projections.rs index 3c155deae..ac23fe590 100644 --- a/tests/mir-opt/building/custom/projections.rs +++ b/tests/mir-opt/building/custom/projections.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/references.rs b/tests/mir-opt/building/custom/references.rs index f87f6664c..04afe6e64 100644 --- a/tests/mir-opt/building/custom/references.rs +++ b/tests/mir-opt/building/custom/references.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/simple_assign.rs b/tests/mir-opt/building/custom/simple_assign.rs index db041aab2..844227229 100644 --- a/tests/mir-opt/building/custom/simple_assign.rs +++ b/tests/mir-opt/building/custom/simple_assign.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/custom/terminators.rs b/tests/mir-opt/building/custom/terminators.rs index 123118f65..9e442e0f9 100644 --- a/tests/mir-opt/building/custom/terminators.rs +++ b/tests/mir-opt/building/custom/terminators.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(custom_mir, core_intrinsics)] extern crate core; diff --git a/tests/mir-opt/building/enum_cast.rs b/tests/mir-opt/building/enum_cast.rs index 431b5c708..df8e397c8 100644 --- a/tests/mir-opt/building/enum_cast.rs +++ b/tests/mir-opt/building/enum_cast.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR enum_cast.foo.built.after.mir // EMIT_MIR enum_cast.bar.built.after.mir // EMIT_MIR enum_cast.boo.built.after.mir diff --git a/tests/mir-opt/building/issue_101867.main.built.after.mir b/tests/mir-opt/building/issue_101867.main.built.after.mir index 915c5ef11..57f8cca9a 100644 --- a/tests/mir-opt/building/issue_101867.main.built.after.mir +++ b/tests/mir-opt/building/issue_101867.main.built.after.mir @@ -1,8 +1,8 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option -| 1: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option +| 0: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option +| 1: user_ty: Canonical { value: Ty(std::option::Option), max_universe: U0, variables: [] }, span: $DIR/issue_101867.rs:4:12: 4:22, inferred_ty: std::option::Option | fn main() -> () { let mut _0: (); @@ -25,7 +25,7 @@ fn main() -> () { FakeRead(ForLet(None), _1); AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); StorageLive(_5); - FakeRead(ForMatchedPlace(None), _1); + PlaceMention(_1); _6 = discriminant(_1); switchInt(move _6) -> [1: bb4, otherwise: bb3]; } diff --git a/tests/mir-opt/building/issue_101867.rs b/tests/mir-opt/building/issue_101867.rs index a32d8cb37..f8a531e89 100644 --- a/tests/mir-opt/building/issue_101867.rs +++ b/tests/mir-opt/building/issue_101867.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_101867.main.built.after.mir fn main() { let x: Option = Some(1); diff --git a/tests/mir-opt/building/issue_110508.rs b/tests/mir-opt/building/issue_110508.rs index bcbb1c298..e597cd5d0 100644 --- a/tests/mir-opt/building/issue_110508.rs +++ b/tests/mir-opt/building/issue_110508.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR issue_110508.{impl#0}-BAR.built.after.mir // EMIT_MIR issue_110508.{impl#0}-SELF_BAR.built.after.mir diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir index 5fc6d911a..c3d28fae5 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::BAR` after built +// MIR for `::BAR` after built -const ::BAR: Foo = { +const ::BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir index 1a8925599..177518c30 100644 --- a/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir +++ b/tests/mir-opt/building/issue_110508.{impl#0}-SELF_BAR.built.after.mir @@ -1,6 +1,6 @@ -// MIR for `::SELF_BAR` after built +// MIR for `::SELF_BAR` after built -const ::SELF_BAR: Foo = { +const ::SELF_BAR: Foo = { let mut _0: Foo; let mut _1: (); diff --git a/tests/mir-opt/building/issue_49232.main.built.after.mir b/tests/mir-opt/building/issue_49232.main.built.after.mir index f809132bc..ac50b3889 100644 --- a/tests/mir-opt/building/issue_49232.main.built.after.mir +++ b/tests/mir-opt/building/issue_49232.main.built.after.mir @@ -24,7 +24,7 @@ fn main() -> () { StorageLive(_2); StorageLive(_3); _3 = const true; - FakeRead(ForMatchedPlace(None), _3); + PlaceMention(_3); switchInt(_3) -> [0: bb3, otherwise: bb4]; } diff --git a/tests/mir-opt/building/issue_49232.rs b/tests/mir-opt/building/issue_49232.rs index 7e9f0de81..ac06e0277 100644 --- a/tests/mir-opt/building/issue_49232.rs +++ b/tests/mir-opt/building/issue_49232.rs @@ -1,3 +1,4 @@ +// skip-filecheck // We must mark a variable whose initialization fails due to an // abort statement as StorageDead. diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs index ae159f7e1..00e666ed9 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.rs +++ b/tests/mir-opt/building/logical_or_in_conditional.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -Z validate-mir #![feature(let_chains)] struct Droppy(u8); diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir index 096aaec4a..7407e7a8b 100644 --- a/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir +++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir @@ -23,7 +23,7 @@ fn test_complex() -> () { } bb1: { - FakeRead(ForMatchedPlace(None), _2); + PlaceMention(_2); _3 = discriminant(_2); switchInt(move _3) -> [0: bb2, otherwise: bb3]; } @@ -151,7 +151,7 @@ fn test_complex() -> () { } bb25: { - FakeRead(ForMatchedPlace(None), _12); + PlaceMention(_12); _13 = discriminant(_12); switchInt(move _13) -> [1: bb27, otherwise: bb26]; } diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir index 9f64a23f3..b99b0b995 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir @@ -26,7 +26,7 @@ fn full_tested_match() -> () { StorageLive(_1); StorageLive(_2); _2 = Option::::Some(const 42_i32); - FakeRead(ForMatchedPlace(None), _2); + PlaceMention(_2); _3 = discriminant(_2); switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; } @@ -45,6 +45,7 @@ fn full_tested_match() -> () { } bb4: { + FakeRead(ForMatchedPlace(None), _2); unreachable; } diff --git a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir index 89f9bafb6..d1d86b55d 100644 --- a/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir @@ -26,7 +26,7 @@ fn full_tested_match2() -> () { StorageLive(_1); StorageLive(_2); _2 = Option::::Some(const 42_i32); - FakeRead(ForMatchedPlace(None), _2); + PlaceMention(_2); _3 = discriminant(_2); switchInt(move _3) -> [0: bb1, 1: bb2, otherwise: bb4]; } @@ -51,6 +51,7 @@ fn full_tested_match2() -> () { } bb4: { + FakeRead(ForMatchedPlace(None), _2); unreachable; } diff --git a/tests/mir-opt/building/match_false_edges.main.built.after.mir b/tests/mir-opt/building/match_false_edges.main.built.after.mir index 9a2d89c48..1d4fe67f3 100644 --- a/tests/mir-opt/building/match_false_edges.main.built.after.mir +++ b/tests/mir-opt/building/match_false_edges.main.built.after.mir @@ -37,7 +37,7 @@ fn main() -> () { StorageLive(_1); StorageLive(_2); _2 = Option::::Some(const 1_i32); - FakeRead(ForMatchedPlace(None), _2); + PlaceMention(_2); _4 = discriminant(_2); switchInt(move _4) -> [1: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/building/match_false_edges.rs b/tests/mir-opt/building/match_false_edges.rs index ddfcc1493..839eda40c 100644 --- a/tests/mir-opt/building/match_false_edges.rs +++ b/tests/mir-opt/building/match_false_edges.rs @@ -1,3 +1,4 @@ +// skip-filecheck fn guard() -> bool { false } diff --git a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir index fed5e68c3..e07c2b6fa 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir +++ b/tests/mir-opt/building/receiver_ptr_mutability.main.built.after.mir @@ -1,10 +1,10 @@ // MIR for `main` after built | User Type Annotations -| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test -| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test -| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test +| 0: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test +| 1: user_ty: Canonical { value: Ty(*mut Test), max_universe: U0, variables: [] }, span: $DIR/receiver_ptr_mutability.rs:15:14: 15:23, inferred_ty: *mut Test +| 2: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test +| 3: user_ty: Canonical { value: Ty(&&&&*mut Test), max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, span: $DIR/receiver_ptr_mutability.rs:19:18: 19:31, inferred_ty: &&&&*mut Test | fn main() -> () { let mut _0: (); diff --git a/tests/mir-opt/building/receiver_ptr_mutability.rs b/tests/mir-opt/building/receiver_ptr_mutability.rs index 668530968..4bb3b4cad 100644 --- a/tests/mir-opt/building/receiver_ptr_mutability.rs +++ b/tests/mir-opt/building/receiver_ptr_mutability.rs @@ -1,3 +1,4 @@ +// skip-filecheck // EMIT_MIR receiver_ptr_mutability.main.built.after.mir #![feature(arbitrary_self_types)] diff --git a/tests/mir-opt/building/shifts.rs b/tests/mir-opt/building/shifts.rs index 4b63a00a3..c94a142d3 100644 --- a/tests/mir-opt/building/shifts.rs +++ b/tests/mir-opt/building/shifts.rs @@ -1,3 +1,4 @@ +// skip-filecheck // compile-flags: -C debug-assertions=yes // EMIT_MIR shifts.shift_signed.built.after.mir diff --git a/tests/mir-opt/building/simple_match.match_bool.built.after.mir b/tests/mir-opt/building/simple_match.match_bool.built.after.mir index c89ea2b6c..06de4c510 100644 --- a/tests/mir-opt/building/simple_match.match_bool.built.after.mir +++ b/tests/mir-opt/building/simple_match.match_bool.built.after.mir @@ -5,7 +5,7 @@ fn match_bool(_1: bool) -> usize { let mut _0: usize; bb0: { - FakeRead(ForMatchedPlace(None), _1); + PlaceMention(_1); switchInt(_1) -> [0: bb2, otherwise: bb1]; } diff --git a/tests/mir-opt/building/simple_match.rs b/tests/mir-opt/building/simple_match.rs index 0ef97dde6..4f0a3046a 100644 --- a/tests/mir-opt/building/simple_match.rs +++ b/tests/mir-opt/building/simple_match.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Test that we don't generate unnecessarily large MIR for very simple matches diff --git a/tests/mir-opt/building/storage_live_dead_in_statics.rs b/tests/mir-opt/building/storage_live_dead_in_statics.rs index 79f709148..1f5692118 100644 --- a/tests/mir-opt/building/storage_live_dead_in_statics.rs +++ b/tests/mir-opt/building/storage_live_dead_in_statics.rs @@ -1,3 +1,4 @@ +// skip-filecheck // Check that when we compile the static `XXX` into MIR, we do not // generate `StorageStart` or `StorageEnd` statements. diff --git a/tests/mir-opt/building/uniform_array_move_out.rs b/tests/mir-opt/building/uniform_array_move_out.rs index 4ba107c87..068289161 100644 --- a/tests/mir-opt/building/uniform_array_move_out.rs +++ b/tests/mir-opt/building/uniform_array_move_out.rs @@ -1,3 +1,4 @@ +// skip-filecheck #![feature(stmt_expr_attributes, rustc_attrs)] // EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs new file mode 100644 index 000000000..b06c1639c --- /dev/null +++ b/tests/mir-opt/building/while_storage.rs @@ -0,0 +1,60 @@ +// EMIT_MIR_FOR_EACH_PANIC_STRATEGY +// Test that we correctly generate StorageDead statements for while loop +// conditions on all branches +// compile-flags: -Zmir-opt-level=0 + +fn get_bool(c: bool) -> bool { + c +} + +// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir +fn while_loop(c: bool) { + // CHECK-LABEL: fn while_loop( + // CHECK: bb0: { + // CHECK-NEXT: goto -> bb1; + // CHECK: bb1: { + // CHECK-NEXT: StorageLive(_3); + // CHECK-NEXT: StorageLive(_2); + // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind + // CHECK: bb2: { + // CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4]; + // CHECK: bb3: { + // CHECK-NEXT: StorageDead(_2); + // CHECK-NEXT: StorageLive(_9); + // CHECK-NEXT: _0 = const (); + // CHECK-NEXT: StorageDead(_9); + // CHECK-NEXT: goto -> bb8; + // CHECK: bb4: { + // CHECK-NEXT: StorageDead(_2); + // CHECK-NEXT: StorageLive(_5); + // CHECK-NEXT: StorageLive(_4); + // CHECK-NEXT: _4 = _1; + // CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind + // CHECK: bb5: { + // CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7]; + // CHECK: bb6: { + // CHECK-NEXT: StorageDead(_4); + // CHECK-NEXT: _6 = const (); + // CHECK-NEXT: StorageDead(_5); + // CHECK-NEXT: StorageDead(_3); + // CHECK-NEXT: goto -> bb1; + // CHECK: bb7: { + // CHECK-NEXT: StorageDead(_4); + // CHECK-NEXT: _0 = const (); + // CHECK-NEXT: StorageDead(_5); + // CHECK-NEXT: goto -> bb8; + // CHECK: bb8: { + // CHECK-NEXT: StorageDead(_3); + // CHECK-NEXT: return; + + while get_bool(c) { + if get_bool(c) { + break; + } + } +} + +fn main() { + while_loop(false); +} diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir new file mode 100644 index 000000000..26c82edf2 --- /dev/null +++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir @@ -0,0 +1,70 @@ +// MIR for `while_loop` after PreCodegen + +fn while_loop(_1: bool) -> () { + debug c => _1; + let mut _0: (); + let mut _2: bool; + let mut _3: bool; + let mut _4: bool; + let mut _5: bool; + let mut _6: (); + let mut _7: !; + let mut _8: !; + let _9: (); + let mut _10: !; + + bb0: { + goto -> bb1; + } + + bb1: { + StorageLive(_3); + StorageLive(_2); + _2 = _1; + _3 = get_bool(move _2) -> [return: bb2, unwind unreachable]; + } + + bb2: { + switchInt(move _3) -> [0: bb3, otherwise: bb4]; + } + + bb3: { + StorageDead(_2); + StorageLive(_9); + _0 = const (); + StorageDead(_9); + goto -> bb8; + } + + bb4: { + StorageDead(_2); + StorageLive(_5); + StorageLive(_4); + _4 = _1; + _5 = get_bool(move _4) -> [return: bb5, unwind unreachable]; + } + + bb5: { + switchInt(move _5) -> [0: bb6, otherwise: bb7]; + } + + bb6: { + StorageDead(_4); + _6 = const (); + StorageDead(_5); + StorageDead(_3); + goto -> bb1; + } + + bb7: { + StorageDead(_4); + _0 = const (); + StorageDead(_5); + goto -> bb8; + } + + bb8: { + StorageDead(_3); + return; + } +} diff --git a/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir new file mode 100644 index 000000000..1bb720748 --- /dev/null +++ b/tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir @@ -0,0 +1,70 @@ +// MIR for `while_loop` after PreCodegen + +fn while_loop(_1: bool) -> () { + debug c => _1; + let mut _0: (); + let mut _2: bool; + let mut _3: bool; + let mut _4: bool; + let mut _5: bool; + let mut _6: (); + let mut _7: !; + let mut _8: !; + let _9: (); + let mut _10: !; + + bb0: { + goto -> bb1; + } + + bb1: { + StorageLive(_3); + StorageLive(_2); + _2 = _1; + _3 = get_bool(move _2) -> [return: bb2, unwind continue]; + } + + bb2: { + switchInt(move _3) -> [0: bb3, otherwise: bb4]; + } + + bb3: { + StorageDead(_2); + StorageLive(_9); + _0 = const (); + StorageDead(_9); + goto -> bb8; + } + + bb4: { + StorageDead(_2); + StorageLive(_5); + StorageLive(_4); + _4 = _1; + _5 = get_bool(move _4) -> [return: bb5, unwind continue]; + } + + bb5: { + switchInt(move _5) -> [0: bb6, otherwise: bb7]; + } + + bb6: { + StorageDead(_4); + _6 = const (); + StorageDead(_5); + StorageDead(_3); + goto -> bb1; + } + + bb7: { + StorageDead(_4); + _0 = const (); + StorageDead(_5); + goto -> bb8; + } + + bb8: { + StorageDead(_3); + return; + } +} -- cgit v1.2.3