bless mir-opt, codegen, and remaining ui tests

This commit is contained in:
Ralf Jung 2021-07-14 09:57:54 +02:00
parent ae950a2dc7
commit 1f21ab114e
17 changed files with 144 additions and 150 deletions

View file

@ -10,7 +10,7 @@
// CHECK: @STATIC = {{.*}}, align 4
// This checks the constants from inline_enum_const
// CHECK: @alloc8 = {{.*}}, align 2
// CHECK: @alloc9 = {{.*}}, align 2
// This checks the constants from {low,high}_align_const, they share the same
// constant, but the alignment differs, so the higher one should be used

View file

@ -12,7 +12,7 @@ mod aux_mod;
include!("aux_mod.rs");
// Here we check that the expansion of the file!() macro is mapped.
// CHECK: @alloc1 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
// CHECK: @alloc2 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1
pub static FILE_PATH: &'static str = file!();
fn main() {

View file

@ -16,10 +16,10 @@ fn main() -> () {
_1 = const b"foo"; // scope 0 at $DIR/byte_slice.rs:5:13: 5:19
// ty::Const
// + ty: &[u8; 3]
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/byte_slice.rs:5:13: 5:19
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc1)) }
StorageLive(_2); // scope 1 at $DIR/byte_slice.rs:6:9: 6:10
_2 = [const 5_u8, const 120_u8]; // scope 1 at $DIR/byte_slice.rs:6:13: 6:24
_0 = const (); // scope 0 at $DIR/byte_slice.rs:4:11: 7:2
@ -29,6 +29,6 @@ fn main() -> () {
}
}
alloc0 (size: 3, align: 1) {
alloc1 (size: 3, align: 1) {
66 6f 6f foo
}

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
_2 = const {alloc0: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
_2 = const {alloc1: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
// ty::Const
// + ty: &&[(std::option::Option<i32>, &[&str])]
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation.rs:8:5: 8:8
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
@ -23,43 +23,43 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 8, align: 4) {
alloc17 03 00 00 00 ....
alloc1 (static: FOO, size: 8, align: 4) {
alloc18 03 00 00 00 ....
}
alloc17 (size: 48, align: 4) {
0x00 00 00 00 00 __ __ __ __ alloc4 00 00 00 00 ........
0x10 00 00 00 00 __ __ __ __ alloc8 02 00 00 00 ........
0x20 01 00 00 00 2a 00 00 00 alloc13 03 00 00 00 ....*.......
alloc18 (size: 48, align: 4) {
0x00 00 00 00 00 __ __ __ __ alloc5 00 00 00 00 ........
0x10 00 00 00 00 __ __ __ __ alloc9 02 00 00 00 ........
0x20 01 00 00 00 2a 00 00 00 alloc14 03 00 00 00 ....*.......
}
alloc4 (size: 0, align: 4) {}
alloc5 (size: 0, align: 4) {}
alloc8 (size: 16, align: 4) {
alloc7 03 00 00 00 alloc9 03 00 00 00 ........
alloc9 (size: 16, align: 4) {
alloc8 03 00 00 00 alloc10 03 00 00 00 ........
}
alloc7 (size: 3, align: 1) {
alloc8 (size: 3, align: 1) {
66 6f 6f foo
}
alloc9 (size: 3, align: 1) {
alloc10 (size: 3, align: 1) {
62 61 72 bar
}
alloc13 (size: 24, align: 4) {
0x00 alloc12 03 00 00 00 alloc14 03 00 00 00 ........
0x10 alloc15 04 00 00 00 ....
alloc14 (size: 24, align: 4) {
0x00 alloc13 03 00 00 00 alloc15 03 00 00 00 ........
0x10 alloc16 04 00 00 00 ....
}
alloc12 (size: 3, align: 1) {
alloc13 (size: 3, align: 1) {
6d 65 68 meh
}
alloc14 (size: 3, align: 1) {
alloc15 (size: 3, align: 1) {
6d 6f 70 mop
}
alloc15 (size: 4, align: 1) {
alloc16 (size: 4, align: 1) {
6d c3 b6 70 m..p
}

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
StorageLive(_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
_2 = const {alloc0: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
_2 = const {alloc1: &&[(Option<i32>, &[&str])]}; // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
// ty::Const
// + ty: &&[(std::option::Option<i32>, &[&str])]
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation.rs:8:5: 8:8
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&str])], val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation.rs:8:5: 8:8
StorageDead(_2); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
StorageDead(_1); // scope 0 at $DIR/const_allocation.rs:8:8: 8:9
@ -23,47 +23,47 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 16, align: 8) {
alloc17 03 00 00 00 00 00 00 00 ........
alloc1 (static: FOO, size: 16, align: 8) {
alloc18 03 00 00 00 00 00 00 00 ........
}
alloc17 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc4 ....
alloc18 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc5 ....
0x10 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ ............
0x20 alloc8 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc13 ....*...
0x20 alloc9 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc14 ....*...
0x40 03 00 00 00 00 00 00 00 ........
}
alloc4 (size: 0, align: 8) {}
alloc5 (size: 0, align: 8) {}
alloc8 (size: 32, align: 8) {
0x00 alloc7 03 00 00 00 00 00 00 00 ........
0x10 alloc9 03 00 00 00 00 00 00 00 ........
alloc9 (size: 32, align: 8) {
0x00 alloc8 03 00 00 00 00 00 00 00 ........
0x10 alloc10 03 00 00 00 00 00 00 00 ........
}
alloc7 (size: 3, align: 1) {
alloc8 (size: 3, align: 1) {
66 6f 6f foo
}
alloc9 (size: 3, align: 1) {
alloc10 (size: 3, align: 1) {
62 61 72 bar
}
alloc13 (size: 48, align: 8) {
0x00 alloc12 03 00 00 00 00 00 00 00 ........
0x10 alloc14 03 00 00 00 00 00 00 00 ........
0x20 alloc15 04 00 00 00 00 00 00 00 ........
alloc14 (size: 48, align: 8) {
0x00 alloc13 03 00 00 00 00 00 00 00 ........
0x10 alloc15 03 00 00 00 00 00 00 00 ........
0x20 alloc16 04 00 00 00 00 00 00 00 ........
}
alloc12 (size: 3, align: 1) {
alloc13 (size: 3, align: 1) {
6d 65 68 meh
}
alloc14 (size: 3, align: 1) {
alloc15 (size: 3, align: 1) {
6d 6f 70 mop
}
alloc15 (size: 4, align: 1) {
alloc16 (size: 4, align: 1) {
6d c3 b6 70 m..p
}

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
_2 = const {alloc0: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
_2 = const {alloc1: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
// ty::Const
// + ty: &&[(std::option::Option<i32>, &[&u8])]
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation2.rs:5:5: 5:8
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
@ -23,42 +23,42 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 8, align: 4) {
alloc27 03 00 00 00 ....
alloc1 (static: FOO, size: 8, align: 4) {
alloc28 03 00 00 00 ....
}
alloc27 (size: 48, align: 4) {
0x00 00 00 00 00 __ __ __ __ alloc12 00 00 00 00 ........
0x10 00 00 00 00 __ __ __ __ alloc17 02 00 00 00 ........
0x20 01 00 00 00 2a 00 00 00 alloc25 03 00 00 00 ....*.......
alloc28 (size: 48, align: 4) {
0x00 00 00 00 00 __ __ __ __ alloc13 00 00 00 00 ........
0x10 00 00 00 00 __ __ __ __ alloc18 02 00 00 00 ........
0x20 01 00 00 00 2a 00 00 00 alloc26 03 00 00 00 ....*.......
}
alloc12 (size: 0, align: 4) {}
alloc13 (size: 0, align: 4) {}
alloc17 (size: 8, align: 4) {
alloc15 alloc16
}
alloc15 (size: 1, align: 1) {
05 .
alloc18 (size: 8, align: 4) {
alloc16 alloc17
}
alloc16 (size: 1, align: 1) {
05 .
}
alloc17 (size: 1, align: 1) {
06 .
}
alloc25 (size: 12, align: 4) {
a21+0x3 alloc22 a24+0x2
alloc26 (size: 12, align: 4) {
a22+0x3 alloc23 a25+0x2
}
alloc21 (size: 4, align: 1) {
alloc22 (size: 4, align: 1) {
2a 45 15 6f *E.o
}
alloc22 (size: 1, align: 1) {
alloc23 (size: 1, align: 1) {
2a *
}
alloc24 (size: 4, align: 1) {
alloc25 (size: 4, align: 1) {
2a 45 15 6f *E.o
}

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
StorageLive(_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
_2 = const {alloc0: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
_2 = const {alloc1: &&[(Option<i32>, &[&u8])]}; // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
// ty::Const
// + ty: &&[(std::option::Option<i32>, &[&u8])]
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation2.rs:5:5: 5:8
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&[(std::option::Option<i32>, &[&u8])], val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation2.rs:5:5: 5:8
StorageDead(_2); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
StorageDead(_1); // scope 0 at $DIR/const_allocation2.rs:5:8: 5:9
@ -23,45 +23,45 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 16, align: 8) {
alloc27 03 00 00 00 00 00 00 00 ........
alloc1 (static: FOO, size: 16, align: 8) {
alloc28 03 00 00 00 00 00 00 00 ........
}
alloc27 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc12 ....
alloc28 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc13 ....
0x10 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ ............
0x20 alloc17 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc25 ....*...
0x20 alloc18 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc26 ....*...
0x40 03 00 00 00 00 00 00 00 ........
}
alloc12 (size: 0, align: 8) {}
alloc13 (size: 0, align: 8) {}
alloc17 (size: 16, align: 8) {
alloc15 alloc16
}
alloc15 (size: 1, align: 1) {
05 .
alloc18 (size: 16, align: 8) {
alloc16 alloc17
}
alloc16 (size: 1, align: 1) {
05 .
}
alloc17 (size: 1, align: 1) {
06 .
}
alloc25 (size: 24, align: 8) {
0x00 alloc21+0x3 alloc22
0x10 alloc24+0x2
alloc26 (size: 24, align: 8) {
0x00 alloc22+0x3 alloc23
0x10 alloc25+0x2
}
alloc21 (size: 4, align: 1) {
alloc22 (size: 4, align: 1) {
2a 45 15 6f *E.o
}
alloc22 (size: 1, align: 1) {
alloc23 (size: 1, align: 1) {
2a *
}
alloc24 (size: 4, align: 1) {
alloc25 (size: 4, align: 1) {
2a 45 15 6f *E.o
}

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
_2 = const {alloc0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
_2 = const {alloc1: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
// ty::Const
// + ty: &&Packed
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation3.rs:5:5: 5:8
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
@ -23,31 +23,31 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 4, align: 4) {
alloc10
alloc1 (static: FOO, size: 4, align: 4) {
alloc11
}
alloc10 (size: 168, align: 1) {
alloc11 (size: 168, align: 1) {
0x00 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ................
0x10 ab ab ab ab ab ab ab ab ab ab ab ab alloc5 ............
0x10 ab ab ab ab ab ab ab ab ab ab ab ab alloc6 ............
0x20 01 ef cd ab 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x80 00 00 00 00 00 00 00 00 00 00 alloc7 00 00 ............
0x90 a8+0x63 00 00 00 00 00 00 00 00 00 00 00 00 ............
0x80 00 00 00 00 00 00 00 00 00 00 alloc8 00 00 ............
0x90 a9+0x63 00 00 00 00 00 00 00 00 00 00 00 00 ............
0xa0 00 00 00 00 00 00 00 00 ........
}
alloc5 (size: 4, align: 4) {
alloc6 (size: 4, align: 4) {
2a 00 00 00 *...
}
alloc7 (fn: main)
alloc8 (fn: main)
alloc8 (size: 100, align: 1) {
alloc9 (size: 100, align: 1) {
0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

View file

@ -8,13 +8,13 @@ fn main() -> () {
bb0: {
StorageLive(_1); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
StorageLive(_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
_2 = const {alloc0: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
_2 = const {alloc1: &&Packed}; // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
// ty::Const
// + ty: &&Packed
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const_allocation3.rs:5:5: 5:8
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &&Packed, val: Value(Scalar(alloc1)) }
_1 = (*_2); // scope 0 at $DIR/const_allocation3.rs:5:5: 5:8
StorageDead(_2); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
StorageDead(_1); // scope 0 at $DIR/const_allocation3.rs:5:8: 5:9
@ -23,13 +23,13 @@ fn main() -> () {
}
}
alloc0 (static: FOO, size: 8, align: 8) {
alloc10
alloc1 (static: FOO, size: 8, align: 8) {
alloc11
}
alloc10 (size: 180, align: 1) {
alloc11 (size: 180, align: 1) {
0x00 ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ................
0x10 ab ab ab ab ab ab ab ab ab ab ab ab alloc5 ............
0x10 ab ab ab ab ab ab ab ab ab ab ab ab alloc6 ............
0x20 01 ef cd ab 00 00 00 00 00 00 00 00 ............
0x30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
@ -37,18 +37,18 @@ alloc10 (size: 180, align: 1) {
0x60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ..............
0x90 alloc7 00 00 alloc8+0x63 ..
0x90 alloc8 00 00 alloc9+0x63 ..
0xa0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0xb0 00 00 00 00 ....
}
alloc5 (size: 4, align: 4) {
alloc6 (size: 4, align: 4) {
2a 00 00 00 *...
}
alloc7 (fn: main)
alloc8 (fn: main)
alloc8 (size: 100, align: 1) {
alloc9 (size: 100, align: 1) {
0x00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0x20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

View file

@ -7,13 +7,13 @@ promoted[0] in BAR: &[&i32; 1] = {
let mut _3: &i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
bb0: {
_3 = const {alloc0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
_3 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
// ty::Const
// + ty: &i32
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
// + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
@ -21,6 +21,6 @@ promoted[0] in BAR: &[&i32; 1] = {
}
}
alloc0 (static: Y, size: 4, align: 4) {
alloc1 (static: Y, size: 4, align: 4) {
2a 00 00 00 *...
}

View file

@ -16,16 +16,16 @@
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
- StorageLive(_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
- _5 = const {alloc0: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
- _5 = const {alloc1: &i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:9:33: 9:34
+ _6 = const BAR::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
// ty::Const
- // + ty: &i32
- // + val: Value(Scalar(alloc0))
- // + val: Value(Scalar(alloc1))
+ // + ty: &[&i32; 1]
+ // + val: Unevaluated(BAR, [], Some(promoted[0]))
// mir::Constant
- // + span: $DIR/const-promotion-extern-static.rs:9:33: 9:34
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc0)) }
- // + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
- _4 = &(*_5); // scope 0 at $DIR/const-promotion-extern-static.rs:9:32: 9:34
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:9:31: 9:35
@ -53,7 +53,7 @@
}
- }
-
- alloc0 (static: Y, size: 4, align: 4) {
- alloc1 (static: Y, size: 4, align: 4) {
- 2a 00 00 00 │ *...
}

View file

@ -7,13 +7,13 @@ promoted[0] in FOO: &[&i32; 1] = {
let mut _3: *const i32; // in scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
bb0: {
_3 = const {alloc2: *const i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
_3 = const {alloc3: *const i32}; // scope 0 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
// ty::Const
// + ty: *const i32
// + val: Value(Scalar(alloc2))
// + val: Value(Scalar(alloc3))
// mir::Constant
// + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
// + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
_2 = &(*_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
_1 = [move _2]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
_0 = &_1; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
@ -21,4 +21,4 @@ promoted[0] in FOO: &[&i32; 1] = {
}
}
alloc2 (extern static: X)
alloc3 (extern static: X)

View file

@ -18,16 +18,16 @@
- StorageLive(_3); // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
- StorageLive(_4); // scope 0 at $DIR/const-promotion-extern-static.rs:13:32: 13:45
- StorageLive(_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
- _5 = const {alloc2: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
- _5 = const {alloc3: *const i32}; // scope 1 at $DIR/const-promotion-extern-static.rs:13:42: 13:43
+ _6 = const FOO::promoted[0]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
// ty::Const
- // + ty: *const i32
- // + val: Value(Scalar(alloc2))
- // + val: Value(Scalar(alloc3))
+ // + ty: &[&i32; 1]
+ // + val: Unevaluated(FOO, [], Some(promoted[0]))
// mir::Constant
- // + span: $DIR/const-promotion-extern-static.rs:13:42: 13:43
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc2)) }
- // + literal: Const { ty: *const i32, val: Value(Scalar(alloc3)) }
- _4 = &(*_5); // scope 1 at $DIR/const-promotion-extern-static.rs:13:41: 13:43
- _3 = [move _4]; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
- _2 = &_3; // scope 0 at $DIR/const-promotion-extern-static.rs:13:31: 13:46
@ -55,5 +55,5 @@
}
}
-
- alloc2 (extern static: X)
- alloc3 (extern static: X)

View file

@ -23,13 +23,13 @@
StorageLive(_2); // scope 1 at $DIR/mutable_variable_no_prop.rs:8:5: 10:6
StorageLive(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
StorageLive(_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
_4 = const {alloc0: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
_4 = const {alloc1: *mut u32}; // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
// ty::Const
// + ty: *mut u32
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/mutable_variable_no_prop.rs:9:13: 9:19
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: *mut u32, val: Value(Scalar(alloc1)) }
_3 = (*_4); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:13: 9:19
_1 = move _3; // scope 2 at $DIR/mutable_variable_no_prop.rs:9:9: 9:19
StorageDead(_3); // scope 2 at $DIR/mutable_variable_no_prop.rs:9:18: 9:19
@ -45,7 +45,7 @@
}
}
alloc0 (static: STATIC, size: 4, align: 4) {
alloc1 (static: STATIC, size: 4, align: 4) {
2a 00 00 00 │ *...
}

View file

@ -16,24 +16,24 @@
StorageLive(_1); // scope 0 at $DIR/read_immutable_static.rs:7:9: 7:10
StorageLive(_2); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
StorageLive(_3); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
_3 = const {alloc0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
_3 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
// ty::Const
// + ty: &u8
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _2 = (*_3); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
+ _2 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
StorageLive(_4); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
StorageLive(_5); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
_5 = const {alloc0: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
_5 = const {alloc1: &u8}; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
// ty::Const
// + ty: &u8
// + val: Value(Scalar(alloc0))
// + val: Value(Scalar(alloc1))
// mir::Constant
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0)) }
// + literal: Const { ty: &u8, val: Value(Scalar(alloc1)) }
- _4 = (*_5); // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
- _1 = Add(move _2, move _4); // scope 0 at $DIR/read_immutable_static.rs:7:13: 7:22
+ _4 = const 2_u8; // scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
@ -48,7 +48,7 @@
}
}
alloc0 (static: FOO, size: 1, align: 1) {
alloc1 (static: FOO, size: 1, align: 1) {
02 │ .
}

View file

@ -3,8 +3,7 @@
const REG_ADDR: *const u8 = 0x5f3759df as *const u8;
const VALUE: u8 = unsafe { *REG_ADDR };
//~^ ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out
//~^ ERROR evaluation of constant value failed
fn main() {
}

View file

@ -1,14 +1,9 @@
error: any use of this value will cause an error
error[E0080]: evaluation of constant value failed
--> $DIR/E0396-fixed.rs:5:28
|
LL | const VALUE: u8 = unsafe { *REG_ADDR };
| ---------------------------^^^^^^^^^---
| |
| unable to turn bytes into a pointer
|
= note: `#[deny(const_err)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
| ^^^^^^^^^ 0x5f3759df is not a valid pointer
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.