-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Suggest swapping LHS and RHS for PartialEq #130495
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Code
Current output
Desired output
For more information about this error, try
rustc --explain E0308.Rationale and extra context
Because
PartialEq<Rhs>is asymmetric,t == sands == tare semantically different ifsandtare different types. Because most people view==as being a symmetric operation, this could lead to confusion ifTimplementsPartialEq<S>butSdoes not implementPartialEq<T>. Thus, providing a hint that swapping the LHS and RHS of the equality operator could elucidate why the error is occurring.Other cases
No response
Rust Version
rustc 1.81.0 (eeb90cd 2024-09-04)
binary: rustc
commit-hash: eeb90cd
commit-date: 2024-09-04
host: x86_64-unknown-linux-gnu
release: 1.81.0
LLVM version: 18.1.7
Anything else?
No response