gen fn
with lifetime issue yields nonsensical suggestion
#130942
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
Godbolt link
The correct suggestion would be to suggest
&'a Value<'a>
asf
’s return type (or no suggestion at all).Additionally, I don’t understand why this is an error in the first place? Given that
Self
contains lifetime'a
, the elided lifetime of&self
must clearly be outlived by'a
? For reference, this works when directly returning&'a Value
without a generator (Godbolt link):Tracking issue: #117078
Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: