rust/tests/fail/function_pointers/execute_memory.rs
2022-07-08 16:08:32 +00:00

13 lines
305 B
Rust

// Validation makes this fail in the wrong place
//@compile-flags: -Zmiri-disable-validation
#![feature(box_syntax)]
fn main() {
let x = box 42;
unsafe {
let f = std::mem::transmute::<Box<i32>, fn()>(x);
f() //~ ERROR function pointer but it does not point to a function
}
}