mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
87e1447aad
On Fn arg mismatch for a fn path, suggest a closure When encountering a fn call that has a path to another fn being passed in, where an `Fn` impl is expected, and the arguments differ, suggest wrapping the argument with a closure with the appropriate arguments. The last `help` is new: ``` error[E0631]: type mismatch in function arguments --> $DIR/E0631.rs:9:9 | LL | fn f(_: u64) {} | ------------ found signature defined here ... LL | foo(f); | --- ^ expected due to this | | | required by a bound introduced by this call | = note: expected function signature `fn(usize) -> _` found function signature `fn(u64) -> _` note: required by a bound in `foo` --> $DIR/E0631.rs:3:11 | LL | fn foo<F: Fn(usize)>(_: F) {} | ^^^^^^^^^ required by this bound in `foo` help: consider wrapping the function in a closure | LL | foo(|arg0: usize| f(/* u64 */)); | +++++++++++++ +++++++++++ ``` |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl |