rust/tests/compile-fail/execute_memory.rs
2018-10-19 12:29:49 +02:00

13 lines
328 B
Rust

// Validation makes this fail in the wrong place
// compile-flags: -Zmir-emit-validate=0 -Zmiri-disable-validation
#![feature(box_syntax)]
fn main() {
let x = box 42;
unsafe {
let f = std::mem::transmute::<Box<i32>, fn()>(x);
f() //~ ERROR tried to treat a memory pointer as a function pointer
}
}