-
Notifications
You must be signed in to change notification settings - Fork 182
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
Fix Self
type retrieval from ProjectionTy
#778
Conversation
The failure for Book lint check seems spurious (network failure). As for Test (nightly), it's failing on this |
For that one doc test, can you just ignore it with comment to unignore when GATs stable? |
Replaced |
@bors r+ Thanks! |
☀️ Test successful - checks-actions |
Two things: - `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder` (rust-lang/chalk#772) - `ProjectionTy::self_type_parameter()` has been removed (rust-lang/chalk#778)
Bump chalk There's a bug in current chalk that prevents us from properly supporting GATs, which is supposed to be fixed in v0.86. Note the following: - v0.86 is only going to be released next Sunday so I'll keep this PR as draft until then. - This doesn't compile without rust-lang/chalk#779, which I hope will be included in v0.86. I confirmed this compiles with it locally. Two breaking changes from v0.84: - `TypeFolder` has been split into `TypeFolder` and `FallibleTypeFolder` (rust-lang/chalk#772) - `ProjectionTy::self_type_parameter()` has been removed (rust-lang/chalk#778)
Fix projection substitution order considering GATs When an `AliasEq` goal contains another alias as its self type, we generate the following clause: `<<X as Y>::A as Z>::B == U :- <T as Z>::B == U, <X as Y>::A == T`, with `T` being a new variable. We've been building `<T as Z>::B` by swapping the first argument in the original projection's substitution with `T`, but it's not the self type when the associated type `B` has generic parameters, leading to wrong subgoals. The added test would yield "No possible solution" in current master. Also removes `ignore` attribute on a doctest that was added in #778 as GATs hit stable. Spotted in rust-lang/rust-analyzer#14164.
As I understand it, a
ProjectionTy
's substitution is in the order of the args for the associated type, and then the args for its parent (i.e. impl or trait).ProjectionTy::self_type_parameter()
has been returning the first type argument in the substitution, which is not theSelf
type its callers would expect when the associated type has its own type parameters.The added test shows the problem: it fails in current master as the recursive solver reports ambiguity after it gets wrong
Self
type and flounders in here. It hasn't been uncovered because all the traits in tests for GATs are not#[non_enumerable]
(and rust-analyzer hasn't implemented GATs yet).