Skip to content

Commit

Permalink
Updated the fix for rust-lang#85845
Browse files Browse the repository at this point in the history
 - Made the check stricter.
**Note: I've checked and there is no other trait that can be possibly passed than std ones. (BinOps) so there is no need for a `can_derive` or something similar. Furthermore, this mean we can't pass another thing than a str.**
  • Loading branch information
ccgauche committed Aug 1, 2021
1 parent 518f643 commit 01996be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ fn suggest_impl_missing(err: &mut DiagnosticBuilder<'_>, ty: Ty<'_>, missing_tra
missing_trait, ty
));
// This checks if the missing trait is PartialEq to suggest adding a derive
if missing_trait.ends_with("PartialEq") {
if missing_trait.ends_with("std::cmp::PartialEq") {
err.note(&format!(
"add `#[derive(PartialEq)]` or manually implement `PartialEq` for `{}`",
ty
Expand Down

0 comments on commit 01996be

Please sign in to comment.