]> git.lizzy.rs Git - rust.git/blob - src/tools/miri/tests/fail/function_pointers/cast_box_int_to_fn_ptr.rs
Rollup merge of #100006 - jyn514:update-copy, r=dtolnay
[rust.git] / src / tools / miri / tests / fail / function_pointers / 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 { std::mem::transmute::<&Box<usize>, &fn(i32)>(&b) };
7
8     (*g)(42) //~ ERROR: it does not point to a function
9 }