rust/tests/compile-fail/never_say_never.rs

15 lines
284 B
Rust
Raw Normal View History

2017-09-22 06:21:30 -05:00
// This should fail even without validation
// compile-flags: -Zmiri-disable-validation
2017-09-22 06:21:30 -05:00
#![allow(unreachable_code)]
fn main() {
let y = &5;
let x: ! = unsafe {
2018-10-19 04:50:17 -05:00
*(y as *const _ as *const !) //~ ERROR entered unreachable code
};
f(x)
}
fn f(x: !) -> ! { x }