]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-eval/union-ice.stderr
Auto merge of #52712 - oli-obk:const_eval_cleanups, r=RalfJung
[rust.git] / src / test / ui / const-eval / union-ice.stderr
1 error: this constant cannot be used
2   --> $DIR/union-ice.rs:23:1
3    |
4 LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR this constant cannot be used
5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
6    |
7    = note: #[deny(const_err)] on by default
8
9 error: this constant cannot be used
10   --> $DIR/union-ice.rs:25:1
11    |
12 LL | / const FIELD_PATH: Struct = Struct { //~ ERROR this constant cannot be used
13 LL | |     a: 42,
14 LL | |     b: unsafe { UNION.field3 },
15 LL | | };
16    | |__^ attempted to read undefined bytes
17
18 error[E0080]: this constant likely exhibits undefined behavior
19   --> $DIR/union-ice.rs:35:1
20    |
21 LL | / const FIELD_PATH2: Struct2 = Struct2 { //~ ERROR this constant likely exhibits undefined behavior
22 LL | |     b: [
23 LL | |         21,
24 LL | |         unsafe { UNION.field3 },
25 ...  |
26 LL | |     a: 42,
27 LL | | };
28    | |__^ type validation failed: encountered undefined bytes at .b[1]
29    |
30    = 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
31
32 error: aborting due to 3 previous errors
33
34 For more information about this error, try `rustc --explain E0080`.