rust/tests/fail/never_transmute_humans.rs
2022-07-11 11:48:56 +00:00

13 lines
260 B
Rust

// This should fail even without validation
//@compile-flags: -Zmiri-disable-validation
#![feature(never_type)]
struct Human;
fn main() {
let _x: ! = unsafe {
std::mem::transmute::<Human, !>(Human) //~ ERROR: transmuting to uninhabited
};
}