]> git.proxmox.com Git - rustc.git/blobdiff - src/test/mir-opt/const-promotion-extern-static.rs
New upstream version 1.44.1+dfsg1
[rustc.git] / src / test / mir-opt / const-promotion-extern-static.rs
index f6f7d0910911c544e9ca15096dd6e73d9a9811b4..c9d350a98fd9c80aca4b4696f2283922bcf3440f 100644 (file)
@@ -4,70 +4,12 @@ extern "C" {
 
 static Y: i32 = 42;
 
-static mut BAR: *const &'static i32 = [&Y].as_ptr();
+// EMIT_MIR rustc.BAR.PromoteTemps.diff
+// EMIT_MIR rustc.BAR-promoted[0].ConstProp.after.mir
+static mut BAR: *const &i32 = [&Y].as_ptr();
 
-static mut FOO: *const &'static i32 = [unsafe { &X }].as_ptr();
+// EMIT_MIR rustc.FOO.PromoteTemps.diff
+// EMIT_MIR rustc.FOO-promoted[0].ConstProp.after.mir
+static mut FOO: *const &i32 = [unsafe { &X }].as_ptr();
 
 fn main() {}
-
-// END RUST SOURCE
-// START rustc.FOO.PromoteTemps.before.mir
-// bb0: {
-// ...
-//     _5 = const Scalar(alloc1+0) : &i32;
-//     _4 = &(*_5);
-//     _3 = [move _4];
-//     _2 = &_3;
-//     _1 = move _2 as &[&'static i32] (Pointer(Unsize));
-//     _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
-// }
-// ...
-// bb2: {
-//     StorageDead(_5);
-//     StorageDead(_3);
-//     return;
-// }
-// END rustc.FOO.PromoteTemps.before.mir
-// START rustc.BAR.PromoteTemps.before.mir
-// bb0: {
-// ...
-//     _5 = const Scalar(alloc0+0) : &i32;
-//     _4 = &(*_5);
-//     _3 = [move _4];
-//     _2 = &_3;
-//     _1 = move _2 as &[&'static i32] (Pointer(Unsize));
-//     _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
-// }
-// ...
-// bb2: {
-//     StorageDead(_5);
-//     StorageDead(_3);
-//     return;
-// }
-// END rustc.BAR.PromoteTemps.before.mir
-// START rustc.BAR.PromoteTemps.after.mir
-// bb0: {
-// ...
-//     _6 = const BAR::promoted[0];
-//     _2 = &(*_6);
-//     _1 = move _2 as &[&'static i32] (Pointer(Unsize));
-//     _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
-// }
-// ...
-// bb2: {
-//     return;
-// }
-// END rustc.BAR.PromoteTemps.after.mir
-// START rustc.FOO.PromoteTemps.after.mir
-// bb0: {
-// ...
-//     _6 = const FOO::promoted[0];
-//     _2 = &(*_6);
-//     _1 = move _2 as &[&'static i32] (Pointer(Unsize));
-//     _0 = const core::slice::<impl [&'static i32]>::as_ptr(move _1) -> [return: bb2, unwind: bb1];
-// }
-// ...
-// bb2: {
-//     return;
-// }
-// END rustc.FOO.PromoteTemps.after.mir