Skip to content

feat: Add --output-format=json to cargo doc as an unstable option#17025

Open
LukeMathWalker wants to merge 1 commit into
rust-lang:masterfrom
LukeMathWalker:cargo-doc-fix
Open

feat: Add --output-format=json to cargo doc as an unstable option#17025
LukeMathWalker wants to merge 1 commit into
rust-lang:masterfrom
LukeMathWalker:cargo-doc-fix

Conversation

@LukeMathWalker
Copy link
Copy Markdown

@LukeMathWalker LukeMathWalker commented May 23, 2026

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-format support to cargo 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 doc even 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.

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. Command-doc labels May 23, 2026
@weihanglo
Copy link
Copy Markdown
Member

cc #13283

@LukeMathWalker
Copy link
Copy Markdown
Author

LukeMathWalker commented May 26, 2026

cc @aDotInTheVoid for visibility.

@LukeMathWalker LukeMathWalker marked this pull request as ready for review May 26, 2026 07:35
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 26, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 26, 2026

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

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

Labels

A-cli Area: Command-line interface, option parsing, etc. Command-doc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants