rust/tests/fail/never_say_never.rs
2022-07-11 11:48:56 +00:00

18 lines
313 B
Rust

// This should fail even without validation
//@compile-flags: -Zmiri-disable-validation
#![feature(never_type)]
#![allow(unreachable_code)]
fn main() {
let y = &5;
let x: ! = unsafe {
*(y as *const _ as *const !) //~ ERROR: entering unreachable code
};
f(x)
}
fn f(x: !) -> ! {
x
}