Skip to content

rustdoc: don't link doc(hidden) associated type projections#157438

Open
qaijuang wants to merge 2 commits into
rust-lang:mainfrom
qaijuang:rustdoc-hidden-assoc-type-link
Open

rustdoc: don't link doc(hidden) associated type projections#157438
qaijuang wants to merge 2 commits into
rust-lang:mainfrom
qaijuang:rustdoc-hidden-assoc-type-link

Conversation

@qaijuang
Copy link
Copy Markdown
Contributor

@qaijuang qaijuang commented Jun 4, 2026

Rustdoc renders associated type projections like T::Foo by linking Foo to the containing trait page and appending #associatedtype.Foo.

For #[doc(hidden)] associated types, that anchor is not rendered in normal docs, so this can produce dangling links.

This PR checks the corresponding trait associated item before emitting the projection link.
When the associated type is hidden, rustdoc leaves the projection text plain, accounting for --document-hidden-items as well.

Fixes #151454.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 4, 2026
@qaijuang qaijuang marked this pull request as ready for review June 4, 2026 17:21
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 4, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 4, 2026

r? @notriddle

rustbot has assigned @notriddle.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: rustdoc
  • rustdoc expanded to 9 candidates
  • Random selection from GuillaumeGomez, camelid, lolbinarycat, notriddle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc creates links to doc(hidden) associated type

3 participants