diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-05-07 15:20:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-07 15:20:29 +0900 |
| commit | 47050275f4bacfeb2d67d23697ea01340f0c0ab2 (patch) | |
| tree | 9b56520739044e290d4e1cc789ba8eaca61a8255 /src | |
| parent | 326fec27a6e7df3947e7b62bec43ab86b776ea9d (diff) | |
| parent | bcf622b87d83867c1a765ca699ca3c15e462e5f8 (diff) | |
| download | rust-47050275f4bacfeb2d67d23697ea01340f0c0ab2.tar.gz rust-47050275f4bacfeb2d67d23697ea01340f0c0ab2.zip | |
Rollup merge of #84972 - RalfJung:null-ptr-msg, r=oli-obk
CTFE inbounds-error-messages tweak * use CheckInAllocMsg::PointerArithmeticTest for ptr_offset error * nicer errors for some null pointer cases r? `@oli-obk`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/offset_from_ub.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/consts/offset_ub.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/consts/ptr_comparisons.stderr | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr index 7ca5c647d88..404ce409d93 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr @@ -296,7 +296,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:135:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inbounds test failed: 0x0 is not a valid pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not allowed for this operation error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:139:5 diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr index e42c65a1517..39c56542762 100644 --- a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr +++ b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr @@ -296,7 +296,7 @@ error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:135:5 | LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize)) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ inbounds test failed: 0x0 is not a valid pointer + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not allowed for this operation error[E0080]: could not evaluate static initializer --> $DIR/ub-wide-ptr.rs:139:5 diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr index eb726f9cb11..d5d213f9c79 100644 --- a/src/test/ui/consts/offset_from_ub.stderr +++ b/src/test/ui/consts/offset_from_ub.stderr @@ -74,7 +74,7 @@ error: any use of this value will cause an error LL | unsafe { intrinsics::ptr_offset_from(self, origin) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | inbounds test failed: 0x0 is not a valid pointer + | null pointer is not allowed for this operation | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `OFFSET_FROM_NULL` at $DIR/offset_from_ub.rs:36:14 | diff --git a/src/test/ui/consts/offset_ub.stderr b/src/test/ui/consts/offset_ub.stderr index 082142fbbb7..45203d3e271 100644 --- a/src/test/ui/consts/offset_ub.stderr +++ b/src/test/ui/consts/offset_ub.stderr @@ -23,7 +23,7 @@ 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 2, but is outside bounds of allocN which has size 1 + | pointer arithmetic failed: pointer must be in-bounds at offset 2, but is outside bounds of allocN which has size 1 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `AFTER_END` at $DIR/offset_ub.rs:7:43 | @@ -41,7 +41,7 @@ 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 101, but is outside bounds of allocN which has size 100 + | pointer arithmetic failed: pointer must be in-bounds at offset 101, but is outside bounds of allocN which has size 100 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `AFTER_ARRAY` at $DIR/offset_ub.rs:8:45 | @@ -131,7 +131,7 @@ 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 1, but is outside bounds of allocN which has size 0 + | pointer arithmetic failed: pointer must be in-bounds at offset 1, but is outside bounds of allocN which has size 0 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:15:50 | @@ -167,7 +167,7 @@ error: any use of this value will cause an error LL | unsafe { intrinsics::offset(self, count) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | | - | inbounds test failed: 0x0 is not a valid pointer + | pointer arithmetic failed: 0x0 is not a valid pointer | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:19:50 | diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr index 9ec009c55c4..62b33000e60 100644 --- a/src/test/ui/consts/ptr_comparisons.stderr +++ b/src/test/ui/consts/ptr_comparisons.stderr @@ -4,7 +4,7 @@ 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 $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD + | pointer arithmetic failed: pointer must be in-bounds at offset $TWO_WORDS, but is outside bounds of alloc2 which has size $WORD | inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL | inside `_` at $DIR/ptr_comparisons.rs:61:34 | |
