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