-
Notifications
You must be signed in to change notification settings - Fork 13.3k
enforce WF conditions after generalizing #41716
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
Conversation
☔ The latest upstream changes (presumably #41773) made this pull request unmergeable. Please resolve the merge conflicts. |
Got back from holidays. Had a fun week. This looks like a rather brutal fix. As for concrete worries, I was worried that we might create wf obligations "inside" an higher-ranked binder, and that would cause trouble, but I don't think we ever do subtyping in a higher-ranked context right now? |
Brutal as in "brute force"?
I don't think that would be a problem. It's not that we don't do subtyping in a higher-ranked context. Rather, it's that we protect against skolemized regions "escaping" into instantiated type variables. If we did instantiate some type variable with something that includes skolemized regions --- or with region variables that wind up related to skolemized variables --- that would be detected during the leak-check. Since we only ever create the (As an aside, I am, though, actively planning how to overhaul that system right now to make it more robust, roughly in the manner that we talked about.) |
This is basically a hack around bivariance not being implemented properly, but let's go for it (r+ modulo conflict fix). |
The new messages seem universally better. I think these result because we recognize that we are in an invariant context more often.
@bors r=arielb1 |
📌 Commit 2490ee5 has been approved by |
enforce WF conditions after generalizing Add a `WF(T')` obligation after generalizing `T` to `T'`, if `T'` contains an unconstrained type variable in a bivariant context. Fixes rust-lang#41677. Beta nominating -- regression. r? @arielb1
enforce WF conditions after generalizing Add a `WF(T')` obligation after generalizing `T` to `T'`, if `T'` contains an unconstrained type variable in a bivariant context. Fixes rust-lang#41677. Beta nominating -- regression. r? @arielb1
☀️ Test successful - status-appveyor, status-travis |
Doesn't cherry-pick cleanly cc @nikomatsakis |
Accepting for backport. cc @rust-lang/compiler |
Add a
WF(T')
obligation after generalizingT
toT'
, ifT'
contains an unconstrained type variable in a bivariant context.Fixes #41677.
Beta nominating -- regression.
r? @arielb1