Diagnostics request: suggest a closure with an async block when an async closure is encountered #71686
Labels
A-async-await
Area: Async & Await
A-closures
Area: Closures (`|…| { … }`)
A-diagnostics
Area: Messages for errors, warnings, and lints
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
F-async_closure
`#![feature(async_closure)]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Consider the following code (playground):
With the following output:
In many cases moving the
async
keyword fixes the error and is "good enough" despite the differences in semantics, so it would be nice if the compiler could suggest this as well:This is also easy to run into when using futures or stream combinators such as
then
, especially for someone who is not yet very familiar withasync
/await
.The text was updated successfully, but these errors were encountered: