blob: aca0b13bb90700535e1fca36532985df2de02891 [file] [log] [blame]
error[E0080]: constructing invalid value: encountered a value of uninhabited type `Bar`
--> $DIR/ub-uninhabit.rs:20:35
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_BAD` failed here
error[E0080]: constructing invalid value: encountered a reference pointing to uninhabited type Bar
--> $DIR/ub-uninhabit.rs:23:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value
|
= 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]: constructing invalid value at [0]: encountered a value of uninhabited type `Bar`
--> $DIR/ub-uninhabit.rs:26:42
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `BAD_BAD_ARRAY` failed here
error[E0080]: constructing invalid value: encountered a value of the never type `!`
--> $DIR/ub-uninhabit.rs:32:16
|
LL | let _val = intrinsics::read_via_copy(ptr);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `READ_NEVER` failed here
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0080`.