rust/tests/fail/never_say_never.rs

18 lines
313 B
Rust
Raw Normal View History

2017-09-22 06:21:30 -05:00
// This should fail even without validation
2022-07-08 11:08:32 -05:00
//@compile-flags: -Zmiri-disable-validation
2017-09-22 06:21:30 -05:00
#![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
}