]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / validate_uninhabited_zsts.32bit.stderr
1 warning: the type `!` does not permit zero-initialization
2 --> $DIR/validate_uninhabited_zsts.rs:4:14
3 |
4 LL | 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
13 error[E0080]: evaluation of constant value failed
14 --> $DIR/validate_uninhabited_zsts.rs:4:14
15 |
16 LL | unsafe { std::mem::transmute(()) }
17 | ^^^^^^^^^^^^^^^^^^^^^^^
18 | |
19 | transmuting to uninhabited type
20 | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14
21 ...
22 LL | const FOO: [empty::Empty; 3] = [foo(); 3];
23 | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:20:33
24
25 error[E0080]: it is undefined behavior to use this value
26 --> $DIR/validate_uninhabited_zsts.rs:23:1
27 |
28 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
29 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed at [0].0: encountered a value of uninhabited type empty::Void
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.
32 = note: the raw bytes of the constant (size: 0, align: 1) {}
33
34 warning: the type `empty::Empty` does not permit zero-initialization
35 --> $DIR/validate_uninhabited_zsts.rs:23:42
36 |
37 LL | 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
42 |
43 note: enums with no variants have no valid value (in this struct field)
44 --> $DIR/validate_uninhabited_zsts.rs:16:22
45 |
46 LL | pub struct Empty(Void);
47 | ^^^^
48
49 error: aborting due to 2 previous errors; 2 warnings emitted
50
51 For more information about this error, try `rustc --explain E0080`.