]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/cast_int_to_fn_ptr.rs
3000779a93307e8ca3e325e5e694af674670bb79
[rust.git] / tests / compile-fail / cast_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 g = unsafe {
6         std::mem::transmute::<usize, fn(i32)>(42)
7     };
8
9     g(42) //~ ERROR invalid use of 42 as a pointer
10 }