Skip to content

Suggest #[derive(PartialEq)] on E0369 #85845

Closed
@estebank

Description

@estebank

When PartialEq isn't implemented for a type, like this

error[E0369]: binary operation `==` cannot be applied to type `&Group`
  --> src/tests/a.rs:19:5
   |
19 |     assert_eq!(result.unwrap(), &group);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     &Group
   |     &Group
   |
   = note: an implementation of `std::cmp::PartialEq` might be missing for `&Group`
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

We should suggest #[derive(PartialEq)] on the appropriate type if possible.

Taken from https://blog.frankel.ch/start-rust/1/

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.D-papercutDiagnostics: An error or lint that needs small tweaks.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions