rust/tests/compile-fail/deref_fn_ptr.rs
2020-03-19 08:25:08 +01:00

9 lines
184 B
Rust

fn f() {}
fn main() {
let x: u8 = unsafe {
*std::mem::transmute::<fn(), *const u8>(f) //~ ERROR contains a function
};
panic!("this should never print: {}", x);
}