rust-lang / rust-lang/rust

rustdoc: sidebar generation code duplicates logic

Open
#138,576 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-cleanup T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I recently discovered this in https://github.com/rust-lang/rust/pull/138574, when I fixed the bug for the main page, but the erroneous items were still in the sidebar.

If we simply collected a list of sidebar items during rendering of the main page, almost the entirety of sidebar.rs could be removed. This could even be done incrementally, with each sidebar_* function being replaced with a field on Context.

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 in sidebar.rs and trace the main-page rendering path described in the issue. Compare how sidebar items are produced with the proposed collection during main-page rendering, then identify a sidebar_* function that can be replaced by a Context field. Done means the duplicated sidebar logic is removed incrementally and the sidebar no longer retains the erroneous items described in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.