Skip to content

rustdoc: Correctness & perf improvements to link-to-definition - #156413

Merged
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
fmease:rustdoc-ltd-improvs
May 14, 2026
Merged

rustdoc: Correctness & perf improvements to link-to-definition#156413
rust-bors[bot] merged 6 commits into
rust-lang:mainfrom
fmease:rustdoc-ltd-improvs

Conversation

@fmease

@fmeasefmease commented May 10, 2026

Copy link
Copy Markdown
Member

Rewrite the way we resolve type-dependent paths (incl. method calls) in SpanMapVisitor. Instead of trying to (re)find the enclosing body owner each time we encounter such a node, potentially calling typeck_body several times per body, keep track of the "active" BodyId in the visitor and cache the corresponding TypeckResults. The "active" BodyId is updated in visit_nested_body (add) and in visit_item (remove).

This fixes a class of ICEs where we tried to look up the definition of type-relative paths located in non-body items nested in bodies, in the overarching body which is never correct. rustdoc@main has a hack to fix this issue for paths specifically found in assoc types in impls.

Fixes#147882. Fixes#147057. Fixes#155327. Fixes#149089. Fixes#150153. Fixes#156418.
Supersedes #147911.


--generate-link-to-definition is not enabled by default, so we can't perf this as is. Instead, I'm benching them against PR #156348 in PR #156355 using the same parent commit for the try-builds. For context, LTD is extremely costly as the perf run for the baseline PR shows: #156348 (comment).

"Absolute results": #156355 (comment).
"Relative results": https://perf.rust-lang.org/compare.html?....

Excerpt of the relative results:

Primary:

BenchmarkProfileScenarioBackendTarget% ChangeSignificance ThresholdSignificance Factor
nalgebra-0.33.0docfullllvmx64-5.82%0.20%29.09x
diesel-2.2.10docfullllvmx64-3.41%0.20%17.05x
image-0.25.6docfullllvmx64-2.03%0.20%10.16x
regex-automata-0.4.8docfullllvmx64-1.94%0.20%9.71x
cargo-0.87.1docfullllvmx64-1.64%0.20%8.21x
clap_derive-4.5.32docfullllvmx64-1.63%0.20%8.14x
cranelift-codegen-0.119.0docfullllvmx64-1.48%0.20%7.41x
syn-2.0.101docfullllvmx64-1.07%0.20%5.35x
ripgrep-14.1.1docfullllvmx64-0.96%0.20%4.78x
stm32f4-0.15.1docfullllvmx64-0.80%0.20%4.01x
serde-1.0.219docfullllvmx64-0.67%0.20%3.33x
hyper-1.6.0docfullllvmx64-0.66%0.20%3.30x
eza-0.21.2docfullllvmx64-0.55%0.20%2.74x
unicode-normalization-0.1.24docfullllvmx64-0.49%0.20%2.45x
serde_derive-1.0.219docfullllvmx64-0.45%0.20%2.26x
typenum-1.18.0docfullllvmx64-0.42%0.20%2.08x
bitmaps-3.2.1docfullllvmx64-0.32%0.20%1.61x

Secondary:

BenchmarkProfileScenarioBackendTarget% ChangeSignificance ThresholdSignificance Factor
deep-vectordocfullllvmx64-23.96%0.20%119.78x
large-workspacedocfullllvmx64-2.16%0.20%10.81x
deeply-nested-multidocfullllvmx64-1.35%0.20%6.75x
serde-1.0.219-threads4docfullllvmx64-0.67%0.20%3.33x
wg-grammardocfullllvmx64-0.32%0.20%1.62x
tt-muncheroptfullllvmx64-0.31%0.20%1.56x

nalgebra-0.33.0:

Query/FunctionTime (%)Time (s)Time deltaExecutionsExecutions deltaHitsHits delta
Totals109.57%2.185-0.138 (-5.9%)1614146-5602 (-0.3%)16983840-1436455 (-7.8%)
typeck_root15.75%0.344-0.105 (-23.4%)1704-954 (-35.9%)393-6758 (-94.5%)
........................

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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 May 10, 2026
@fmease
fmeaseforce-pushed the rustdoc-ltd-improvs branch from 710fac1 to 359b42cCompareMay 10, 2026 19:02
Comment threadsrc/librustdoc/html/render/span_map.rs Outdated
@GuillaumeGomez

