Skip to content

#[doc(hidden)] supresses missing_docs on #[doc(inline)]d reexports #140784

Open
@SLUCHABLUB

Description

@SLUCHABLUB

Hi, I'm sorry if this is not a bug, but I find it weird. The #[doc(hidden)] attribute suppresses the missing_docs lint, which is intended, but it also does it if the item is publicly reexported with #[doc(inline)].

Here is an example:

//! crate docs

#![deny(missing_docs)]

/// foo module docs
pub mod foo {
    #[doc(hidden)]
    /// foo struct docs
    pub struct Foo {
        // not documented!
        pub pub bar: (),
    }
    
    /// baz docs
    pub struct Baz;
}

#[doc(inline)]
pub use foo::Foo;

Foo appears in the docs as if it was defined in the crate root, which is intended. However, some of it has not been documented (the field bar) since deny(missing_docs) was suppressed.

I feel like this goes against the spirit of the missing_docs lint, allowing an undocumented item in the public docs.

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-apple-darwin
release: 1.86.0
LLVM version: 19.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions