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:19: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:20: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:23: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:26: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: $SIZE, align: $ALIGN) {
51 error[E0080]: it is undefined behavior to use this value
52 --> $DIR/forbidden_slices.rs:28: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: $SIZE, align: $ALIGN) {
63 error[E0080]: it is undefined behavior to use this value
64 --> $DIR/forbidden_slices.rs:30: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: $SIZE, align: $ALIGN) {
74 error[E0080]: it is undefined behavior to use this value
75 --> $DIR/forbidden_slices.rs:33: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: $SIZE, align: $ALIGN) {
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:44: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:47: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:48: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>::add`
135 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
137 --> $DIR/forbidden_slices.rs:51:25
139 LL | from_ptr_range(ptr..ptr.add(2))
142 error[E0080]: it is undefined behavior to use this value
143 --> $DIR/forbidden_slices.rs:53:1
145 LL | pub static R4: &[u8] = unsafe {
146 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
148 = 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.
149 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
153 error[E0080]: it is undefined behavior to use this value
154 --> $DIR/forbidden_slices.rs:58:1
156 LL | pub static R5: &[u8] = unsafe {
157 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
159 = help: this code performed an operation that depends on the underlying bytes representing a pointer
160 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
161 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
165 error[E0080]: it is undefined behavior to use this value
166 --> $DIR/forbidden_slices.rs:63:1
168 LL | pub static R6: &[bool] = unsafe {
169 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
171 = 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.
172 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
176 error[E0080]: could not evaluate static initializer
177 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
179 = note: accessing memory with alignment 1, but alignment 2 is required
181 note: inside `std::slice::from_raw_parts::<'_, u16>`
182 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
183 note: inside `from_ptr_range::<'_, u16>`
184 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
186 --> $DIR/forbidden_slices.rs:70:5
188 LL | from_ptr_range(ptr..ptr.add(4))
189 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191 error[E0080]: could not evaluate static initializer
192 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
194 = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
196 note: inside `ptr::const_ptr::<impl *const u64>::add`
197 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
199 --> $DIR/forbidden_slices.rs:74:25
201 LL | from_ptr_range(ptr..ptr.add(1))
204 error[E0080]: could not evaluate static initializer
205 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
207 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
209 note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
210 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
211 note: inside `from_ptr_range::<'_, u32>`
212 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
214 --> $DIR/forbidden_slices.rs:79:34
216 LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
217 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
219 error[E0080]: could not evaluate static initializer
220 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
222 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
224 note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
225 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
226 note: inside `from_ptr_range::<'_, u32>`
227 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
229 --> $DIR/forbidden_slices.rs:80:35
231 LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
232 | ^^^^^^^^^^^^^^^^^^^^^^^^
234 error: aborting due to 18 previous errors
236 For more information about this error, try `rustc --explain E0080`.