]> git.proxmox.com Git - rustc.git/blame - tests/ui/const-ptr/forbidden_slices.stderr
New upstream version 1.73.0+dfsg1
[rustc.git] / tests / ui / const-ptr / forbidden_slices.stderr
CommitLineData
923072b8
FG
1error[E0080]: could not evaluate static initializer
2 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
3 |
9c376795 4 = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
487cf647
FG
5 |
6note: inside `std::slice::from_raw_parts::<'_, u32>`
7 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 8note: inside `S0`
9c376795 9 --> $DIR/forbidden_slices.rs:19:34
923072b8
FG
10 |
11LL | pub static S0: &[u32] = unsafe { from_raw_parts(ptr::null(), 0) };
487cf647 12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
13
14error[E0080]: could not evaluate static initializer
15 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
16 |
9c376795 17 = note: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
487cf647
FG
18 |
19note: inside `std::slice::from_raw_parts::<'_, ()>`
20 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 21note: inside `S1`
9c376795 22 --> $DIR/forbidden_slices.rs:20:33
923072b8
FG
23 |
24LL | pub static S1: &[()] = unsafe { from_raw_parts(ptr::null(), 0) };
487cf647 25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
26
27error[E0080]: could not evaluate static initializer
28 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
29 |
9c376795 30 = note: dereferencing pointer failed: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
487cf647
FG
31 |
32note: inside `std::slice::from_raw_parts::<'_, u32>`
33 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 34note: inside `S2`
9c376795 35 --> $DIR/forbidden_slices.rs:23:34
923072b8
FG
36 |
37LL | pub static S2: &[u32] = unsafe { from_raw_parts(&D0, 2) };
487cf647 38 | ^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
39
40error[E0080]: it is undefined behavior to use this value
9c376795 41 --> $DIR/forbidden_slices.rs:26:1
923072b8
FG
42 |
43LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
add651ee 44 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
923072b8
FG
45 |
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.
9c376795
FG
47 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
48 HEX_DUMP
923072b8
FG
49 }
50
51error[E0080]: it is undefined behavior to use this value
9c376795 52 --> $DIR/forbidden_slices.rs:28:1
923072b8
FG
53 |
54LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, size_of::<&u32>()) };
add651ee 55 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
923072b8 56 |
add651ee 57 = 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.
9c376795
FG
58 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
59 HEX_DUMP
923072b8 60 }
fe692bf9
FG
61 = help: this code performed an operation that depends on the underlying bytes representing a pointer
62 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
923072b8
FG
63
64error[E0080]: it is undefined behavior to use this value
9c376795 65 --> $DIR/forbidden_slices.rs:30:1
923072b8
FG
66 |
67LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
064997fb 68 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
923072b8
FG
69 |
70 = 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.
9c376795
FG
71 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
72 HEX_DUMP
923072b8
FG
73 }
74
75error[E0080]: it is undefined behavior to use this value
9c376795 76 --> $DIR/forbidden_slices.rs:33:1
923072b8 77 |
064997fb 78LL | pub static S7: &[u16] = unsafe {
add651ee 79 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
923072b8
FG
80 |
81 = 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.
9c376795
FG
82 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
83 HEX_DUMP
923072b8
FG
84 }
85
86error[E0080]: could not evaluate static initializer
87 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
88 |
9c376795 89 = note: dereferencing pointer failed: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
923072b8 90 |
487cf647
FG
91note: inside `std::slice::from_raw_parts::<'_, u64>`
92 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 93note: inside `S8`
9c376795 94 --> $DIR/forbidden_slices.rs:44:5
923072b8
FG
95 |
96LL | from_raw_parts(ptr, 1)
487cf647 97 | ^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
98
99error[E0080]: could not evaluate static initializer
100 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
101 |
fe692bf9 102 = note: out-of-bounds `offset_from`: null pointer is a dangling pointer (it has no provenance)
923072b8 103 |
487cf647
FG
104note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
105 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647
FG
106note: inside `from_ptr_range::<'_, u32>`
107 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 108note: inside `R0`
9c376795 109 --> $DIR/forbidden_slices.rs:47:34
923072b8
FG
110 |
111LL | pub static R0: &[u32] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
487cf647 112 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
113
114error[E0080]: could not evaluate static initializer
115 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
116 |
9c376795 117 = 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
923072b8 118 |
487cf647
FG
119note: inside `ptr::const_ptr::<impl *const ()>::sub_ptr`
120 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647
FG
121note: inside `from_ptr_range::<'_, ()>`
122 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647 123note: inside `R1`
9c376795 124 --> $DIR/forbidden_slices.rs:48:33
923072b8
FG
125 |
126LL | pub static R1: &[()] = unsafe { from_ptr_range(ptr::null()..ptr::null()) };
487cf647 127 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
128 = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
129
130error[E0080]: could not evaluate static initializer
131 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
132 |
9c376795 133 = note: out-of-bounds pointer arithmetic: allocN has size 4, so pointer to 8 bytes starting at offset 0 is out-of-bounds
487cf647 134 |
487cf647
FG
135note: inside `ptr::const_ptr::<impl *const u32>::add`
136 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647 137note: inside `R2`
9c376795 138 --> $DIR/forbidden_slices.rs:51:25
923072b8
FG
139 |
140LL | from_ptr_range(ptr..ptr.add(2))
487cf647 141 | ^^^^^^^^^^
923072b8
FG
142
143error[E0080]: it is undefined behavior to use this value
9c376795 144 --> $DIR/forbidden_slices.rs:53:1
923072b8 145 |
064997fb 146LL | pub static R4: &[u8] = unsafe {
add651ee 147 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
923072b8
FG
148 |
149 = 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.
9c376795
FG
150 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
151 HEX_DUMP
923072b8
FG
152 }
153
154error[E0080]: it is undefined behavior to use this value
9c376795 155 --> $DIR/forbidden_slices.rs:58:1
923072b8 156 |
064997fb 157LL | pub static R5: &[u8] = unsafe {
add651ee 158 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
923072b8 159 |
add651ee 160 = 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.
9c376795
FG
161 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
162 HEX_DUMP
923072b8 163 }
fe692bf9
FG
164 = help: this code performed an operation that depends on the underlying bytes representing a pointer
165 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
923072b8
FG
166
167error[E0080]: it is undefined behavior to use this value
9c376795 168 --> $DIR/forbidden_slices.rs:63:1
923072b8 169 |
064997fb
FG
170LL | pub static R6: &[bool] = unsafe {
171 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
923072b8
FG
172 |
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.
9c376795
FG
174 = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
175 HEX_DUMP
923072b8
FG
176 }
177
9c376795
FG
178error[E0080]: could not evaluate static initializer
179 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
923072b8 180 |
9c376795 181 = note: accessing memory with alignment 1, but alignment 2 is required
923072b8 182 |
9c376795
FG
183note: inside `std::slice::from_raw_parts::<'_, u16>`
184 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
185note: inside `from_ptr_range::<'_, u16>`
186 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
187note: inside `R7`
188 --> $DIR/forbidden_slices.rs:70:5
189 |
190LL | from_ptr_range(ptr..ptr.add(4))
191 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
192
193error[E0080]: could not evaluate static initializer
194 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
195 |
9c376795 196 = note: out-of-bounds pointer arithmetic: allocN has size 8, so pointer to 8 bytes starting at offset 1 is out-of-bounds
487cf647 197 |
487cf647
FG
198note: inside `ptr::const_ptr::<impl *const u64>::add`
199 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647
FG
200note: inside `R8`
201 --> $DIR/forbidden_slices.rs:74:25
923072b8
FG
202 |
203LL | from_ptr_range(ptr..ptr.add(1))
487cf647 204 | ^^^^^^^^^^
923072b8
FG
205
206error[E0080]: could not evaluate static initializer
207 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
208 |
9c376795 209 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
923072b8 210 |
487cf647
FG
211note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
212 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647
FG
213note: inside `from_ptr_range::<'_, u32>`
214 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647
FG
215note: inside `R9`
216 --> $DIR/forbidden_slices.rs:79:34
923072b8
FG
217 |
218LL | pub static R9: &[u32] = unsafe { from_ptr_range(&D0..(&D0 as *const u32).add(1)) };
487cf647 219 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
220
221error[E0080]: could not evaluate static initializer
222 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
223 |
9c376795 224 = note: `ptr_offset_from_unsigned` called on pointers into different allocations
923072b8 225 |
487cf647
FG
226note: inside `ptr::const_ptr::<impl *const u32>::sub_ptr`
227 --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
487cf647
FG
228note: inside `from_ptr_range::<'_, u32>`
229 --> $SRC_DIR/core/src/slice/raw.rs:LL:COL
487cf647
FG
230note: inside `R10`
231 --> $DIR/forbidden_slices.rs:80:35
923072b8
FG
232 |
233LL | pub static R10: &[u32] = unsafe { from_ptr_range(&D0..&D0) };
487cf647 234 | ^^^^^^^^^^^^^^^^^^^^^^^^
923072b8
FG
235
236error: aborting due to 18 previous errors
237
238For more information about this error, try `rustc --explain E0080`.