Skip to content

If the book is going to show off enum variant comparison with ==, it also needs to talk about PartialEq #21196

Closed
@bstrie

Description

@bstrie

A cousin to #17967.

The relevant bit of the docs is here: http://doc.rust-lang.org/book/compound-data-types.html#enums

The problem with this is that it's showing off the ability to compare enum variants with ==, which, aside from being something that almost never happens in practice, continually confounds users who expect it to automatically work on enums that they define themselves. That this section of the guide has been a stumbling block for so long (#17675, #18155) should be throwing up red flags by now.

If nothing else, it needs to contain a footnote/link/code comment giving some hint as to PartialEq's existence. If that would be out-of-scope for this chapter, then the section needs to be revised to eliminate the usage of ==.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions