rust/tests/fail/function_pointers/deref_fn_ptr.rs
2022-07-11 11:48:56 +00:00

9 lines
179 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);
}