rust-lang / rust-lang/rust

Types in `#[doc(hidden)]` module show up under trait implementations

Open
#145,371 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Code

Example in this PR: https://github.com/rust-lang/rust/pull/145335#issuecomment-3182304585

The wtf8 module is hidden, but the linkchecker shows that the implementations of traits for its types are not hidden, leading to dead links.

Reproduction Steps

  1. In non-hidden module, define non-hidden trait
  2. In hidden module, define a type and implement the non-hidden trait
  3. When generating documentation, the implementation of the hidden type will show up on the non-hidden trait, with a dead link

Expected Outcome

Types in hidden modules should be hidden in all cases, including trait implementations.

Workaround

Adding #[doc(hidden)] directly to the types inside the hidden module correctly hides the implementations under the trait. However, this should not be necessary, since the hidden module does not generate documentation for its items.

Version

rustdoc 1.90.0-nightly (430d6eddf 2025-07-25)

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 by reproducing the reported case with rustdoc or cargo doc: a non-hidden trait implemented for a type in a #[doc(hidden)] module. Inspect the generated trait documentation and linkchecker results. Done means the hidden type's trait implementation no longer appears publicly or produces a dead link, without requiring #[doc(hidden)] on the type itself.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.