rust/tests/compile-fail/execute_memory.rs

10 lines
213 B
Rust
Raw Normal View History

#![feature(box_syntax)]
2016-06-13 12:29:01 +02:00
2016-08-27 01:44:46 -06:00
fn main() {
let x = box 42;
2016-06-13 12:29:01 +02:00
unsafe {
let f = std::mem::transmute::<Box<i32>, fn()>(x);
f() //~ ERROR: tried to treat a memory pointer as a function pointer
2016-06-13 12:29:01 +02:00
}
}