rust-lang / rust-lang/rust

rustdoc ui doesn't show associated types for folded summaries of trait implementations

Open
#142,782 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-rustdoc-ui C-feature-request T-rustdoc-frontend
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

For traits like Iterator or Future, it's essential to know what is their associated type. However, lists of trait implementations can be folded into a summary, and the summary hides the associated type.

The detailed list of trait implementations for a type can be quite long, so it's easier to scan it with all items folded into summaries (using top-right summary button). That makes the trait implementations also less informative:

impl Iterator for Foo

type Item = Bar

I think the summaries could be made more useful by including the associated type in the summary somehow:

impl Iterator for Foo // Item = Bar

and the redundant annotation can be hidden when the details are expanded, with a bit of CSS trickery:

<style>
    details[open] > summary span {
        display: none;
    }
</style>
<details>
    <summary>impl Iterator for Foo <span>// Item = Bar</span></summary>
    type Item = Bar
</details>

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 locating the rustdoc UI code that builds folded summaries for trait implementations and inspect how associated types are rendered in the expanded details. Add the associated type to folded summaries while keeping the expanded view free of redundant text, then verify the resulting HTML and styling against the Iterator or Future example described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.