summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mir-opt/building')
-rw-r--r--tests/mir-opt/building/async_await.a-{closure#0}.generator_resume.0.mir22
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir102
-rw-r--r--tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir11
-rw-r--r--tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.rs71
-rw-r--r--tests/mir-opt/building/custom/debuginfo.structured.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant.built.after.mir10
-rw-r--r--tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir11
-rw-r--r--tests/mir-opt/building/enum_cast.droppy.built.after.mir2
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.rs39
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir186
-rw-r--r--tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir87
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir2
-rw-r--r--tests/mir-opt/building/match_false_edges.main.built.after.mir4
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir6
-rw-r--r--tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir6
17 files changed, 524 insertions, 57 deletions
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
index 9be5b8509..98b1befc3 100644
--- 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
@@ -9,7 +9,7 @@
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<()> {
+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: ();
@@ -17,23 +17,31 @@ fn a::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:11:14: 11:16]>
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: bb2, otherwise: bb3];
+ _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 ();
- _0 = Poll::<()>::Ready(move _3);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:11:14: 11:16]))) = 1;
- return;
+ goto -> bb3;
}
bb2: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb2, unwind unreachable];
+ _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}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
index 80ac92d59..15330b13c 100644
--- 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
@@ -2,7 +2,17 @@
/* generator_layout = GeneratorLayout {
field_tys: {
_0: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ 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],
@@ -10,7 +20,17 @@
ignore_for_traits: false,
},
_1: GeneratorSavedTy {
- ty: impl std::future::Future<Output = ()>,
+ 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],
@@ -31,19 +51,19 @@
},
} */
-fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>, _2: &mut Context<'_>) -> Poll<()> {
+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: impl std::future::Future<Output = ()>;
- let mut _5: impl std::future::Future<Output = ()>;
- let mut _6: impl std::future::Future<Output = ()>;
+ 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 impl std::future::Future<Output = ()>>;
- let mut _11: &mut impl std::future::Future<Output = ()>;
- let mut _12: &mut impl std::future::Future<Output = ()>;
+ 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<'_>;
@@ -51,14 +71,14 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
let mut _18: !;
let mut _19: &mut std::task::Context<'_>;
let mut _20: ();
- let mut _21: impl std::future::Future<Output = ()>;
- let mut _22: impl std::future::Future<Output = ()>;
- let mut _23: impl std::future::Future<Output = ()>;
+ 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 impl std::future::Future<Output = ()>>;
- let mut _27: &mut impl std::future::Future<Output = ()>;
- let mut _28: &mut impl std::future::Future<Output = ()>;
+ 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<'_>;
@@ -70,7 +90,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
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: impl std::future::Future<Output = ()>);
+ 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 {
}
@@ -79,7 +99,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>);
+ 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 {
}
@@ -89,8 +109,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb0: {
- _39 = discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])));
- switchInt(move _39) -> [0: bb1, 1: bb28, 3: bb26, 4: bb27, otherwise: bb29];
+ _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: {
@@ -102,13 +122,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable];
+ _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: impl std::future::Future<Output = ()>) = move _4;
+ (((*(_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;
}
@@ -118,9 +138,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
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: impl std::future::Future<Output = ()>);
+ _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 impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
+ _10 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _11) -> [return: bb5, unwind unreachable];
}
bb5: {
@@ -136,7 +156,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb6: {
_13 = &mut (*_14);
StorageDead(_15);
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
+ _9 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable];
}
bb7: {
@@ -156,7 +176,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_20);
_20 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 3;
return;
}
@@ -173,7 +193,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_12);
StorageDead(_9);
StorageDead(_8);
- goto -> bb12;
+ 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: {
@@ -198,13 +218,13 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable];
+ _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: impl std::future::Future<Output = ()>) = move _21;
+ (((*(_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;
}
@@ -214,9 +234,9 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
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: impl std::future::Future<Output = ()>);
+ _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 impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
+ _26 = Pin::<&mut {async fn body@$DIR/async_await.rs:11:14: 11:16}>::new_unchecked(move _27) -> [return: bb17, unwind unreachable];
}
bb17: {
@@ -232,7 +252,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb18: {
_29 = &mut (*_30);
StorageDead(_31);
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
+ _25 = <{async fn body@$DIR/async_await.rs:11:14: 11:16} as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable];
}
bb19: {
@@ -252,7 +272,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageLive(_36);
_36 = ();
_0 = Poll::<()>::Pending;
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4;
+ discriminant((*(_1.0: &mut {async fn body@$DIR/async_await.rs:14:18: 17:2}))) = 4;
return;
}
@@ -265,7 +285,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_28);
StorageDead(_25);
StorageDead(_24);
- goto -> bb23;
+ 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: {
@@ -283,16 +303,20 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb24: {
StorageDead(_21);
- goto -> bb25;
+ goto -> bb26;
}
bb25: {
_0 = Poll::<()>::Ready(move _37);
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 1;
+ 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);
@@ -301,7 +325,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb11;
}
- bb27: {
+ bb28: {
StorageLive(_21);
StorageLive(_35);
StorageLive(_36);
@@ -309,11 +333,11 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
goto -> bb22;
}
- bb28: {
- assert(const false, "`async fn` resumed after completion") -> [success: bb28, unwind unreachable];
+ bb29: {
+ assert(const false, "`async fn` resumed after completion") -> [success: bb29, unwind unreachable];
}
- bb29: {
+ bb30: {
unreachable;
}
}
diff --git a/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
new file mode 100644
index 000000000..d86392537
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.numbered.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `numbered` after built
+
+fn numbered(_1: (u32, i32)) -> () {
+ debug first => (_1.0: u32);
+ debug second => (_1.0: u32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
new file mode 100644
index 000000000..86cced6f8
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.pointee.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `pointee` after built
+
+fn pointee(_1: &mut Option<i32>) -> () {
+ debug foo => (((*_1) as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.rs b/tests/mir-opt/building/custom/debuginfo.rs
new file mode 100644
index 000000000..bfdc3d3ea
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.rs
@@ -0,0 +1,71 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR debuginfo.pointee.built.after.mir
+#[custom_mir(dialect = "built")]
+fn pointee(opt: &mut Option<i32>) {
+ mir!(
+ debug foo => Field::<i32>(Variant(*opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.numbered.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn numbered(i: (u32, i32)) {
+ mir!(
+ debug first => i.0;
+ debug second => i.0;
+ {
+ Return()
+ }
+ )
+}
+
+struct S { x: f32 }
+
+// EMIT_MIR debuginfo.structured.built.after.mir
+#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
+fn structured(i: S) {
+ mir!(
+ debug x => i.x;
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant(opt: Option<i32>) {
+ mir!(
+ debug inner => Field::<i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR debuginfo.variant_deref.built.after.mir
+#[custom_mir(dialect = "built")]
+fn variant_deref(opt: Option<&i32>) {
+ mir!(
+ debug pointer => Field::<&i32>(Variant(opt, 1), 0);
+ debug deref => *Field::<&i32>(Variant(opt, 1), 0);
+ {
+ Return()
+ }
+ )
+}
+
+fn main() {
+ numbered((5, 6));
+ structured(S { x: 5. });
+ variant(Some(5));
+ variant_deref(Some(&5));
+ pointee(&mut Some(5));
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
new file mode 100644
index 000000000..d122b6bfe
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.structured.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `structured` after built
+
+fn structured(_1: S) -> () {
+ debug x => (_1.0: f32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
new file mode 100644
index 000000000..d173723fd
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `variant` after built
+
+fn variant(_1: Option<i32>) -> () {
+ debug inner => ((_1 as variant#1).0: i32);
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
new file mode 100644
index 000000000..37d5d1b2d
--- /dev/null
+++ b/tests/mir-opt/building/custom/debuginfo.variant_deref.built.after.mir
@@ -0,0 +1,11 @@
+// MIR for `variant_deref` after built
+
+fn variant_deref(_1: Option<&i32>) -> () {
+ debug pointer => ((_1 as variant#1).0: &i32);
+ debug deref => (*((_1 as variant#1).0: &i32));
+ let mut _0: ();
+
+ bb0: {
+ return;
+ }
+}
diff --git a/tests/mir-opt/building/enum_cast.droppy.built.after.mir b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
index 1caf9e4a5..ea0edb610 100644
--- a/tests/mir-opt/building/enum_cast.droppy.built.after.mir
+++ b/tests/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -62,7 +62,7 @@ fn droppy() -> () {
}
bb4 (cleanup): {
- drop(_2) -> [return: bb5, unwind terminate];
+ drop(_2) -> [return: bb5, unwind terminate(cleanup)];
}
bb5 (cleanup): {
diff --git a/tests/mir-opt/building/logical_or_in_conditional.rs b/tests/mir-opt/building/logical_or_in_conditional.rs
new file mode 100644
index 000000000..ae159f7e1
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.rs
@@ -0,0 +1,39 @@
+// compile-flags: -Z validate-mir
+#![feature(let_chains)]
+struct Droppy(u8);
+impl Drop for Droppy {
+ fn drop(&mut self) {
+ println!("drop {}", self.0);
+ }
+}
+
+enum E {
+ A(u8),
+ B,
+}
+
+impl E {
+ fn f() -> Self {
+ Self::A(1)
+ }
+}
+
+fn always_true() -> bool {
+ true
+}
+
+// EMIT_MIR logical_or_in_conditional.test_or.built.after.mir
+fn test_or() {
+ if Droppy(0).0 > 0 || Droppy(1).0 > 1 {}
+}
+
+// EMIT_MIR logical_or_in_conditional.test_complex.built.after.mir
+fn test_complex() {
+ if let E::A(_) = E::f() && ((always_true() && Droppy(0).0 > 0) || Droppy(1).0 > 1) {}
+
+ if !always_true() && let E::B = E::f() {}
+}
+
+fn main() {
+ test_or();
+}
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
new file mode 100644
index 000000000..096aaec4a
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_complex.built.after.mir
@@ -0,0 +1,186 @@
+// MIR for `test_complex` after built
+
+fn test_complex() -> () {
+ let mut _0: ();
+ let _1: ();
+ let mut _2: E;
+ let mut _3: isize;
+ let mut _4: bool;
+ let mut _5: bool;
+ let mut _6: u8;
+ let mut _7: Droppy;
+ let mut _8: bool;
+ let mut _9: u8;
+ let mut _10: Droppy;
+ let mut _11: bool;
+ let mut _12: E;
+ let mut _13: isize;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ _2 = E::f() -> [return: bb1, unwind: bb31];
+ }
+
+ bb1: {
+ FakeRead(ForMatchedPlace(None), _2);
+ _3 = discriminant(_2);
+ switchInt(move _3) -> [0: bb2, otherwise: bb3];
+ }
+
+ bb2: {
+ falseEdge -> [real: bb4, imaginary: bb3];
+ }
+
+ bb3: {
+ goto -> bb19;
+ }
+
+ bb4: {
+ StorageLive(_4);
+ _4 = always_true() -> [return: bb5, unwind: bb31];
+ }
+
+ bb5: {
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ StorageLive(_5);
+ StorageLive(_6);
+ StorageLive(_7);
+ _7 = Droppy(const 0_u8);
+ _6 = (_7.0: u8);
+ _5 = Gt(move _6, const 0_u8);
+ switchInt(move _5) -> [0: bb9, otherwise: bb8];
+ }
+
+ bb7: {
+ goto -> bb13;
+ }
+
+ bb8: {
+ drop(_7) -> [return: bb10, unwind: bb31];
+ }
+
+ bb9: {
+ goto -> bb11;
+ }
+
+ bb10: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb16;
+ }
+
+ bb11: {
+ drop(_7) -> [return: bb12, unwind: bb31];
+ }
+
+ bb12: {
+ StorageDead(_7);
+ StorageDead(_6);
+ goto -> bb13;
+ }
+
+ bb13: {
+ StorageLive(_8);
+ StorageLive(_9);
+ StorageLive(_10);
+ _10 = Droppy(const 1_u8);
+ _9 = (_10.0: u8);
+ _8 = Gt(move _9, const 1_u8);
+ switchInt(move _8) -> [0: bb15, otherwise: bb14];
+ }
+
+ bb14: {
+ drop(_10) -> [return: bb16, unwind: bb31];
+ }
+
+ bb15: {
+ goto -> bb17;
+ }
+
+ bb16: {
+ StorageDead(_10);
+ StorageDead(_9);
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb17: {
+ drop(_10) -> [return: bb18, unwind: bb31];
+ }
+
+ bb18: {
+ StorageDead(_10);
+ StorageDead(_9);
+ goto -> bb19;
+ }
+
+ bb19: {
+ _1 = const ();
+ goto -> bb20;
+ }
+
+ bb20: {
+ StorageDead(_8);
+ StorageDead(_5);
+ StorageDead(_4);
+ StorageDead(_2);
+ StorageDead(_1);
+ StorageLive(_11);
+ _11 = always_true() -> [return: bb21, unwind: bb31];
+ }
+
+ bb21: {
+ switchInt(move _11) -> [0: bb23, otherwise: bb22];
+ }
+
+ bb22: {
+ goto -> bb29;
+ }
+
+ bb23: {
+ goto -> bb24;
+ }
+
+ bb24: {
+ StorageLive(_12);
+ _12 = E::f() -> [return: bb25, unwind: bb31];
+ }
+
+ bb25: {
+ FakeRead(ForMatchedPlace(None), _12);
+ _13 = discriminant(_12);
+ switchInt(move _13) -> [1: bb27, otherwise: bb26];
+ }
+
+ bb26: {
+ goto -> bb29;
+ }
+
+ bb27: {
+ falseEdge -> [real: bb28, imaginary: bb26];
+ }
+
+ bb28: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb29: {
+ _0 = const ();
+ goto -> bb30;
+ }
+
+ bb30: {
+ StorageDead(_11);
+ StorageDead(_12);
+ return;
+ }
+
+ bb31 (cleanup): {
+ resume;
+ }
+}
diff --git a/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
new file mode 100644
index 000000000..b84c17c21
--- /dev/null
+++ b/tests/mir-opt/building/logical_or_in_conditional.test_or.built.after.mir
@@ -0,0 +1,87 @@
+// MIR for `test_or` after built
+
+fn test_or() -> () {
+ let mut _0: ();
+ let mut _1: bool;
+ let mut _2: u8;
+ let mut _3: Droppy;
+ let mut _4: bool;
+ let mut _5: u8;
+ let mut _6: Droppy;
+
+ bb0: {
+ StorageLive(_1);
+ StorageLive(_2);
+ StorageLive(_3);
+ _3 = Droppy(const 0_u8);
+ _2 = (_3.0: u8);
+ _1 = Gt(move _2, const 0_u8);
+ switchInt(move _1) -> [0: bb2, otherwise: bb1];
+ }
+
+ bb1: {
+ drop(_3) -> [return: bb3, unwind: bb12];
+ }
+
+ bb2: {
+ goto -> bb4;
+ }
+
+ bb3: {
+ StorageDead(_3);
+ StorageDead(_2);
+ goto -> bb8;
+ }
+
+ bb4: {
+ drop(_3) -> [return: bb5, unwind: bb12];
+ }
+
+ bb5: {
+ StorageDead(_3);
+ StorageDead(_2);
+ StorageLive(_4);
+ StorageLive(_5);
+ StorageLive(_6);
+ _6 = Droppy(const 1_u8);
+ _5 = (_6.0: u8);
+ _4 = Gt(move _5, const 1_u8);
+ switchInt(move _4) -> [0: bb7, otherwise: bb6];
+ }
+
+ bb6: {
+ drop(_6) -> [return: bb8, unwind: bb12];
+ }
+
+ bb7: {
+ goto -> bb9;
+ }
+
+ bb8: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb9: {
+ drop(_6) -> [return: bb10, unwind: bb12];
+ }
+
+ bb10: {
+ StorageDead(_6);
+ StorageDead(_5);
+ _0 = const ();
+ goto -> bb11;
+ }
+
+ bb11: {
+ StorageDead(_4);
+ StorageDead(_1);
+ return;
+ }
+
+ bb12 (cleanup): {
+ resume;
+ }
+}
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 bd4cd4eb6..9f64a23f3 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
@@ -51,7 +51,7 @@ fn full_tested_match() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
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 595e3ab92..89f9bafb6 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
@@ -57,7 +57,7 @@ fn full_tested_match2() -> () {
bb5: {
StorageLive(_6);
_6 = &((_2 as Some).0: i32);
- _4 = &shallow _2;
+ _4 = &fake _2;
StorageLive(_7);
_7 = guard() -> [return: bb6, unwind: bb12];
}
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 91fe2f90e..9a2d89c48 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
@@ -78,7 +78,7 @@ fn main() -> () {
bb8: {
StorageLive(_7);
_7 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_8);
_8 = guard() -> [return: bb9, unwind: bb20];
}
@@ -120,7 +120,7 @@ fn main() -> () {
bb14: {
StorageLive(_11);
_11 = &((_2 as Some).0: i32);
- _5 = &shallow _2;
+ _5 = &fake _2;
StorageLive(_12);
StorageLive(_13);
_13 = (*_11);
diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
index fea1138ba..82424de03 100644
--- a/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
+++ b/tests/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
@@ -89,15 +89,15 @@ fn move_out_by_subslice() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {
diff --git a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
index 3def40a85..0872d1b6a 100644
--- a/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
+++ b/tests/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
@@ -89,15 +89,15 @@ fn move_out_from_end() -> () {
}
bb9 (cleanup): {
- drop(_1) -> [return: bb12, unwind terminate];
+ drop(_1) -> [return: bb12, unwind terminate(cleanup)];
}
bb10 (cleanup): {
- drop(_7) -> [return: bb11, unwind terminate];
+ drop(_7) -> [return: bb11, unwind terminate(cleanup)];
}
bb11 (cleanup): {
- drop(_2) -> [return: bb12, unwind terminate];
+ drop(_2) -> [return: bb12, unwind terminate(cleanup)];
}
bb12 (cleanup): {