Skip to content

missing_doc should not deny on invisible internal items #9777

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

Closed
dcrewi opened this issue Oct 9, 2013 · 1 comment
Closed

missing_doc should not deny on invisible internal items #9777

dcrewi opened this issue Oct 9, 2013 · 1 comment

Comments

@dcrewi
Copy link
Contributor

dcrewi commented Oct 9, 2013

I expect missing_doc lint to only check that publicly-visible code is documented. The following gets caught by the lint checker when I think that it shouldn't:

#[deny(missing_doc)]

mod internal_impl {
    pub fn secret_sauce() {
        // unstable, messy, or unsafe code
    }
}

pub mod public_interface {
    use super::internal_impl;

    /// I do something.
    pub fn do_something() {
        // [do stuff]
        internal_impl::secret_sauce();
        // [do more stuff]
    }
}
@alexcrichton
Copy link
Member

I agree!

On an implementation note, I would recommend using the results of the analysis from the privacy pass of the compiler instead of trying to re-implement it in a lint pass.

One tricky case to keep in mind is that you may pub use an overall private item, and the item should probably still get documented. i.e.

pub use imp::foo;

mod imp {
    // this should require documentation even though impl::foo isn't a public path
    pub fn foo() {}
}

@bors bors closed this as completed in 1f7eb4f Nov 13, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 1, 2022
Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

fixes rust-lang#9901
fixes rust-lang#9777
changelog: `explicit_auto_deref`: Don't lint when the initial value is neither a reference, nor a receiver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants