rust/tests/compile-fail/never_say_never.rs
2017-09-22 13:24:55 +02:00

16 lines
316 B
Rust

// This should fail even without validation
// compile-flags: -Zmir-emit-validate=0
#![feature(never_type)]
#![allow(unreachable_code)]
fn main() {
let y = &5;
let x: ! = unsafe {
*(y as *const _ as *const !) //~ ERROR tried to access a dead local variable
};
f(x)
}
fn f(x: !) -> ! { x }