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