rust-lang / rust-lang/rust

Public type alias to private or doc(hidden) type only shows impls written in terms of alias

Open
#152,445 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Code

mod private {
    #[derive(Clone, Copy)]
    pub struct Public<T>(T);
}

pub type A<T> = private::Public<Vec<T>>;
impl<T> private::Public<T> { pub fn f() {} }
impl<T> private::Public<Vec<T>> { pub fn g() {} }

impl<T> A<T> {
    pub fn h() {}
}

Reproduction Steps

  • cargo doc --open and observe the documentation for A

Expected Outcome

All of f, g, and h, as well as the implementations of Clone and Copy get shown on the page.

Actual Output

Only the h function is shown in the documentation.

Version

rustdoc 1.95.0-nightly (366a1b93e 2026-02-03)

Additional Details

In my testing, the behavior differs significantly from the rules documented for pub use re-exports, which I initially expected to apply. Ideally, the behavior would be the same between the two, or at least provided similar amounts of control.

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 snippet with cargo doc --open and compare the generated documentation for A with the expected methods and trait implementations. Trace rustdoc's handling of public type aliases to private or doc(hidden) types; done means f, g, h, Clone, and Copy are all shown as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
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.