rust/tests/compile-fail/execute_memory.rs

11 lines
243 B
Rust
Raw Normal View History

#![feature(box_syntax)]
2016-06-13 05:29:01 -05:00
// FIXME: This span is wrong.
fn main() { //~ ERROR: tried to treat a memory pointer as a function pointer
let x = box 42;
2016-06-13 05:29:01 -05:00
unsafe {
let f = std::mem::transmute::<Box<i32>, fn()>(x);
f()
}
}