Skip to content

Include Item::stability info in rustdoc JSON.#158230

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
obi1kenobi:pg/item-stability-rustdoc-json
Jun 22, 2026
Merged

Include Item::stability info in rustdoc JSON.#158230
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
obi1kenobi:pg/item-stability-rustdoc-json

Conversation

@obi1kenobi

@obi1kenobi obi1kenobi commented Jun 21, 2026

Copy link
Copy Markdown
Member

Include Item::stability info in rustdoc JSON, to enable tools like cargo-semver-checks to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to #154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:

  • Added since information for stable items.
  • Stability is now boxed to ensure a smaller bump in Item size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
  • We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and #[doc(hidden)] analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
  • Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

AI disclosure: This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.

aDotInTheVoid and others added 2 commits May 31, 2026 15:58
This is motivated by cargo-semver-checks wanting to work on the standard
library, but that requires being able to filter out breaking changes to
unstable items, so it can only flag breaking changes to stable items.
This in turn is motivated by
https://www.github.com/rust-lang/rust/issues/153486.
@rustbot

rustbot commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

These commits modify tests/rustdoc-json.
rustdoc-json is a public (but unstable) interface.

Please ensure that if you've changed the output:

  • It's intentional.
  • The FORMAT_VERSION in src/librustdoc-json-types is bumped if necessary.

cc @aDotInTheVoid

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

@rustbot rustbot 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 Jun 21, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member

Nothing to say except: nice work!

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit da1a658 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 22, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 22, 2026
…oc-json, r=GuillaumeGomez

Include `Item::stability` info in rustdoc JSON.

Include `Item::stability` info in rustdoc JSON, to enable tools like `cargo-semver-checks` to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to rust-lang#154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:
- Added `since` information for stable items.
- `Stability` is now boxed to ensure a smaller bump in `Item` size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
- We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and `#[doc(hidden)]` analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
- Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 22, 2026
…oc-json, r=GuillaumeGomez

Include `Item::stability` info in rustdoc JSON.

Include `Item::stability` info in rustdoc JSON, to enable tools like `cargo-semver-checks` to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to rust-lang#154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:
- Added `since` information for stable items.
- `Stability` is now boxed to ensure a smaller bump in `Item` size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
- We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and `#[doc(hidden)]` analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
- Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #155811 (Include AtomicU128/AtomicI128 in docs for any target)
 - #158242 (Fix linking for wasm with crate metadata included)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 22, 2026
…oc-json, r=GuillaumeGomez

Include `Item::stability` info in rustdoc JSON.

Include `Item::stability` info in rustdoc JSON, to enable tools like `cargo-semver-checks` to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to rust-lang#154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:
- Added `since` information for stable items.
- `Stability` is now boxed to ensure a smaller bump in `Item` size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
- We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and `#[doc(hidden)]` analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
- Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 5 pull requests

Successful merges:

 - #155811 (Include AtomicU128/AtomicI128 in docs for any target)
 - #158242 (Fix linking for wasm with crate metadata included)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 22, 2026
…oc-json, r=GuillaumeGomez

Include `Item::stability` info in rustdoc JSON.

Include `Item::stability` info in rustdoc JSON, to enable tools like `cargo-semver-checks` to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to rust-lang#154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:
- Added `since` information for stable items.
- `Stability` is now boxed to ensure a smaller bump in `Item` size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
- We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and `#[doc(hidden)]` analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
- Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 7 pull requests

Successful merges:

 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158242 (Fix linking for wasm with crate metadata included)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #158242 (Fix linking for wasm with crate metadata included)
 - #157978 (Avoid `&raw` recovery ICE after trailing comma)
 - #158119 (Refactor `proc_macro_decls_static`)
 - #158171 (rustdoc: Avoid ICE on unevaluated `type const` projections in array lengths)
 - #158172 (update `asm_experimental_reg` comments)
 - #158230 (Include `Item::stability` info in rustdoc JSON.)
 - #158258 (Use an unexpanded span for actually written down opt out params)
 - #158262 (Change compiler leads in triagebot.toml)
@rust-bors rust-bors Bot merged commit 818d29d into rust-lang:main Jun 22, 2026
13 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 22, 2026
rust-timer added a commit that referenced this pull request Jun 22, 2026
Rollup merge of #158230 - obi1kenobi:pg/item-stability-rustdoc-json, r=GuillaumeGomez

Include `Item::stability` info in rustdoc JSON.

Include `Item::stability` info in rustdoc JSON, to enable tools like `cargo-semver-checks` to compute stability information and (eventually, soon™️) be used to catch accidental breaking changes in the Rust standard library (cc @Amanieu).

Successor to #154603 by @aDotInTheVoid, building directly on top of its commit.

Differences relative to that PR:
- Added `since` information for stable items.
- `Stability` is now boxed to ensure a smaller bump in `Item` size. Most non-built-in crates won't have stability information, so minimizing that memory use is material for them.
- We have well-defined stability semantics for items, optimizing for consistency with how existing JSON users already must perform reachability and `#[doc(hidden)]` analysis, instead of how rustdoc HTML presentation works. Note the detailed inline comment about this.
- Tests and docs, which the original PR noted needed to be added.

Other flavors of stability, such as const stability or default-body stability, are left as future work.

r? @GuillaumeGomez

**AI disclosure:** This PR is the product of a combination of manual work and AI tools. I secured approval in advance from the designated reviewer. I stand behind the quality of the code I'm submitting, and I vouch it's as good or better compared to if I had written every line by my own hand.
@obi1kenobi obi1kenobi deleted the pg/item-stability-rustdoc-json branch June 22, 2026 23:12
@obi1kenobi

Copy link
Copy Markdown
Member Author

Thank you! I had good mentors :)

Would you be open to me making a follow-up PR to also expose const stability, and perhaps another follow-up for default-body stability as well? These are less important for checking external SemVer but will be nice for checking the standard library itself for accidental breaking changes around those partial stabilizations.

I think const stability is the easiest next PR, and would just be another boxed field on Item. Default body stability would be a bit more tricky, and I'd save it for a subsequent PR since I don't think it makes as much sense to put it on Item directly.

@GuillaumeGomez

Copy link
Copy Markdown
Member

Go ahead!

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

Labels

A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants