1 error[E0080]: evaluation of constant value failed
2 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
4 LL | unsafe { intrinsics::offset(self, count) }
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | overflowing in-bounds pointer arithmetic
8 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
10 ::: $DIR/offset_ub.rs:8:46
12 LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
13 | ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:8:46
15 error[E0080]: evaluation of constant value failed
16 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
18 LL | unsafe { intrinsics::offset(self, count) }
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 | pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
22 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
24 ::: $DIR/offset_ub.rs:9:43
26 LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
27 | ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:9:43
29 error[E0080]: evaluation of constant value failed
30 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
32 LL | unsafe { intrinsics::offset(self, count) }
33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 | pointer arithmetic failed: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
36 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
38 ::: $DIR/offset_ub.rs:10:45
40 LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
41 | ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:10:45
43 error[E0080]: evaluation of constant value failed
44 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
46 LL | unsafe { intrinsics::offset(self, count) }
47 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
49 | overflowing in-bounds pointer arithmetic
50 | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
52 ::: $DIR/offset_ub.rs:12:43
54 LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
55 | ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:12:43
57 error[E0080]: evaluation of constant value failed
58 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
60 LL | unsafe { intrinsics::offset(self, count) }
61 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 | overflowing in-bounds pointer arithmetic
64 | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
66 ::: $DIR/offset_ub.rs:13:44
68 LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
69 | ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:13:44
71 error[E0080]: evaluation of constant value failed
72 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
74 LL | unsafe { intrinsics::offset(self, count) }
75 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77 | overflowing in-bounds pointer arithmetic
78 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
80 ::: $DIR/offset_ub.rs:14:56
82 LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
83 | ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:56
85 error[E0080]: evaluation of constant value failed
86 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
88 LL | unsafe { intrinsics::offset(self, count) }
89 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91 | overflowing in-bounds pointer arithmetic
92 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
94 ::: $DIR/offset_ub.rs:15:57
96 LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
97 | --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:15:57
99 error[E0080]: evaluation of constant value failed
100 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
102 LL | unsafe { intrinsics::offset(self, count) }
103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
105 | pointer arithmetic failed: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
106 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
108 ::: $DIR/offset_ub.rs:16:49
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
113 error[E0080]: evaluation of constant value failed
114 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
116 LL | unsafe { intrinsics::offset(self, count) }
117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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
122 ::: $DIR/offset_ub.rs:18:50
124 LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
125 | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:18:50
127 error[E0080]: evaluation of constant value failed
128 --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
130 LL | unsafe { intrinsics::offset(self, count) as *mut T }
131 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133 | 0x1 is not a valid pointer
134 | inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
136 ::: $DIR/offset_ub.rs:19:42
138 LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
139 | ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:19:42
141 error[E0080]: evaluation of constant value failed
142 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
144 LL | unsafe { intrinsics::offset(self, count) }
145 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 | pointer arithmetic failed: 0x0 is not a valid pointer
148 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
150 ::: $DIR/offset_ub.rs:22:50
152 LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
153 | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:22:50
155 error[E0080]: evaluation of constant value failed
156 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
158 LL | unsafe { intrinsics::offset(self, count) }
159 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
161 | 0x7f..f is not a valid pointer
162 | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
164 ::: $DIR/offset_ub.rs:25:47
166 LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
167 | -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:25:47
169 error: aborting due to 12 previous errors
171 For more information about this error, try `rustc --explain E0080`.