]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / ub-ref-ptr.64bit.stderr
1 error[E0080]: it is undefined behavior to use this value
2 --> $DIR/ub-ref-ptr.rs:13:1
3 |
4 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned reference (required 2 byte alignment but found 1)
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 ╾───────alloc2────────╼ │ ╾──────╼
10 }
11
12 error[E0080]: it is undefined behavior to use this value
13 --> $DIR/ub-ref-ptr.rs:17:1
14 |
15 LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered an unaligned box (required 2 byte alignment but found 1)
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 ╾───────alloc6────────╼ │ ╾──────╼
21 }
22
23 error[E0080]: it is undefined behavior to use this value
24 --> $DIR/ub-ref-ptr.rs:21:1
25 |
26 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null reference
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: 8, align: 8) {
31 00 00 00 00 00 00 00 00 │ ........
32 }
33
34 error[E0080]: it is undefined behavior to use this value
35 --> $DIR/ub-ref-ptr.rs:24:1
36 |
37 LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a null box
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: 8, align: 8) {
42 00 00 00 00 00 00 00 00 │ ........
43 }
44
45 error[E0080]: it is undefined behavior to use this value
46 --> $DIR/ub-ref-ptr.rs:30:1
47 |
48 LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
49 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered pointer to alloc14, but expected initialized plain (non-pointer) bytes
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: 8) {
53 ╾───────alloc14───────╼ │ ╾──────╼
54 }
55
56 error[E0080]: it is undefined behavior to use this value
57 --> $DIR/ub-ref-ptr.rs:33:1
58 |
59 LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
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 ╾───────alloc20───────╼ │ ╾──────╼
65 }
66
67 error[E0080]: it is undefined behavior to use this value
68 --> $DIR/ub-ref-ptr.rs:36:1
69 |
70 LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
71 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer at .<deref>, but expected plain (non-pointer) bytes
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: 8, align: 8) {
75 ╾───────alloc25───────╼ │ ╾──────╼
76 }
77
78 error[E0080]: it is undefined behavior to use this value
79 --> $DIR/ub-ref-ptr.rs:39:1
80 |
81 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
82 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling reference (created from integer)
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 39 05 00 00 00 00 00 00 │ 9.......
87 }
88
89 error[E0080]: it is undefined behavior to use this value
90 --> $DIR/ub-ref-ptr.rs:42:1
91 |
92 LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
93 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a dangling box (created from integer)
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: 8, align: 8) {
97 39 05 00 00 00 00 00 00 │ 9.......
98 }
99
100 error[E0080]: it is undefined behavior to use this value
101 --> $DIR/ub-ref-ptr.rs:45:1
102 |
103 LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized raw pointer
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: 8, align: 8) {
108 __ __ __ __ __ __ __ __ │ ░░░░░░░░
109 }
110
111 error[E0080]: it is undefined behavior to use this value
112 --> $DIR/ub-ref-ptr.rs:47:1
113 |
114 LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a function pointer
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: 8, align: 8) {
119 __ __ __ __ __ __ __ __ │ ░░░░░░░░
120 }
121
122 error: aborting due to 11 previous errors
123
124 For more information about this error, try `rustc --explain E0080`.