rustdoc cannot emit dep-info alongside JSON output
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
// lib.rs
pub fn f() {}
Reproduction Steps
$ rustdoc --crate-name lib -Zunstable-options --output-format=json --emit=dep-info=lib.d lib.rs -o out
$ echo $?
0
$ ls lib.d
lib.d
$ ls out/lib.json
ls: out/lib.json: No such file or directory
Related cases:
$ rustdoc --crate-name lib -Zunstable-options --output-format=json --emit=html-static-files,dep-info=lib.d lib.rs -o out
error: the `--emit=html-static-files` flag is not supported with `--output-format=json`
$ rustdoc --crate-name lib -Zunstable-options --output-format=json --emit=json-files lib.rs -o out
error: unrecognized emission type: json-files
Expected Outcome
A way to request the dep-info file and the JSON doc output in one invocation.
For example, making the json-files emission type nameable on CLI
(I knew #155679 made it non-nameable), like hte following:
$ rustdoc --output-format=json --emit=json-files,dep-info=lib.d lib.rs -o out
$ ls out/lib.json lib.d
out/lib.json lib.d
This was found in https://github.com/rust-lang/cargo/pull/17020
that Cargo wants a better rebuild detection also for JSON output.
At minimum,
an explicit --emit in JSON mode that omits the JSON output
should not exit 0 while silently skipping the primary artifact
Actual Output
$ rustdoc --output-format=json --emit=dep-info=lib.d lib.rs -o out
# exit=0
# no out/lib.json produced
# dep-info was produced
Version
rustdoc 1.99.0-nightly (3659db0d3 2026-07-05)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the rustdoc commands in the issue and tracing how --output-format=json and --emit are handled. Check the existing emission-type validation and JSON output path. Done means one invocation produces both out/lib.json and lib.d, while explicitly omitting the primary JSON artifact no longer exits successfully without warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100