Skip to content

Commit 34771e2

Browse files
authored
Rollup merge of #119660 - RalfJung:const-ub-enum, r=oli-obk
remove an unnecessary stderr-per-bitwidth also update some regexp, `a(lloc)?` would no longer match now that we have compiletest itself do alloc ID normalization. r? ````@oli-obk````
2 parents 668e8b5 + 4292190 commit 34771e2

File tree

5 files changed

+6
-140
lines changed

5 files changed

+6
-140
lines changed

tests/ui/consts/const-eval/ub-enum.64bit.stderr

-134
This file was deleted.

tests/ui/consts/const-eval/ub-enum.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// stderr-per-bitwidth
21
// Strip out raw byte dumps to make comparison platform-independent:
32
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
4-
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
3+
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
4+
// normalize-stderr-test "0x0+" -> "0x0"
55
#![feature(never_type)]
66
#![allow(invalid_value)]
77

tests/ui/consts/const-eval/ub-enum.32bit.stderr renamed to tests/ui/consts/const-eval/ub-enum.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0080]: it is undefined behavior to use this value
22
--> $DIR/ub-enum.rs:27:1
33
|
44
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
5-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
5+
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x01, but expected a valid enum tag
66
|
77
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
88
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -31,7 +31,7 @@ error[E0080]: it is undefined behavior to use this value
3131
--> $DIR/ub-enum.rs:45:1
3232
|
3333
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
34-
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
34+
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0, but expected a valid enum tag
3535
|
3636
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
3737
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {

tests/ui/consts/const-eval/ub-uninhabit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Strip out raw byte dumps to make comparison platform-independent:
22
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
3-
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
3+
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
44
#![feature(core_intrinsics)]
55
#![feature(never_type)]
66

tests/ui/consts/validate_never_arrays.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Strip out raw byte dumps to make comparison platform-independent:
22
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
3-
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
3+
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
44
#![feature(never_type)]
55

66
const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior

0 commit comments

Comments
 (0)