]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-eval/ub-uninhabit.stderr
Auto merge of #106520 - ehuss:update-mdbook, r=Mark-Simulacrum
[rust.git] / tests / ui / consts / const-eval / ub-uninhabit.stderr
1 error[E0080]: it is undefined behavior to use this value
2   --> $DIR/ub-uninhabit.rs:16:1
3    |
4 LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
5    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar
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: $SIZE, align: $ALIGN) {}
9
10 error[E0080]: it is undefined behavior to use this value
11   --> $DIR/ub-uninhabit.rs:19:1
12    |
13 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
14    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
15    |
16    = 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.
17    = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
18                HEX_DUMP
19            }
20
21 error[E0080]: it is undefined behavior to use this value
22   --> $DIR/ub-uninhabit.rs:22:1
23    |
24 LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
25    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar
26    |
27    = 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.
28    = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {}
29
30 error: aborting due to 3 previous errors
31
32 For more information about this error, try `rustc --explain E0080`.