about summary refs log tree commit diff
path: root/tests/ui/statics/uninhabited-static.rs
blob: 955d489d3133e569d6707ebeda797bca639397b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![feature(never_type)]
#![deny(uninhabited_static)]

enum Void {}
extern "C" {
    static VOID: Void; //~ ERROR static of uninhabited type
    //~| WARN: previously accepted
    static NEVER: !; //~ ERROR static of uninhabited type
    //~| WARN: previously accepted
}

static VOID2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
//~| WARN: previously accepted
//~| ERROR value of uninhabited type `Void`
static NEVER2: Void = unsafe { std::mem::transmute(()) }; //~ ERROR static of uninhabited type
//~| WARN: previously accepted
//~| ERROR value of uninhabited type `Void`

fn main() {}