-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Confusing error message with borrows and dyn Error #95404
Copy link
Copy link
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.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 lintsA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.Async-await issues that have been triaged during a working group meeting.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.
Given the following code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=06baecf9bfb364dbe030e6009f2316f9
The current output is:
Ideally the output should look like:
I'm not really sure. I actually don't get why this is an error? If I remove any one of those arguments it works. I think this is a combination of
dynwith async and multiple references, although weirdly if there's only one &str it compiles... idk!Things that are confusing:
There is no "impl Future" - it's hidden, but where? I know it's because async desugares to that, but I think that's confusing.
_#14rIDK which lifetime that's referring to. I sort of suspect it's the dyn one.It doesn't tell me what to do
The code to fix this is to add a lifetime:
So ideally it'd suggest that. An anonymous lifetime works too, actually.