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