Skip to content

[WIP] [perf] rustdoc: Fix the rendering and the disguising of the sized hierarchy - #166431

Draft
fmease wants to merge 13 commits into
rust-lang:mainfrom
fmease:rustdoc-sized-hierarchy-overhaul
Draft

fmease wants to merge 13 commits into
rust-lang:mainfrom
fmease:rustdoc-sized-hierarchy-overhaul

Conversation

@fmease

@fmease fmease commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

On main, we always (try to) "disguise" the sized hierarchy .. except this actually only happens for the middle::ty IR1 and not the HIR2 (so while we succeed in disguising it in the std façade we fail to disguise it in core for example).

Under this WIP PR, (the HIR issue is fixed but more crucially) we only disguise it if the feature sized_hierarchy isn't enabled in the local crate or if the crate root declares #![doc(disguise_sized_hierarchy)], a new temporary internal attribute intended to be used in the std library.

Fixes #157247.
Part of #144404.


Likely needs a bunch of perf iterations.
Needs clean up, extra work & tests.

(No LLM was or will be used by me during the entire creation process of this PR)

Footnotes

  1. Inlined cross-crate re-exports and synthetic impls. ↩

  2. Local items including inlined local re-exports. ↩

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 24, 2026
@fmease fmease added the rla-silenced Silences rust-log-analyzer postings to the PR it's added on. label Nov 24, 2026
@fmease

fmease commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

First, let's perf this w/o setting #![doc(disguise_sized_hierarchy)] in the std library.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 24, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
[WIP] [perf] rustdoc: Fix the rendering and the disguising of the sized hierarchy
@fmease fmease added the F-sized_hierarchy `#![feature(sized_hierarchy)]` label Nov 24, 2026
@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 9fab6aa (9fab6aaad26e0d1cebe4f1b5021796fd86df24ac)
Base parent: 20fe935 (20fe935d50367c0ff8872c2ebfa050c5c99d9201)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (9fab6aa): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.0% [-1.3%, -0.1%] 7
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -3.4%, secondary -4.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
-4.3% [-5.6%, -3.4%] 3
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

Cycles

Results (secondary 4.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
6.1% [2.1%, 8.9%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.2% [-3.2%, -3.2%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 463.652s -> 461.994s (-0.36%)
Artifact size: 406.52 MiB -> 405.84 MiB (-0.17%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 24, 2026
@fmease
fmease force-pushed the rustdoc-sized-hierarchy-overhaul branch from 3e259ed to ed97bfd Compare November 24, 2026 20:24
@fmease

fmease commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 24, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
[WIP] [perf] rustdoc: Fix the rendering and the disguising of the sized hierarchy
@fmease

fmease commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Perf'ing in parallel: #146483 (comment).

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 73a1484 (73a1484e062ce1e78ef50ef865ffe0c32d2f001b)
Base parent: 4cedc6b (4cedc6bd576618ca90bc479c67e4ba16892a6188)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (73a1484): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.6%, 0.6%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.2% [1.3%, 3.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.2% [1.3%, 3.1%] 2

Cycles

Results (secondary 1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.2% [1.3%, 5.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-2.5%, -2.5%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 461.503s -> 463.506s (0.43%)
Artifact size: 406.39 MiB -> 405.66 MiB (-0.18%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 25, 2026

This branch has not been deployed

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-json Area: Rustdoc JSON backend F-sized_hierarchy `#![feature(sized_hierarchy)]` rla-silenced Silences rust-log-analyzer postings to the PR it's added on. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc: Actually render the new sizedness bounds if sized_hierarchy is enabled unless #![doc(dont_leak_sized_hierarchy)] (to be used in the stdlib)

3 participants