]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/union-ub.stderr
const validation: add test for uninit bool
[rust.git] / src / test / ui / consts / const-eval / union-ub.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/union-ub.rs:32:1
3    |
4 LL | const BAD_BOOL: bool = unsafe { DummyUnion { u8: 42 }.bool};
5    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered 0x2a, but expected a boolean
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
9 error[E0080]: it is undefined behavior to use this value
10   --> $DIR/union-ub.rs:34:1
11    |
12 LL | const UNINIT_BOOL: bool = unsafe { DummyUnion { unit: () }.bool};
13    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered uninitialized bytes, but expected a boolean
14    |
15    = 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.
16
17 error: aborting due to 2 previous errors
18
19 For more information about this error, try `rustc --explain E0080`.