Skip to content
New issue

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

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

Already on GitHub? # to your account

Check lints related to trait implementations for false-positives if the trait impl is #[doc(hidden)] #762

Open
5 tasks
obi1kenobi opened this issue Apr 18, 2024 · 0 comments
Labels
A-lint Area: new or existing lint C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.

Comments

@obi1kenobi
Copy link
Owner

For example:

pub struct SecretlyIter;

#[doc(hidden)]
impl Iterator for SecretlyIter {
    type Item = i64;

    fn next(&mut self) -> Option<Self::Item> {
        None
    }
}

The fact that SecretlyIter is impl Iterator is not public API. But there is still a hazard, since users may rely on SecretlyIter being impl Iterator indirectly, e.g. by using it in a for loop. Discussion on that here: https://hachyderm.io/@kornel@mastodon.social/112292583897196920

This situation will require some nuance. Tentative plan:

  • Add test cases for various edge cases, to pin down the current behavior of our lints.
  • Make the "trait no longer implemented" lint check that the original impl was public API.
  • Add a new lint for "trait impl stopped being public API".
  • After Lint level control #58, add a new warning-level lint that checks for "trait no longer implemented" ignoring the public API property, narrowed specifically for special traits in the Rust prelude like Iterator.
  • Eliminate any other false-positives, and consider adding more lints if needed, analogously to the above.
@obi1kenobi obi1kenobi added A-lint Area: new or existing lint C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue. labels Apr 18, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lint Area: new or existing lint C-enhancement Category: raise the bar on expectations E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: Mentorship is available for this issue.
Projects
None yet
Development

No branches or pull requests

1 participant