33 lines
1.6 KiB
Plaintext
33 lines
1.6 KiB
Plaintext
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/ub-uninhabit.rs:19:35
|
|
|
|
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type `Bar`
|
|
|
|
error[E0080]: it is undefined behavior to use this value
|
|
--> $DIR/ub-uninhabit.rs:23:1
|
|
|
|
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
|
|
|
|
|
= 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.
|
|
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
|
HEX_DUMP
|
|
}
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/ub-uninhabit.rs:27:42
|
|
|
|
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type `Bar`
|
|
|
|
error[E0080]: evaluation of constant value failed
|
|
--> $DIR/ub-uninhabit.rs:35:16
|
|
|
|
|
LL | let _val = intrinsics::read_via_copy(ptr);
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0080`.
|