Skip to content

Warn on types that are PartialEq<Self> (Debug, Display, PartialOrd<Self>, Hash) but don't expose dyn PartialEq<dyn Dyncast> (…) #2

@Tamschi

Description

@Tamschi

Is your feature request related to a problem? Please describe.

Currently, it's easy to forget to expose a dyncast target for existing functionality, and this can be a bit tricky to debug.

Describe the solution you'd like

The most clear solution would be an additional attribute #[not_dyncast(…)] that accepts (token literal) types for which there'd otherwise be a warning.

Describe alternatives you've considered

An alternative would be to allow negative targets (i.e. dyn !Trait), but that's less obvious and potentially leads to parsing difficulties once the never-type is available.

Additional context

Specifying a literal type with not_dyncast but also exposing it should be statically checked and turned into a compile-time error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    HacktoberfestA good-for-Hacktoberfest issue. This label is only maintained in October.priority: somedayIf you need this, please let me know!state: approvedApproved to proceed.type: documentationRelated to documentation and information.type: featureBrand new functionality, features, pages, workflows, endpoints, etc.work: clearA known solution is (to be) implemented.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions