rust/tests/compile-fail/never_transmute_void.rs

17 lines
271 B
Rust
Raw Normal View History

2017-01-12 04:23:44 -06:00
#![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);
}