Skip to content

Commit eade170

Browse files
committed
Fix tests for big-endian
The tests fail on s390x and presumably other big-endian systems, due to print of raw values and padding bytes. To fix the tests remove the raw output values in the error note with `normalize-stderr`.
1 parent 1064752 commit eade170

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

tests/ui/consts/const-eval/union-const-eval-field.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//@ dont-require-annotations: NOTE
22
//@ normalize-stderr: "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
3+
//@ normalize-stderr: "([[:xdigit:]]{2}\s){4}(__\s){4}\s+│\s+([?|\.]){4}\W{4}" -> "HEX_DUMP"
34

45
type Field1 = i32;
56
type Field2 = f32;

tests/ui/consts/const-eval/union-const-eval-field.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error[E0080]: reading memory at ALLOC0[0x0..0x8], but memory is uninitialized at [0x4..0x8], and this operation requires initialized memory
2-
--> $DIR/union-const-eval-field.rs:29:37
2+
--> $DIR/union-const-eval-field.rs:30:37
33
|
44
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
55
| ^^^^^^^^^^^^ evaluation of `read_field3::FIELD3` failed here
66
|
77
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
8-
00 00 80 3f __ __ __ __ │ ...?░░░░
8+
HEX_DUMP
99
}
1010

1111
note: erroneous constant encountered
12-
--> $DIR/union-const-eval-field.rs:31:5
12+
--> $DIR/union-const-eval-field.rs:32:5
1313
|
1414
LL | FIELD3
1515
| ^^^^^^
1616

1717
note: erroneous constant encountered
18-
--> $DIR/union-const-eval-field.rs:31:5
18+
--> $DIR/union-const-eval-field.rs:32:5
1919
|
2020
LL | FIELD3
2121
| ^^^^^^

tests/ui/intrinsics/intrinsic-raw_eq-const-bad.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ normalize-stderr: "[[:xdigit:]]{2} __ ([[:xdigit:]]{2}\s){2}" -> "HEX_DUMP"
12
#![feature(core_intrinsics)]
23

34
const RAW_EQ_PADDING: bool = unsafe {

tests/ui/intrinsics/intrinsic-raw_eq-const-bad.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
error[E0080]: reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x2], and this operation requires initialized memory
2-
--> $DIR/intrinsic-raw_eq-const-bad.rs:4:5
2+
--> $DIR/intrinsic-raw_eq-const-bad.rs:5:5
33
|
44
LL | std::intrinsics::raw_eq(&(1_u8, 2_u16), &(1_u8, 2_u16))
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `RAW_EQ_PADDING` failed here
66
|
77
= note: the raw bytes of the constant (size: 4, align: 2) {
8-
01 __ 02 00 │ .░..
8+
HEX_DUMP │ .░..
99
}
1010

1111
error[E0080]: unable to turn pointer into integer
12-
--> $DIR/intrinsic-raw_eq-const-bad.rs:9:5
12+
--> $DIR/intrinsic-raw_eq-const-bad.rs:10:5
1313
|
1414
LL | std::intrinsics::raw_eq(&(&0), &(&1))
1515
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `RAW_EQ_PTR` failed here
@@ -18,7 +18,7 @@ LL | std::intrinsics::raw_eq(&(&0), &(&1))
1818
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
1919

2020
error[E0080]: accessing memory with alignment 1, but alignment 4 is required
21-
--> $DIR/intrinsic-raw_eq-const-bad.rs:16:5
21+
--> $DIR/intrinsic-raw_eq-const-bad.rs:17:5
2222
|
2323
LL | std::intrinsics::raw_eq(aref, aref)
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `RAW_EQ_NOT_ALIGNED` failed here

0 commit comments

Comments
 (0)