Unclear error message on async closure #100755
Labels
A-async-await
Area: Async & Await
A-diagnostics
Area: Messages for errors, warnings, and lints
AsyncAwait-Polish
Async-await issues that are part of the "polish" area
AsyncAwait-Triaged
Async-await issues that have been triaged during a working group meeting.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Trying to setup async closures and it took awhile to figure out what was happening.
It is when types are defined as
Box<dyn Fn() -> (dyn Future<Output = ()>)>
More can be seen here: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7eab934ef04fb7171121c4e4180f7f4d
The current output is:
Above was apparently caused by lack of
Pin<Box<_>>
on the future. Once added it works fine (also on playground link)Would be nice if the error was directing me to the return value of the closure.
The text was updated successfully, but these errors were encountered: