feat: Add --output-format=json to cargo doc as an unstable option#17025
Merged
Conversation
a836d85 to
13c5949
Compare
Member
|
cc #13283 |
Contributor
Author
|
cc @aDotInTheVoid for visibility. |
Collaborator
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
weihanglo
approved these changes
May 27, 2026
Member
There was a problem hiding this comment.
This seems good to me.
Namely, it becomes possible to compute the JSON docs for the whole workspace at once and then retrieve the artefacts directly from the build directory.
I don't understand this. build directory layout is private, and I don't know there is really a way to retrieve artifacts from there. That said, this doesn't block this from merging. Thanks for the PR!
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Jun 3, 2026
Update cargo submodule 14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958 2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000 - chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060) - chore(deps): update compatible (rust-lang/cargo#17057) - fix(util): constant type for Redox OS (rust-lang/cargo#17064) - chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059) - chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058) - chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054) - chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049) - Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048) - feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038) - docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036) - feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025) - feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033) - fix(add): Ensure erros are lower case (rust-lang/cargo#17037) - fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Jun 3, 2026
Update cargo submodule 14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958 2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000 - chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060) - chore(deps): update compatible (rust-lang/cargo#17057) - fix(util): constant type for Redox OS (rust-lang/cargo#17064) - chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059) - chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058) - chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054) - chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049) - Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048) - feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038) - docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036) - feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025) - feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033) - fix(add): Ensure erros are lower case (rust-lang/cargo#17037) - fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Jun 3, 2026
Update cargo submodule 14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958 2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000 - chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060) - chore(deps): update compatible (rust-lang/cargo#17057) - fix(util): constant type for Redox OS (rust-lang/cargo#17064) - chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059) - chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058) - chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054) - chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049) - Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048) - feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038) - docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036) - feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025) - feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033) - fix(add): Ensure erros are lower case (rust-lang/cargo#17037) - fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
pull Bot
pushed a commit
to xtqqczze/rust-lang-rustc-dev-guide
that referenced
this pull request
Jun 4, 2026
Update cargo submodule 14 commits in fbb61be30e5f9ac3a6ad58e56a5c0f5db2d2b3ef..0b1123a48825309b697312b44fdb64b3df00c958 2026-05-26 15:08:03 +0000 to 2026-06-01 21:20:28 +0000 - chore(deps): update rust crate git2 to 0.21.0 (rust-lang/cargo#17060) - chore(deps): update compatible (rust-lang/cargo#17057) - fix(util): constant type for Redox OS (rust-lang/cargo#17064) - chore(deps): update crate-ci/typos action to v1.47.0 (rust-lang/cargo#17059) - chore(deps): update embarkstudios/cargo-deny-action action to v2.0.20 (rust-lang/cargo#17058) - chore(deps): update cargo-semver-checks to v0.48.0 (rust-lang/cargo#17054) - chore: bump to 0.99.0; update changelog (rust-lang/cargo#17049) - Bump cargo-util-schemas to 0.14.2 (rust-lang/cargo#17048) - feat: Add edition for scripts anytime we mutate the manifest (rust-lang/cargo#17038) - docs: clarify on crate removal post RFC 3660 (rust-lang/cargo#17036) - feat: Add --output-format=json to cargo doc as an unstable option (rust-lang/cargo#17025) - feat(diag): Add the 'cargo::default' group (rust-lang/cargo#17033) - fix(add): Ensure erros are lower case (rust-lang/cargo#17037) - fix(diag): Report summaries for unused_deps (rust-lang/cargo#17034)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
In #13283, the issue of naming conflict between doc artefacts was raised as a reason to wait before adding
--output-formatsupport tocargo doc.Given the changes in #16773, I argue we shouldn't treat that oustanding design question as a blocker: since JSON doc output is now locked in to use the new build directory layout, we get benefits from first-class support in
cargo doceven if the conflicts in the target directory remain unresolved.Namely, it becomes possible to compute the JSON docs for the whole workspace at once and then retrieve the artefacts directly from the build directory. This would significantly speed up tools like cheadergen when launched on workspaces that inevitably have multiple versions of the same crate in their dependency tree.
How to test and review this PR?
I followed the same testing approach used in #16773 to ease review. Happy to add more test cases if we deem they are necessary.