]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / validate_uninhabited_zsts.64bit.stderr
CommitLineData
136023e0 1error[E0080]: evaluation of constant value failed
60c5eb7d
XL
2 --> $DIR/validate_uninhabited_zsts.rs:5:14
3 |
4LL | unsafe { std::mem::transmute(()) }
dfeec247
XL
5 | ^^^^^^^^^^^^^^^^^^^^^^^
6 | |
ba9703b0
XL
7 | transmuting to uninhabited type
8 | inside `foo` at $DIR/validate_uninhabited_zsts.rs:5:14
dfeec247 9...
60c5eb7d 10LL | const FOO: [Empty; 3] = [foo(); 3];
136023e0 11 | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:14:26
60c5eb7d
XL
12
13error[E0080]: it is undefined behavior to use this value
136023e0 14 --> $DIR/validate_uninhabited_zsts.rs:17:1
60c5eb7d
XL
15 |
16LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
136023e0 17 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0]: encountered a value of uninhabited type Empty
60c5eb7d
XL
18 |
19 = 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.
cdc7bbd5 20 = note: the raw bytes of the constant (size: 0, align: 1) {}
60c5eb7d
XL
21
22warning: the type `!` does not permit zero-initialization
23 --> $DIR/validate_uninhabited_zsts.rs:5:14
24 |
25LL | unsafe { std::mem::transmute(()) }
26 | ^^^^^^^^^^^^^^^^^^^^^^^
27 | |
28 | this code causes undefined behavior when executed
29 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
30 |
31 = note: `#[warn(invalid_value)]` on by default
dfeec247 32 = note: the `!` type has no valid value
60c5eb7d
XL
33
34warning: the type `Empty` does not permit zero-initialization
136023e0 35 --> $DIR/validate_uninhabited_zsts.rs:17:35
60c5eb7d
XL
36 |
37LL | const BAR: [Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
38 | ^^^^^^^^^^^^^^^^^^^^^^^
39 | |
40 | this code causes undefined behavior when executed
41 | help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
42 |
dfeec247 43 = note: enums with no variants have no valid value
60c5eb7d 44
136023e0 45error: aborting due to 2 previous errors; 2 warnings emitted
60c5eb7d
XL
46
47For more information about this error, try `rustc --explain E0080`.