I have the following code (Playground):
// Two dummy functions, both with the signature `fn(u32) -> bool`
fn foo(
Each named function has a distinct type since Rust PR #19891 was merged. You can, however, cast the functions to the corresponding function pointer type with the as
operator.
call_both(foo as fn(u32) -> bool, bar as fn(u32) -> bool);
It's also valid to cast only the first of the functions: the cast will be inferred on the second, because both functions must have the same type.
call_both(foo as fn(u32) -> bool, bar);