Skip to content

rustdoc: Fix sidebar heading order - #158085

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
tyilo:fix-sidebar-heading-order
Jul 8, 2026
Merged

rustdoc: Fix sidebar heading order#158085
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
tyilo:fix-sidebar-heading-order

Conversation

@tyilo

@tyilo tyilo commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Makes sidebar heading order match the order of the headings in the main content.

@rustbot rustbot added 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. labels Jun 18, 2026
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

r? @lolbinarycat

rustbot has assigned @lolbinarycat.
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

@rust-log-analyzer

This comment has been minimized.

@lolbinarycat

Copy link
Copy Markdown
Contributor

please provide before/after screenshots, as well as your reasoning for why you believe the previous behavior to be incorrect.

@tyilo
tyilo force-pushed the fix-sidebar-heading-order branch from 5441dce to 2d79bb6 Compare June 19, 2026 06:48
@tyilo

tyilo commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Before

image

Order in sidebar:

  1. Provided Methods
  2. Implementations on Foreign Types
  3. Dyn Compatibility
  4. Implementors

Order in content:

  1. Provided Methods
  2. Dyn Compatibility
  3. Implementations on Foreign Types
  4. Implementors

After

image

Order in sidebar & content:

  1. Provided Methods
  2. Dyn Compatibility
  3. Implementations on Foreign Types
  4. Implementors

Code used:

#![feature(associated_type_defaults)]

pub trait Foo {
    const REQUIRED: bool;
    const PROVIDED: bool = true;

    type REQUIRED;
    type PROVIDED = ();

    fn required() -> Self;
    fn provided() {}
}

// Foreign impl
impl Foo for () {
    const REQUIRED: bool = true;
    type REQUIRED = ();

    fn required() -> Self {
        ()
    }
}

pub struct Bar;

// Impl
impl Foo for Bar {
    const REQUIRED: bool = true;
    type REQUIRED = ();

    fn required() -> Self {
        Self
    }
}

fn main() {
    println!("Hello, world!");
}

@tyilo

tyilo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi @lolbinarycat do you think the explanation is satisfactory?

@lolbinarycat

lolbinarycat commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

The explanation makes sense. The implementation is a bit finicky (adding, then removing and re-adding), but I can't easily think of a nicer way of doing it, so I suppose it's fine.

The one thing I would like to see is a rustdoc-html regression test.

@lolbinarycat

Copy link
Copy Markdown
Contributor

I think it's worth moving this along and just adding the regression test in a followup.

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2d79bb6 has been approved by lolbinarycat

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 7, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
…uwer

Rollup of 19 pull requests

Successful merges:

 - #156016 (view-types: store view types in the AST)
 - #157385 (Enable Enzyme on x86_64-apple)
 - #158179 (std: unconditionally use `preadv`/`pwritev` on AArch64 macOS)
 - #158621 (disallow `extern "custom"` on wasm and spirv targets)
 - #158690 (delegation: support mapping of all arguments with `Self` type)
 - #158696 (Rename some `body_id` to `body_def_id`)
 - #158697 (Fixes for QNX SDP 8)
 - #158760 (Clarify that `LocalKey::try_with` may return `AccessError`)
 - #157801 (Rewrite safety requirements for `Allocator` impls)
 - #158085 (rustdoc: Fix sidebar heading order)
 - #158333 (Fix typetree generation for differentiated functions)
 - #158646 (powerpc64le_unknown_freebsd.rs: link with -lgcc)
 - #158701 ( diagnostics: suggest type annotation for closure params on HRTB FnOnce mismatch)
 - #158791 (Avoid unused braces lint for macro generated arguments)
 - #158802 (Use `ci-mirrors` in `armhf-gnu` for {busybox, ubuntu rootfs} artifacts)
 - #158841 (Avoid final override ICE for RPITIT associated types)
 - #158889 (tests: catch up with LLVM returning f128 on the stack)
 - #158905 (delegation: add constraints to new generic args)
 - #158922 (tests: clean up over-constraint on LLVM feature count)

Failed merges:

 - #158617 (allow mGCA const arguments to fall back to anon consts)
@rust-bors
rust-bors Bot merged commit cae10bd into rust-lang:main Jul 8, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 8, 2026
rust-timer added a commit that referenced this pull request Jul 8, 2026
Rollup merge of #158085 - tyilo:fix-sidebar-heading-order, r=lolbinarycat

rustdoc: Fix sidebar heading order

Makes sidebar heading order match the order of the headings in the main content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

4 participants