Make a test platform independent

This commit is contained in:
Oliver Scherer 2020-08-17 15:31:48 +02:00
parent 34c3c0dae5
commit daf7a37510
2 changed files with 11 additions and 7 deletions

View file

@ -1,4 +1,8 @@
// compile-flags: --crate-type=lib
// normalize-stderr-32bit: "offset 8" -> "offset $$TWO_WORDS"
// normalize-stderr-64bit: "offset 16" -> "offset $$TWO_WORDS"
// normalize-stderr-32bit: "size 4" -> "size $$WORD"
// normalize-stderr-64bit: "size 8" -> "size $$WORD"
#![feature(
const_panic,

View file

@ -4,11 +4,11 @@ error: any use of this value will cause an error
LL | unsafe { intrinsics::offset(self, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| inbounds test failed: pointer must be in-bounds at offset 16, but is outside bounds of alloc2 which has size 8
| inbounds test failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD
| inside `std::ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
| inside `_` at $DIR/ptr_comparisons.rs:58:34
| inside `_` at $DIR/ptr_comparisons.rs:62:34
|
::: $DIR/ptr_comparisons.rs:58:1
::: $DIR/ptr_comparisons.rs:62:1
|
LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
| -------------------------------------------------------------------
@ -16,19 +16,19 @@ LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
= note: `#[deny(const_err)]` on by default
error: any use of this value will cause an error
--> $DIR/ptr_comparisons.rs:63:14
--> $DIR/ptr_comparisons.rs:67:14
|
LL | / const _: *const u8 =
LL | |
LL | | unsafe { std::ptr::raw_const!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
| |______________^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^__-
| |
| memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size 8
| memory access failed: pointer must be in-bounds at offset 1000, but is outside bounds of alloc2 which has size $WORD
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error
--> $DIR/ptr_comparisons.rs:66:27
--> $DIR/ptr_comparisons.rs:70:27
|
LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
@ -36,7 +36,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) +
| "pointer-to-integer cast" needs an rfc before being allowed inside constants
error: any use of this value will cause an error
--> $DIR/ptr_comparisons.rs:71:27
--> $DIR/ptr_comparisons.rs:75:27
|
LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---