update stderr messages

This commit is contained in:
SaltyKitkat 2022-02-13 17:30:10 +08:00
parent ee87c80a85
commit 022756f814
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
6 changed files with 41 additions and 41 deletions

View File

@ -7,10 +7,10 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
::: $DIR/out_of_bounds_read.rs:13:33
::: $DIR/out_of_bounds_read.rs:12:33
|
LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) };
| ----------------------- inside `_READ` at $DIR/out_of_bounds_read.rs:13:33
| ----------------------- inside `_READ` at $DIR/out_of_bounds_read.rs:12:33
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@ -26,10 +26,10 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
LL | unsafe { read(self) }
| ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/out_of_bounds_read.rs:14:39
::: $DIR/out_of_bounds_read.rs:13:39
|
LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() };
| ------------------- inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:14:39
| ------------------- inside `_CONST_READ` at $DIR/out_of_bounds_read.rs:13:39
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
@ -45,10 +45,10 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
LL | unsafe { read(self) }
| ---------- inside `ptr::mut_ptr::<impl *mut u32>::read` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
|
::: $DIR/out_of_bounds_read.rs:15:37
::: $DIR/out_of_bounds_read.rs:14:37
|
LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() };
| --------------------------------- inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:15:37
| --------------------------------- inside `_MUT_READ` at $DIR/out_of_bounds_read.rs:14:37
error: aborting due to 3 previous errors

View File

@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
--> $DIR/invalid-union.rs:41:1
--> $DIR/invalid-union.rs:40:1
|
LL | fn main() {
| ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const`
@ -10,7 +10,7 @@ LL | fn main() {
}
error: erroneous constant used
--> $DIR/invalid-union.rs:42:25
--> $DIR/invalid-union.rs:41:25
|
LL | let _: &'static _ = &C;
| ^^ referenced constant has errors

View File

@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
--> $DIR/invalid-union.rs:41:1
--> $DIR/invalid-union.rs:40:1
|
LL | fn main() {
| ^^^^^^^^^ type validation failed at .<deref>.y.<enum-variant(B)>.0: encountered `UnsafeCell` in a `const`
@ -10,7 +10,7 @@ LL | fn main() {
}
error: erroneous constant used
--> $DIR/invalid-union.rs:42:25
--> $DIR/invalid-union.rs:41:25
|
LL | let _: &'static _ = &C;
| ^^ referenced constant has errors

View File

@ -7,9 +7,9 @@ LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| unable to turn pointer into raw bytes
| inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
| inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
| inside `C` at $DIR/issue-miri-1910.rs:8:5
| inside `C` at $DIR/issue-miri-1910.rs:7:5
|
::: $DIR/issue-miri-1910.rs:5:1
::: $DIR/issue-miri-1910.rs:4:1
|
LL | / const C: () = unsafe {
LL | | let foo = Some(&42 as *const i32);

View File

@ -7,10 +7,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| overflowing in-bounds pointer arithmetic
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:8:46
::: $DIR/offset_ub.rs:7:46
|
LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
| ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:8:46
| ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:7:46
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -21,10 +21,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:9:43
::: $DIR/offset_ub.rs:8:43
|
LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
| ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:9:43
| ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:8:43
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -35,10 +35,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:10:45
::: $DIR/offset_ub.rs:9:45
|
LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
| ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:10:45
| ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:9:45
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -49,10 +49,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| overflowing in-bounds pointer arithmetic
| inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:12:43
::: $DIR/offset_ub.rs:11:43
|
LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
| ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:12:43
| ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:11:43
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -63,10 +63,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| overflowing in-bounds pointer arithmetic
| inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:13:44
::: $DIR/offset_ub.rs:12:44
|
LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
| ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:13:44
| ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:12:44
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -77,10 +77,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| overflowing in-bounds pointer arithmetic
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:14:56
::: $DIR/offset_ub.rs:13:56
|
LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
| ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:56
| ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:56
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -91,10 +91,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| overflowing in-bounds pointer arithmetic
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:15:57
::: $DIR/offset_ub.rs:14:57
|
LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
| --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:15:57
| --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:57
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -105,10 +105,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:16:49
::: $DIR/offset_ub.rs:15:49
|
LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
| ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:16:49
| ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:15:49
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -119,10 +119,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:18:50
::: $DIR/offset_ub.rs:17:50
|
LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
| --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:18:50
| --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:17:50
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
@ -133,10 +133,10 @@ LL | unsafe { intrinsics::offset(self, count) as *mut T }
| pointer arithmetic failed: 0x1 is not a valid pointer
| inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:19:42
::: $DIR/offset_ub.rs:18:42
|
LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
| ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:19:42
| ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:18:42
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -147,10 +147,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: null pointer is not a valid pointer
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:22:50
::: $DIR/offset_ub.rs:21:50
|
LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
| --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:22:50
| --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:21:50
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -161,10 +161,10 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: 0x7f..f is not a valid pointer
| inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/offset_ub.rs:25:47
::: $DIR/offset_ub.rs:24:47
|
LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
| -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:25:47
| -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:24:47
error: aborting due to 12 previous errors

View File

@ -7,19 +7,19 @@ LL | unsafe { intrinsics::offset(self, count) }
| pointer arithmetic failed: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds
| inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
::: $DIR/ptr_comparisons.rs:59:34
::: $DIR/ptr_comparisons.rs:58:34
|
LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
| ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:59:34
| ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:58:34
error[E0080]: evaluation of constant value failed
--> $DIR/ptr_comparisons.rs:62:33
--> $DIR/ptr_comparisons.rs:61:33
|
LL | unsafe { std::ptr::addr_of!((*(FOO as *const usize as *const [u8; 1000]))[999]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: alloc3 has size $WORD, so pointer to 1000 bytes starting at offset 0 is out-of-bounds
error: any use of this value will cause an error
--> $DIR/ptr_comparisons.rs:66:27
--> $DIR/ptr_comparisons.rs:65:27
|
LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) + 4 };
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---
@ -31,7 +31,7 @@ LL | const _: usize = unsafe { std::mem::transmute::<*const usize, usize>(FOO) +
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error: any use of this value will cause an error
--> $DIR/ptr_comparisons.rs:71:27
--> $DIR/ptr_comparisons.rs:70:27
|
LL | const _: usize = unsafe { *std::mem::transmute::<&&usize, &usize>(&FOO) + 4 };
| --------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---