]> git.proxmox.com Git - rustc.git/blob - tests/ui/consts/const-eval/raw-bytes.64bit.stderr
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / ui / consts / const-eval / raw-bytes.64bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2 --> $DIR/raw-bytes.rs:20:1
3 |
4 LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
5 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
6 |
7 = 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.
8 = note: the raw bytes of the constant (size: 8, align: 8) {
9 01 00 00 00 00 00 00 00 │ ........
10 }
11
12 error[E0080]: it is undefined behavior to use this value
13 --> $DIR/raw-bytes.rs:28:1
14 |
15 LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
16 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
17 |
18 = 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.
19 = note: the raw bytes of the constant (size: 8, align: 8) {
20 00 00 00 00 00 00 00 00 │ ........
21 }
22
23 error[E0080]: it is undefined behavior to use this value
24 --> $DIR/raw-bytes.rs:42:1
25 |
26 LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
28 |
29 = 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.
30 = note: the raw bytes of the constant (size: 1, align: 1) {
31 01 │ .
32 }
33
34 error[E0080]: it is undefined behavior to use this value
35 --> $DIR/raw-bytes.rs:44:1
36 |
37 LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
39 |
40 = 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.
41 = note: the raw bytes of the constant (size: 1, align: 1) {
42 03 │ .
43 }
44
45 error[E0080]: it is undefined behavior to use this value
46 --> $DIR/raw-bytes.rs:50:1
47 |
48 LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
50 |
51 = 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.
52 = note: the raw bytes of the constant (size: 8, align: 4) {
53 78 00 00 00 ff ff ff ff │ x.......
54 }
55
56 error[E0080]: it is undefined behavior to use this value
57 --> $DIR/raw-bytes.rs:54:1
58 |
59 LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
61 |
62 = 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.
63 = note: the raw bytes of the constant (size: 8, align: 8) {
64 00 00 00 00 00 00 00 00 │ ........
65 }
66
67 error[E0080]: it is undefined behavior to use this value
68 --> $DIR/raw-bytes.rs:57:1
69 |
70 LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
71 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
72 |
73 = 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.
74 = note: the raw bytes of the constant (size: 1, align: 1) {
75 00 │ .
76 }
77
78 error[E0080]: it is undefined behavior to use this value
79 --> $DIR/raw-bytes.rs:59:1
80 |
81 LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
83 |
84 = 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.
85 = note: the raw bytes of the constant (size: 8, align: 8) {
86 00 00 00 00 00 00 00 00 │ ........
87 }
88
89 error[E0080]: it is undefined behavior to use this value
90 --> $DIR/raw-bytes.rs:65:1
91 |
92 LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
94 |
95 = 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.
96 = note: the raw bytes of the constant (size: 4, align: 4) {
97 2a 00 00 00 │ *...
98 }
99
100 error[E0080]: it is undefined behavior to use this value
101 --> $DIR/raw-bytes.rs:71:1
102 |
103 LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
105 |
106 = 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.
107 = note: the raw bytes of the constant (size: 4, align: 4) {
108 14 00 00 00 │ ....
109 }
110
111 error[E0080]: it is undefined behavior to use this value
112 --> $DIR/raw-bytes.rs:74:1
113 |
114 LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
116 |
117 = 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.
118 = note: the raw bytes of the constant (size: 16, align: 8) {
119 00 00 00 00 00 00 00 00 ╾ALLOC_ID╼ │ ........╾──────╼
120 }
121
122 error[E0080]: it is undefined behavior to use this value
123 --> $DIR/raw-bytes.rs:82:1
124 |
125 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
126 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
127 |
128 = 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.
129 = note: the raw bytes of the constant (size: 8, align: 8) {
130 ╾ALLOC_ID╼ │ ╾──────╼
131 }
132
133 error[E0080]: it is undefined behavior to use this value
134 --> $DIR/raw-bytes.rs:86:1
135 |
136 LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
137 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
138 |
139 = 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.
140 = note: the raw bytes of the constant (size: 8, align: 8) {
141 ╾ALLOC_ID╼ │ ╾──────╼
142 }
143
144 error[E0080]: it is undefined behavior to use this value
145 --> $DIR/raw-bytes.rs:90:1
146 |
147 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
148 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
149 |
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: 8) {
152 00 00 00 00 00 00 00 00 │ ........
153 }
154
155 error[E0080]: it is undefined behavior to use this value
156 --> $DIR/raw-bytes.rs:93:1
157 |
158 LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
159 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
160 |
161 = 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.
162 = note: the raw bytes of the constant (size: 8, align: 8) {
163 00 00 00 00 00 00 00 00 │ ........
164 }
165
166 error[E0080]: it is undefined behavior to use this value
167 --> $DIR/raw-bytes.rs:96:1
168 |
169 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
170 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance)
171 |
172 = 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.
173 = note: the raw bytes of the constant (size: 8, align: 8) {
174 39 05 00 00 00 00 00 00 │ 9.......
175 }
176
177 error[E0080]: it is undefined behavior to use this value
178 --> $DIR/raw-bytes.rs:99:1
179 |
180 LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
181 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance)
182 |
183 = 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.
184 = note: the raw bytes of the constant (size: 8, align: 8) {
185 39 05 00 00 00 00 00 00 │ 9.......
186 }
187
188 error[E0080]: it is undefined behavior to use this value
189 --> $DIR/raw-bytes.rs:102:1
190 |
191 LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
192 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
193 |
194 = 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.
195 = note: the raw bytes of the constant (size: 8, align: 8) {
196 00 00 00 00 00 00 00 00 │ ........
197 }
198
199 error[E0080]: it is undefined behavior to use this value
200 --> $DIR/raw-bytes.rs:104:1
201 |
202 LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
203 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
204 |
205 = 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.
206 = note: the raw bytes of the constant (size: 8, align: 8) {
207 0d 00 00 00 00 00 00 00 │ ........
208 }
209
210 error[E0080]: it is undefined behavior to use this value
211 --> $DIR/raw-bytes.rs:106:1
212 |
213 LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
214 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a function pointer
215 |
216 = 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.
217 = note: the raw bytes of the constant (size: 8, align: 8) {
218 ╾ALLOC_ID╼ │ ╾──────╼
219 }
220
221 error[E0080]: it is undefined behavior to use this value
222 --> $DIR/raw-bytes.rs:112:1
223 |
224 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
225 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
226 |
227 = 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.
228 = note: the raw bytes of the constant (size: 8, align: 8) {
229 01 00 00 00 00 00 00 00 │ ........
230 }
231
232 error[E0080]: it is undefined behavior to use this value
233 --> $DIR/raw-bytes.rs:137:1
234 |
235 LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
236 | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
237 |
238 = 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.
239 = note: the raw bytes of the constant (size: 16, align: 8) {
240 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
241 }
242
243 error[E0080]: it is undefined behavior to use this value
244 --> $DIR/raw-bytes.rs:139:1
245 |
246 LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
247 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object
248 |
249 = 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.
250 = note: the raw bytes of the constant (size: 16, align: 8) {
251 ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
252 }
253
254 error[E0080]: it is undefined behavior to use this value
255 --> $DIR/raw-bytes.rs:141:1
256 |
257 LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
258 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
259 |
260 = 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.
261 = note: the raw bytes of the constant (size: 16, align: 8) {
262 ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
263 }
264
265 error[E0080]: it is undefined behavior to use this value
266 --> $DIR/raw-bytes.rs:144:1
267 |
268 LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
269 | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
270 |
271 = 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.
272 = note: the raw bytes of the constant (size: 16, align: 8) {
273 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
274 }
275
276 error[E0080]: it is undefined behavior to use this value
277 --> $DIR/raw-bytes.rs:146:1
278 |
279 LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
280 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
281 |
282 = 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.
283 = note: the raw bytes of the constant (size: 16, align: 8) {
284 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
285 }
286
287 error[E0080]: it is undefined behavior to use this value
288 --> $DIR/raw-bytes.rs:148:1
289 |
290 LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
291 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
292 |
293 = help: this code performed an operation that depends on the underlying bytes representing a pointer
294 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
295 = note: the raw bytes of the constant (size: 16, align: 8) {
296 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
297 }
298
299 error[E0080]: it is undefined behavior to use this value
300 --> $DIR/raw-bytes.rs:152:1
301 |
302 LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
303 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
304 |
305 = 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.
306 = note: the raw bytes of the constant (size: 16, align: 8) {
307 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
308 }
309
310 error[E0080]: it is undefined behavior to use this value
311 --> $DIR/raw-bytes.rs:154:1
312 |
313 LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
314 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
315 |
316 = 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.
317 = note: the raw bytes of the constant (size: 16, align: 8) {
318 ╾ALLOC_ID╼ ff ff ff ff ff ff ff 7f │ ╾──────╼........
319 }
320
321 error[E0080]: it is undefined behavior to use this value
322 --> $DIR/raw-bytes.rs:157:1
323 |
324 LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
325 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation)
326 |
327 = 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.
328 = note: the raw bytes of the constant (size: 16, align: 8) {
329 ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
330 }
331
332 error[E0080]: it is undefined behavior to use this value
333 --> $DIR/raw-bytes.rs:160:1
334 |
335 LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
336 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
337 |
338 = 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.
339 = note: the raw bytes of the constant (size: 8, align: 8) {
340 ╾ALLOC_ID╼ │ ╾──────╼
341 }
342
343 note: erroneous constant used
344 --> $DIR/raw-bytes.rs:160:40
345 |
346 LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
347 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
348
349 error[E0080]: it is undefined behavior to use this value
350 --> $DIR/raw-bytes.rs:166:1
351 |
352 LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
354 |
355 = 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.
356 = note: the raw bytes of the constant (size: 8, align: 8) {
357 ╾ALLOC_ID╼ │ ╾──────╼
358 }
359
360 note: erroneous constant used
361 --> $DIR/raw-bytes.rs:166:42
362 |
363 LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
364 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
365
366 error[E0080]: it is undefined behavior to use this value
367 --> $DIR/raw-bytes.rs:170:1
368 |
369 LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean
371 |
372 = 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.
373 = note: the raw bytes of the constant (size: 8, align: 8) {
374 ╾ALLOC_ID╼ │ ╾──────╼
375 }
376
377 note: erroneous constant used
378 --> $DIR/raw-bytes.rs:170:42
379 |
380 LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
381 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
382
383 error[E0080]: it is undefined behavior to use this value
384 --> $DIR/raw-bytes.rs:175:1
385 |
386 LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
387 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
388 |
389 = 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.
390 = note: the raw bytes of the constant (size: 16, align: 8) {
391 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
392 }
393
394 error[E0080]: it is undefined behavior to use this value
395 --> $DIR/raw-bytes.rs:179:1
396 |
397 LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
398 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
399 |
400 = 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.
401 = note: the raw bytes of the constant (size: 16, align: 8) {
402 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
403 }
404
405 error[E0080]: it is undefined behavior to use this value
406 --> $DIR/raw-bytes.rs:183:1
407 |
408 LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
409 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer
410 |
411 = 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.
412 = note: the raw bytes of the constant (size: 16, align: 8) {
413 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
414 }
415
416 error[E0080]: it is undefined behavior to use this value
417 --> $DIR/raw-bytes.rs:186:1
418 |
419 LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
420 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, but expected a vtable pointer
421 |
422 = 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.
423 = note: the raw bytes of the constant (size: 16, align: 8) {
424 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
425 }
426
427 error[E0080]: it is undefined behavior to use this value
428 --> $DIR/raw-bytes.rs:190:1
429 |
430 LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
431 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean
432 |
433 = 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.
434 = note: the raw bytes of the constant (size: 16, align: 8) {
435 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
436 }
437
438 error[E0080]: it is undefined behavior to use this value
439 --> $DIR/raw-bytes.rs:194:1
440 |
441 LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
442 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
443 |
444 = 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.
445 = note: the raw bytes of the constant (size: 16, align: 8) {
446 ╾ALLOC_ID╼ 00 00 00 00 00 00 00 00 │ ╾──────╼........
447 }
448
449 error[E0080]: it is undefined behavior to use this value
450 --> $DIR/raw-bytes.rs:196:1
451 |
452 LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, but expected a vtable pointer
454 |
455 = 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.
456 = note: the raw bytes of the constant (size: 16, align: 8) {
457 ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
458 }
459
460 error[E0080]: it is undefined behavior to use this value
461 --> $DIR/raw-bytes.rs:201:1
462 |
463 LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
464 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
465 |
466 = 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.
467 = note: the raw bytes of the constant (size: 16, align: 8) {
468 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 │ ................
469 }
470
471 error[E0080]: it is undefined behavior to use this value
472 --> $DIR/raw-bytes.rs:205:1
473 |
474 LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
475 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
476 |
477 = 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.
478 = note: the raw bytes of the constant (size: 16, align: 8) {
479 09 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 │ ................
480 }
481
482 error[E0080]: it is undefined behavior to use this value
483 --> $DIR/raw-bytes.rs:209:1
484 |
485 LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
486 | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
487 |
488 = 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.
489 = note: the raw bytes of the constant (size: 8, align: 8) {
490 01 00 00 00 00 00 00 00 │ ........
491 }
492
493 error[E0080]: it is undefined behavior to use this value
494 --> $DIR/raw-bytes.rs:210:1
495 |
496 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
497 | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
498 |
499 = 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.
500 = note: the raw bytes of the constant (size: 16, align: 8) {
501 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
502 }
503
504 error[E0080]: it is undefined behavior to use this value
505 --> $DIR/raw-bytes.rs:211:1
506 |
507 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
508 | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
509 |
510 = 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.
511 = note: the raw bytes of the constant (size: 16, align: 8) {
512 01 00 00 00 00 00 00 00 2a 00 00 00 00 00 00 00 │ ........*.......
513 }
514
515 error[E0080]: it is undefined behavior to use this value
516 --> $DIR/raw-bytes.rs:215:1
517 |
518 LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
519 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
520 |
521 = 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.
522 = note: the raw bytes of the constant (size: 16, align: 8) {
523 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
524 }
525
526 error[E0080]: it is undefined behavior to use this value
527 --> $DIR/raw-bytes.rs:218:1
528 |
529 LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
530 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
531 |
532 = help: this code performed an operation that depends on the underlying bytes representing a pointer
533 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
534 = note: the raw bytes of the constant (size: 16, align: 8) {
535 ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
536 }
537
538 error[E0080]: it is undefined behavior to use this value
539 --> $DIR/raw-bytes.rs:221:1
540 |
541 LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
542 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
543 |
544 = 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.
545 = note: the raw bytes of the constant (size: 16, align: 8) {
546 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
547 }
548
549 error[E0080]: it is undefined behavior to use this value
550 --> $DIR/raw-bytes.rs:225:1
551 |
552 LL | pub static S7: &[u16] = unsafe {
553 | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
554 |
555 = 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.
556 = note: the raw bytes of the constant (size: 16, align: 8) {
557 ╾ALLOC_ID+0x2╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
558 }
559
560 error[E0080]: it is undefined behavior to use this value
561 --> $DIR/raw-bytes.rs:232:1
562 |
563 LL | pub static R4: &[u8] = unsafe {
564 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
565 |
566 = 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.
567 = note: the raw bytes of the constant (size: 16, align: 8) {
568 ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
569 }
570
571 error[E0080]: it is undefined behavior to use this value
572 --> $DIR/raw-bytes.rs:237:1
573 |
574 LL | pub static R5: &[u8] = unsafe {
575 | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
576 |
577 = help: this code performed an operation that depends on the underlying bytes representing a pointer
578 = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
579 = note: the raw bytes of the constant (size: 16, align: 8) {
580 ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
581 }
582
583 error[E0080]: it is undefined behavior to use this value
584 --> $DIR/raw-bytes.rs:242:1
585 |
586 LL | pub static R6: &[bool] = unsafe {
587 | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
588 |
589 = 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.
590 = note: the raw bytes of the constant (size: 16, align: 8) {
591 ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
592 }
593
594 error: aborting due to 52 previous errors
595
596 For more information about this error, try `rustc --explain E0080`.