]> git.lizzy.rs Git - rust.git/blob - src/test/ui/statics/uninhabited-static.stderr
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[rust.git] / src / test / ui / statics / uninhabited-static.stderr
1 error: static of uninhabited type
2   --> $DIR/uninhabited-static.rs:6:5
3    |
4 LL |     static VOID: Void;
5    |     ^^^^^^^^^^^^^^^^^^
6    |
7 note: the lint level is defined here
8   --> $DIR/uninhabited-static.rs:2:9
9    |
10 LL | #![deny(uninhabited_static)]
11    |         ^^^^^^^^^^^^^^^^^^
12    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
13    = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
14    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
15
16 error: static of uninhabited type
17   --> $DIR/uninhabited-static.rs:8:5
18    |
19 LL |     static NEVER: !;
20    |     ^^^^^^^^^^^^^^^^
21    |
22    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
23    = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
24    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
25
26 error: static of uninhabited type
27   --> $DIR/uninhabited-static.rs:12:1
28    |
29 LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
30    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31    |
32    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
33    = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
34    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
35
36 error: static of uninhabited type
37   --> $DIR/uninhabited-static.rs:16:1
38    |
39 LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
40    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41    |
42    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
43    = note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
44    = note: uninhabited statics cannot be initialized, and any access would be an immediate error
45
46 error[E0080]: could not evaluate static initializer
47   --> $DIR/uninhabited-static.rs:12:31
48    |
49 LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
50    |                               ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
51
52 error[E0080]: could not evaluate static initializer
53   --> $DIR/uninhabited-static.rs:16:32
54    |
55 LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
56    |                                ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
57
58 warning: the type `Void` does not permit zero-initialization
59   --> $DIR/uninhabited-static.rs:12:31
60    |
61 LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
62    |                               ^^^^^^^^^^^^^^^^^^^^^^^
63    |                               |
64    |                               this code causes undefined behavior when executed
65    |                               help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
66    |
67    = note: `#[warn(invalid_value)]` on by default
68    = note: enums with no variants have no valid value
69
70 warning: the type `Void` does not permit zero-initialization
71   --> $DIR/uninhabited-static.rs:16:32
72    |
73 LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
74    |                                ^^^^^^^^^^^^^^^^^^^^^^^
75    |                                |
76    |                                this code causes undefined behavior when executed
77    |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
78    |
79    = note: enums with no variants have no valid value
80
81 error: aborting due to 6 previous errors; 2 warnings emitted
82
83 For more information about this error, try `rustc --explain E0080`.