-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest implementing #[derive(PartialEq)]
for types in vectors and arrays
#95371
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
Suggest implementing #[derive(PartialEq)]
for types in vectors and arrays
#95371
Conversation
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
} | ||
} | ||
|
||
if Some(trait_pred.trait_ref.def_id) == self.tcx.lang_items().eq_trait() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave a comment for what this function does? Also a comment explaining the special casing just for Eq
. Alternatively, we could think of some way to generalize this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. In case of PartialOrd
, rustc properly explains why xs
can't be compared with [X, X, X]
.
fn main() {
struct X;
let xs = [X, X, X];
let eq = xs > [X, X, X];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to implement the PartialEq
suggestion by re-using the code for PartialOrd
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I'm going to do it.
☔ The latest upstream changes (presumably #96459) made this pull request unmergeable. Please resolve the merge conflicts. |
@TaKO8Ki any updates on this? |
closes #95285