feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

feat(rustdoc-json): Add optional support for rkyv (de)serialization - #153283

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support
Mar 11, 2026
Merged

feat(rustdoc-json): Add optional support for rkyv (de)serialization#153283
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
LukeMathWalker:add-rkyv-support

Conversation

@LukeMathWalker

@LukeMathWalkerLukeMathWalker commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

View all comments

Motivation

The JSON documents produced by rustdoc-json are big. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given rustdoc-json-types type.

Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke rustdoc-json to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. bincode or postcard) and thus amortize the cost of future queries that hit the persistent cache rather than rustdoc-json.
This is better, but still not great: the deserialization cost for crates like std still shows up prominently in flamegraphs.

An Alternative Approach: rkyv

rkyv provides a different opportunity: you avoid paying the deserialization cost upfront thanks to zero-copy deserialization.
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need (example).

The Change

This PR adds support for rkyv behind a feature flag (rkyv_0_8).
For most types, it's a straight-forward derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from rkyv's JSON example.

I have added new round-trip tests to ensure rkyv works as expected.

r? @aDotInTheVoid

@rustbot

Copy link
Copy Markdown
Collaborator

rustdoc-json-types is a public (although nightly-only) API. If possible, consider changing src/librustdoc/json/conversions.rs; otherwise, make sure you bump the FORMAT_VERSION constant.

cc @CraftSpider, @aDotInTheVoid, @Enselic, @obi1kenobi

@rustbotrustbot added A-rustdoc-json Area: Rustdoc JSON backend 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. labels Mar 2, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

aDotInTheVoid is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This makes sense as a thing to add.

View changes since this review


#[cfg(feature = "rkyv_0_8")]
mod rkyv {
use std::fmt::Debug;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These tests don't run. When I applied

diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs
index e878350e43b..258c22304c3 100644
--- a/src/rustdoc-json-types/tests.rs+++ b/src/rustdoc-json-types/tests.rs@@ -41,6 +41,11 @@ fn test_union_info_roundtrip() {
#[cfg(feature = "rkyv_0_8")]
mod rkyv {
+ #[test]+ fn definenly_fails() {+ panic!("at least the rkyv tests were ran");+ }+
use std::fmt::Debug;
use rkyv::Archive;

Running ./x test ./src/rustdoc-json-types/ still passed.

The fix (I think) is to enable this feature in bootsrap:

diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 88f10775333..ab1d2b8a24b 100644
--- a/src/bootstrap/src/core/build_steps/test.rs+++ b/src/bootstrap/src/core/build_steps/test.rs@@ -3302,7 +3302,7 @@ fn run(self, builder: &Builder<'_>) {
builder.kind,
"src/rustdoc-json-types",
SourceType::InTree,
- &[],+ &["rkyv_0_8".to_owned()],
);
// FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy.

(CC @jieyouxu, is this ok to do?)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Apologies, I had only tested the crate directly via local cargo test, under the implicit assumption that the testing infrastructure would automatically pick up feature flags for matrix testing.
I've added the feature flag to the bootstrap script, let me know if other changes are needed.

Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
Comment threadsrc/rustdoc-json-types/lib.rs
@aDotInTheVoid

Copy link
Copy Markdown
Member

@rustbot author

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 3, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 3, 2026
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

@rustbot ready

@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 Mar 3, 2026
@rust-log-analyzer

This comment has been minimized.

@aDotInTheVoidaDotInTheVoid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I hope this helps perf.

r=me with commits squashed, and when someone from T-bootstrap signs off that 39f7f0d is ok.

View changes since this review

Comment threadsrc/rustdoc-json-types/lib.rs
@LukeMathWalker

Copy link
Copy Markdown
ContributorAuthor

Commits have been squashed @aDotInTheVoid. What's the best way to get a reviewer from T-bootstrap (or is your tag in the thread enough)?

@aDotInTheVoid

Copy link
Copy Markdown
Member

I asked on zulip (#t-infra/bootstrap > Review Request: Adding a feature in a test step.). Seems fine. (Sorry, I should've made that clear here).

@bors r+ rollup

@rust-bors

rust-borsBot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1d81c50 has been approved by aDotInTheVoid

It is now in the queue for this repository.

@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 Mar 9, 2026
aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 9, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
feat(rustdoc-json): Add optional support for rkyv (de)serialization
try-job: dist-x86_64-linux-alt
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 1f05c76 has been approved by aDotInTheVoid

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. 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 Mar 10, 2026
@rust-bors

rust-borsBot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 11041de failed: CI. Failed job:

@JonathanBrouwer

JonathanBrouwer commented Mar 10, 2026

Copy link
Copy Markdown
Member

That's github CI being funny, not this PRs fault...
The fix looks fine to me so lets just keep this approved

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web)(plain enhanced)(plain)

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

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 10, 2026
…=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #152457 (Pass -pg to linker when using -Zinstrument-mcount)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
rust-borsBot pushed a commit that referenced this pull request Mar 10, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- #149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- #153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- #153471 (Refactor `ActiveJobGuard`)
- #153595 (`QueryLatch` cleanups)
- #153653 (scalable vector: type renames and simple checks)
- #152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- #153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- #153479 (Add rationale for intentional potential_query_instability allows)
- #153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- #153600 (add test for proc-macros with custom panic payloads)
- #153643 (Avoid projection-only suggestions for inherent assoc types)
- #153657 (triagebot: remove myself from some mention groups)
- #153659 (Mark an unreachable match arm as such)
@rust-bors
rust-borsBot merged commit cf951ba into rust-lang:mainMar 11, 2026
11 of 12 checks passed
@rustbotrustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 11, 2026
@rustbotrustbot added this to the 1.96.0 milestone Mar 11, 2026
rust-timer added a commit that referenced this pull request Mar 11, 2026
Rollup merge of #153283 - LukeMathWalker:add-rkyv-support, r=aDotInTheVoid
feat(rustdoc-json): Add optional support for rkyv (de)serialization
## Motivation
The JSON documents produced by `rustdoc-json` are _big_. More often than not, tools need to access a small fraction of that output—e.g. a couple of types from a transitive dependency, or a subset of the fields on a given `rustdoc-json-types` type.
Using a binary (de)serialization format and a cache helps to drive down the performance cost of deserialization: you invoke `rustdoc-json` to get the JSON output you need, re-serialize it using a more perfomant format as target (e.g. `bincode` or `postcard`) and thus amortize the cost of future queries that hit the persistent cache rather than `rustdoc-json`.
This is _better_, but still not great: the deserialization cost for crates like `std` still shows up prominently in flamegraphs.
## An Alternative Approach: rkyv
`rkyv` provides a different opportunity: you avoid paying the deserialization cost _upfront_ thanks to [zero-copy deserialization](https://rkyv.org/zero-copy-deserialization.html).
You're often able to determine if you need a certain entry from the JSON document using the archived version of that type, thus incurring the full deserialization cost only for the subset of items you actually need ([example](LukeMathWalker/pavex@d067e7e)).
## The Change
This PR adds support for `rkyv` behind a feature flag (`rkyv_0_8`).
For most types, it's a straight-forward `derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)` annotation. For co-recursive types, we need to adjust the generated bounds, using the techniques from [`rkyv`'s JSON example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs).
I have added new round-trip tests to ensure `rkyv` works as expected.
r? @aDotInTheVoid
Delta17920 pushed a commit to Delta17920/rust that referenced this pull request Mar 11, 2026
…nathanBrouwer
Rollup of 13 pull requests
Successful merges:
- rust-lang#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang#153471 (Refactor `ActiveJobGuard`)
- rust-lang#153595 (`QueryLatch` cleanups)
- rust-lang#153653 (scalable vector: type renames and simple checks)
- rust-lang#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang#153600 (add test for proc-macros with custom panic payloads)
- rust-lang#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang#153657 (triagebot: remove myself from some mention groups)
- rust-lang#153659 (Mark an unreachable match arm as such)
@JonathanBrouwer

Copy link
Copy Markdown
Member

@rust-timer build 69b11eb

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (69b11eb): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.3%[0.3%, 0.3%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary -6.0%, secondary -3.6%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
-6.0%[-6.0%, -6.0%]1
Improvements ✅
(secondary)
-3.6%[-3.6%, -3.6%]1
All ❌✅ (primary)-6.0%[-6.0%, -6.0%]1

Cycles

Results (secondary -2.1%)

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

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
--0
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.1%[-2.1%, -2.1%]1
All ❌✅ (primary)--0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.034s -> 479.577s (-0.10%)
Artifact size: 394.90 MiB -> 394.89 MiB (-0.00%)

aDotInTheVoid added a commit to aDotInTheVoid/rustdoc-types-contrib that referenced this pull request Mar 12, 2026
aDotInTheVoid added a commit to rust-lang/rustdoc-types that referenced this pull request Mar 12, 2026
@aDotInTheVoid

Copy link
Copy Markdown
Member

Published as v0.57.2

github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Mar 16, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
…uwer
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#149130 (Implement coercions between `&pin (mut|const) T` and `&(mut) T` when `T: Unpin`)
- rust-lang/rust#153143 (Allow `./x test` to run tests without doc tests and without benchmarks)
- rust-lang/rust#153471 (Refactor `ActiveJobGuard`)
- rust-lang/rust#153595 (`QueryLatch` cleanups)
- rust-lang/rust#153653 (scalable vector: type renames and simple checks)
- rust-lang/rust#152302 (fix: don't suggest replacing `env!("CARGO_BIN_NAME")` with itself)
- rust-lang/rust#153283 (feat(rustdoc-json): Add optional support for rkyv (de)serialization)
- rust-lang/rust#153479 (Add rationale for intentional potential_query_instability allows)
- rust-lang/rust#153533 (Fix LegacyKeyValueFormat report from docker build: miscellaneous)
- rust-lang/rust#153600 (add test for proc-macros with custom panic payloads)
- rust-lang/rust#153643 (Avoid projection-only suggestions for inherent assoc types)
- rust-lang/rust#153657 (triagebot: remove myself from some mention groups)
- rust-lang/rust#153659 (Mark an unreachable match arm as such)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rustdoc-jsonArea: Rustdoc JSON backendA-testsuiteArea: The testsuite used to check the correctness of rustcS-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-rustdocRelevant 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.

6 participants

@LukeMathWalker@rustbot@rust-log-analyzer@aDotInTheVoid@JonathanBrouwer@rust-timer