1 error[E0080]: could not evaluate static initializer
2 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
4 LL | &*ptr::slice_from_raw_parts(data, len)
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
8 | inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
10 ::: $DIR/forbidden_slices.rs:18:34
12 LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
13 | ------------------------------ inside `S0` at $DIR/forbidden_slices.rs:18:34
15 error[E0080]: could not evaluate static initializer
16 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
18 LL | &*ptr::slice_from_raw_parts(data, len)
19 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21 | dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
22 | inside `std::slice::from_raw_parts::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
24 ::: $DIR/forbidden_slices.rs:19:33
26 LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
27 | ------------------------------ inside `S1` at $DIR/forbidden_slices.rs:19:33
29 error[E0080]: could not evaluate static initializer
30 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
32 LL | &*ptr::slice_from_raw_parts(data, len)
33 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 | dereferencing pointer failed: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
36 | inside `std::slice::from_raw_parts::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
38 ::: $DIR/forbidden_slices.rs:22:34
40 LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
41 | ---------------------- inside `S2` at $DIR/forbidden_slices.rs:22:34
43 error[E0080]: it is undefined behavior to use this value
44 --> $DIR/forbidden_slices.rs:25:1
46 LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
47 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
49 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
50 = note: the raw bytes of the constant (size: 8, align: 4) {
51 ╾─ALLOC_ID─╼ 01 00 00 00 │ ╾──╼....
54 error[E0080]: it is undefined behavior to use this value
55 --> $DIR/forbidden_slices.rs:27:1
57 LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
58 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
60 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
61 = note: the raw bytes of the constant (size: 8, align: 4) {
62 ╾─ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
65 error[E0080]: it is undefined behavior to use this value
66 --> $DIR/forbidden_slices.rs:29:1
68 LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
69 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
71 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
72 = note: the raw bytes of the constant (size: 8, align: 4) {
73 ╾─ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
76 error[E0080]: it is undefined behavior to use this value
77 --> $DIR/forbidden_slices.rs:32:1
79 LL | pub static S7: &[u16] = unsafe {
80 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
82 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
83 = note: the raw bytes of the constant (size: 8, align: 4) {
84 ╾─A_ID+0x1─╼ 04 00 00 00 │ ╾──╼....
87 error[E0080]: could not evaluate static initializer
88 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
90 LL | &*ptr::slice_from_raw_parts(data, len)
91 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
93 | dereferencing pointer failed: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
94 | inside `std::slice::from_raw_parts::<u64>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
96 ::: $DIR/forbidden_slices.rs:43:5
98 LL | from_raw_parts(ptr, 1)
99 | ---------------------- inside `S8` at $DIR/forbidden_slices.rs:43:5
101 error[E0080]: could not evaluate static initializer
102 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
104 LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
105 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107 | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
108 | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
110 ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
112 LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
113 | ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
115 ::: $DIR/forbidden_slices.rs:46:34
117 LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
118 | ---------------------------------------- inside `R0` at $DIR/forbidden_slices.rs:46:34
120 error[E0080]: could not evaluate static initializer
121 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
123 LL | assert!(0 < pointee_size && pointee_size <= isize::MAX as usize);
124 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126 | the evaluated program panicked at 'assertion failed: 0 < pointee_size && pointee_size <= isize::MAX as usize', $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
127 | inside `ptr::const_ptr::<impl *const ()>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
129 ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
131 LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
132 | ------------------------------ inside `from_ptr_range::<()>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
134 ::: $DIR/forbidden_slices.rs:47:33
136 LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
137 | ---------------------------------------- inside `R1` at $DIR/forbidden_slices.rs:47:33
139 = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
141 error[E0080]: could not evaluate static initializer
142 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
144 LL | unsafe { intrinsics::offset(self, count) }
145 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147 | out-of-bounds pointer arithmetic: ALLOC_ID has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
148 | inside `ptr::const_ptr::<impl *const u32>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
150 LL | unsafe { self.offset(count as isize) }
151 | --------------------------- inside `ptr::const_ptr::<impl *const u32>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
153 ::: $DIR/forbidden_slices.rs:50:25
155 LL | from_ptr_range(ptr..ptr.add(2))
156 | ---------- inside `R2` at $DIR/forbidden_slices.rs:50:25
158 error[E0080]: it is undefined behavior to use this value
159 --> $DIR/forbidden_slices.rs:52:1
161 LL | pub static R4: &[u8] = unsafe {
162 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
164 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
165 = note: the raw bytes of the constant (size: 8, align: 4) {
166 ╾ALLOC_ID─╼ 01 00 00 00 │ ╾──╼....
169 error[E0080]: it is undefined behavior to use this value
170 --> $DIR/forbidden_slices.rs:57:1
172 LL | pub static R5: &[u8] = unsafe {
173 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered a pointer, but expected plain (non-pointer) bytes
175 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
176 = note: the raw bytes of the constant (size: 8, align: 4) {
177 ╾ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
180 error[E0080]: it is undefined behavior to use this value
181 --> $DIR/forbidden_slices.rs:62:1
183 LL | pub static R6: &[bool] = unsafe {
184 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
186 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
187 = note: the raw bytes of the constant (size: 8, align: 4) {
188 ╾ALLOC_ID─╼ 04 00 00 00 │ ╾──╼....
191 error[E0080]: it is undefined behavior to use this value
192 --> $DIR/forbidden_slices.rs:67:1
194 LL | pub static R7: &[u16] = unsafe {
195 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
197 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
198 = note: the raw bytes of the constant (size: 8, align: 4) {
199 ╾A_ID+0x1─╼ 04 00 00 00 │ ╾──╼....
202 error[E0080]: could not evaluate static initializer
203 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
205 LL | unsafe { intrinsics::offset(self, count) }
206 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208 | out-of-bounds pointer arithmetic: ALLOC_ID has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
209 | inside `ptr::const_ptr::<impl *const u64>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
211 LL | unsafe { self.offset(count as isize) }
212 | --------------------------- inside `ptr::const_ptr::<impl *const u64>::add` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
214 ::: $DIR/forbidden_slices.rs:74:25
216 LL | from_ptr_range(ptr..ptr.add(1))
217 | ---------- inside `R8` at $DIR/forbidden_slices.rs:74:25
219 error[E0080]: could not evaluate static initializer
220 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
222 LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
223 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
225 | `ptr_offset_from_unsigned` called on pointers into different allocations
226 | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
228 ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
230 LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
231 | ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
233 ::: $DIR/forbidden_slices.rs:79:34
235 LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
236 | ----------------------------------------------- inside `R9` at $DIR/forbidden_slices.rs:79:34
238 error[E0080]: could not evaluate static initializer
239 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
241 LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
242 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
244 | `ptr_offset_from_unsigned` called on pointers into different allocations
245 | inside `ptr::const_ptr::<impl *const u32>::sub_ptr` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
247 ::: $SRC_DIR/core/src/slice/raw.rs:LL:COL
249 LL | unsafe { from_raw_parts(range.start, range.end.sub_ptr(range.start)) }
250 | ------------------------------ inside `from_ptr_range::<u32>` at $SRC_DIR/core/src/slice/raw.rs:LL:COL
252 ::: $DIR/forbidden_slices.rs:80:35
254 LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
255 | ------------------------ inside `R10` at $DIR/forbidden_slices.rs:80:35
257 error: aborting due to 18 previous errors
259 For more information about this error, try `rustc --explain E0080`.