rust/tests/run-pass/cast_fn_ptr.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
158 B
Rust

fn main() {
fn f(_: *const u8) {}
let g = unsafe {
std::mem::transmute::<fn(*const u8), fn(*const i32)>(f)
};
g(&42 as *const _);
}