Skip to content

Commit daf7a37

Browse files
committed
Make a test platform independent
1 parent 34c3c0d commit daf7a37

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/test/ui/consts/ptr_comparisons.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// compile-flags: --crate-type=lib
2+
// normalize-stderr-32bit: "offset 8" -> "offset $$TWO_WORDS"
3+
// normalize-stderr-64bit: "offset 16" -> "offset $$TWO_WORDS"
4+
// normalize-stderr-32bit: "size 4" -> "size $$WORD"
5+
// normalize-stderr-64bit: "size 8" -> "size $$WORD"
26

37
#![feature(
48
const_panic,

src/test/ui/consts/ptr_comparisons.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,39 @@ error: any use of this value will cause an error
44
LL | unsafe { intrinsics::offset(self, count) }
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
| |
7-
| inbounds test failed: pointer must be in-bounds at offset 16, but is outside bounds of alloc2 which has size 8
7+
| inbounds test failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD
88
| inside `std::ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
9-
| inside `_` at $DIR/ptr_comparisons.rs:58:34
9+
| inside `_` at $DIR/ptr_comparisons.rs:62:34
1010
|
11-
::: $DIR/ptr_comparisons.rs:58:1
11+
::: $DIR/ptr_comparisons.rs:62:1
1212
|
1313
LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
1414
| -------------------------------------------------------------------
1515
|
1616
= note: `#[deny(const_err)]` on by default
1717

1818
error: any use of this value will cause an error
19-
--> $DIR/ptr_comparisons.rs:63:14
19+
--> $DIR/ptr_comparisons.rs:67:14
2020
|
2121
LL | / const _: *const u8 =
2222
LL | |
2323
LL | | unsafe { std::ptr::raw_const!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
2424
| |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__-
2525
| |
26-
| memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size 8
26+
| memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD
2727
|
2828
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2929

3030
error: any use of this value will cause an error
31-
--> $DIR/ptr_comparisons.rs:66:27
31+
--> $DIR/ptr_comparisons.rs:70:27
3232
|
3333
LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
3434
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
3535
| |
3636
| "pointer-to-integer cast" needs an rfc before being allowed inside constants
3737

3838
error: any use of this value will cause an error
39-
--> $DIR/ptr_comparisons.rs:71:27
39+
--> $DIR/ptr_comparisons.rs:75:27
4040
|
4141
LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
4242
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---

0 commit comments

Comments
 (0)