-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-async-closures`async || {}``async || {}`A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
fn main() {
async |_| {};
}
Current output
error[E0282]: type annotations needed
--> src/main.rs:2:15
|
2 | async |_| {};
| ^^ cannot infer type
Desired output
error[E0282]: type annotations needed
--> src/main.rs:2:7
|
2 | async |_| {};
| ^
|
help: consider giving this closure parameter an explicit type
|
2 | async |_: /* Type */| {};
| ++++++++++++
Rationale and extra context
diagnostics for non-async closures are better and already use this improved error
Other cases
Rust Version
1.88.0-nightly
(2025-03-29 1799887bb281d1ab4928)
Anything else?
@rustbot label A-async-closures
Metadata
Metadata
Assignees
Labels
A-async-closures`async || {}``async || {}`A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.