rust-lang / rust-lang/rust

`rustdoctest` doesn't pass `--help` to custom runners

Open
#151,862 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-doctests C-bug needs-triage T-cargo
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Running cargo test --doc -- -h with a custom runner doesn't pass -h to the custom runner, but instead emits the help page generated from libtest.

I didn't dig into the details, but presumably Cargo runs doctests by libtest first, which then invokes the runner. Ergo when detecting -h and a custom runner is configured, it should pass it along instead of handling that itself.

Meta

rustc --version --verbose:

rustc 1.93.0 (254b59607 2026-01-19)
binary: rustc
commit-hash: 254b59607d4417e9dffbc307138ae5c86280fe4c
commit-date: 2026-01-19
host: x86_64-unknown-linux-gnu
release: 1.93.0
LLVM version: 21.1.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing cargo test --doc -- -h with a custom runner, then trace how Cargo doctests and libtest handle help arguments before invoking the runner. The issue is done when -h is forwarded to the configured custom runner instead of producing only the libtest help page.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.