Skip to content

Commit 63f2a13

Browse files
authored
Rollup merge of #106047 - uweigand:s390x-test-bigendian-ui, r=oli-obk
Fix ui constant tests for big-endian platforms A number of tests under ui/const-ptr and ui/consts are currently failing on big-endian platforms as the binary encoding of some constants is hard-coded in the stderr test files. Fix this by a combination of two types of changes: - Where possible (i.e. where the particular value of a constant does not affect the purpose of the test), choose constant values that have the same encoding on big- and little-endian platforms. - Where this is not possible, provide a normalize-stderr-test rule that transforms the printed big-endian encoding of such constants into the corresponding little-endian form. Fixes part of #105383.
2 parents c1f8a3f + 73e7207 commit 63f2a13

30 files changed

+1716
-1130
lines changed

src/test/ui/const-ptr/forbidden_slices.64bit.stderr

-240
This file was deleted.

src/test/ui/const-ptr/forbidden_slices.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// stderr-per-bitwidth
2-
// normalize-stderr-test "╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$2╼"
1+
// Strip out raw byte dumps to make comparison platform-independent:
2+
// 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"
34
// normalize-stderr-test "alloc\d+" -> "allocN"
45
// error-pattern: could not evaluate static initializer
56
#![feature(
@@ -78,7 +79,7 @@ pub static R8: &[u64] = unsafe {
7879
pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
7980
pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
8081

81-
const D0: u32 = 0x11;
82+
const D0: u32 = 0x11111111; // Constant chosen for endianness-independent behavior.
8283
const D1: MaybeUninit<&u32> = MaybeUninit::uninit();
8384
const D2: Struct = Struct { a: 1, b: 2, c: 3, d: 4 };
8485
const D3: &u32 = &42;

0 commit comments

Comments
 (0)