Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tamschi opened this issue Sep 29, 2021 · 2 comments
Labels
Hacktoberfest A good-for-Hacktoberfest issue. This label is only maintained in October. priority: someday If you need this, please let me know! state: approved Approved to proceed. type: documentation Related to documentation and information. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. work: clear A known solution is (to be) implemented.

Comments

@Tamschi
Copy link
Owner

Tamschi commented Sep 29, 2021

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.

@Tamschi Tamschi added type: documentation Related to documentation and information. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. state: approved Approved to proceed. priority: someday If you need this, please let me know! labels Sep 29, 2021
@Tamschi
Copy link
Owner Author

Tamschi commented Oct 1, 2021

A few hints for Hacktoberfest:

@Tamschi Tamschi added Hacktoberfest A good-for-Hacktoberfest issue. This label is only maintained in October. work: clear A known solution is (to be) implemented. labels Oct 1, 2021
@Tamschi Tamschi changed the title Warn on types that are PartialEq<Self> but don't expose dyn PartialEq<dyn Dyncast>, and so on Warn on types that are PartialEq<Self> (Debug, Display, PartialOrd<Self>, Hash) but don't expose dyn PartialEq<dyn Dyncast> (…) Oct 1, 2021
@Tamschi
Copy link
Owner Author

Tamschi commented Oct 1, 2021

Hacktober Hint: I also accept PRs that solve part of the issue here, as long as at least one case is thoroughly covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest A good-for-Hacktoberfest issue. This label is only maintained in October. priority: someday If you need this, please let me know! state: approved Approved to proceed. type: documentation Related to documentation and information. type: feature Brand new functionality, features, pages, workflows, endpoints, etc. work: clear A known solution is (to be) implemented.
Projects
None yet
Development

No branches or pull requests

1 participant