Closed
Description
Current docs on PartialEq
derive state:
When derived on enums, each variant is equal to itself and not equal to the other variants.
I interpret the above statement as "PartialEq
compares enum discriminants", which is not the case.
This is true for enums variants with no data, however for enum variants that are struct-like or tuple struct-like, derived PartialEq
actually compares the fields (which is expected) and not just discriminants:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=64530ce03a4506d1e82a1df4d78765ff
Metadata
Metadata
Assignees
Labels
Area: Documentation for any part of the project, including the compiler, standard library, and toolsCategory: PRs that clean code up or issues documenting cleanup.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Relevant to the library API team, which will review and decide on the PR/issue.