]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/never_transmute_void.rs
2a822ab1b5150582caba2b47c578fc621f68097c
[rust.git] / tests / compile-fail / never_transmute_void.rs
1 // This should fail even without validation
2 // compile-flags: -Zmiri-disable-validation
3
4 #![feature(never_type)]
5 #![allow(unused, invalid_value)]
6
7 enum Void {}
8
9 fn f(v: Void) -> ! {
10     match v {} //~ ERROR  entering unreachable code
11 }
12
13 fn main() {
14     let v: Void = unsafe {
15         std::mem::transmute::<(), Void>(())
16     };
17     f(v); //~ inside call to `f`
18 }