Skip to content

rustdoc: Only analyze head of self type when deciding impl inlining - #159854

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
camelid:selfty-head
Jul 29, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
camelid:selfty-head

Conversation

@camelid

@camelid camelid commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

View all comments

We only care about whether the self type is a generic or an item (inlined) in
the current crate, so we don't actually need to compute the param_env, which is
expensive when done to every external impl. This PR avoids computing the
param_env until we actually decide to inline the impl. Moreover, it adds
specialized cleaning logic for types that stops after the "head" (the top-level
structure) is constructed, which is enough for the self type-based impl
inlining analysis.

@rustbot rustbot 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. labels Jul 24, 2026
@camelid

camelid commented Jul 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 Jul 24, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 24, 2026
rustdoc: Only analyze head of self type when deciding impl inlining
@rust-bors

rust-bors Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b8110ca (b8110ca9b8652ec8b2b3ae78916c0f05ed62d565)
Base parent: 29e68fe (29e68fe2295f8fc2feb52b8cb0b61a055842fdcf)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b8110ca): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

@bors rollup=never rustc-perf
@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)
-8.4% [-37.1%, -0.8%] 19
Improvements ✅
(secondary)
-21.1% [-36.9%, -2.4%] 24
All ❌✅ (primary) -8.4% [-37.1%, -0.8%] 19

Max RSS (memory usage)

Results (primary -5.9%, secondary -8.7%)

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

mean range count
Regressions ❌
(primary)
3.1% [3.1%, 3.1%] 1
Regressions ❌
(secondary)
6.0% [6.0%, 6.0%] 1
Improvements ✅
(primary)
-6.4% [-11.8%, -1.2%] 20
Improvements ✅
(secondary)
-9.3% [-12.7%, -2.9%] 23
All ❌✅ (primary) -5.9% [-11.8%, 3.1%] 21

Cycles

Results (primary -11.5%, secondary -23.6%)

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)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
-11.5% [-38.4%, -2.6%] 17
Improvements ✅
(secondary)
-24.7% [-38.6%, -2.7%] 23
All ❌✅ (primary) -11.5% [-38.4%, -2.6%] 17

Binary size

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

Bootstrap: 488.104s -> 487.819s (-0.06%)
Artifact size: 387.69 MiB -> 387.70 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 24, 2026
Comment thread src/librustdoc/passes/collect_trait_impls.rs Outdated
We only care about whether the self type is a generic or an item
(inlined) in the current crate, so we don't actually need to compute the
param_env, which is expensive when done to every external impl.
@camelid
camelid marked this pull request as ready for review July 24, 2026 20:10
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2026
@rustbot

rustbot commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

r? @notriddle

