-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lifetime inference fails when construct then returning an instance of a GAT #92836
Comments
Interested in fixing this. I think all we need to do is treat Secondly I might also put up a PR that suggests adding @rustbot claim |
@compiler-errors ah yes, good catch, the second solution does work with In the way I had originally encountered this it didn't work without more nightly features ( |
I don't know if I've looked at this code before. But seems about right. I'm wondering if something like |
This might be a little bit difficult though. When using a concrete struck like I'm not sure how I feel about this tbh. If you can fix it, I'd probably want to get some second thoughts before merging. |
…lision, r=jackh726 Allow eliding GATs in expression position Thoughts on whether this is worthwhile? Fixes rust-lang#92836 r? `@jackh726`
I tried this code:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ad49e24a0e96620b942d3abd23d49549
I expected to see this happen: the lifetime is correctly inferred when using
Instead, this happened: I have to use one of the work arounds described in the linked code.
Swap from GAT lifetime to the trait parameterized by a lifetime it works:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=551e676af610e612a7627661d6c5ca05
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: