Skip to content

Conversation

@aDotInTheVoid
Copy link
Member

Historically in rustdoc, -o, --out-dir and --output all controlled the output directory, as rustdoc produced many HTML files, so it didn't make sense to give the path to an individual one.

This doesn't make sense for rustdoc-json, where only a single file is produced. This commit makes -o/--output give a path to a file, rather than a directory. --out-dir is uneffected. This commit doesn't effect the HTML behaviour.

Works towards #142370 and rust-lang/cargo#16291. Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/rustdoc-json.20output.20filename.20design/with/560468799

r? @GuillaumeGomez CC @weihanglo

TODO

  • Docs
  • Tests

Historically in rustdoc, `-o`, `--out-dir` and `--output` all controlled
the output directory, as rustdoc produced many HTML files, so it didn't
make sense to give the path to an individual one.

This doesn't make sense for rustdoc-json, where only a single file is
produced. This commit makes `-o`/`--output` give a path to a file,
rather than a directory. `--out-dir` is uneffected. This commit doesn't
effect the HTML behaviour.

Works towards https://www.github.com/rust-lang/rust/issues/142370 and
https://www.github.com/rust-lang/cargo/issues/16291. Zulip Discussion:
https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/rustdoc-json.20output.20filename.20design/with/560468799
@rustbot
Copy link
Collaborator

rustbot commented Nov 26, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Nov 26, 2025
@aDotInTheVoid aDotInTheVoid marked this pull request as draft November 26, 2025 23:41
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2025
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having an alternative here: #83784 (comment).

What about we expanding --emit to have per-emit-type output path. That is pretty similar to rustc --emit. Having a similar behavior across for the same CLI options could be a win and lower the learning cost. That we also can cut off two CLI options (--output-format and this --output options)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, that's worth at least considering. It might also resolve that --output-format=json is used both for "major mode" settings like json and doctest, but also "minor mode" like when giving doc-coverage information.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants