Skip to content

Commit

Permalink
Rollup merge of rust-lang#106047 - uweigand:s390x-test-bigendian-ui, …
Browse files Browse the repository at this point in the history
…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 rust-lang#105383.
  • Loading branch information
Yuki Okushi authored Jan 9, 2023
2 parents a50c757 + 73e7207 commit 3cc24ec
Show file tree
Hide file tree
Showing 30 changed files with 1,716 additions and 1,130 deletions.
240 changes: 0 additions & 240 deletions src/test/ui/const-ptr/forbidden_slices.64bit.stderr

This file was deleted.

7 changes: 4 additions & 3 deletions src/test/ui/const-ptr/forbidden_slices.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// stderr-per-bitwidth
// normalize-stderr-test "╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$2╼"
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
// normalize-stderr-test "alloc\d+" -> "allocN"
// error-pattern: could not evaluate static initializer
#![feature(
Expand Down Expand Up @@ -78,7 +79,7 @@ pub static R8: &[u64] = unsafe {
pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };

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

0 comments on commit 3cc24ec

Please sign in to comment.