Closed lowr closed 1 year ago
@bors r+
:pushpin: Commit db746e092a30eec47eb31f939cbf221fed95e377 has been approved by jackh726
It is now in the queue for this repository.
:lock: Merge conflict
This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.
:umbrella: The latest upstream changes (presumably #780) made this pull request unmergeable. Please resolve the merge conflicts.
@bors r+
:pushpin: Commit 91c24e391eab2c717398dccb97162206c90b450a has been approved by jackh726
It is now in the queue for this repository.
:hourglass: Testing commit 91c24e391eab2c717398dccb97162206c90b450a with merge 88fd1c21e39fd17933d1965c2b986446c3e1822d...
:sunny: Test successful - checks-actions Approved by: jackh726 Pushing 88fd1c21e39fd17933d1965c2b986446c3e1822d to master...
Consider a goal:
AliasEq(<<?0 as X>::A as Y>::B = <<?1 as X>::A as Y>::B)
. This is expected to (eventually) flounder when the traits are non-enumerable and the variables are yet to be known, but it's currently disproven:forall<T, U> AliasEq(<<T as X>::A as Y>::B = <<U as X>::A as Y>::B)
ProgramClause
that could match:forall<T, U, ..> AliasEq(<<T as X>::A as Y>::B = <<U as X>::A as Y>::B) :- AliasEq(..), AliasEq(..)
AliasEq(<<?0 as X>::A as Y>::B = <<?1 as X>::A as Y>::B)
AliasEq
, we see twoAliasTy
s that we cannot unify structurally, forcing us to produce the subgoalThe problem is that because we're reusing the original goal as the consequence of the program clause we expect them to unify structurally, however we cannot unify aliases structurally in general (e.g.
<?0 as X>::A = <?1 as X>::A
does not imply?0 = ?1
).This PR solves it by placing a fresh variable in rhs of the consequence
AliasEq
instead of reusing the original term. This ensures that rhs of the originalAliasEq
goal is preserved via unification without producing subgoals even if it's an alias.See rust-lang/rust-analyzer#14369 for a real world case where this issue arises.