rust/tests/fail/function_pointers/deref_fn_ptr.rs
2022-06-01 10:53:38 -04: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);
}