Skip to content

rustdoc: Please use sticky headers for impl blocks #133506

Description

@joshtriplett

If you have a long rustdoc page with different impl blocks for the same type, such as https://doc.rust-lang.org/1.82.0/std/primitive.slice.html , each of which has various methods, it's really easy to lose track of which impl block a method is in.

I'd love to see rustdoc use "sticky" headings for impl blocks, which stay visible while scrolling through the contents of the impl block, and scroll away when past that impl block. This should be possible with a bit of CSS (no JavaScript required).

This came up when discussing some methods we wanted to add to [MaybeUninit<T>].

Activity

  1. added
    A-rustdoc-uiArea: Rustdoc UI (generated HTML)
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
    on Nov 26, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 26, 2024
  3. added
    C-enhancementCategory: An issue proposing an enhancement or a PR with one.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Nov 26, 2024
  4. RalfJung commented on Dec 1, 2024

    @RalfJung
    Member

    Oh yes that would be amazing. Currently it can actually be quite hard to figure out what the type of self is when looking at a method in rustdoc.

    Cc @rust-lang/rustdoc

  5. GuillaumeGomez commented on Dec 1, 2024

    @GuillaumeGomez
    Member

    It's a very good idea. Gonna add that.

  6. GuillaumeGomez commented on Dec 1, 2024

    @GuillaumeGomez
    Member

    Opened #133717.

  7. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-uiArea: Rustdoc UI (generated HTML)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.T-rustdoc-frontendRelevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions