]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/never_say_never.rs
d7e6a8c09f64e14422881da7af65dddeaaeebe9e
[rust.git] / tests / compile-fail / never_say_never.rs
1 // This should fail even without validation
2 // compile-flags: -Zmiri-disable-validation
3
4 #![feature(never_type)]
5 #![allow(unreachable_code)]
6
7 fn main() {
8     let y = &5;
9     let x: ! = unsafe {
10         *(y as *const _ as *const !)  //~ ERROR entered unreachable code
11     };
12     f(x)
13 }
14
15 fn f(x: !) -> ! { x }