rust-lang / rust-lang/rust

Rustdoc is showing definitions of "private" types in type def documentation

Open
#142,019 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-local-reexports A-visibility C-bug S-has-mcve T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

https://github.com/diesel-rs/diesel/commit/116e8686aea1fcd0d488e293a2887c31aa805d78

cargo +nightly doc --open -p diesel --no-deps

Search for diesel::dsl::Eq afterwards to get to this page

I expected to see this happen: Rustdoc hides the aliased type + tuple field sections as the Grouped by type is not exposed as part of the public API. (That type is in a crate local module)

Instead, this happened: Rustdoc shows information about private types.

Meta

rustdoc --version --verbose:

rustdoc 1.89.0-nightly (59aa1e873 2025-06-03)
binary: rustdoc
commit-hash: 59aa1e873028948faaf8b97e5e02d4db340ad7b1
commit-date: 2025-06-03
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5

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

Reproduce the report using Diesel commit 116e8686aea1fcd0d488e293a2887c31aa805d78 and cargo +nightly doc --open -p diesel --no-deps, then inspect the diesel::dsl::Eq page. Trace rustdoc's visibility handling for the aliased type and tuple fields; done means private Grouped details are no longer shown while public type documentation remains available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.