@@ -102,13 +102,27 @@ error[E0080]: evaluation of constant value failed
102102LL | unsafe { intrinsics::offset(self, count) }
103103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104104 | |
105- | pointer arithmetic failed: allocN has size 0 , so pointer to 1 bytes starting at offset 0 is out-of-bounds
105+ | pointer arithmetic failed: allocN has size 1 , so pointer to 2 bytes starting at offset -4 is out-of-bounds
106106 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
107107 |
108- ::: $DIR/offset_ub.rs:17:50
108+ ::: $DIR/offset_ub.rs:16:49
109+ |
110+ LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
111+ | ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:16:49
112+
113+ error[E0080]: evaluation of constant value failed
114+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
115+ |
116+ LL | unsafe { intrinsics::offset(self, count) }
117+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118+ | |
119+ | pointer arithmetic failed: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
120+ | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
121+ |
122+ ::: $DIR/offset_ub.rs:18:50
109123 |
110124LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
111- | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:17 :50
125+ | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:18 :50
112126
113127error[E0080]: evaluation of constant value failed
114128 --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
@@ -119,10 +133,10 @@ LL | unsafe { intrinsics::offset(self, count) as *mut T }
119133 | 0x1 is not a valid pointer
120134 | inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
121135 |
122- ::: $DIR/offset_ub.rs:18 :42
136+ ::: $DIR/offset_ub.rs:19 :42
123137 |
124138LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
125- | ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:18 :42
139+ | ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:19 :42
126140
127141error[E0080]: evaluation of constant value failed
128142 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -133,10 +147,10 @@ LL | unsafe { intrinsics::offset(self, count) }
133147 | pointer arithmetic failed: 0x0 is not a valid pointer
134148 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
135149 |
136- ::: $DIR/offset_ub.rs:21 :50
150+ ::: $DIR/offset_ub.rs:22 :50
137151 |
138152LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
139- | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:21 :50
153+ | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:22 :50
140154
141155error[E0080]: evaluation of constant value failed
142156 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@@ -147,11 +161,11 @@ LL | unsafe { intrinsics::offset(self, count) }
147161 | 0x7f..f is not a valid pointer
148162 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
149163 |
150- ::: $DIR/offset_ub.rs:24 :47
164+ ::: $DIR/offset_ub.rs:25 :47
151165 |
152166LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
153- | -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:24 :47
167+ | -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:25 :47
154168
155- error: aborting due to 11 previous errors
169+ error: aborting due to 12 previous errors
156170
157171For more information about this error, try `rustc --explain E0080`.
0 commit comments