rust/tests/compile-fail/never_transmute_humans.rs

13 lines
257 B
Rust
Raw Normal View History

2018-05-09 10:30:16 -05:00
// This should fail even without validation
// compile-flags: -Zmiri-disable-validation
2018-05-09 10:30:16 -05:00
#![feature(never_type)]
struct Human;
fn main() {
let _x: ! = unsafe {
2019-04-21 06:18:05 -05:00
std::mem::transmute::<Human, !>(Human) //~ ERROR entered unreachable code
2018-05-09 10:30:16 -05:00
};
}