-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Confusing errors when using Self
variants with lifetimes
#69224
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
FWIW this is still an issue on the latest stable: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=c6da051f190e76b03a995df938a86f2c Also potentially related to #86555, even though the two are not technically the same. We could potentially just allow the version that uses |
Tool-chain version:
Gives (with the self variant):
Is it agreed that this sufficiently explains the lifetimes' issue? |
Honestly? Not really; the key is clarifying that |
Agreed, my apologies I didn't read/study things thoroughly enough. |
Minimal example, imagine that we have the following type:
If the user returns
Self
variants, this fails:But the same code works when you change
Self
toMyCow
!The real error here is that
Self
really representsMyCow<'a>
and notMyCow<'_>
orMyCow<'static>
-, but the errors don't really relay this. Potentially linked issue: #30904 (has been fixed).The text was updated successfully, but these errors were encountered: