Skip to content

duplicated errors for invalid derives #34229

Closed
@durka

Description

@durka

This code attempts to derive PartialOrd in an invalid situation, and is rewarded with a barrage of duplicate errors:

#[derive(PartialEq)] struct Comparable;
#[derive(PartialEq, PartialOrd)] struct Nope(Comparable);

The error the trait core::cmp::PartialOrd is not implemented for the type Comparable only appears once. However, the error binary operation < cannot be applied to type Comparable (along with note an implementation of std::cmp::PartialOrd might be missing for Comparable... gee, really?) appears eight times, four for < and four for >.

I assume this is because an error is generated at several points within the (invisible) generated PartialOrd implementation. But since they are all assigned the same span, maybe we can deduplicate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions