rust/tests/compile-fail/never_transmute_void.rs
2017-01-12 11:23:44 +01:00

17 lines
271 B
Rust

#![feature(never_type)]
#![allow(unreachable_code)]
#![allow(unused_variables)]
enum Void {}
fn f(v: Void) -> ! {
match v {}
}
fn main() {
let v: Void = unsafe {
std::mem::transmute::<(), Void>(()) //~ ERROR entered unreachable code
};
f(v);
}