rust-lang / rust-lang/rust

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

Open
#140,784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-bug L-missing_docs T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Rust reproducer using #[doc(hidden)], #[doc(inline)], and deny(missing_docs), then trace how the compiler handles the reexport and lint. Done means the publicly inlined Foo no longer hides the undocumented bar field, with regression coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.