Copy link
Copy Markdown
Member

Thanks! Please ping me once ready for review. :)

@rust-log-analyzer

This comment has been minimized.

@fmease
fmeaseforce-pushed the rustdoc-ltd-improvs branch 4 times, most recently from 73d1fc8 to 79a5881CompareMay 12, 2026 20:05
@fmeasefmease changed the title [WIP] rustdoc: Correctness & perf improvements to link-to-definitionrustdoc: Correctness & perf improvements to link-to-definitionMay 12, 2026
@fmease
fmease marked this pull request as ready for review May 12, 2026 20:18
@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 12, 2026
@@ -653,6 +653,15 @@ add the `--scrape-tests` flag.
This flag enables the generation of links in the source code pages which allow the reader
to jump to a type definition.

@fmeasefmeaseMay 12, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just documenting pre-existing behavior.

View changes since the review

type X;
}

pub struct F<T: C>(pub T::X);

@fmeasefmeaseMay 12, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file is no longer necessary. You added this regression test for an ICE I reported during review (#135771 (comment)) but now assoc-items.rs tests this case among myriads of others (see "tag" Item, AssocTy, TypeRelative).

View changes since the review

@fmeasefmeaseMay 12, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superseded by tests/rustdoc-ui/generate-link-to-definition/items-nested-in-bodies.rs

View changes since the review

@fmease

Copy link
Copy Markdown
MemberAuthor

@GuillaumeGomez, ready for review. Best reviewed commit by commit. See the PR description for details about the perf improvements.

@fmeasefmeaseMay 12, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really horrible diff, I'm sorry. I fully replaced this file, better look at the source directly.

View changes since the review

Comment on lines -29 to -31
// These two links must not change and in particular must contain `/derive.`!
//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'

@fmeasefmeaseMay 12, 2026

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already gets tested here:

//@ has - '//a[@href="{{channel}}/core/fmt/macros/derive.Debug.html"]' 'Debug'
//@ has - '//a[@href="{{channel}}/core/cmp/derive.PartialEq.html"]' 'PartialEq'

View changes since the review

@GuillaumeGomez

Copy link
Copy Markdown
Member

This is a much smaller change than I expected. Looks all good to me, thanks! Feel free to r+ if the PR is ready. =D

@fmease

Copy link
Copy Markdown
MemberAuthor

It's ready :) @bors r=GuillaumeGomez rollup (unstable, gated behind flag, perf change not observable)

@rust-bors

rust-borsBot commented May 12, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 79a5881 has been approved by GuillaumeGomez

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@rust-borsrust-borsBot 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 May 12, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 12, 2026
…laumeGomez
rustdoc: Correctness & perf improvements to link-to-definition
Rewrite the way we resolve type-dependent paths (incl. method calls) in `SpanMapVisitor`. Instead of trying to (re)find the enclosing body owner each time we encounter such a node, potentially calling `typeck_body` several times per body, keep track of the "active" `BodyId` in the visitor and cache the corresponding `TypeckResults`. The "active" `BodyId` is updated in `visit_nested_body` (add) and in `visit_item` (remove).
This fixes a class of ICEs where we tried to look up the definition of type-relative paths located in non-body items nested in bodies, in the overarching body which is never correct. rustdoc@main has a hack to fix this issue for paths specifically found in assoc types in impls.
Fixesrust-lang#147882. Fixesrust-lang#147057. Fixesrust-lang#155327. Fixesrust-lang#149089. Fixesrust-lang#150153.
Supersedes rust-lang#147911.
---
`--generate-link-to-definition` is not enabled by default, so we can't perf this as is. Instead, I'm benching them against PR rust-lang#156348 in PR rust-lang#156355 using the same parent commit for the try-builds. For context, LTD is *extremely* costly as the perf run for the baseline PR shows: rust-lang#156348 (comment).
"Absolute results": rust-lang#156355 (comment).
"Relative results": [https://perf.rust-lang.org/compare.html?...](https://perf.rust-lang.org/compare.html?start=68c2bff6cb08a87e59246064a6a9f37098e22c3f&end=78d15de5525370011388c8f63847e873c4de14ed&stat=instructions%3Au).
Excerpt of the relative results:
Primary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
nalgebra-0.33.0 | doc | full | llvm | x64 | -5.82% | 0.20% | 29.09x
diesel-2.2.10 | doc | full | llvm | x64 | -3.41% | 0.20% | 17.05x
image-0.25.6 | doc | full | llvm | x64 | -2.03% | 0.20% | 10.16x
regex-automata-0.4.8 | doc | full | llvm | x64 | -1.94% | 0.20% | 9.71x
cargo-0.87.1 | doc | full | llvm | x64 | -1.64% | 0.20% | 8.21x
clap_derive-4.5.32 | doc | full | llvm | x64 | -1.63% | 0.20% | 8.14x
cranelift-codegen-0.119.0 | doc | full | llvm | x64 | -1.48% | 0.20% | 7.41x
syn-2.0.101 | doc | full | llvm | x64 | -1.07% | 0.20% | 5.35x
ripgrep-14.1.1 | doc | full | llvm | x64 | -0.96% | 0.20% | 4.78x
stm32f4-0.15.1 | doc | full | llvm | x64 | -0.80% | 0.20% | 4.01x
serde-1.0.219 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
hyper-1.6.0 | doc | full | llvm | x64 | -0.66% | 0.20% | 3.30x
eza-0.21.2 | doc | full | llvm | x64 | -0.55% | 0.20% | 2.74x
unicode-normalization-0.1.24 | doc | full | llvm | x64 | -0.49% | 0.20% | 2.45x
serde_derive-1.0.219 | doc | full | llvm | x64 | -0.45% | 0.20% | 2.26x
typenum-1.18.0 | doc | full | llvm | x64 | -0.42% | 0.20% | 2.08x
bitmaps-3.2.1 | doc | full | llvm | x64 | -0.32% | 0.20% | 1.61x
Secondary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
deep-vector | doc | full | llvm | x64 | -23.96% | 0.20% | 119.78x
large-workspace | doc | full | llvm | x64 | -2.16% | 0.20% | 10.81x
deeply-nested-multi | doc | full | llvm | x64 | -1.35% | 0.20% | 6.75x
serde-1.0.219-threads4 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
wg-grammar | doc | full | llvm | x64 | -0.32% | 0.20% | 1.62x
tt-muncher | opt | full | llvm | x64 | -0.31% | 0.20% | 1.56x
nalgebra-0.33.0:
Query/Function | Time (%) | Time (s) | Time delta | Executions | Executions delta | Hits | Hits delta
---|---|---|---|---|---|---|---
Totals | 109.57% | 2.185 | -0.138 (-5.9%) | 1614146 | -5602 (-0.3%) | 16983840 | -1436455 (-7.8%)
typeck_root | 15.75% | 0.344 | -0.105 (-23.4%) | 1704 | -954 (-35.9%) | 393 | -6758 (-94.5%)
...|...|...|...|...|...|...|...
fmease added 3 commits May 13, 2026 03:51
Don't unnecessarily try to obtain the type-dependent definition of callees
in `visit_expr`, just let `visit_qpath` handle callees.
This means that for callees that are
* `Resolved` paths (the majority of callees) we don't try to `typeck` the
enclosing body which should improve perf if the body doesn't contain
any type-dependent definitions.
* actually `TypeRelative` paths we don't resolve them twice (with
slightly different spans)
@fmease
fmeaseforce-pushed the rustdoc-ltd-improvs branch from 79a5881 to 96b43c6CompareMay 13, 2026 01:51
@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-bors

rust-borsBot commented May 13, 2026

Copy link
Copy Markdown
Contributor

⚠️ A new commit 96b43c65c708566e679761ec3a874cef6d50c3b0 was pushed.

This PR was contained in a rollup (#156514), which was closed.

@fmease
fmeaseforce-pushed the rustdoc-ltd-improvs branch from 96b43c6 to e205784CompareMay 13, 2026 01:56
@fmeasefmease added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 13, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

Thanks for the quick update! Looks good to me. :)

@bors r+ rollup

@rust-bors

rust-borsBot commented May 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e205784 has been approved by GuillaumeGomez

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@rust-borsrust-borsBot 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 May 13, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 13, 2026
…laumeGomez
rustdoc: Correctness & perf improvements to link-to-definition
Rewrite the way we resolve type-dependent paths (incl. method calls) in `SpanMapVisitor`. Instead of trying to (re)find the enclosing body owner each time we encounter such a node, potentially calling `typeck_body` several times per body, keep track of the "active" `BodyId` in the visitor and cache the corresponding `TypeckResults`. The "active" `BodyId` is updated in `visit_nested_body` (add) and in `visit_item` (remove).
This fixes a class of ICEs where we tried to look up the definition of type-relative paths located in non-body items nested in bodies, in the overarching body which is never correct. rustdoc@main has a hack to fix this issue for paths specifically found in assoc types in impls.
Fixesrust-lang#147882. Fixesrust-lang#147057. Fixesrust-lang#155327. Fixesrust-lang#149089. Fixesrust-lang#150153. Fixesrust-lang#156418.
Supersedes rust-lang#147911.
---
`--generate-link-to-definition` is not enabled by default, so we can't perf this as is. Instead, I'm benching them against PR rust-lang#156348 in PR rust-lang#156355 using the same parent commit for the try-builds. For context, LTD is *extremely* costly as the perf run for the baseline PR shows: rust-lang#156348 (comment).
"Absolute results": rust-lang#156355 (comment).
"Relative results": [https://perf.rust-lang.org/compare.html?...](https://perf.rust-lang.org/compare.html?start=68c2bff6cb08a87e59246064a6a9f37098e22c3f&end=78d15de5525370011388c8f63847e873c4de14ed&stat=instructions%3Au).
Excerpt of the relative results:
Primary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
nalgebra-0.33.0 | doc | full | llvm | x64 | -5.82% | 0.20% | 29.09x
diesel-2.2.10 | doc | full | llvm | x64 | -3.41% | 0.20% | 17.05x
image-0.25.6 | doc | full | llvm | x64 | -2.03% | 0.20% | 10.16x
regex-automata-0.4.8 | doc | full | llvm | x64 | -1.94% | 0.20% | 9.71x
cargo-0.87.1 | doc | full | llvm | x64 | -1.64% | 0.20% | 8.21x
clap_derive-4.5.32 | doc | full | llvm | x64 | -1.63% | 0.20% | 8.14x
cranelift-codegen-0.119.0 | doc | full | llvm | x64 | -1.48% | 0.20% | 7.41x
syn-2.0.101 | doc | full | llvm | x64 | -1.07% | 0.20% | 5.35x
ripgrep-14.1.1 | doc | full | llvm | x64 | -0.96% | 0.20% | 4.78x
stm32f4-0.15.1 | doc | full | llvm | x64 | -0.80% | 0.20% | 4.01x
serde-1.0.219 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
hyper-1.6.0 | doc | full | llvm | x64 | -0.66% | 0.20% | 3.30x
eza-0.21.2 | doc | full | llvm | x64 | -0.55% | 0.20% | 2.74x
unicode-normalization-0.1.24 | doc | full | llvm | x64 | -0.49% | 0.20% | 2.45x
serde_derive-1.0.219 | doc | full | llvm | x64 | -0.45% | 0.20% | 2.26x
typenum-1.18.0 | doc | full | llvm | x64 | -0.42% | 0.20% | 2.08x
bitmaps-3.2.1 | doc | full | llvm | x64 | -0.32% | 0.20% | 1.61x
Secondary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
deep-vector | doc | full | llvm | x64 | -23.96% | 0.20% | 119.78x
large-workspace | doc | full | llvm | x64 | -2.16% | 0.20% | 10.81x
deeply-nested-multi | doc | full | llvm | x64 | -1.35% | 0.20% | 6.75x
serde-1.0.219-threads4 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
wg-grammar | doc | full | llvm | x64 | -0.32% | 0.20% | 1.62x
tt-muncher | opt | full | llvm | x64 | -0.31% | 0.20% | 1.56x
nalgebra-0.33.0:
Query/Function | Time (%) | Time (s) | Time delta | Executions | Executions delta | Hits | Hits delta
---|---|---|---|---|---|---|---
Totals | 109.57% | 2.185 | -0.138 (-5.9%) | 1614146 | -5602 (-0.3%) | 16983840 | -1436455 (-7.8%)
typeck_root | 15.75% | 0.344 | -0.105 (-23.4%) | 1704 | -954 (-35.9%) | 393 | -6758 (-94.5%)
...|...|...|...|...|...|...|...
rust-borsBot pushed a commit that referenced this pull request May 13, 2026
…uwer
Rollup of 5 pull requests
Successful merges:
- #155521 (Add lint againts invalid runtime symbol definitions)
- #156500 (Privacy: move macros handling to early stage)
- #156413 (rustdoc: Correctness & perf improvements to link-to-definition)
- #156539 (Add `ChildExt::kill_process_group`)
- #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 13, 2026
…laumeGomez
rustdoc: Correctness & perf improvements to link-to-definition
Rewrite the way we resolve type-dependent paths (incl. method calls) in `SpanMapVisitor`. Instead of trying to (re)find the enclosing body owner each time we encounter such a node, potentially calling `typeck_body` several times per body, keep track of the "active" `BodyId` in the visitor and cache the corresponding `TypeckResults`. The "active" `BodyId` is updated in `visit_nested_body` (add) and in `visit_item` (remove).
This fixes a class of ICEs where we tried to look up the definition of type-relative paths located in non-body items nested in bodies, in the overarching body which is never correct. rustdoc@main has a hack to fix this issue for paths specifically found in assoc types in impls.
Fixesrust-lang#147882. Fixesrust-lang#147057. Fixesrust-lang#155327. Fixesrust-lang#149089. Fixesrust-lang#150153. Fixesrust-lang#156418.
Supersedes rust-lang#147911.
---
`--generate-link-to-definition` is not enabled by default, so we can't perf this as is. Instead, I'm benching them against PR rust-lang#156348 in PR rust-lang#156355 using the same parent commit for the try-builds. For context, LTD is *extremely* costly as the perf run for the baseline PR shows: rust-lang#156348 (comment).
"Absolute results": rust-lang#156355 (comment).
"Relative results": [https://perf.rust-lang.org/compare.html?...](https://perf.rust-lang.org/compare.html?start=68c2bff6cb08a87e59246064a6a9f37098e22c3f&end=78d15de5525370011388c8f63847e873c4de14ed&stat=instructions%3Au).
Excerpt of the relative results:
Primary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
nalgebra-0.33.0 | doc | full | llvm | x64 | -5.82% | 0.20% | 29.09x
diesel-2.2.10 | doc | full | llvm | x64 | -3.41% | 0.20% | 17.05x
image-0.25.6 | doc | full | llvm | x64 | -2.03% | 0.20% | 10.16x
regex-automata-0.4.8 | doc | full | llvm | x64 | -1.94% | 0.20% | 9.71x
cargo-0.87.1 | doc | full | llvm | x64 | -1.64% | 0.20% | 8.21x
clap_derive-4.5.32 | doc | full | llvm | x64 | -1.63% | 0.20% | 8.14x
cranelift-codegen-0.119.0 | doc | full | llvm | x64 | -1.48% | 0.20% | 7.41x
syn-2.0.101 | doc | full | llvm | x64 | -1.07% | 0.20% | 5.35x
ripgrep-14.1.1 | doc | full | llvm | x64 | -0.96% | 0.20% | 4.78x
stm32f4-0.15.1 | doc | full | llvm | x64 | -0.80% | 0.20% | 4.01x
serde-1.0.219 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
hyper-1.6.0 | doc | full | llvm | x64 | -0.66% | 0.20% | 3.30x
eza-0.21.2 | doc | full | llvm | x64 | -0.55% | 0.20% | 2.74x
unicode-normalization-0.1.24 | doc | full | llvm | x64 | -0.49% | 0.20% | 2.45x
serde_derive-1.0.219 | doc | full | llvm | x64 | -0.45% | 0.20% | 2.26x
typenum-1.18.0 | doc | full | llvm | x64 | -0.42% | 0.20% | 2.08x
bitmaps-3.2.1 | doc | full | llvm | x64 | -0.32% | 0.20% | 1.61x
Secondary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
deep-vector | doc | full | llvm | x64 | -23.96% | 0.20% | 119.78x
large-workspace | doc | full | llvm | x64 | -2.16% | 0.20% | 10.81x
deeply-nested-multi | doc | full | llvm | x64 | -1.35% | 0.20% | 6.75x
serde-1.0.219-threads4 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
wg-grammar | doc | full | llvm | x64 | -0.32% | 0.20% | 1.62x
tt-muncher | opt | full | llvm | x64 | -0.31% | 0.20% | 1.56x
nalgebra-0.33.0:
Query/Function | Time (%) | Time (s) | Time delta | Executions | Executions delta | Hits | Hits delta
---|---|---|---|---|---|---|---
Totals | 109.57% | 2.185 | -0.138 (-5.9%) | 1614146 | -5602 (-0.3%) | 16983840 | -1436455 (-7.8%)
typeck_root | 15.75% | 0.344 | -0.105 (-23.4%) | 1704 | -954 (-35.9%) | 393 | -6758 (-94.5%)
...|...|...|...|...|...|...|...
This was referenced May 13, 2026
rust-borsBot pushed a commit that referenced this pull request May 13, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #156552 (Clippy subtree update)
- #156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter)
- #156500 (Privacy: move macros handling to early stage)
- #156260 (test: suppress deprecation warning)
- #156413 (rustdoc: Correctness & perf improvements to link-to-definition)
- #156539 (Add `ChildExt::kill_process_group`)
- #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
rust-borsBot pushed a commit that referenced this pull request May 14, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- #156552 (Clippy subtree update)
- #156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter)
- #156500 (Privacy: move macros handling to early stage)
- #156260 (test: suppress deprecation warning)
- #156413 (rustdoc: Correctness & perf improvements to link-to-definition)
- #156539 (Add `ChildExt::kill_process_group`)
- #156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
@rust-bors
rust-borsBot merged commit 0f950ce into rust-lang:mainMay 14, 2026
11 checks passed
@rustbotrustbot added this to the 1.97.0 milestone May 14, 2026
rust-timer added a commit that referenced this pull request May 14, 2026
Rollup merge of #156413 - fmease:rustdoc-ltd-improvs, r=GuillaumeGomez
rustdoc: Correctness & perf improvements to link-to-definition
Rewrite the way we resolve type-dependent paths (incl. method calls) in `SpanMapVisitor`. Instead of trying to (re)find the enclosing body owner each time we encounter such a node, potentially calling `typeck_body` several times per body, keep track of the "active" `BodyId` in the visitor and cache the corresponding `TypeckResults`. The "active" `BodyId` is updated in `visit_nested_body` (add) and in `visit_item` (remove).
This fixes a class of ICEs where we tried to look up the definition of type-relative paths located in non-body items nested in bodies, in the overarching body which is never correct. rustdoc@main has a hack to fix this issue for paths specifically found in assoc types in impls.
Fixes#147882. Fixes#147057. Fixes#155327. Fixes#149089. Fixes#150153. Fixes#156418.
Supersedes #147911.
---
`--generate-link-to-definition` is not enabled by default, so we can't perf this as is. Instead, I'm benching them against PR #156348 in PR #156355 using the same parent commit for the try-builds. For context, LTD is *extremely* costly as the perf run for the baseline PR shows: #156348 (comment).
"Absolute results": #156355 (comment).
"Relative results": [https://perf.rust-lang.org/compare.html?...](https://perf.rust-lang.org/compare.html?start=68c2bff6cb08a87e59246064a6a9f37098e22c3f&end=78d15de5525370011388c8f63847e873c4de14ed&stat=instructions%3Au).
Excerpt of the relative results:
Primary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
nalgebra-0.33.0 | doc | full | llvm | x64 | -5.82% | 0.20% | 29.09x
diesel-2.2.10 | doc | full | llvm | x64 | -3.41% | 0.20% | 17.05x
image-0.25.6 | doc | full | llvm | x64 | -2.03% | 0.20% | 10.16x
regex-automata-0.4.8 | doc | full | llvm | x64 | -1.94% | 0.20% | 9.71x
cargo-0.87.1 | doc | full | llvm | x64 | -1.64% | 0.20% | 8.21x
clap_derive-4.5.32 | doc | full | llvm | x64 | -1.63% | 0.20% | 8.14x
cranelift-codegen-0.119.0 | doc | full | llvm | x64 | -1.48% | 0.20% | 7.41x
syn-2.0.101 | doc | full | llvm | x64 | -1.07% | 0.20% | 5.35x
ripgrep-14.1.1 | doc | full | llvm | x64 | -0.96% | 0.20% | 4.78x
stm32f4-0.15.1 | doc | full | llvm | x64 | -0.80% | 0.20% | 4.01x
serde-1.0.219 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
hyper-1.6.0 | doc | full | llvm | x64 | -0.66% | 0.20% | 3.30x
eza-0.21.2 | doc | full | llvm | x64 | -0.55% | 0.20% | 2.74x
unicode-normalization-0.1.24 | doc | full | llvm | x64 | -0.49% | 0.20% | 2.45x
serde_derive-1.0.219 | doc | full | llvm | x64 | -0.45% | 0.20% | 2.26x
typenum-1.18.0 | doc | full | llvm | x64 | -0.42% | 0.20% | 2.08x
bitmaps-3.2.1 | doc | full | llvm | x64 | -0.32% | 0.20% | 1.61x
Secondary:
Benchmark | Profile | Scenario | Backend | Target | % Change | Significance Threshold | Significance Factor
---|---|---|---|---|---|---|---
deep-vector | doc | full | llvm | x64 | -23.96% | 0.20% | 119.78x
large-workspace | doc | full | llvm | x64 | -2.16% | 0.20% | 10.81x
deeply-nested-multi | doc | full | llvm | x64 | -1.35% | 0.20% | 6.75x
serde-1.0.219-threads4 | doc | full | llvm | x64 | -0.67% | 0.20% | 3.33x
wg-grammar | doc | full | llvm | x64 | -0.32% | 0.20% | 1.62x
tt-muncher | opt | full | llvm | x64 | -0.31% | 0.20% | 1.56x
nalgebra-0.33.0:
Query/Function | Time (%) | Time (s) | Time delta | Executions | Executions delta | Hits | Hits delta
---|---|---|---|---|---|---|---
Totals | 109.57% | 2.185 | -0.138 (-5.9%) | 1614146 | -5602 (-0.3%) | 16983840 | -1436455 (-7.8%)
typeck_root | 15.75% | 0.344 | -0.105 (-23.4%) | 1704 | -954 (-35.9%) | 393 | -6758 (-94.5%)
...|...|...|...|...|...|...|...
@fmease
fmease deleted the rustdoc-ltd-improvs branch May 14, 2026 06:33
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 7 pull requests
Successful merges:
- rust-lang/rust#156552 (Clippy subtree update)
- rust-lang/rust#156344 (Do not index past end of buffer when checking heuristic in error index syntax highlighter)
- rust-lang/rust#156500 (Privacy: move macros handling to early stage)
- rust-lang/rust#156260 (test: suppress deprecation warning)
- rust-lang/rust#156413 (rustdoc: Correctness & perf improvements to link-to-definition)
- rust-lang/rust#156539 (Add `ChildExt::kill_process_group`)
- rust-lang/rust#156540 (use `deref_patterns` in `rustdoc` instead of `box_patterns`)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

4 participants

@fmease@GuillaumeGomez@rust-log-analyzer@rustbot