Skip to content

Commit

Permalink
Rollup merge of #110877 - compiler-errors:binop-err, r=cjgillot
Browse files Browse the repository at this point in the history
Provide better type hints when a type doesn't support a binary operator

For example, when checking whether `vec![A] == vec![A]` holds, we first evaluate the LHS's ty, then probe for any `PartialEq` implementations for that. If none is found, we report an error by evaluating `Vec<A>: PartialEq<?0>` for fulfillment errors, but the RHS is not yet evaluated and remains an inference variable `?0`!

To fix this, we evaluate the RHS and equate it to that RHS infer var `?0`, so that we are able to provide more detailed fulfillment errors for why `Vec<A>: PartialEq<Vec<A>>` doesn't hold (namely, the nested obligation `A: PartialEq<A>` doesn't hold).

Fixes #95285
Fixes #110867
  • Loading branch information
matthiaskrgr authored Apr 28, 2023
2 parents 9feb315 + 9467bb5 commit b719520
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit b719520

Please sign in to comment.