Confusing error message with borrows and dyn Error #95404
Labels
A-async-await
Area: Async & Await
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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
dyn
with 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.
_#14r
IDK 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.
The text was updated successfully, but these errors were encountered: