rust-lang / chalk

An implementation and definition of the Rust trait system using a PROLOG-like logic solver
https://rust-lang.github.io/chalk/book/
Other
1.81k stars 179 forks source link

Fix projection substitution order considering GATs #790

Closed lowr closed 1 year ago

lowr commented 1 year ago

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.

jackh726 commented 1 year ago

@bors r+

bors commented 1 year ago

:pushpin: Commit aa036e6c3b654dd7062aa0e4c2893118f4234bf0 has been approved by jackh726

It is now in the queue for this repository.

bors commented 1 year ago

:hourglass: Testing commit aa036e6c3b654dd7062aa0e4c2893118f4234bf0 with merge e7e15c3f5d0255036b0a7912319c24a46c046c30...

bors commented 1 year ago

:sunny: Test successful - checks-actions Approved by: jackh726 Pushing e7e15c3f5d0255036b0a7912319c24a46c046c30 to master...