Skip to content

rustdoc cannot emit dep-info alongside JSON output #158869

Open

Description

@weihanglo

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 rust-lang/cargo#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)

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    on Jul 6, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 6, 2026
  3. weihanglo commented on Jul 6, 2026

    @weihanglo
    MemberAuthor

    I haven't looked at a possible fix. Willing to try a fix if you folks think the expected outcome is reasonable.

    cc @fmease (since you wrote #155679)

  4. added
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rustdoc-jsonArea: Rustdoc JSON backendC-bugCategory: This is a bug.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions