1 error[E0080]: could not evaluate static initializer
2 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
4 = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
6 note: inside `std::slice::from_raw_parts::<'_, u32>`
7 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
9 --> $DIR/forbidden_slices.rs:18:34
11 LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 error[E0080]: could not evaluate static initializer
15 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
17 = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
19 note: inside `std::slice::from_raw_parts::<'_, ()>`
20 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
22 --> $DIR/forbidden_slices.rs:19:33
24 LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27 error[E0080]: could not evaluate static initializer
28 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
30 = note: dereferencing pointer failed: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
32 note: inside `std::slice::from_raw_parts::<'_, u32>`
33 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
35 --> $DIR/forbidden_slices.rs:22:34
37 LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
38 | ^^^^^^^^^^^^^^^^^^^^^^
40 error[E0080]: it is undefined behavior to use this value
41 --> $DIR/forbidden_slices.rs:25:1
43 LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
44 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
46 = 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.
47 = note: the raw bytes of the constant (size: 8, align: 4) {
48 ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
51 error[E0080]: it is undefined behavior to use this value
52 --> $DIR/forbidden_slices.rs:27:1
54 LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
55 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
57 = help: this code performed an operation that depends on the underlying bytes representing a pointer
58 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
59 = note: the raw bytes of the constant (size: 8, align: 4) {
60 ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
63 error[E0080]: it is undefined behavior to use this value
64 --> $DIR/forbidden_slices.rs:29:1
66 LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
67 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
69 = 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.
70 = note: the raw bytes of the constant (size: 8, align: 4) {
71 ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
74 error[E0080]: it is undefined behavior to use this value
75 --> $DIR/forbidden_slices.rs:32:1
77 LL | pub static S7: &[u16] = unsafe {
78 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
80 = 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.
81 = note: the raw bytes of the constant (size: 8, align: 4) {
82 ╾ALLOC_ID+0x2╼ 04 00 00 00 │ ╾──╼....
85 error[E0080]: could not evaluate static initializer
86 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
88 = note: dereferencing pointer failed: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
90 note: inside `std::slice::from_raw_parts::<'_, u64>`
91 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
93 --> $DIR/forbidden_slices.rs:43:5
95 LL | from_raw_parts(ptr, 1)
96 | ^^^^^^^^^^^^^^^^^^^^^^
98 error[E0080]: could not evaluate static initializer
99 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
101 = note: out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
103 note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
104 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
105 note: inside `from_ptr_range::<'_, u32>`
106 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
108 --> $DIR/forbidden_slices.rs:46:34
110 LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
111 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113 error[E0080]: could not evaluate static initializer
114 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
116 = note: 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
118 note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
119 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
120 note: inside `from_ptr_range::<'_, ()>`
121 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
123 --> $DIR/forbidden_slices.rs:47:33
125 LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
126 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127 = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
129 error[E0080]: could not evaluate static initializer
130 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
132 = note: out-of-bounds pointer arithmetic: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
134 note: inside `ptr::const_ptr::<impl *const u32>::offset`
135 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
136 note: inside `ptr::const_ptr::<impl *const u32>::add`
137 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
139 --> $DIR/forbidden_slices.rs:50:25
141 LL | from_ptr_range(ptr..ptr.add(2))
144 error[E0080]: it is undefined behavior to use this value
145 --> $DIR/forbidden_slices.rs:52:1
147 LL | pub static R4: &[u8] = unsafe {
148 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
150 = 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.
151 = note: the raw bytes of the constant (size: 8, align: 4) {
152 ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
155 error[E0080]: it is undefined behavior to use this value
156 --> $DIR/forbidden_slices.rs:57:1
158 LL | pub static R5: &[u8] = unsafe {
159 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
161 = help: this code performed an operation that depends on the underlying bytes representing a pointer
162 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
163 = note: the raw bytes of the constant (size: 8, align: 4) {
164 ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
167 error[E0080]: it is undefined behavior to use this value
168 --> $DIR/forbidden_slices.rs:62:1
170 LL | pub static R6: &[bool] = unsafe {
171 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
173 = 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.
174 = note: the raw bytes of the constant (size: 8, align: 4) {
175 ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
178 error[E0080]: could not evaluate static initializer
179 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
181 = note: accessing memory with alignment 1, but alignment 2 is required
183 note: inside `std::slice::from_raw_parts::<'_, u16>`
184 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
185 note: inside `from_ptr_range::<'_, u16>`
186 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
188 --> $DIR/forbidden_slices.rs:69:5
190 LL | from_ptr_range(ptr..ptr.add(4))
191 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
193 error[E0080]: could not evaluate static initializer
194 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
196 = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
198 note: inside `ptr::const_ptr::<impl *const u64>::offset`
199 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
200 note: inside `ptr::const_ptr::<impl *const u64>::add`
201 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
203 --> $DIR/forbidden_slices.rs:73:25
205 LL | from_ptr_range(ptr..ptr.add(1))
208 error[E0080]: could not evaluate static initializer
209 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
211 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
213 note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
214 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
215 note: inside `from_ptr_range::<'_, u32>`
216 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
218 --> $DIR/forbidden_slices.rs:78:34
220 LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
221 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
223 error[E0080]: could not evaluate static initializer
224 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
226 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
228 note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
229 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
230 note: inside `from_ptr_range::<'_, u32>`
231 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
233 --> $DIR/forbidden_slices.rs:79:35
235 LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
236 | ^^^^^^^^^^^^^^^^^^^^^^^^
238 error: aborting due to 18 previous errors
240 For more information about this error, try `rustc --explain E0080`.