rust/tests/compile-fail/never_transmute_humans.rs

13 lines
259 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)]
2018-05-09 10:30:16 -05:00
struct Human;
fn main() {
let _x: ! = unsafe {
std::mem::transmute::<Human, !>(Human) //~ ERROR transmuting to uninhabited
2018-05-09 10:30:16 -05:00
};
}