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