Skip to content

fix(rustdoc): Remove rustdoc --test, --bench and --all-targets arguments#16973

Open
QrkenBananen wants to merge 3 commits into
rust-lang:masterfrom
QrkenBananen:remove_rustdoc_test_bench
Open

fix(rustdoc): Remove rustdoc --test, --bench and --all-targets arguments#16973
QrkenBananen wants to merge 3 commits into
rust-lang:masterfrom
QrkenBananen:remove_rustdoc_test_bench

Conversation

@QrkenBananen
Copy link
Copy Markdown

What does this PR try to resolve?

Removes the --test, --tests, --bench, --benches and --all-targets arguments from the rustdoc command. Fixes #13427.

These arguments are generally broken, and --test(s) in particular can cause import errors.

From my own testing, these arguments appears to work (no errors) if there is no integration tests in the project, even though they are broken. So there is a chance that there are people who use these and will be affected by removing them.

This also brings rustdoc in line with the doc command so that they support the same targets.

How to test and review this PR?

Run
cargo rustdoc --test
cargo rustdoc --bench
etc..
And verify they all return "unexpected argument" errors.

…ents

See (rust-lang#13427).

Using --test(s) in a project with integration tests causes import errors.

--bench(es) does not cause errors, but also doesn't work correctly and
is not supported by rustdoc.

--all-targets have the same issues as --test(s) as it implicitly
includes the --tests argument.

Removing these also means that the "rustdoc" command now have the same
targets as the "doc" command.

In projects without integration tests these arguments doesn't cause
errors, but they also don't work correctly. There is a chance that
someone uses these arguments for whom this is a breaking change.
`rustdoc_bench` and `rustdoc_test` were both testing that the --test and
--bench arguments were working, but now that those arguments have been
removed, change the tests to make sure the --test and --bench arguments
are not recognized.

The `cargo_rustdoc::help::case` test is checking for the output of
`rustdoc --help`, but this help output has changed.

Remove --test and --bench checks in rustdoc_list_availables
@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation Command-rustdoc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 2026

r? @epage

rustbot has assigned @epage.
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. A-cli-help Area: built-in command-line help A-documenting-cargo-itself Area: Cargo's documentation Command-rustdoc 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.

[rustdoc] Integration test documentation build failure

3 participants