-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Superfluous errors for missing lifetime in async function argument #76938
Copy link
Copy link
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-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.
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.Status: This issue has no reproduction and needs a reproduction to make progress.T-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
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).