Skip to content

cargo doc --output-format=json (unstable) is undocumented #17323

Description

@GuTS805

Problem

cargo doc gained an unstable --output-format flag in PR #17025 (merged 2026-05-27), mirroring cargo rustdoc's existing flag and using the same tracking issue (#13283). It's real: src/bin/cargo/commands/doc.rs:19-23 defines it, and cargo doc --help shows it.

But the docs never caught up:

  • doc/man/cargo-doc.md has no output-format entry, even though doc/man/cargo-rustdoc.md does (line 106, {{> options-output-format }}).
  • doc/book/src/reference/unstable.md's section is still titled "output-format for rustdoc" (line 1308) and only shows a cargo rustdoc example. No mention that cargo doc supports it too.

Nightly users trying -Z unstable-options with cargo doc have no man page or book entry telling them the flag exists.

Steps

  1. grep -n "output-format" doc/man/cargo-doc.md. No match
  2. Look at doc/book/src/reference/unstable.md around line 1308 — only mentions cargo rustdoc
  3. Compare to cargo doc --help, which does show --output-format

Possible Solution(s)

Add {{> options-output-format }} to doc/man/cargo-doc.md's options section, and update the unstable.md section to also mention cargo doc alongside cargo rustdoc.

Notes

Not the same as #13283 (the tracking issue itself, doesn't cover this doc gap) or #16720 (unrelated request for a new markdown format). No open PR touches these two doc files for this flag.

Version

cargo 1.97.1 (c980f4866 2026-06-30)
release: 1.97.1
commit-hash: c980f4866141969fab6254a680546a277789d6f0
commit-date: 2026-06-30
host: x86_64-pc-windows-msvc
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.20.0-DEV (sys:0.4.88+curl-8.20.0 vendored ssl:Schannel)
os: Windows 10.0.26200 (Windows 11 CoreSingleLanguage) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationC-bugCategory: bugCommand-docS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions