-
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
Properly support LUB for ReErased #102943
Conversation
This is needed to properly check obligations on opaque types, since instead of returning ReEmpty, we now return ReErased for unconstrained regions in MIR borrowck.
This comment was marked as duplicate.
This comment was marked as duplicate.
Yeah this is probably the easiest way out of this. I don't think it's a "proper" fix though, but I'm not sure what that would look like. As you said, this almost merits a |
Yeah, we can't do that, since this needs to be a lifetime that we can return in the Other choices like using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with a FIXME comment added referencing the issue. I think its worth merging this now, but it's not the right long-term fix. I can also see a case to actually escalate a bit more and open an issue to actually track a "proper" fix, but I'm not sure.
I'm not really comfortable with this. I believe a more acceptable short-term fix is to instantiate For the long-term fix I imagine wrapping the hidden type with an existential binder and adding sufficient assertions that the existential variables only appear in closure/generator parent substs. |
Yea, I'd also prefer to limit this to just opaque types, so instantiating the
|
…li-obk replace ReErased with fresh region vars in opaque types See inline comments. Prior art rust-lang#102943. cc `@compiler-errors` `@oli-obk` Fixes rust-lang#100267 Fixes rust-lang#101940 Fixes rust-lang#102649 Fixes rust-lang#102510
…li-obk replace ReErased with fresh region vars in opaque types See inline comments. Prior art rust-lang#102943. cc ``@compiler-errors`` ``@oli-obk`` Fixes rust-lang#100267 Fixes rust-lang#101940 Fixes rust-lang#102649 Fixes rust-lang#102510
This is needed to properly check obligations on opaque types, since instead of returning ReEmpty, we now return ReErased for unconstrained regions in MIR borrowck.
This shouldn't be unsafe for now, but it does kinda risk future bugs if we accidentally allow
ReEmpty
to leak into other inference contexts, since LUB would cause an ICE that is very obvious to see otherwise. I'm not really certain how to fix this other than reintroducing aReRootEmpty
region for opaque type inference that properly represents an unconstrained opaque lifetime..cc @oli-obk and @jackh726
not sure which of y'all to request review from, so I flipped a coin and it landed on heads. therefore r? @oli-obk, feel free to reassign though.
Fixes #102649
Fixes #102510
Originally caused by #98559