rust/tests/compile-fail/cast_fn_ptr2.rs
Ralf Jung 99433a1ffd improve fn pointer signature check to allow some casts that should be permitted
Also properly check the "non-capturing Fn to fn" case
2017-05-30 10:41:38 -07:00

10 lines
240 B
Rust

fn main() {
fn f(_ : (i32,i32)) {}
let g = unsafe {
std::mem::transmute::<fn((i32,i32)), fn(i32)>(f)
};
g(42) //~ ERROR tried to call a function with sig fn((i32, i32)) through a function pointer of type fn(i32)
}