]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/cast_box_int_to_fn_ptr.rs
Auto merge of #852 - lzutao:rustup, r=RalfJung
[rust.git] / tests / compile-fail / cast_box_int_to_fn_ptr.rs
1 // Validation makes this fail in the wrong place
2 // compile-flags: -Zmiri-disable-validation
3
4 fn main() {
5     let b = Box::new(42);
6     let g = unsafe {
7         std::mem::transmute::<&Box<usize>, &fn(i32)>(&b)
8     };
9
10     (*g)(42) //~ ERROR tried to treat a memory pointer as a function pointer
11 }