]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/execute_memory.rs
Merge pull request #21 from oli-obk/function_pointers2
[rust.git] / tests / compile-fail / execute_memory.rs
1 #![feature(custom_attribute, box_syntax)]
2 #![allow(dead_code, unused_attributes)]
3
4 #[miri_run]
5 fn deref_fn_ptr() {
6     //FIXME: this span is wrong
7     let x = box 42; //~ ERROR: tried to treat a memory pointer as a function pointer
8     unsafe {
9         let f = std::mem::transmute::<Box<i32>, fn()>(x);
10         f()
11     }
12 }
13
14 fn main() {}