]> git.lizzy.rs Git - rust.git/blob - tests/ui/statics/uninhabited-static.rs
Rollup merge of #106397 - compiler-errors:new-solver-impl-wc, r=lcnr
[rust.git] / tests / ui / statics / uninhabited-static.rs
1 #![feature(never_type)]
2 #![deny(uninhabited_static)]
3
4 enum Void {}
5 extern {
6     static VOID: Void; //~ ERROR static of uninhabited type
7     //~| WARN: previously accepted
8     static NEVER: !; //~ ERROR static of uninhabited type
9     //~| WARN: previously accepted
10 }
11
12 static VOID2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
13 //~| WARN: previously accepted
14 //~| ERROR could not evaluate static initializer
15 //~| WARN: type `Void` does not permit zero-initialization
16 static NEVER2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
17 //~| WARN: previously accepted
18 //~| ERROR could not evaluate static initializer
19 //~| WARN: type `Void` does not permit zero-initialization
20
21 fn main() {}