1 warning: any use of this value will cause an error
2 --> $DIR/validate_uninhabited_zsts.rs:5:14
4 LL | unsafe { std::mem::transmute(()) }
5 | ^^^^^^^^^^^^^^^^^^^^^^^
7 | transmuting to uninhabited type
8 | inside call to `foo` at $DIR/validate_uninhabited_zsts.rs:14:26
10 LL | const FOO: [Empty; 3] = [foo(); 3];
11 | -----------------------------------
13 note: the lint level is defined here
14 --> $DIR/validate_uninhabited_zsts.rs:13:8
16 LL | #[warn(const_err)]
19 error[E0080]: it is undefined behavior to use this value
20 --> $DIR/validate_uninhabited_zsts.rs:17:1
22 LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
23 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a value of uninhabited type Empty at [0]
25 = 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.
27 warning: the type `!` does not permit zero-initialization
28 --> $DIR/validate_uninhabited_zsts.rs:5:14
30 LL | unsafe { std::mem::transmute(()) }
31 | ^^^^^^^^^^^^^^^^^^^^^^^
33 | this code causes undefined behavior when executed
34 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
36 = note: `#[warn(invalid_value)]` on by default
37 = note: the `!` type has no valid value
39 warning: the type `Empty` does not permit zero-initialization
40 --> $DIR/validate_uninhabited_zsts.rs:17:35
42 LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
43 | ^^^^^^^^^^^^^^^^^^^^^^^
45 | this code causes undefined behavior when executed
46 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
48 = note: enums with no variants have no valid value
50 error: aborting due to previous error
52 For more information about this error, try `rustc --explain E0080`.