Superfluous errors for missing lifetime in async function argument #76938
Labels
A-async-await
Area: Async & Await
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.
D-verbose
Diagnostics: Too much output caused by a single piece of incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In the example below (which is a little convoluted -- sorry, I already spent quite a bit reducing it), I'm getting what amounts to three compiler errors. But, when I fix the cause of the first error by applying the suggested fix, the other two errors go away. It feels like the compiler could be smarter about this and only throw the first diagnostic.
I tried this code:
(Playground.)
This is the compiler output I got:
I expected to see this happen: it would be nice if I only got the first error (E0726). It seems like the compiler is substituting some placeholder lifetime in place of the missing lifetime which is making things worse, causing the two other errors. It seems reasonable to replace missing lifetimes with
'_
instead (especially if that's the suggested fix anyway) instead, which would make the other errors go away and makes it easier to focus on the actual problem. For this particular case, I also find the second and third error highly opaque and not very actionable.Meta
The same thing happens on both current stable (1.46.0) and latest nightly (rustc 1.48.0-nightly bbc6774 2020-09-18).
The text was updated successfully, but these errors were encountered: