mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
Make a test platform independent
This commit is contained in:
parent
34c3c0dae5
commit
daf7a37510
@ -1,4 +1,8 @@
|
|||||||
// compile-flags: --crate-type=lib
|
// 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(
|
#![feature(
|
||||||
const_panic,
|
const_panic,
|
||||||
|
@ -4,11 +4,11 @@ error: any use of this value will cause an error
|
|||||||
LL | unsafe { intrinsics::offset(self, count) }
|
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 `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) };
|
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
|
= note: `#[deny(const_err)]` on by default
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
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 | / const _: *const u8 =
|
||||||
LL | |
|
LL | |
|
||||||
LL | | unsafe { std::ptr::raw_const!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
|
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)
|
= 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
|
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 };
|
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
|
| "pointer-to-integer cast" needs an rfc before being allowed inside constants
|
||||||
|
|
||||||
error: any use of this value will cause an error
|
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 };
|
LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
|
||||||
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
|
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
|
||||||
|
Loading…
Reference in New Issue
Block a user