]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const-pointer-values-in-various-types.stderr
0126743eedecba9ced796711dfebdbad95645730
[rust.git] / src / test / ui / consts / const-eval / const-pointer-values-in-various-types.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/const-pointer-values-in-various-types.rs:24:5
3    |
4 LL |     const I32_REF_USIZE_UNION: usize = unsafe { Nonsense { int_32_ref: &3 }.u };
5    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
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 rust compiler repository if you believe it should not be considered undefined behavior
8
9 error: any use of this value will cause an error
10   --> $DIR/const-pointer-values-in-various-types.rs:27:5
11    |
12 LL |     const I32_REF_U8_UNION: u8 = unsafe { Nonsense { int_32_ref: &3 }.uint_8 };
13    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
14    |                                           |
15    |                                           a raw memory access tried to access part of a pointer value as raw bytes
16    |
17    = note: #[deny(const_err)] on by default
18
19 error: any use of this value will cause an error
20   --> $DIR/const-pointer-values-in-various-types.rs:30:5
21    |
22 LL |     const I32_REF_U16_UNION: u16 = unsafe { Nonsense { int_32_ref: &3 }.uint_16 };
23    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^
24    |                                             |
25    |                                             a raw memory access tried to access part of a pointer value as raw bytes
26
27 error: any use of this value will cause an error
28   --> $DIR/const-pointer-values-in-various-types.rs:33:5
29    |
30 LL |     const I32_REF_U32_UNION: u32 = unsafe { Nonsense { int_32_ref: &3 }.uint_32 };
31    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^
32    |                                             |
33    |                                             a raw memory access tried to access part of a pointer value as raw bytes
34
35 error[E0080]: it is undefined behavior to use this value
36   --> $DIR/const-pointer-values-in-various-types.rs:36:5
37    |
38 LL |     const I32_REF_U64_UNION: u64 = unsafe { Nonsense { int_32_ref: &3 }.uint_64 };
39    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
40    |
41    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
42
43 error: any use of this value will cause an error
44   --> $DIR/const-pointer-values-in-various-types.rs:39:5
45    |
46 LL |     const I32_REF_U128_UNION: u128 = unsafe { Nonsense { int_32_ref: &3 }.uint_128 };
47    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
48
49 error: any use of this value will cause an error
50   --> $DIR/const-pointer-values-in-various-types.rs:42:5
51    |
52 LL |     const I32_REF_I8_UNION: i8 = unsafe { Nonsense { int_32_ref: &3 }.int_8 };
53    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
54    |                                           |
55    |                                           a raw memory access tried to access part of a pointer value as raw bytes
56
57 error: any use of this value will cause an error
58   --> $DIR/const-pointer-values-in-various-types.rs:45:5
59    |
60 LL |     const I32_REF_I16_UNION: i16 = unsafe { Nonsense { int_32_ref: &3 }.int_16 };
61    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
62    |                                             |
63    |                                             a raw memory access tried to access part of a pointer value as raw bytes
64
65 error: any use of this value will cause an error
66   --> $DIR/const-pointer-values-in-various-types.rs:48:5
67    |
68 LL |     const I32_REF_I32_UNION: i32 = unsafe { Nonsense { int_32_ref: &3 }.int_32 };
69    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
70    |                                             |
71    |                                             a raw memory access tried to access part of a pointer value as raw bytes
72
73 error[E0080]: it is undefined behavior to use this value
74   --> $DIR/const-pointer-values-in-various-types.rs:51:5
75    |
76 LL |     const I32_REF_I64_UNION: i64 = unsafe { Nonsense { int_32_ref: &3 }.int_64 };
77    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
78    |
79    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
80
81 error: any use of this value will cause an error
82   --> $DIR/const-pointer-values-in-various-types.rs:54:5
83    |
84 LL |     const I32_REF_I128_UNION: i128 = unsafe { Nonsense { int_32_ref: &3 }.int_128 };
85    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
86
87 error: any use of this value will cause an error
88   --> $DIR/const-pointer-values-in-various-types.rs:57:5
89    |
90 LL |     const I32_REF_F32_UNION: f32 = unsafe { Nonsense { int_32_ref: &3 }.float_32 };
91    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^
92    |                                             |
93    |                                             a raw memory access tried to access part of a pointer value as raw bytes
94
95 error[E0080]: it is undefined behavior to use this value
96   --> $DIR/const-pointer-values-in-various-types.rs:60:5
97    |
98 LL |     const I32_REF_F64_UNION: f64 = unsafe { Nonsense { int_32_ref: &3 }.float_64 };
99    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
100    |
101    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
102
103 error: any use of this value will cause an error
104   --> $DIR/const-pointer-values-in-various-types.rs:63:5
105    |
106 LL |     const I32_REF_BOOL_UNION: bool = unsafe { Nonsense { int_32_ref: &3 }.truthy_falsey };
107    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------------^^^
108    |                                               |
109    |                                               a raw memory access tried to access part of a pointer value as raw bytes
110
111 error: any use of this value will cause an error
112   --> $DIR/const-pointer-values-in-various-types.rs:66:5
113    |
114 LL |     const I32_REF_CHAR_UNION: char = unsafe { Nonsense { int_32_ref: &3 }.character };
115    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------------^^^
116    |                                               |
117    |                                               a raw memory access tried to access part of a pointer value as raw bytes
118
119 error: any use of this value will cause an error
120   --> $DIR/const-pointer-values-in-various-types.rs:69:5
121    |
122 LL |     const STR_U8_UNION: u8 = unsafe { Nonsense { stringy: "3" }.uint_8 };
123    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
124    |                                       |
125    |                                       a raw memory access tried to access part of a pointer value as raw bytes
126
127 error: any use of this value will cause an error
128   --> $DIR/const-pointer-values-in-various-types.rs:72:5
129    |
130 LL |     const STR_U16_UNION: u16 = unsafe { Nonsense { stringy: "3" }.uint_16 };
131    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
132    |                                         |
133    |                                         a raw memory access tried to access part of a pointer value as raw bytes
134
135 error: any use of this value will cause an error
136   --> $DIR/const-pointer-values-in-various-types.rs:75:5
137    |
138 LL |     const STR_U32_UNION: u32 = unsafe { Nonsense { stringy: "3" }.uint_32 };
139    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
140    |                                         |
141    |                                         a raw memory access tried to access part of a pointer value as raw bytes
142
143 error[E0080]: it is undefined behavior to use this value
144   --> $DIR/const-pointer-values-in-various-types.rs:78:5
145    |
146 LL |     const STR_U64_UNION: u64 = unsafe { Nonsense { stringy: "3" }.uint_64 };
147    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
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 rust compiler repository if you believe it should not be considered undefined behavior
150
151 error: any use of this value will cause an error
152   --> $DIR/const-pointer-values-in-various-types.rs:81:5
153    |
154 LL |     const STR_U128_UNION: u128 = unsafe { Nonsense { stringy: "3" }.uint_128 };
155    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
156    |                                           |
157    |                                           a raw memory access tried to access part of a pointer value as raw bytes
158
159 error: any use of this value will cause an error
160   --> $DIR/const-pointer-values-in-various-types.rs:84:5
161    |
162 LL |     const STR_I8_UNION: i8 = unsafe { Nonsense { stringy: "3" }.int_8 };
163    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------------------------^^^
164    |                                       |
165    |                                       a raw memory access tried to access part of a pointer value as raw bytes
166
167 error: any use of this value will cause an error
168   --> $DIR/const-pointer-values-in-various-types.rs:87:5
169    |
170 LL |     const STR_I16_UNION: i16 = unsafe { Nonsense { stringy: "3" }.int_16 };
171    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
172    |                                         |
173    |                                         a raw memory access tried to access part of a pointer value as raw bytes
174
175 error: any use of this value will cause an error
176   --> $DIR/const-pointer-values-in-various-types.rs:90:5
177    |
178 LL |     const STR_I32_UNION: i32 = unsafe { Nonsense { stringy: "3" }.int_32 };
179    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------------------------^^^
180    |                                         |
181    |                                         a raw memory access tried to access part of a pointer value as raw bytes
182
183 error[E0080]: it is undefined behavior to use this value
184   --> $DIR/const-pointer-values-in-various-types.rs:93:5
185    |
186 LL |     const STR_I64_UNION: i64 = unsafe { Nonsense { stringy: "3" }.int_64 };
187    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
188    |
189    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
190
191 error: any use of this value will cause an error
192   --> $DIR/const-pointer-values-in-various-types.rs:96:5
193    |
194 LL |     const STR_I128_UNION: i128 = unsafe { Nonsense { stringy: "3" }.int_128 };
195    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^^^
196    |                                           |
197    |                                           a raw memory access tried to access part of a pointer value as raw bytes
198
199 error: any use of this value will cause an error
200   --> $DIR/const-pointer-values-in-various-types.rs:99:5
201    |
202 LL |     const STR_F32_UNION: f32 = unsafe { Nonsense { stringy: "3" }.float_32 };
203    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^^^
204    |                                         |
205    |                                         a raw memory access tried to access part of a pointer value as raw bytes
206
207 error[E0080]: it is undefined behavior to use this value
208   --> $DIR/const-pointer-values-in-various-types.rs:102:5
209    |
210 LL |     const STR_F64_UNION: f64 = unsafe { Nonsense { stringy: "3" }.float_64 };
211    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected initialized plain (non-pointer) bytes
212    |
213    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
214
215 error: any use of this value will cause an error
216   --> $DIR/const-pointer-values-in-various-types.rs:105:5
217    |
218 LL |     const STR_BOOL_UNION: bool = unsafe { Nonsense { stringy: "3" }.truthy_falsey };
219    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------^^^
220    |                                           |
221    |                                           a raw memory access tried to access part of a pointer value as raw bytes
222
223 error: any use of this value will cause an error
224   --> $DIR/const-pointer-values-in-various-types.rs:108:5
225    |
226 LL |     const STR_CHAR_UNION: char = unsafe { Nonsense { stringy: "3" }.character };
227    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------------------------------^^^
228    |                                           |
229    |                                           a raw memory access tried to access part of a pointer value as raw bytes
230
231 error: aborting due to 29 previous errors
232
233 For more information about this error, try `rustc --explain E0080`.