]> git.proxmox.com Git - rustc.git/blob - tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / consts / const-eval / validate_uninhabited_zsts.64bit.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: the `!` type has no valid value
11 = note: `#[warn(invalid_value)]` on by default
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 | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
18 |
19 note: inside `foo`
20 --> $DIR/validate_uninhabited_zsts.rs:4:14
21 |
22 LL | unsafe { std::mem::transmute(()) }
23 | ^^^^^^^^^^^^^^^^^^^^^^^
24 note: inside `FOO`
25 --> $DIR/validate_uninhabited_zsts.rs:19:33
26 |
27 LL | const FOO: [empty::Empty; 3] = [foo(); 3];
28 | ^^^^^
29
30 error[E0080]: it is undefined behavior to use this value
31 --> $DIR/validate_uninhabited_zsts.rs:21:1
32 |
33 LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
34 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void
35 |
36 = 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.
37 = note: the raw bytes of the constant (size: 0, align: 1) {}
38
39 warning: the type `empty::Empty` does not permit zero-initialization
40 --> $DIR/validate_uninhabited_zsts.rs:21:42
41 |
42 LL | const BAR: [empty::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: in this struct field
49 --> $DIR/validate_uninhabited_zsts.rs:16:22
50 |
51 LL | pub struct Empty(Void);
52 | ^^^^
53 note: enums with no inhabited variants have no valid value
54 --> $DIR/validate_uninhabited_zsts.rs:13:5
55 |
56 LL | enum Void {}
57 | ^^^^^^^^^
58
59 error: aborting due to 2 previous errors; 2 warnings emitted
60
61 For more information about this error, try `rustc --explain E0080`.