1 warning: the type `!` does not permit zero-initialization
2 --> $DIR/validate_uninhabited_zsts.rs:4:14
4 LL | unsafe { std::mem::transmute(()) }
5 | ^^^^^^^^^^^^^^^^^^^^^^^
7 | this code causes undefined behavior when executed
8 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
10 = note: `#[warn(invalid_value)]` on by default
11 = note: the `!` type has no valid value
13 error[E0080]: evaluation of constant value failed
14 --> $DIR/validate_uninhabited_zsts.rs:4:14
16 LL | unsafe { std::mem::transmute(()) }
17 | ^^^^^^^^^^^^^^^^^^^^^^^
19 | transmuting to uninhabited type
20 | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14
22 LL | const FOO: [empty::Empty; 3] = [foo(); 3];
23 | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:20:33
25 error[E0080]: it is undefined behavior to use this value
26 --> $DIR/validate_uninhabited_zsts.rs:23:1
28 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0].0: encountered a value of uninhabited type empty::Void
31 = 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.
32 = note: the raw bytes of the constant (size: 0, align: 1) {}
34 warning: the type `empty::Empty` does not permit zero-initialization
35 --> $DIR/validate_uninhabited_zsts.rs:23:42
37 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
38 | ^^^^^^^^^^^^^^^^^^^^^^^
40 | this code causes undefined behavior when executed
41 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
43 note: enums with no variants have no valid value (in this struct field)
44 --> $DIR/validate_uninhabited_zsts.rs:16:22
46 LL | pub struct Empty(Void);
49 error: aborting due to 2 previous errors; 2 warnings emitted
51 For more information about this error, try `rustc --explain E0080`.