]> git.proxmox.com Git - rustc.git/blame - tests/ui/consts/const-eval/union-ub.64bit.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / consts / const-eval / union-ub.64bit.stderr
CommitLineData
a1dfa0c6 1error[E0080]: it is undefined behavior to use this value
2b03887a 2 --> $DIR/union-ub.rs:32:1
8faf50e0
XL
3 |
4LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool};
064997fb 5 | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0x2a, but expected a boolean
8faf50e0 6 |
e1599b0c 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.
cdc7bbd5
XL
8 = note: the raw bytes of the constant (size: 1, align: 1) {
9 2a │ *
10 }
8faf50e0 11
f2b60f7d 12error[E0080]: evaluation of constant value failed
2b03887a 13 --> $DIR/union-ub.rs:34:36
f035d41b
XL
14 |
15LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool};
f2b60f7d 16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
f035d41b
XL
17
18error: aborting due to 2 previous errors
8faf50e0
XL
19
20For more information about this error, try `rustc --explain E0080`.