summaryrefslogtreecommitdiffstats
path: root/src/test/mir-opt/building
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
commit4e8199b572f2035b7749cba276ece3a26630d23e (patch)
treef09feeed6a0fe39d027b1908aa63ea6b35e4b631 /src/test/mir-opt/building
parentAdding upstream version 1.66.0+dfsg1. (diff)
downloadrustc-4e8199b572f2035b7749cba276ece3a26630d23e.tar.xz
rustc-4e8199b572f2035b7749cba276ece3a26630d23e.zip
Adding upstream version 1.67.1+dfsg1.upstream/1.67.1+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/mir-opt/building')
-rw-r--r--src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir22
-rw-r--r--src/test/mir-opt/building/custom/arbitrary_let.rs28
-rw-r--r--src/test/mir-opt/building/custom/consts.consts.built.after.mir22
-rw-r--r--src/test/mir-opt/building/custom/consts.rs36
-rw-r--r--src/test/mir-opt/building/custom/consts.statics.built.after.mir27
-rw-r--r--src/test/mir-opt/building/custom/references.immut_ref.built.after.mir14
-rw-r--r--src/test/mir-opt/building/custom/references.mut_ref.built.after.mir14
-rw-r--r--src/test/mir-opt/building/custom/references.rs43
-rw-r--r--src/test/mir-opt/building/custom/simple_assign.rs37
-rw-r--r--src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir18
-rw-r--r--src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir10
-rw-r--r--src/test/mir-opt/building/enum_cast.bar.built.after.mir23
-rw-r--r--src/test/mir-opt/building/enum_cast.boo.built.after.mir23
-rw-r--r--src/test/mir-opt/building/enum_cast.droppy.built.after.mir72
-rw-r--r--src/test/mir-opt/building/enum_cast.foo.built.after.mir17
-rw-r--r--src/test/mir-opt/building/enum_cast.rs50
-rw-r--r--src/test/mir-opt/building/issue_101867.main.built.after.mir75
-rw-r--r--src/test/mir-opt/building/issue_101867.rs7
-rw-r--r--src/test/mir-opt/building/issue_49232.main.built.after.mir82
-rw-r--r--src/test/mir-opt/building/issue_49232.rs15
-rw-r--r--src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir112
-rw-r--r--src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir112
-rw-r--r--src/test/mir-opt/building/match_false_edges.main.built.after.mir174
-rw-r--r--src/test/mir-opt/building/match_false_edges.rs39
-rw-r--r--src/test/mir-opt/building/receiver_ptr_mutability.main.built.after.mir96
-rw-r--r--src/test/mir-opt/building/receiver_ptr_mutability.rs20
-rw-r--r--src/test/mir-opt/building/simple_match.match_bool.built.after.mir29
-rw-r--r--src/test/mir-opt/building/simple_match.rs12
-rw-r--r--src/test/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir203
-rw-r--r--src/test/mir-opt/building/storage_live_dead_in_statics.rs33
-rw-r--r--src/test/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir111
-rw-r--r--src/test/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir111
-rw-r--r--src/test/mir-opt/building/uniform_array_move_out.rs18
33 files changed, 1705 insertions, 0 deletions
diff --git a/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir b/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir
new file mode 100644
index 000000000..20dd251e7
--- /dev/null
+++ b/src/test/mir-opt/building/custom/arbitrary_let.arbitrary_let.built.after.mir
@@ -0,0 +1,22 @@
+// MIR for `arbitrary_let` after built
+
+fn arbitrary_let(_1: i32) -> i32 {
+ let mut _0: i32; // return place in scope 0 at $DIR/arbitrary_let.rs:+0:29: +0:32
+ let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ goto -> bb2; // scope 0 at $DIR/arbitrary_let.rs:+4:13: +4:25
+ }
+
+ bb1: {
+ _0 = _3; // scope 0 at $DIR/arbitrary_let.rs:+7:13: +7:20
+ return; // scope 0 at $DIR/arbitrary_let.rs:+8:13: +8:21
+ }
+
+ bb2: {
+ _3 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ goto -> bb1; // scope 0 at $DIR/arbitrary_let.rs:+12:13: +12:24
+ }
+}
diff --git a/src/test/mir-opt/building/custom/arbitrary_let.rs b/src/test/mir-opt/building/custom/arbitrary_let.rs
new file mode 100644
index 000000000..776df3151
--- /dev/null
+++ b/src/test/mir-opt/building/custom/arbitrary_let.rs
@@ -0,0 +1,28 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+use core::ptr::{addr_of, addr_of_mut};
+
+// EMIT_MIR arbitrary_let.arbitrary_let.built.after.mir
+#[custom_mir(dialect = "built")]
+fn arbitrary_let(x: i32) -> i32 {
+ mir!(
+ {
+ let y = x;
+ Goto(second)
+ }
+ third = {
+ RET = z;
+ Return()
+ }
+ second = {
+ let z = y;
+ Goto(third)
+ }
+ )
+}
+
+fn main() {
+ assert_eq!(arbitrary_let(5), 5);
+}
diff --git a/src/test/mir-opt/building/custom/consts.consts.built.after.mir b/src/test/mir-opt/building/custom/consts.consts.built.after.mir
new file mode 100644
index 000000000..ba753cfc2
--- /dev/null
+++ b/src/test/mir-opt/building/custom/consts.consts.built.after.mir
@@ -0,0 +1,22 @@
+// MIR for `consts` after built
+
+fn consts() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:27: +0:27
+ let mut _1: u8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _2: i8; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: u32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _4: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _5: fn() {consts::<10>}; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _1 = const 5_u8; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _2 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _3 = const C; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _4 = const _; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ _5 = consts::<10>; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ // mir::Constant
+ // + span: $DIR/consts.rs:16:18: 16:30
+ // + literal: Const { ty: fn() {consts::<10>}, val: Value(<ZST>) }
+ return; // scope 0 at $DIR/consts.rs:+7:9: +7:17
+ }
+}
diff --git a/src/test/mir-opt/building/custom/consts.rs b/src/test/mir-opt/building/custom/consts.rs
new file mode 100644
index 000000000..ff4fe1a93
--- /dev/null
+++ b/src/test/mir-opt/building/custom/consts.rs
@@ -0,0 +1,36 @@
+#![feature(custom_mir, core_intrinsics, inline_const)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+const D: i32 = 5;
+
+// EMIT_MIR consts.consts.built.after.mir
+#[custom_mir(dialect = "built")]
+fn consts<const C: u32>() {
+ mir!({
+ let _a = 5_u8;
+ let _b = const { 5_i8 };
+ let _c = C;
+ let _d = D;
+ let _e = consts::<10>;
+ Return()
+ })
+}
+
+static S: i32 = 5;
+static mut T: i32 = 10;
+// EMIT_MIR consts.statics.built.after.mir
+#[custom_mir(dialect = "built")]
+fn statics() {
+ mir!({
+ let _a: &i32 = Static(S);
+ let _b: *mut i32 = StaticMut(T);
+ Return()
+ })
+}
+
+fn main() {
+ consts::<5>();
+ statics();
+}
diff --git a/src/test/mir-opt/building/custom/consts.statics.built.after.mir b/src/test/mir-opt/building/custom/consts.statics.built.after.mir
new file mode 100644
index 000000000..ee768e263
--- /dev/null
+++ b/src/test/mir-opt/building/custom/consts.statics.built.after.mir
@@ -0,0 +1,27 @@
+// MIR for `statics` after built
+
+fn statics() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:14: +0:14
+ let mut _1: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _1 = const {alloc1: &i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ // mir::Constant
+ // + span: $DIR/consts.rs:27:31: 27:32
+ // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
+ _2 = const {alloc2: *mut i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ // mir::Constant
+ // + span: $DIR/consts.rs:28:38: 28:39
+ // + literal: Const { ty: *mut i32, val: Value(Scalar(alloc2)) }
+ return; // scope 0 at $DIR/consts.rs:+4:9: +4:17
+ }
+}
+
+alloc2 (static: T, size: 4, align: 4) {
+ 0a 00 00 00 │ ....
+}
+
+alloc1 (static: S, size: 4, align: 4) {
+ 05 00 00 00 │ ....
+}
diff --git a/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir b/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir
new file mode 100644
index 000000000..4d38d45c0
--- /dev/null
+++ b/src/test/mir-opt/building/custom/references.immut_ref.built.after.mir
@@ -0,0 +1,14 @@
+// MIR for `immut_ref` after built
+
+fn immut_ref(_1: &i32) -> &i32 {
+ let mut _0: &i32; // return place in scope 0 at $DIR/references.rs:+0:30: +0:34
+ let mut _2: *const i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _2 = &raw const (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:29
+ Retag([raw] _2); // scope 0 at $DIR/references.rs:+6:13: +6:24
+ _0 = &(*_2); // scope 0 at $DIR/references.rs:+7:13: +7:23
+ Retag(_0); // scope 0 at $DIR/references.rs:+8:13: +8:23
+ return; // scope 0 at $DIR/references.rs:+9:13: +9:21
+ }
+}
diff --git a/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir b/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir
new file mode 100644
index 000000000..01bc8a9cd
--- /dev/null
+++ b/src/test/mir-opt/building/custom/references.mut_ref.built.after.mir
@@ -0,0 +1,14 @@
+// MIR for `mut_ref` after built
+
+fn mut_ref(_1: &mut i32) -> &mut i32 {
+ let mut _0: &mut i32; // return place in scope 0 at $DIR/references.rs:+0:32: +0:40
+ let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _2 = &raw mut (*_1); // scope 0 at $DIR/references.rs:+5:13: +5:33
+ Retag([raw] _2); // scope 0 at $DIR/references.rs:+6:13: +6:24
+ _0 = &mut (*_2); // scope 0 at $DIR/references.rs:+7:13: +7:26
+ Retag(_0); // scope 0 at $DIR/references.rs:+8:13: +8:23
+ return; // scope 0 at $DIR/references.rs:+9:13: +9:21
+ }
+}
diff --git a/src/test/mir-opt/building/custom/references.rs b/src/test/mir-opt/building/custom/references.rs
new file mode 100644
index 000000000..dee85722e
--- /dev/null
+++ b/src/test/mir-opt/building/custom/references.rs
@@ -0,0 +1,43 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+use core::ptr::{addr_of, addr_of_mut};
+
+// EMIT_MIR references.mut_ref.built.after.mir
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn mut_ref(x: &mut i32) -> &mut i32 {
+ mir!(
+ let t: *mut i32;
+
+ {
+ t = addr_of_mut!(*x);
+ RetagRaw(t);
+ RET = &mut *t;
+ Retag(RET);
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR references.immut_ref.built.after.mir
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn immut_ref(x: &i32) -> &i32 {
+ mir!(
+ let t: *const i32;
+
+ {
+ t = addr_of!(*x);
+ RetagRaw(t);
+ RET = & *t;
+ Retag(RET);
+ Return()
+ }
+ )
+}
+
+fn main() {
+ let mut x = 5;
+ assert_eq!(*mut_ref(&mut x), 5);
+ assert_eq!(*immut_ref(&x), 5);
+}
diff --git a/src/test/mir-opt/building/custom/simple_assign.rs b/src/test/mir-opt/building/custom/simple_assign.rs
new file mode 100644
index 000000000..ec6dbe1d0
--- /dev/null
+++ b/src/test/mir-opt/building/custom/simple_assign.rs
@@ -0,0 +1,37 @@
+#![feature(custom_mir, core_intrinsics)]
+
+extern crate core;
+use core::intrinsics::mir::*;
+
+// EMIT_MIR simple_assign.simple.built.after.mir
+#[custom_mir(dialect = "built")]
+pub fn simple(x: i32) -> i32 {
+ mir!(
+ let temp1: i32;
+ let temp2: _;
+
+ {
+ temp1 = x;
+ Goto(exit)
+ }
+
+ exit = {
+ temp2 = Move(temp1);
+ RET = temp2;
+ Return()
+ }
+ )
+}
+
+// EMIT_MIR simple_assign.simple_ref.built.after.mir
+#[custom_mir(dialect = "built")]
+pub fn simple_ref(x: &mut i32) -> &mut i32 {
+ mir!({
+ RET = Move(x);
+ Return()
+ })
+}
+
+fn main() {
+ assert_eq!(5, simple(5));
+}
diff --git a/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir b/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir
new file mode 100644
index 000000000..d7560fde6
--- /dev/null
+++ b/src/test/mir-opt/building/custom/simple_assign.simple.built.after.mir
@@ -0,0 +1,18 @@
+// MIR for `simple` after built
+
+fn simple(_1: i32) -> i32 {
+ let mut _0: i32; // return place in scope 0 at $DIR/simple_assign.rs:+0:26: +0:29
+ let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+ let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
+
+ bb0: {
+ _2 = _1; // scope 0 at $DIR/simple_assign.rs:+6:13: +6:22
+ goto -> bb1; // scope 0 at $DIR/simple_assign.rs:+7:13: +7:23
+ }
+
+ bb1: {
+ _3 = move _2; // scope 0 at $DIR/simple_assign.rs:+11:13: +11:32
+ _0 = _3; // scope 0 at $DIR/simple_assign.rs:+12:13: +12:24
+ return; // scope 0 at $DIR/simple_assign.rs:+13:13: +13:21
+ }
+}
diff --git a/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir b/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir
new file mode 100644
index 000000000..2b0e8f104
--- /dev/null
+++ b/src/test/mir-opt/building/custom/simple_assign.simple_ref.built.after.mir
@@ -0,0 +1,10 @@
+// MIR for `simple_ref` after built
+
+fn simple_ref(_1: &mut i32) -> &mut i32 {
+ let mut _0: &mut i32; // return place in scope 0 at $DIR/simple_assign.rs:+0:35: +0:43
+
+ bb0: {
+ _0 = move _1; // scope 0 at $DIR/simple_assign.rs:+2:9: +2:22
+ return; // scope 0 at $DIR/simple_assign.rs:+3:9: +3:17
+ }
+}
diff --git a/src/test/mir-opt/building/enum_cast.bar.built.after.mir b/src/test/mir-opt/building/enum_cast.bar.built.after.mir
new file mode 100644
index 000000000..0746e0b49
--- /dev/null
+++ b/src/test/mir-opt/building/enum_cast.bar.built.after.mir
@@ -0,0 +1,23 @@
+// MIR for `bar` after built
+
+fn bar(_1: Bar) -> usize {
+ debug bar => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
+ let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
+ let _2: Bar; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _4 = Ge(const 1_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _5 = Le(const 0_isize, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/src/test/mir-opt/building/enum_cast.boo.built.after.mir b/src/test/mir-opt/building/enum_cast.boo.built.after.mir
new file mode 100644
index 000000000..699c876b0
--- /dev/null
+++ b/src/test/mir-opt/building/enum_cast.boo.built.after.mir
@@ -0,0 +1,23 @@
+// MIR for `boo` after built
+
+fn boo(_1: Boo) -> usize {
+ debug boo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
+ let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
+ let _2: Boo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _3: u8; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _4: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ let mut _5: bool; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _4 = Ge(const 1_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(_4); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _5 = Le(const 0_u8, _3); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ assume(_5); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/src/test/mir-opt/building/enum_cast.droppy.built.after.mir b/src/test/mir-opt/building/enum_cast.droppy.built.after.mir
new file mode 100644
index 000000000..5231c2eab
--- /dev/null
+++ b/src/test/mir-opt/building/enum_cast.droppy.built.after.mir
@@ -0,0 +1,72 @@
+// MIR for `droppy` after built
+
+fn droppy() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/enum_cast.rs:+0:13: +0:13
+ let _1: (); // in scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
+ let _2: Droppy; // in scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
+ let _4: Droppy; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
+ let mut _5: isize; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:18
+ let mut _6: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
+ let mut _7: bool; // in scope 0 at $DIR/enum_cast.rs:+5:17: +5:27
+ let _8: Droppy; // in scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
+ scope 1 {
+ debug x => _2; // in scope 1 at $DIR/enum_cast.rs:+2:13: +2:14
+ scope 2 {
+ debug y => _3; // in scope 2 at $DIR/enum_cast.rs:+5:13: +5:14
+ }
+ scope 3 {
+ let _3: usize; // in scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
+ }
+ }
+ scope 4 {
+ debug z => _8; // in scope 4 at $DIR/enum_cast.rs:+7:9: +7:10
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
+ _2 = Droppy::C; // scope 0 at $DIR/enum_cast.rs:+2:17: +2:26
+ FakeRead(ForLet(None), _2); // scope 0 at $DIR/enum_cast.rs:+2:13: +2:14
+ StorageLive(_3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
+ StorageLive(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
+ _4 = move _2; // scope 3 at $DIR/enum_cast.rs:+5:17: +5:18
+ _5 = discriminant(_4); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ _6 = Ge(const 2_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ assume(_6); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ _7 = Le(const 0_isize, _5); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ assume(_7); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ _3 = move _5 as usize (IntToInt); // scope 3 at $DIR/enum_cast.rs:+5:17: +5:27
+ drop(_4) -> [return: bb1, unwind: bb4]; // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27
+ }
+
+ bb1: {
+ StorageDead(_4); // scope 3 at $DIR/enum_cast.rs:+5:26: +5:27
+ FakeRead(ForLet(None), _3); // scope 3 at $DIR/enum_cast.rs:+5:13: +5:14
+ _1 = const (); // scope 0 at $DIR/enum_cast.rs:+1:5: +6:6
+ StorageDead(_3); // scope 1 at $DIR/enum_cast.rs:+6:5: +6:6
+ drop(_2) -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ }
+
+ bb2: {
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ StorageDead(_1); // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ StorageLive(_8); // scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
+ _8 = Droppy::B; // scope 0 at $DIR/enum_cast.rs:+7:13: +7:22
+ FakeRead(ForLet(None), _8); // scope 0 at $DIR/enum_cast.rs:+7:9: +7:10
+ _0 = const (); // scope 0 at $DIR/enum_cast.rs:+0:13: +8:2
+ drop(_8) -> [return: bb3, unwind: bb5]; // scope 0 at $DIR/enum_cast.rs:+8:1: +8:2
+ }
+
+ bb3: {
+ StorageDead(_8); // scope 0 at $DIR/enum_cast.rs:+8:1: +8:2
+ return; // scope 0 at $DIR/enum_cast.rs:+8:2: +8:2
+ }
+
+ bb4 (cleanup): {
+ drop(_2) -> bb5; // scope 0 at $DIR/enum_cast.rs:+6:5: +6:6
+ }
+
+ bb5 (cleanup): {
+ resume; // scope 0 at $DIR/enum_cast.rs:+0:1: +8:2
+ }
+}
diff --git a/src/test/mir-opt/building/enum_cast.foo.built.after.mir b/src/test/mir-opt/building/enum_cast.foo.built.after.mir
new file mode 100644
index 000000000..17e0abf2e
--- /dev/null
+++ b/src/test/mir-opt/building/enum_cast.foo.built.after.mir
@@ -0,0 +1,17 @@
+// MIR for `foo` after built
+
+fn foo(_1: Foo) -> usize {
+ debug foo => _1; // in scope 0 at $DIR/enum_cast.rs:+0:8: +0:11
+ let mut _0: usize; // return place in scope 0 at $DIR/enum_cast.rs:+0:21: +0:26
+ let _2: Foo; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ let mut _3: isize; // in scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+
+ bb0: {
+ StorageLive(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _2 = move _1; // scope 0 at $DIR/enum_cast.rs:+1:5: +1:8
+ _3 = discriminant(_2); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ _0 = move _3 as usize (IntToInt); // scope 0 at $DIR/enum_cast.rs:+1:5: +1:17
+ StorageDead(_2); // scope 0 at $DIR/enum_cast.rs:+1:16: +1:17
+ return; // scope 0 at $DIR/enum_cast.rs:+2:2: +2:2
+ }
+}
diff --git a/src/test/mir-opt/building/enum_cast.rs b/src/test/mir-opt/building/enum_cast.rs
new file mode 100644
index 000000000..98fd5acfb
--- /dev/null
+++ b/src/test/mir-opt/building/enum_cast.rs
@@ -0,0 +1,50 @@
+// EMIT_MIR enum_cast.foo.built.after.mir
+// EMIT_MIR enum_cast.bar.built.after.mir
+// EMIT_MIR enum_cast.boo.built.after.mir
+
+enum Foo {
+ A
+}
+
+enum Bar {
+ A, B
+}
+
+#[repr(u8)]
+enum Boo {
+ A, B
+}
+
+fn foo(foo: Foo) -> usize {
+ foo as usize
+}
+
+fn bar(bar: Bar) -> usize {
+ bar as usize
+}
+
+fn boo(boo: Boo) -> usize {
+ boo as usize
+}
+
+// EMIT_MIR enum_cast.droppy.built.after.mir
+enum Droppy {
+ A, B, C
+}
+
+impl Drop for Droppy {
+ fn drop(&mut self) {}
+}
+
+fn droppy() {
+ {
+ let x = Droppy::C;
+ // remove this entire test once `cenum_impl_drop_cast` becomes a hard error
+ #[allow(cenum_impl_drop_cast)]
+ let y = x as usize;
+ }
+ let z = Droppy::B;
+}
+
+fn main() {
+}
diff --git a/src/test/mir-opt/building/issue_101867.main.built.after.mir b/src/test/mir-opt/building/issue_101867.main.built.after.mir
new file mode 100644
index 000000000..0ebd840cf
--- /dev/null
+++ b/src/test/mir-opt/building/issue_101867.main.built.after.mir
@@ -0,0 +1,75 @@
+// MIR for `main` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option<u8>) }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
+| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(std::option::Option<u8>) }, span: $DIR/issue_101867.rs:3:12: 3:22, inferred_ty: std::option::Option<u8>
+|
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/issue_101867.rs:+0:11: +0:11
+ let _1: std::option::Option<u8> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
+ let mut _2: !; // in scope 0 at $DIR/issue_101867.rs:+2:26: +4:6
+ let _3: (); // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
+ let mut _4: !; // in scope 0 at $SRC_DIR/std/src/panic.rs:LL:COL
+ let mut _6: isize; // in scope 0 at $DIR/issue_101867.rs:+2:9: +2:16
+ scope 1 {
+ debug x => _1; // in scope 1 at $DIR/issue_101867.rs:+1:9: +1:10
+ let _5: u8; // in scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
+ scope 2 {
+ debug y => _5; // in scope 2 at $DIR/issue_101867.rs:+2:14: +2:15
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
+ _1 = Option::<u8>::Some(const 1_u8); // scope 0 at $DIR/issue_101867.rs:+1:25: +1:32
+ FakeRead(ForLet(None), _1); // scope 0 at $DIR/issue_101867.rs:+1:9: +1:10
+ AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/issue_101867.rs:+1:12: +1:22
+ StorageLive(_5); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
+ FakeRead(ForMatchedPlace(None), _1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
+ _6 = discriminant(_1); // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
+ switchInt(move _6) -> [1_isize: bb4, otherwise: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
+ }
+
+ bb1: {
+ StorageLive(_3); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
+ StorageLive(_4); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
+ _4 = begin_panic::<&str>(const "explicit panic") -> bb7; // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
+ // mir::Constant
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
+ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(<ZST>) }
+ // mir::Constant
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL
+ // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ }
+
+ bb2: {
+ StorageDead(_4); // scope 1 at $SRC_DIR/std/src/panic.rs:LL:COL
+ StorageDead(_3); // scope 1 at $DIR/issue_101867.rs:+3:16: +3:17
+ unreachable; // scope 1 at $DIR/issue_101867.rs:+2:26: +4:6
+ }
+
+ bb3: {
+ goto -> bb6; // scope 1 at $DIR/issue_101867.rs:+2:19: +2:20
+ }
+
+ bb4: {
+ falseEdge -> [real: bb5, imaginary: bb3]; // scope 1 at $DIR/issue_101867.rs:+2:9: +2:16
+ }
+
+ bb5: {
+ _5 = ((_1 as Some).0: u8); // scope 1 at $DIR/issue_101867.rs:+2:14: +2:15
+ _0 = const (); // scope 0 at $DIR/issue_101867.rs:+0:11: +5:2
+ StorageDead(_5); // scope 1 at $DIR/issue_101867.rs:+5:1: +5:2
+ StorageDead(_1); // scope 0 at $DIR/issue_101867.rs:+5:1: +5:2
+ return; // scope 0 at $DIR/issue_101867.rs:+5:2: +5:2
+ }
+
+ bb6: {
+ StorageDead(_5); // scope 1 at $DIR/issue_101867.rs:+5:1: +5:2
+ goto -> bb1; // scope 0 at $DIR/issue_101867.rs:+0:11: +5:2
+ }
+
+ bb7 (cleanup): {
+ resume; // scope 0 at $DIR/issue_101867.rs:+0:1: +5:2
+ }
+}
diff --git a/src/test/mir-opt/building/issue_101867.rs b/src/test/mir-opt/building/issue_101867.rs
new file mode 100644
index 000000000..a32d8cb37
--- /dev/null
+++ b/src/test/mir-opt/building/issue_101867.rs
@@ -0,0 +1,7 @@
+// EMIT_MIR issue_101867.main.built.after.mir
+fn main() {
+ let x: Option<u8> = Some(1);
+ let Some(y) = x else {
+ panic!();
+ };
+}
diff --git a/src/test/mir-opt/building/issue_49232.main.built.after.mir b/src/test/mir-opt/building/issue_49232.main.built.after.mir
new file mode 100644
index 000000000..9182bcaa2
--- /dev/null
+++ b/src/test/mir-opt/building/issue_49232.main.built.after.mir
@@ -0,0 +1,82 @@
+// MIR for `main` after built
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/issue_49232.rs:+0:11: +0:11
+ let mut _1: (); // in scope 0 at $DIR/issue_49232.rs:+0:1: +10:2
+ let _2: i32; // in scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
+ let mut _3: bool; // in scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
+ let mut _4: !; // in scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ let _5: (); // in scope 0 at $DIR/issue_49232.rs:+8:9: +8:22
+ let mut _6: &i32; // in scope 0 at $DIR/issue_49232.rs:+8:14: +8:21
+ scope 1 {
+ debug beacon => _2; // in scope 1 at $DIR/issue_49232.rs:+2:13: +2:19
+ }
+
+ bb0: {
+ goto -> bb1; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ }
+
+ bb1: {
+ falseUnwind -> [real: bb2, cleanup: bb11]; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ }
+
+ bb2: {
+ StorageLive(_2); // scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
+ StorageLive(_3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
+ _3 = const true; // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
+ FakeRead(ForMatchedPlace(None), _3); // scope 0 at $DIR/issue_49232.rs:+3:19: +3:23
+ switchInt(_3) -> [false: bb3, otherwise: bb4]; // scope 0 at $DIR/issue_49232.rs:+3:13: +3:23
+ }
+
+ bb3: {
+ falseEdge -> [real: bb5, imaginary: bb4]; // scope 0 at $DIR/issue_49232.rs:+4:17: +4:22
+ }
+
+ bb4: {
+ _0 = const (); // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ goto -> bb10; // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ }
+
+ bb5: {
+ _2 = const 4_i32; // scope 0 at $DIR/issue_49232.rs:+4:26: +4:27
+ goto -> bb8; // scope 0 at $DIR/issue_49232.rs:+4:26: +4:27
+ }
+
+ bb6: {
+ unreachable; // scope 0 at $DIR/issue_49232.rs:+5:25: +5:30
+ }
+
+ bb7: {
+ goto -> bb8; // scope 0 at $DIR/issue_49232.rs:+6:13: +6:14
+ }
+
+ bb8: {
+ FakeRead(ForLet(None), _2); // scope 0 at $DIR/issue_49232.rs:+2:13: +2:19
+ StorageDead(_3); // scope 0 at $DIR/issue_49232.rs:+7:10: +7:11
+ StorageLive(_5); // scope 1 at $DIR/issue_49232.rs:+8:9: +8:22
+ StorageLive(_6); // scope 1 at $DIR/issue_49232.rs:+8:14: +8:21
+ _6 = &_2; // scope 1 at $DIR/issue_49232.rs:+8:14: +8:21
+ _5 = std::mem::drop::<&i32>(move _6) -> [return: bb9, unwind: bb11]; // scope 1 at $DIR/issue_49232.rs:+8:9: +8:22
+ // mir::Constant
+ // + span: $DIR/issue_49232.rs:13:9: 13:13
+ // + literal: Const { ty: fn(&i32) {std::mem::drop::<&i32>}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ StorageDead(_6); // scope 1 at $DIR/issue_49232.rs:+8:21: +8:22
+ StorageDead(_5); // scope 1 at $DIR/issue_49232.rs:+8:22: +8:23
+ _1 = const (); // scope 0 at $DIR/issue_49232.rs:+1:10: +9:6
+ StorageDead(_2); // scope 0 at $DIR/issue_49232.rs:+9:5: +9:6
+ goto -> bb1; // scope 0 at $DIR/issue_49232.rs:+1:5: +9:6
+ }
+
+ bb10: {
+ StorageDead(_3); // scope 0 at $DIR/issue_49232.rs:+7:10: +7:11
+ StorageDead(_2); // scope 0 at $DIR/issue_49232.rs:+9:5: +9:6
+ return; // scope 0 at $DIR/issue_49232.rs:+10:2: +10:2
+ }
+
+ bb11 (cleanup): {
+ resume; // scope 0 at $DIR/issue_49232.rs:+0:1: +10:2
+ }
+}
diff --git a/src/test/mir-opt/building/issue_49232.rs b/src/test/mir-opt/building/issue_49232.rs
new file mode 100644
index 000000000..7e9f0de81
--- /dev/null
+++ b/src/test/mir-opt/building/issue_49232.rs
@@ -0,0 +1,15 @@
+// We must mark a variable whose initialization fails due to an
+// abort statement as StorageDead.
+
+// EMIT_MIR issue_49232.main.built.after.mir
+fn main() {
+ loop {
+ let beacon = {
+ match true {
+ false => 4,
+ true => break,
+ }
+ };
+ drop(&beacon);
+ }
+}
diff --git a/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir b/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
new file mode 100644
index 000000000..9a190c3d6
--- /dev/null
+++ b/src/test/mir-opt/building/match_false_edges.full_tested_match.built.after.mir
@@ -0,0 +1,112 @@
+// MIR for `full_tested_match` after built
+
+fn full_tested_match() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:28: +0:28
+ let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
+ let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36
+ let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
+ let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+3:24: +3:25
+ scope 1 {
+ }
+ scope 2 {
+ debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ }
+ scope 3 {
+ debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:+3:14: +3:15
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
+ StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
+ }
+
+ bb1: {
+ _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:17: +4:23
+ }
+
+ bb2: {
+ falseEdge -> [real: bb5, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ }
+
+ bb3: {
+ falseEdge -> [real: bb10, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:16
+ }
+
+ bb4: {
+ unreachable; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ }
+
+ bb5: {
+ StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ // mir::Constant
+ // + span: $DIR/match_false_edges.rs:14:20: 14:25
+ // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb7: {
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
+ _8 = _5; // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
+ _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:+2:31: +2:37
+ StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ }
+
+ bb8: {
+ goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb9: {
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ goto -> bb3; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb10: {
+ StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
+ _9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+3:14: +3:15
+ StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25
+ _10 = _9; // scope 3 at $DIR/match_false_edges.rs:+3:24: +3:25
+ _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+3:20: +3:26
+ StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+3:25: +3:26
+ StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:25: +3:26
+ }
+
+ bb11: {
+ StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
+ StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
+ _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:28: +6:2
+ return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
+ }
+
+ bb12 (cleanup): {
+ resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
+ }
+}
diff --git a/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir b/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
new file mode 100644
index 000000000..1c9953e7e
--- /dev/null
+++ b/src/test/mir-opt/building/match_false_edges.full_tested_match2.built.after.mir
@@ -0,0 +1,112 @@
+// MIR for `full_tested_match2` after built
+
+fn full_tested_match2() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:29: +0:29
+ let mut _1: (i32, i32); // in scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
+ let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ let mut _4: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ let _5: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ let _6: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ let mut _7: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ let mut _8: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:35: +2:36
+ let _9: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ let mut _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:24: +4:25
+ scope 1 {
+ }
+ scope 2 {
+ debug x => _5; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ debug x => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:15
+ }
+ scope 3 {
+ debug y => _9; // in scope 3 at $DIR/match_false_edges.rs:+4:14: +4:15
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +5:6
+ StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ _2 = Option::<i32>::Some(const 42_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ switchInt(move _3) -> [0_isize: bb1, 1_isize: bb2, otherwise: bb4]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:27
+ }
+
+ bb1: {
+ falseEdge -> [real: bb10, imaginary: bb3]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:13
+ }
+
+ bb2: {
+ falseEdge -> [real: bb5, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:16
+ }
+
+ bb3: {
+ StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ _9 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ StorageLive(_10); // scope 3 at $DIR/match_false_edges.rs:+4:24: +4:25
+ _10 = _9; // scope 3 at $DIR/match_false_edges.rs:+4:24: +4:25
+ _1 = (const 2_i32, move _10); // scope 3 at $DIR/match_false_edges.rs:+4:20: +4:26
+ StorageDead(_10); // scope 3 at $DIR/match_false_edges.rs:+4:25: +4:26
+ StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+4:25: +4:26
+ }
+
+ bb4: {
+ unreachable; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ }
+
+ bb5: {
+ StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _6 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _4 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:27
+ StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ _7 = guard() -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ // mir::Constant
+ // + span: $DIR/match_false_edges.rs:25:20: 25:25
+ // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ }
+
+ bb6: {
+ switchInt(move _7) -> [false: bb8, otherwise: bb7]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb7: {
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ FakeRead(ForMatchGuard, _4); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ FakeRead(ForGuardBinding, _6); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ StorageLive(_5); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ _5 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:15
+ StorageLive(_8); // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
+ _8 = _5; // scope 2 at $DIR/match_false_edges.rs:+2:35: +2:36
+ _1 = (const 1_i32, move _8); // scope 2 at $DIR/match_false_edges.rs:+2:31: +2:37
+ StorageDead(_8); // scope 2 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_5); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ }
+
+ bb8: {
+ goto -> bb9; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb9: {
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:26: +2:27
+ StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:36: +2:37
+ falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:20: +2:27
+ }
+
+ bb10: {
+ _1 = (const 3_i32, const 3_i32); // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
+ goto -> bb11; // scope 0 at $DIR/match_false_edges.rs:+3:17: +3:23
+ }
+
+ bb11: {
+ StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
+ StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+5:6: +5:7
+ _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:29: +6:2
+ return; // scope 0 at $DIR/match_false_edges.rs:+6:2: +6:2
+ }
+
+ bb12 (cleanup): {
+ resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +6:2
+ }
+}
diff --git a/src/test/mir-opt/building/match_false_edges.main.built.after.mir b/src/test/mir-opt/building/match_false_edges.main.built.after.mir
new file mode 100644
index 000000000..08c67d39d
--- /dev/null
+++ b/src/test/mir-opt/building/match_false_edges.main.built.after.mir
@@ -0,0 +1,174 @@
+// MIR for `main` after built
+
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/match_false_edges.rs:+0:11: +0:11
+ let mut _1: i32; // in scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
+ let mut _2: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ let mut _3: isize; // in scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16
+ let mut _4: isize; // in scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17
+ let mut _5: &std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ let _6: i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ let _7: &i32; // in scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ let mut _8: bool; // in scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ let _9: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
+ let _10: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ let _11: &i32; // in scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ let mut _12: bool; // in scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ let mut _13: i32; // in scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
+ let _14: std::option::Option<i32>; // in scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
+ scope 1 {
+ }
+ scope 2 {
+ debug _w => _6; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:16
+ debug _w => _7; // in scope 2 at $DIR/match_false_edges.rs:+2:14: +2:16
+ }
+ scope 3 {
+ debug _x => _9; // in scope 3 at $DIR/match_false_edges.rs:+3:9: +3:11
+ }
+ scope 4 {
+ debug y => _10; // in scope 4 at $DIR/match_false_edges.rs:+4:14: +4:15
+ debug y => _11; // in scope 4 at $DIR/match_false_edges.rs:+4:14: +4:15
+ }
+ scope 5 {
+ debug _z => _14; // in scope 5 at $DIR/match_false_edges.rs:+5:9: +5:11
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/match_false_edges.rs:+1:13: +6:6
+ StorageLive(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ _2 = Option::<i32>::Some(const 1_i32); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ FakeRead(ForMatchedPlace(None), _2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ _4 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ switchInt(move _4) -> [1_isize: bb2, otherwise: bb1]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ }
+
+ bb1: {
+ falseEdge -> [real: bb13, imaginary: bb6]; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
+ }
+
+ bb2: {
+ falseEdge -> [real: bb8, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:9: +2:17
+ }
+
+ bb3: {
+ goto -> bb1; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ }
+
+ bb4: {
+ _3 = discriminant(_2); // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ switchInt(move _3) -> [1_isize: bb6, otherwise: bb5]; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ }
+
+ bb5: {
+ StorageLive(_14); // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
+ _14 = _2; // scope 0 at $DIR/match_false_edges.rs:+5:9: +5:11
+ _1 = const 4_i32; // scope 5 at $DIR/match_false_edges.rs:+5:15: +5:16
+ StorageDead(_14); // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
+ goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+5:15: +5:16
+ }
+
+ bb6: {
+ falseEdge -> [real: bb14, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:9: +4:16
+ }
+
+ bb7: {
+ goto -> bb5; // scope 0 at $DIR/match_false_edges.rs:+1:13: +1:26
+ }
+
+ bb8: {
+ StorageLive(_7); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ _7 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ StorageLive(_8); // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ _8 = guard() -> [return: bb9, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ // mir::Constant
+ // + span: $DIR/match_false_edges.rs:34:21: 34:26
+ // + literal: Const { ty: fn() -> bool {guard}, val: Value(<ZST>) }
+ }
+
+ bb9: {
+ switchInt(move _8) -> [false: bb11, otherwise: bb10]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ }
+
+ bb10: {
+ StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
+ FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
+ FakeRead(ForGuardBinding, _7); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
+ StorageLive(_6); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ _6 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+2:14: +2:16
+ _1 = const 1_i32; // scope 2 at $DIR/match_false_edges.rs:+2:32: +2:33
+ StorageDead(_6); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
+ goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
+ }
+
+ bb11: {
+ goto -> bb12; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ }
+
+ bb12: {
+ StorageDead(_8); // scope 0 at $DIR/match_false_edges.rs:+2:27: +2:28
+ StorageDead(_7); // scope 0 at $DIR/match_false_edges.rs:+2:32: +2:33
+ falseEdge -> [real: bb3, imaginary: bb1]; // scope 0 at $DIR/match_false_edges.rs:+2:21: +2:28
+ }
+
+ bb13: {
+ StorageLive(_9); // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
+ _9 = _2; // scope 0 at $DIR/match_false_edges.rs:+3:9: +3:11
+ _1 = const 2_i32; // scope 3 at $DIR/match_false_edges.rs:+3:15: +3:16
+ StorageDead(_9); // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
+ goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+3:15: +3:16
+ }
+
+ bb14: {
+ StorageLive(_11); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ _11 = &((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ _5 = &shallow _2; // scope 0 at $DIR/match_false_edges.rs:+1:19: +1:26
+ StorageLive(_12); // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ StorageLive(_13); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
+ _13 = (*_11); // scope 0 at $DIR/match_false_edges.rs:+4:27: +4:28
+ _12 = guard2(move _13) -> [return: bb15, unwind: bb20]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ // mir::Constant
+ // + span: $DIR/match_false_edges.rs:36:20: 36:26
+ // + literal: Const { ty: fn(i32) -> bool {guard2}, val: Value(<ZST>) }
+ }
+
+ bb15: {
+ switchInt(move _12) -> [false: bb17, otherwise: bb16]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ }
+
+ bb16: {
+ StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ FakeRead(ForMatchGuard, _5); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ FakeRead(ForGuardBinding, _11); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ StorageLive(_10); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ _10 = ((_2 as Some).0: i32); // scope 0 at $DIR/match_false_edges.rs:+4:14: +4:15
+ _1 = const 3_i32; // scope 4 at $DIR/match_false_edges.rs:+4:33: +4:34
+ StorageDead(_10); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
+ StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
+ goto -> bb19; // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
+ }
+
+ bb17: {
+ goto -> bb18; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ }
+
+ bb18: {
+ StorageDead(_13); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ StorageDead(_12); // scope 0 at $DIR/match_false_edges.rs:+4:28: +4:29
+ StorageDead(_11); // scope 0 at $DIR/match_false_edges.rs:+4:33: +4:34
+ falseEdge -> [real: bb7, imaginary: bb5]; // scope 0 at $DIR/match_false_edges.rs:+4:20: +4:29
+ }
+
+ bb19: {
+ StorageDead(_2); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
+ StorageDead(_1); // scope 0 at $DIR/match_false_edges.rs:+6:6: +6:7
+ _0 = const (); // scope 0 at $DIR/match_false_edges.rs:+0:11: +7:2
+ return; // scope 0 at $DIR/match_false_edges.rs:+7:2: +7:2
+ }
+
+ bb20 (cleanup): {
+ resume; // scope 0 at $DIR/match_false_edges.rs:+0:1: +7:2
+ }
+}
diff --git a/src/test/mir-opt/building/match_false_edges.rs b/src/test/mir-opt/building/match_false_edges.rs
new file mode 100644
index 000000000..ddfcc1493
--- /dev/null
+++ b/src/test/mir-opt/building/match_false_edges.rs
@@ -0,0 +1,39 @@
+fn guard() -> bool {
+ false
+}
+
+fn guard2(_: i32) -> bool {
+ true
+}
+
+// no_mangle to make sure this gets instantiated even in an executable.
+#[no_mangle]
+// EMIT_MIR match_false_edges.full_tested_match.built.after.mir
+pub fn full_tested_match() {
+ let _ = match Some(42) {
+ Some(x) if guard() => (1, x),
+ Some(y) => (2, y),
+ None => (3, 3),
+ };
+}
+
+// no_mangle to make sure this gets instantiated even in an executable.
+#[no_mangle]
+// EMIT_MIR match_false_edges.full_tested_match2.built.after.mir
+pub fn full_tested_match2() {
+ let _ = match Some(42) {
+ Some(x) if guard() => (1, x),
+ None => (3, 3),
+ Some(y) => (2, y),
+ };
+}
+
+// EMIT_MIR match_false_edges.main.built.after.mir
+fn main() {
+ let _ = match Some(1) {
+ Some(_w) if guard() => 1,
+ _x => 2,
+ Some(y) if guard2(y) => 3,
+ _z => 4,
+ };
+}
diff --git a/src/test/mir-opt/building/receiver_ptr_mutability.main.built.after.mir b/src/test/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
new file mode 100644
index 000000000..41eb00363
--- /dev/null
+++ b/src/test/mir-opt/building/receiver_ptr_mutability.main.built.after.mir
@@ -0,0 +1,96 @@
+// MIR for `main` after built
+
+| User Type Annotations
+| 0: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
+| 1: user_ty: Canonical { max_universe: U0, variables: [], value: Ty(*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:14:14: 14:23, inferred_ty: *mut Test
+| 2: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }], value: Ty(&&&&*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
+| 3: user_ty: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }], value: Ty(&&&&*mut Test) }, span: $DIR/receiver_ptr_mutability.rs:18:18: 18:31, inferred_ty: &&&&*mut Test
+|
+fn main() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/receiver_ptr_mutability.rs:+0:11: +0:11
+ let _1: *mut Test as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
+ let _2: (); // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ let mut _3: *const Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ let mut _4: *mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
+ let _6: &&&&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
+ let _7: &&&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
+ let _8: &&*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
+ let _9: &*mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
+ let _10: (); // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ let mut _11: *const Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ let mut _12: *mut Test; // in scope 0 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ scope 1 {
+ debug ptr => _1; // in scope 1 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
+ let _5: &&&&*mut Test as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ scope 2 {
+ debug ptr_ref => _5; // in scope 2 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ }
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
+ _1 = null_mut::<Test>() -> [return: bb1, unwind: bb4]; // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:26: +1:46
+ // mir::Constant
+ // + span: $DIR/receiver_ptr_mutability.rs:14:26: 14:44
+ // + literal: Const { ty: fn() -> *mut Test {null_mut::<Test>}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ FakeRead(ForLet(None), _1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:9: +1:12
+ AscribeUserType(_1, o, UserTypeProjection { base: UserType(1), projs: [] }); // scope 0 at $DIR/receiver_ptr_mutability.rs:+1:14: +1:23
+ StorageLive(_2); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ StorageLive(_3); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ StorageLive(_4); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
+ _4 = _1; // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:8
+ _3 = move _4 as *const Test (Pointer(MutToConstPointer)); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ StorageDead(_4); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:7: +2:8
+ _2 = Test::x(move _3) -> [return: bb2, unwind: bb4]; // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:5: +2:12
+ // mir::Constant
+ // + span: $DIR/receiver_ptr_mutability.rs:15:9: 15:10
+ // + literal: Const { ty: fn(*const Test) {Test::x}, val: Value(<ZST>) }
+ }
+
+ bb2: {
+ StorageDead(_3); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:11: +2:12
+ StorageDead(_2); // scope 1 at $DIR/receiver_ptr_mutability.rs:+2:12: +2:13
+ StorageLive(_5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ StorageLive(_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
+ StorageLive(_7); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
+ StorageLive(_8); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
+ StorageLive(_9); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
+ _9 = &_1; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:37: +5:41
+ _8 = &_9; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:36: +5:41
+ _7 = &_8; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:35: +5:41
+ _6 = &_7; // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
+ _5 = &(*_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:34: +5:41
+ FakeRead(ForLet(None), _5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:9: +5:16
+ AscribeUserType(_5, o, UserTypeProjection { base: UserType(3), projs: [] }); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:18: +5:31
+ StorageDead(_6); // scope 1 at $DIR/receiver_ptr_mutability.rs:+5:41: +5:42
+ StorageLive(_10); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ StorageLive(_11); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ StorageLive(_12); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ _12 = (*(*(*(*_5)))); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ _11 = move _12 as *const Test (Pointer(MutToConstPointer)); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ StorageDead(_12); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:11: +6:12
+ _10 = Test::x(move _11) -> [return: bb3, unwind: bb4]; // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:5: +6:16
+ // mir::Constant
+ // + span: $DIR/receiver_ptr_mutability.rs:19:13: 19:14
+ // + literal: Const { ty: fn(*const Test) {Test::x}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageDead(_11); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:15: +6:16
+ StorageDead(_10); // scope 2 at $DIR/receiver_ptr_mutability.rs:+6:16: +6:17
+ _0 = const (); // scope 0 at $DIR/receiver_ptr_mutability.rs:+0:11: +7:2
+ StorageDead(_9); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
+ StorageDead(_8); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
+ StorageDead(_7); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
+ StorageDead(_5); // scope 1 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
+ StorageDead(_1); // scope 0 at $DIR/receiver_ptr_mutability.rs:+7:1: +7:2
+ return; // scope 0 at $DIR/receiver_ptr_mutability.rs:+7:2: +7:2
+ }
+
+ bb4 (cleanup): {
+ resume; // scope 0 at $DIR/receiver_ptr_mutability.rs:+0:1: +7:2
+ }
+}
diff --git a/src/test/mir-opt/building/receiver_ptr_mutability.rs b/src/test/mir-opt/building/receiver_ptr_mutability.rs
new file mode 100644
index 000000000..668530968
--- /dev/null
+++ b/src/test/mir-opt/building/receiver_ptr_mutability.rs
@@ -0,0 +1,20 @@
+// EMIT_MIR receiver_ptr_mutability.main.built.after.mir
+
+#![feature(arbitrary_self_types)]
+
+struct Test {}
+
+impl Test {
+ fn x(self: *const Self) {
+ println!("x called");
+ }
+}
+
+fn main() {
+ let ptr: *mut Test = std::ptr::null_mut();
+ ptr.x();
+
+ // Test autoderefs
+ let ptr_ref: &&&&*mut Test = &&&&ptr;
+ ptr_ref.x();
+}
diff --git a/src/test/mir-opt/building/simple_match.match_bool.built.after.mir b/src/test/mir-opt/building/simple_match.match_bool.built.after.mir
new file mode 100644
index 000000000..a4516026c
--- /dev/null
+++ b/src/test/mir-opt/building/simple_match.match_bool.built.after.mir
@@ -0,0 +1,29 @@
+// MIR for `match_bool` after built
+
+fn match_bool(_1: bool) -> usize {
+ debug x => _1; // in scope 0 at $DIR/simple_match.rs:+0:15: +0:16
+ let mut _0: usize; // return place in scope 0 at $DIR/simple_match.rs:+0:27: +0:32
+
+ bb0: {
+ FakeRead(ForMatchedPlace(None), _1); // scope 0 at $DIR/simple_match.rs:+1:11: +1:12
+ switchInt(_1) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/simple_match.rs:+1:5: +1:12
+ }
+
+ bb1: {
+ falseEdge -> [real: bb3, imaginary: bb2]; // scope 0 at $DIR/simple_match.rs:+2:9: +2:13
+ }
+
+ bb2: {
+ _0 = const 20_usize; // scope 0 at $DIR/simple_match.rs:+3:14: +3:16
+ goto -> bb4; // scope 0 at $DIR/simple_match.rs:+3:14: +3:16
+ }
+
+ bb3: {
+ _0 = const 10_usize; // scope 0 at $DIR/simple_match.rs:+2:17: +2:19
+ goto -> bb4; // scope 0 at $DIR/simple_match.rs:+2:17: +2:19
+ }
+
+ bb4: {
+ return; // scope 0 at $DIR/simple_match.rs:+5:2: +5:2
+ }
+}
diff --git a/src/test/mir-opt/building/simple_match.rs b/src/test/mir-opt/building/simple_match.rs
new file mode 100644
index 000000000..0ef97dde6
--- /dev/null
+++ b/src/test/mir-opt/building/simple_match.rs
@@ -0,0 +1,12 @@
+// Test that we don't generate unnecessarily large MIR for very simple matches
+
+
+// EMIT_MIR simple_match.match_bool.built.after.mir
+fn match_bool(x: bool) -> usize {
+ match x {
+ true => 10,
+ _ => 20,
+ }
+}
+
+fn main() {}
diff --git a/src/test/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir b/src/test/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir
new file mode 100644
index 000000000..1d3f77e07
--- /dev/null
+++ b/src/test/mir-opt/building/storage_live_dead_in_statics.XXX.built.after.mir
@@ -0,0 +1,203 @@
+// MIR for `XXX` after built
+
+static XXX: &Foo = {
+ let mut _0: &Foo; // return place in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:13: +0:25
+ let _1: &Foo; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
+ let _2: Foo; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
+ let mut _3: &[(u32, u32)]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ let mut _4: &[(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ let _5: &[(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ let _6: [(u32, u32); 42]; // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
+ let mut _7: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
+ let mut _8: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
+ let mut _9: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
+ let mut _10: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
+ let mut _11: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
+ let mut _12: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
+ let mut _13: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
+ let mut _14: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
+ let mut _15: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
+ let mut _16: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
+ let mut _17: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
+ let mut _18: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
+ let mut _19: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
+ let mut _20: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
+ let mut _21: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
+ let mut _22: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
+ let mut _23: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
+ let mut _24: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
+ let mut _25: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
+ let mut _26: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
+ let mut _27: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
+ let mut _28: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
+ let mut _29: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
+ let mut _30: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
+ let mut _31: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
+ let mut _32: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
+ let mut _33: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
+ let mut _34: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
+ let mut _35: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
+ let mut _36: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
+ let mut _37: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
+ let mut _38: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
+ let mut _39: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
+ let mut _40: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
+ let mut _41: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
+ let mut _42: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
+ let mut _43: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
+ let mut _44: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
+ let mut _45: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
+ let mut _46: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
+ let mut _47: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
+ let mut _48: (u32, u32); // in scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
+ StorageLive(_2); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
+ StorageLive(_3); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ StorageLive(_4); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ StorageLive(_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ StorageLive(_6); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
+ StorageLive(_7); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
+ _7 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:9: +3:15
+ StorageLive(_8); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
+ _8 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:17: +3:23
+ StorageLive(_9); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
+ _9 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+3:25: +3:31
+ StorageLive(_10); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
+ _10 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:9: +4:15
+ StorageLive(_11); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
+ _11 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:17: +4:23
+ StorageLive(_12); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
+ _12 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+4:25: +4:31
+ StorageLive(_13); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
+ _13 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:9: +5:15
+ StorageLive(_14); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
+ _14 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:17: +5:23
+ StorageLive(_15); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
+ _15 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+5:25: +5:31
+ StorageLive(_16); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
+ _16 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:9: +6:15
+ StorageLive(_17); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
+ _17 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:17: +6:23
+ StorageLive(_18); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
+ _18 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+6:25: +6:31
+ StorageLive(_19); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
+ _19 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:9: +7:15
+ StorageLive(_20); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
+ _20 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:17: +7:23
+ StorageLive(_21); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
+ _21 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+7:25: +7:31
+ StorageLive(_22); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
+ _22 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:9: +8:15
+ StorageLive(_23); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
+ _23 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:17: +8:23
+ StorageLive(_24); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
+ _24 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+8:25: +8:31
+ StorageLive(_25); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
+ _25 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:9: +9:15
+ StorageLive(_26); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
+ _26 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:17: +9:23
+ StorageLive(_27); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
+ _27 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+9:25: +9:31
+ StorageLive(_28); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
+ _28 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:9: +10:15
+ StorageLive(_29); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
+ _29 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:17: +10:23
+ StorageLive(_30); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
+ _30 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+10:25: +10:31
+ StorageLive(_31); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
+ _31 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:9: +11:15
+ StorageLive(_32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
+ _32 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:17: +11:23
+ StorageLive(_33); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
+ _33 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+11:25: +11:31
+ StorageLive(_34); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
+ _34 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:9: +12:15
+ StorageLive(_35); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
+ _35 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:17: +12:23
+ StorageLive(_36); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
+ _36 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+12:25: +12:31
+ StorageLive(_37); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
+ _37 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:9: +13:15
+ StorageLive(_38); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
+ _38 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:17: +13:23
+ StorageLive(_39); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
+ _39 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+13:25: +13:31
+ StorageLive(_40); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
+ _40 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:9: +14:15
+ StorageLive(_41); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
+ _41 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:17: +14:23
+ StorageLive(_42); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
+ _42 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+14:25: +14:31
+ StorageLive(_43); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
+ _43 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:9: +15:15
+ StorageLive(_44); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
+ _44 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:17: +15:23
+ StorageLive(_45); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
+ _45 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+15:25: +15:31
+ StorageLive(_46); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
+ _46 = (const 0_u32, const 1_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:9: +16:15
+ StorageLive(_47); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
+ _47 = (const 0_u32, const 2_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:17: +16:23
+ StorageLive(_48); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
+ _48 = (const 0_u32, const 3_u32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+16:25: +16:31
+ _6 = [move _7, move _8, move _9, move _10, move _11, move _12, move _13, move _14, move _15, move _16, move _17, move _18, move _19, move _20, move _21, move _22, move _23, move _24, move _25, move _26, move _27, move _28, move _29, move _30, move _31, move _32, move _33, move _34, move _35, move _36, move _37, move _38, move _39, move _40, move _41, move _42, move _43, move _44, move _45, move _46, move _47, move _48]; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:12: +17:6
+ StorageDead(_48); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_47); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_46); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_45); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_44); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_43); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_42); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_41); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_40); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_39); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_38); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_37); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_36); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_35); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_34); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_33); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_32); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_31); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_30); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_29); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_28); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_27); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_26); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_25); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_24); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_23); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_22); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_21); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_20); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_19); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_18); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_17); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_16); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_15); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_14); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_13); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_12); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_11); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_10); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_9); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_8); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ StorageDead(_7); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ _5 = &_6; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ _4 = &(*_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ _3 = move _4 as &[(u32, u32)] (Pointer(Unsize)); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+2:11: +17:6
+ StorageDead(_4); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+17:5: +17:6
+ _2 = Foo { tup: const "hi", data: move _3 }; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:29: +18:2
+ // mir::Constant
+ // + span: $DIR/storage_live_dead_in_statics.rs:6:10: 6:14
+ // + literal: Const { ty: &str, val: Value(Slice(..)) }
+ StorageDead(_3); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
+ _1 = &_2; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
+ _0 = &(*_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:28: +18:2
+ StorageDead(_5); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
+ StorageDead(_1); // scope 0 at $DIR/storage_live_dead_in_statics.rs:+18:1: +18:2
+ return; // scope 0 at $DIR/storage_live_dead_in_statics.rs:+0:1: +18:3
+ }
+}
diff --git a/src/test/mir-opt/building/storage_live_dead_in_statics.rs b/src/test/mir-opt/building/storage_live_dead_in_statics.rs
new file mode 100644
index 000000000..79f709148
--- /dev/null
+++ b/src/test/mir-opt/building/storage_live_dead_in_statics.rs
@@ -0,0 +1,33 @@
+// Check that when we compile the static `XXX` into MIR, we do not
+// generate `StorageStart` or `StorageEnd` statements.
+
+// EMIT_MIR storage_live_dead_in_statics.XXX.built.after.mir
+static XXX: &'static Foo = &Foo {
+ tup: "hi",
+ data: &[
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ (0, 1), (0, 2), (0, 3),
+ ]
+};
+
+#[derive(Debug)]
+struct Foo {
+ tup: &'static str,
+ data: &'static [(u32, u32)]
+}
+
+fn main() {
+ println!("{:?}", XXX);
+}
diff --git a/src/test/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir b/src/test/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
new file mode 100644
index 000000000..234cd0839
--- /dev/null
+++ b/src/test/mir-opt/building/uniform_array_move_out.move_out_by_subslice.built.after.mir
@@ -0,0 +1,111 @@
+// MIR for `move_out_by_subslice` after built
+
+fn move_out_by_subslice() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +0:27
+ let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ scope 1 {
+ debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ let _12: [std::boxed::Box<i32>; 2]; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
+ scope 4 {
+ debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
+ }
+ }
+ scope 2 {
+ }
+ scope 3 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ // mir::Constant
+ // + span: $DIR/uniform_array_move_out.rs:11:14: 11:19
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ }
+
+ bb2: {
+ StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ // mir::Constant
+ // + span: $DIR/uniform_array_move_out.rs:11:21: 11:26
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ }
+
+ bb4: {
+ StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +1:27
+ drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb5: {
+ StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb6: {
+ StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
+ _12 = move _1[0..2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:10: +2:12
+ _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:27: +3:2
+ drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb7: {
+ StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb8: {
+ StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ return; // scope 0 at $DIR/uniform_array_move_out.rs:+3:2: +3:2
+ }
+
+ bb9 (cleanup): {
+ drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb10 (cleanup): {
+ drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb11 (cleanup): {
+ drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb12 (cleanup): {
+ resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +3:2
+ }
+}
diff --git a/src/test/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir b/src/test/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
new file mode 100644
index 000000000..24a189498
--- /dev/null
+++ b/src/test/mir-opt/building/uniform_array_move_out.move_out_from_end.built.after.mir
@@ -0,0 +1,111 @@
+// MIR for `move_out_from_end` after built
+
+fn move_out_from_end() -> () {
+ let mut _0: (); // return place in scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +0:24
+ let _1: [std::boxed::Box<i32>; 2]; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ let mut _2: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _3: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _4: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _5: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _6: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ let mut _7: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _8: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _9: usize; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _10: *mut u8; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ let mut _11: std::boxed::Box<i32>; // in scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ scope 1 {
+ debug a => _1; // in scope 1 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ let _12: std::boxed::Box<i32>; // in scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
+ scope 4 {
+ debug _y => _12; // in scope 4 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
+ }
+ }
+ scope 2 {
+ }
+ scope 3 {
+ }
+
+ bb0: {
+ StorageLive(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ StorageLive(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _3 = SizeOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _4 = AlignOf(i32); // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _5 = alloc::alloc::exchange_malloc(move _3, move _4) -> [return: bb1, unwind: bb12]; // scope 2 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ // mir::Constant
+ // + span: $DIR/uniform_array_move_out.rs:5:14: 5:19
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ }
+
+ bb1: {
+ StorageLive(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ _6 = ShallowInitBox(move _5, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ (*_6) = const 1_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ _2 = move _6; // scope 0 at $DIR/uniform_array_move_out.rs:+1:14: +1:19
+ drop(_6) -> [return: bb2, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ }
+
+ bb2: {
+ StorageDead(_6); // scope 0 at $DIR/uniform_array_move_out.rs:+1:18: +1:19
+ StorageLive(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _8 = SizeOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _9 = AlignOf(i32); // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _10 = alloc::alloc::exchange_malloc(move _8, move _9) -> [return: bb3, unwind: bb11]; // scope 3 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ // mir::Constant
+ // + span: $DIR/uniform_array_move_out.rs:5:21: 5:26
+ // + literal: Const { ty: unsafe fn(usize, usize) -> *mut u8 {alloc::alloc::exchange_malloc}, val: Value(<ZST>) }
+ }
+
+ bb3: {
+ StorageLive(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ _11 = ShallowInitBox(move _10, i32); // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ (*_11) = const 2_i32; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ _7 = move _11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:21: +1:26
+ drop(_11) -> [return: bb4, unwind: bb10]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ }
+
+ bb4: {
+ StorageDead(_11); // scope 0 at $DIR/uniform_array_move_out.rs:+1:25: +1:26
+ _1 = [move _2, move _7]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:13: +1:27
+ drop(_7) -> [return: bb5, unwind: bb11]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb5: {
+ StorageDead(_7); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ drop(_2) -> [return: bb6, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb6: {
+ StorageDead(_2); // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ FakeRead(ForLet(None), _1); // scope 0 at $DIR/uniform_array_move_out.rs:+1:9: +1:10
+ StorageLive(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
+ _12 = move _1[1 of 2]; // scope 1 at $DIR/uniform_array_move_out.rs:+2:14: +2:16
+ _0 = const (); // scope 0 at $DIR/uniform_array_move_out.rs:+0:24: +3:2
+ drop(_12) -> [return: bb7, unwind: bb9]; // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb7: {
+ StorageDead(_12); // scope 1 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ drop(_1) -> [return: bb8, unwind: bb12]; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb8: {
+ StorageDead(_1); // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ return; // scope 0 at $DIR/uniform_array_move_out.rs:+3:2: +3:2
+ }
+
+ bb9 (cleanup): {
+ drop(_1) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+3:1: +3:2
+ }
+
+ bb10 (cleanup): {
+ drop(_7) -> bb11; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb11 (cleanup): {
+ drop(_2) -> bb12; // scope 0 at $DIR/uniform_array_move_out.rs:+1:26: +1:27
+ }
+
+ bb12 (cleanup): {
+ resume; // scope 0 at $DIR/uniform_array_move_out.rs:+0:1: +3:2
+ }
+}
diff --git a/src/test/mir-opt/building/uniform_array_move_out.rs b/src/test/mir-opt/building/uniform_array_move_out.rs
new file mode 100644
index 000000000..e925036ec
--- /dev/null
+++ b/src/test/mir-opt/building/uniform_array_move_out.rs
@@ -0,0 +1,18 @@
+#![feature(box_syntax)]
+
+// EMIT_MIR uniform_array_move_out.move_out_from_end.built.after.mir
+fn move_out_from_end() {
+ let a = [box 1, box 2];
+ let [.., _y] = a;
+}
+
+// EMIT_MIR uniform_array_move_out.move_out_by_subslice.built.after.mir
+fn move_out_by_subslice() {
+ let a = [box 1, box 2];
+ let [_y @ ..] = a;
+}
+
+fn main() {
+ move_out_by_subslice();
+ move_out_from_end();
+}