Code
fn foo(_: impl AsyncFn(&mut i32)) {}
fn main() {
foo(|_: i32| async {});
}
Current output
error[E0631]: type mismatch in closure arguments
--> src/main.rs:4:5
|
4 | foo(|_: i32| async {});
| ^^^^--------^^^^^^^^^^
| | |
| | found signature defined here
| expected due to this
|
= note: expected closure signature `for<'a> fn((&'a mut _,)) -> _`
found closure signature `fn((_,)) -> _`
note: required by a bound in `foo`
--> src/main.rs:1:16
|
1 | fn foo(_: impl AsyncFn(&mut i32)) {}
| ^^^^^^^^^^^^^^^^^ required by this bound in `foo`
For more information about this error, try `rustc --explain E0631`.
Desired output
Rationale and extra context
I don't know why the argument is put into a tuple in the diagnostic.
Other cases
Rust Version
Reproducible on the playground with version 1.97.0-nightly (2026-04-21 9ec5d5f32e19d250c7fb)
Anything else?
No response
Code
Current output
Desired output
Rationale and extra context
I don't know why the argument is put into a tuple in the diagnostic.
Other cases
Rust Version
Anything else?
No response