rustbot has assigned @notriddle.
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 8 candidates
  • Random selection from GuillaumeGomez, lolbinarycat, notriddle

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 24, 2026
Comment thread src/librustdoc/passes/collect_trait_impls.rs Outdated
@camelid
camelid force-pushed the selfty-head branch 3 times, most recently from 69b025c to a1136eb Compare July 25, 2026 18:04
Comment thread src/librustdoc/passes/collect_trait_impls.rs
Comment thread src/librustdoc/passes/collect_trait_impls.rs Outdated
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2026
@camelid camelid 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 Jul 27, 2026
@rustbot rustbot added the T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. label Jul 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 28, 2026
This feature is unstable but will be stabilized soon, and this is a good
way of dogfooding it to make sure it works properly. It should have no
effect on the generated docs, but it provides a significant speedup. For
example, I measure a 3x speedup locally (3m 11s -> 1m 1s) -- note that
this is with the latest rustdoc perf improvements (#159854).
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job dist-x86_64-solaris failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 28, 2026
@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

💔 Test for e59475a failed: CI. Failed job:

@camelid

camelid commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

Argh. Appears spurious AFAICT. I don't even see an error in the logs, weirdly...

@bors retry spurious>

@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 28, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member

Just to be sure
@bors try jobs=dist-x86_64-solaris

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 28, 2026
rustdoc: Only analyze head of self type when deciding impl inlining


try-job: dist-x86_64-solaris
@rust-bors

rust-bors Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 217458e (217458eabef1c6d9349658606aaa4460fcb75fb7)
Base parent: e19d321 (e19d321c06479c6fd77533582b0d5a86651f1be3)

@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 29, 2026
@rust-bors

rust-bors Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: notriddle,GuillaumeGomez
Duration: 3h 42m 18s
Pushing 701a651 to main...

@rust-bors
rust-bors Bot merged commit 701a651 into rust-lang:main Jul 29, 2026
15 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 26ae60a (parent) -> 701a651 (this PR)

Test differences

Show 6 test diffs

Stage 1

  • [rustdoc-html] tests/rustdoc-html/inline_cross/impl-for-projection-reexport.rs: [missing] -> pass (J0)

Stage 2

  • [rustdoc-html] tests/rustdoc-html/inline_cross/impl-for-projection-reexport.rs: [missing] -> pass (J1)

Additionally, 4 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 701a6513a48eac30d49110ba06187648b7553622 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 14m 41s -> 8m 45s (-40.3%)
  2. x86_64-gnu-llvm-21-1: 54m 59s -> 34m 57s (-36.4%)
  3. dist-powerpc64le-linux-musl: 1h 12m -> 1h 36m (+33.7%)
  4. x86_64-msvc-ext2: 2h 2m -> 1h 23m (-31.6%)
  5. i686-msvc-1: 2h 13m -> 2h 54m (+30.0%)
  6. x86_64-gnu-llvm-21-3: 1h 46m -> 1h 17m (-27.6%)
  7. x86_64-gnu-miri: 1h 39m -> 1h 14m (-25.1%)
  8. x86_64-gnu-gcc: 1h 14m -> 56m 24s (-24.8%)
  9. x86_64-msvc-1: 1h 59m -> 2h 27m (+23.3%)
  10. x86_64-msvc-ext1: 2h 7m -> 1h 38m (-23.3%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (701a651): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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)
-9.1% [-39.9%, -0.9%] 19
Improvements ✅
(secondary)
-22.8% [-39.7%, -2.6%] 24
All ❌✅ (primary) -9.1% [-39.9%, -0.9%] 19

Max RSS (memory usage)

Results (primary -6.5%, secondary -10.6%)

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

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-7.0% [-13.7%, -1.5%] 20
Improvements ✅
(secondary)
-10.6% [-13.2%, -3.0%] 23
All ❌✅ (primary) -6.5% [-13.7%, 2.8%] 21

Cycles

Results (primary -12.1%, secondary -25.4%)

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.0% [2.8%, 3.3%] 2
Improvements ✅
(primary)
-12.1% [-41.4%, -3.0%] 19
Improvements ✅
(secondary)
-27.8% [-41.8%, -4.4%] 23
All ❌✅ (primary) -12.1% [-41.4%, -3.0%] 19

Binary size

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

Bootstrap: 489.651s -> 491.747s (0.43%)
Artifact size: 390.13 MiB -> 390.11 MiB (-0.00%)

@camelid
camelid deleted the selfty-head branch July 29, 2026 15:36
rust-bors Bot pushed a commit that referenced this pull request Sep 3, 2026
…obzol,jieyouxu

bootstrap: Enable rustdoc mergeable CCI for std and internal docs



Takes a different approach to #160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (#159854).

r? @Kobzol
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Sep 4, 2026
…obzol,jieyouxu

bootstrap: Enable rustdoc mergeable CCI for std and internal docs



Takes a different approach to rust-lang/rust#160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (rust-lang/rust#159854).

r? @Kobzol
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Sep 4, 2026
…obzol,jieyouxu

bootstrap: Enable rustdoc mergeable CCI for std and internal docs



Takes a different approach to rust-lang/rust#160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (rust-lang/rust#159854).

r? @Kobzol
renovate-bot pushed a commit to renovate-bot/rust-lang-_-compiler-builtins that referenced this pull request Sep 7, 2026
…obzol,jieyouxu

bootstrap: Enable rustdoc mergeable CCI for std and internal docs



Takes a different approach to rust-lang/rust#160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (rust-lang/rust#159854).

r? @Kobzol
asukaminato0721 pushed a commit to asukaminato0721/rust-analyzer that referenced this pull request Sep 7, 2026
…obzol,jieyouxu

bootstrap: Enable rustdoc mergeable CCI for std and internal docs



Takes a different approach to rust-lang/rust#160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (rust-lang/rust#159854).

r? @Kobzol
notriddle added a commit to notriddle/rust that referenced this pull request Oct 1, 2026
Takes a different approach to rust-lang#160098, where the internal docs are merged by bootstrap directly invoking rustdoc. This requires bootstrap to gather the list of metadata directories by inspecting cargo's fingerprint files (which aren't stable). The first commit is written by @camelid, but I wrote the other two.

This feature is needed because:

1. The search index (that powers [web-based search](https://doc.rust-lang.org/nightly/nightly-rustc/?search=ty%20-%3E%20rustdoc%3A%3Atype)) needs to contain all of the crates in the nightly-rustc project. In particular, I'd prefer if it contained Clippy, Rustdoc, and Rustc, since those crates share type checker stuff and the ability to search all three at once is convenient.
2. For every crate that rustdoc *currently* documents, it has to load the search index from the doc output dir, and rebuild the search index with the new crate added to it. Loading the search index requires $O(\text{crates})$ work, so doing it once for every crate means we're doing $O(\text{crates}^2)$ work overall.
3. It would be more efficient, *instead*, if each crate wrote its data separately, and then the final search index was generated at the end by merging them all at once. Obviously, this would make the work linear instead of quadratic. For the record, Hoogle and Sherlodoc have a similar index-generating step.
4. We call this "Mergeable Cross-Crate-Information." Cargo stores it in the build directory, and supplies it to Rustdoc in a separate phase that runs after everything else. When we eventually stabilize this feature, it will be invisible to (most) end users. `cargo doc` will just be faster.
5. So, in order for crates to share their cross-crate info, we need them to share a build directory.
6. Tools, like Rustdoc and Cargo, don't normally share a build directory with Rustc.
7. To make them share a build directory while generating documentation, without forcing them to share a build directory while compiling, I added a new mode.

---

This rustdoc feature is unstable but will be stabilized soon, and this is a good way of dogfooding it to make sure it works properly. It should have no effect on the generated docs, but it provides a significant speedup. For example, I measure a 3x speedup locally (3m 11s -> 1m 1s) for `x doc src/tools` -- note that this is with the latest rustdoc perf improvements (rust-lang#159854).

---

This reverts commit c84edb3.
dressupgeekout pushed a commit to dressupgeekout/pkgsrc-wip that referenced this pull request Oct 2, 2026
Pkgsrc changes:
 * Adapt to changes in vendored crate versions.
 * Version & checksum changes.

Upstream changes:

Version 1.99.0 (2026-10-01)
==========================

Language
--------
- [Add allow-by-default `raw_borrows_via_references` lint that
  checks for references that decay immediately into raw
  borrows](rust-lang/rust#138230)
- [Extend `unconditional_panic` lint to function calls that panic
  when the chunks/windows size is zero]
  (rust-lang/rust#153563)
- [Stabilize C-variadic function definitions]
  (rust-lang/rust#155697)
- [Stabilize the ability to use `#[unsafe(naked)]` functions to
  define C-variadic functions (`#![feature(c_variadic_naked_functions)]`).]
  (rust-lang/rust#159746)
- [Trait methods are now resolved on an adjusted never type (producing a FCW)]
  (rust-lang/rust#156047)
- [Coerce from inference variables to trait objects if the inference
  variable is related via subtyping to a type that is known to be `Sized`]
  (rust-lang/rust#157820)
- [Stabilize `#[my_macro] mod foo;`]
  (rust-lang/rust#157857). This allows
  outlined modules (`mod foo;`) anywhere in the body of a custom
  attribute or derive macro.
- [Fix the `overflowing_literals` lint with repeated negation]
  (rust-lang/rust#158302). For instance,
  it will now no longer lint on `--128_i8`, which is already detected
  by the `arithmetic_overflow` lint.
- [Add POSIX symbols to the `invalid_runtime_symbol_definitions`
  and `suspicious_runtime_symbol_definitions` lints]
  (rust-lang/rust#158522)
- [Lint unused `#[path]` attributes on inline modules]
  (rust-lang/rust#158835)
- [Enable `unreachable_cfg_select_predicates` lint as part of
  `unused` lint group] (rust-lang/rust#159179)
- [Stabilize passing 128-bit integers via vector registers with `asm!` on x86]
  (rust-lang/rust#159525)
- [Explicitly document that some allocations are allowed to grow
  in-place (but none are allowed to shrink)]
  (rust-lang/rust#159729)
- We now [guarantee]
  (rust-lang/rust#159730) that the contents
  of an `UnsafeCell` can be accessed without going through `get`
  - [The `invalid_reference_casting` lint was adjusted accordingly]
  (rust-lang/rust#159960)
- [Account for globally enabled target features in `global_asm!`]
  (rust-lang/rust#160594)
- [Warn if an invalid `doc` attribute is used on a macro invocation]
  (rust-lang/rust#161003)

Compiler
--------
- [Convert `-Ctarget-cpu` into a target-modifier for AVR, AMDGCN and NVPTX]
  (rust-lang/rust#150732)
- [Enable `static_position_independent_executables` on all gnu and musl targets]
  (rust-lang/rust#158510)
- When providing a suggestion about a missing method, rustc now
  prefers an exactly matching name from a [doc alias attribute]
  (https://doc.rust-lang.org/rustdoc/advanced-features.html#add-aliases-for-an-item-in-documentation-search)
  over a similarity search from other method names. If your new
  users sometimes expect a method under a different name, adding
  a doc alias will now help them find it via rustc suggestions, in
  addition to helping them find it via rustdoc search: [When
  suggesting method names, prefer *exact* doc aliases over similar
  names](rust-lang/rust#160369)

Platform Support
----------------
- [Promote `riscv64-unknown-linux-musl` to Tier 2 with host tools]
  (rust-lang/rust#158766)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

[platform-support-doc]: https://doc.rust-lang.org/rustc/platform-support.html

Libraries
---------
- Iteration on `RangeInclusive` (`a..=b` ranges) is now [optimized
  better in some circumstances]
  (rust-lang/rust#155114). As a side effect
  of this, the behavior of `RangeInclusive` values that has already
  been exhausted (as an iterator) has changed. For example, the
  return values of `start()` and `end()` on such ranges may return
  different values, and using such ranges as slice indexes may have
  different behavior. These behaviors were not guaranteed to be
  stable, so these changes are considered to not be breaking changes.
- [Relax `transmute_copy` to accept `?Sized` types]
  (rust-lang/rust#155989)
- [Update `transmute_copy` to use a non-unwinding panic]
  (rust-lang/rust#155989)
- [Don't escape U+FF9E and U+FF9F in `escape_debug_ext`]
  (rust-lang/rust#158057)
- [Re-export `core::fmt::NumBuffer` in `alloc` (and `std`)]
  (rust-lang/rust#161430)

Stabilized APIs
---------------

- [`IntoIterator` for `Box<[T; N]>`]
  (https://doc.rust-lang.org/stable/std/iter/trait.IntoIterator.html#impl-IntoIterator-for-Box%3C%5BT;+N%5D,+A%3E)
- [`IntoIterator` for `&Box<[T; N]>`]
  (https://doc.rust-lang.org/stable/std/iter/trait.IntoIterator.html#impl-IntoIterator-for-%26Box%3C%5BT;+N%5D,+A%3E)
- [`IntoIterator` for `&mut Box<[T; N]>`]
  (https://doc.rust-lang.org/stable/std/iter/trait.IntoIterator.html#impl-IntoIterator-for-%26mut+Box%3C%5BT;+N%5D,+A%3E)
- [`VecDeque::retain_back`]
  (https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.retain_back)
- [`core::ffi::VaList`]
  (https://doc.rust-lang.org/stable/core/ffi/struct.VaList.html)
- [`Box::into_non_null`]
  (https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.into_non_null)
- [`Box::from_non_null`]
  (https://doc.rust-lang.org/stable/std/boxed/struct.Box.html#method.from_non_null)
- [`Vec::into_parts`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.into_parts)
- [`Vec::from_parts`]
  (https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.from_parts)
- [`core::mem::size_of_val_raw`]
  (https://doc.rust-lang.org/stable/core/mem/fn.size_of_val_raw.html)
- [`core::mem::align_of_val_raw`]
  (https://doc.rust-lang.org/stable/core/mem/fn.align_of_val_raw.html)
- [`core::alloc::Layout::for_value_raw`]
  (https://doc.rust-lang.org/stable/core/alloc/struct.Layout.html#method.for_value_raw)
- [`String::from_utf8_lossy_owned`]
  (https://doc.rust-lang.org/stable/std/string/struct.String.html#method.from_utf8_lossy_owned)
- [`string::FromUtf8Error::into_utf8_lossy`]
  (https://doc.rust-lang.org/stable/std/string/struct.FromUtf8Error.html#method.into_utf8_lossy)
- [`FusedIterator for StepBy<I>`]
  (https://doc.rust-lang.org/stable/std/iter/struct.StepBy.html#impl-FusedIterator-for-StepBy%3CI%3E)
- [`std::fs::set_times`]
  (https://doc.rust-lang.org/stable/std/fs/fn.set_times.html)
- [`std::fs::set_times_nofollow`]
  (https://doc.rust-lang.org/stable/std/fs/fn.set_times_nofollow.html)

Cargo
-----
- Add a new built-in profile `debug`. This is a preparation for
  transitioning the `dev` profile away from debugging to give a saner
  default for faster development iterations. Currently there is no
  difference between `dev` and `debug` profiles. [docs]
  (https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#debug-1)
  [#17214] (rust-lang/cargo#17214)
- Workspace members on edition 2024 or later can now override an
  inherited workspace dependency's `default-features` field. For
  example, `serde = { workspace = true, default-features = false }`
  now turns off default features even when the workspace definition
  enables them. On earlier editions, `default-features = false` is
  ignored with a warning. ([RFC 3945]
  (rust-lang/rfcs#3945))
  [#17126](rust-lang/cargo#17126)
- Incremental compilation is now disabled by default when running
  in CI. CI is detected via the CI environment variable. [#17220]
  (rust-lang/cargo#17220)
  See also the [full Cargo changelog]
  (https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-199-2026-10-01)

Rustdoc
-----
- [Add new `unused_footnote_definition` rustdoc lint]
  (rust-lang/rust#137858)
- Smarter filtering of trait impls yields performance improvements
  of 20% on average and up to 40% on some real-world crates. ([1]
  (rust-lang/rust#159623),
  [2](rust-lang/rust#159721),
  [3](rust-lang/rust#159779),
  [4](rust-lang/rust#159854),
  [5](rust-lang/rust#159091))

Compatibility Notes
-------------------
- [Fully deprecate the legacy integral modules]
  (rust-lang/rust#146882). For example,
  `std::i32::MAX` should be accessed via `i32::MAX` instead.
- [Upgrade `no_mangle_generic_items` into hard error]
  (rust-lang/rust#154585)
- [The `Pin::new_unchecked` has had its safety invariants changed slightly]
  (rust-lang/rust#156935)
- [Do not promote references to extern statics]
  (rust-lang/rust#157641)
- [Ensure that the inferred types of `let` patterns typecheck]
  (rust-lang/rust#157841)
- [hermit/fs: Return `unsupported()` instead of `from_raw_os_error(22)`]
  (rust-lang/rust#158247)
- [Fixed a bug where `#[repr(simd)]` was accidentally allowed on
  macro invocations on stable Rust]
  (rust-lang/rust#158523)
- [Abort const-eval when there are generics in the type of the
  value being produced]
  (rust-lang/rust#159504)
- [Attributes not applying to anything are now an error in code
  blocks in doc comments]
  (rust-lang/rust#159849)
- [`Box::leak`: tell people to avoid unleaking]
  (rust-lang/rust#160323)
- [PowerPC inline ASM: Fix scalar floats being in the wrong vector
  lane on little endian] (rust-lang/rust#160441)
- [Do not take `doc(cfg())` into account when filtering doctests]
  (rust-lang/rust#159014)
- [Infer anonymous lifetimes in the types of associated consts as `'static`]
  (rust-lang/rust#156508)
- Macros that expand to a semicolon now produce a warning lint
  (`semicolon_in_expressions_from_non_local_macros`) even when the
  macro comes from another crate. Previously, such warnings only
  appeared for macros from the same crate, to avoid showing warnings
  that can't be fixed locally; however, this masked problems, as
  integration tests from the crate providing the macro get compiled
  as a separate crate, so tests often wouldn't reveal this issue. If
  you encounter a lint like this, please make sure to report it to
  the crate providing the macro so they can fix it; don't just silence
  it in your own crate.
  - [`semicolon_in_expressions_from_macros`: Lint on non-local
    macros too] (rust-lang/rust#159222)
  - [Split non-local `semicolon_in_expressions_from_macros` into
    a separate lint] (rust-lang/rust#159700)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Update to LLVM 23]
  (rust-lang/rust#158734)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. 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.

8 participants