rust/tests/fail/function_pointers/deref_fn_ptr.rs
2022-06-27 21:22:46 -04:00

9 lines
178 B
Rust

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