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: the `!` type has no valid value
11 = note: `#[warn(invalid_value)]` on by default
13 error[E0080]: evaluation of constant value failed
14 --> $DIR/validate_uninhabited_zsts.rs:4:14
16 LL | unsafe { std::mem::transmute(()) }
17 | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
20 --> $DIR/validate_uninhabited_zsts.rs:4:14
22 LL | unsafe { std::mem::transmute(()) }
23 | ^^^^^^^^^^^^^^^^^^^^^^^
25 --> $DIR/validate_uninhabited_zsts.rs:19:33
27 LL | const FOO: [empty::Empty; 3] = [foo(); 3];
30 error[E0080]: it is undefined behavior to use this value
31 --> $DIR/validate_uninhabited_zsts.rs:21:1
33 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
34 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void
36 = 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.
37 = note: the raw bytes of the constant (size: 0, align: 1) {}
39 warning: the type `empty::Empty` does not permit zero-initialization
40 --> $DIR/validate_uninhabited_zsts.rs:21:42
42 LL | const BAR: [empty::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: in this struct field
49 --> $DIR/validate_uninhabited_zsts.rs:16:22
51 LL | pub struct Empty(Void);
53 note: enums with no inhabited variants have no valid value
54 --> $DIR/validate_uninhabited_zsts.rs:13:5
59 error: aborting due to 2 previous errors; 2 warnings emitted
61 For more information about this error, try `rustc --explain E0080`.