Skip to content

Tracking Issue for rustdoc --doctest-build-arg command line option #134172

Open
@GuillaumeGomez

Description

@GuillaumeGomez

A command line option to pass program arguments to the underlying compiler building doctests.

Original issue motivating this feature: #67533.

Steps

Unresolved Questions

  • Should argument parsing be closer to what already exists for RUSTFLAGS (whitespace splitting and nothing else) or should it be closer to how shell parses input (take into account escaped characters and quote characters)? Or should we offer two options, one that works like RUSTFLAGS for human users and one that works like CARGO_ENCODED_RUSTLFAGS for tool usage? Update: #137096 (comment) changed the requirements and #139863 the design!
    From #139863: Even though we don't process the argument passed to --doctest-build-arg, we end up passing it via an argument file (rustc @argfile) which delimits arguments by line break (LF or CRLF, via) meaning ultimately the arguments still get split which is unfortunate. Is there are good way to resolve this (obvious but intrusive solution: smh signal to rustc not to split inside the argsfile)?

Implementation History

Activity

added
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
on Dec 11, 2024
added a commit that references this issue on Dec 21, 2024

Rollup merge of rust-lang#128780 - GuillaumeGomez:rustflags-doctests,…

472bbb9
added a commit that references this issue on Dec 21, 2024
weihanglo

weihanglo commented on Dec 21, 2024

@weihanglo
Member

Considering all linked issues (#67533, #66623, rust-lang/cargo#13697, rust-lang/miri#3869) are actually Cargo-related, I wonder how to integrate this flag to help Cargo users. Cargo doesn't parse RUSTFLAGS so it may not know if --cap-lints=warn is there and pass to --doctest-compilation-args accordingly.

Also, the feature seems to open a door way bigger than what #67533 was looking for. It accepts arbitrary rustc flags. Mind sharing why propagating -cap-lints isn't under consideration? Maybe there are other use cases for arbitrary flags I am missing. We all know that once we provide more stuff to users, we might have no chance to take it back 😓.

That said, I don't think this feature on its own is bad. Thank you for working on a fix!!

added
A-doctestsArea: Documentation tests, run by rustdoc
A-CLIArea: Command-line interface (CLI) to the compiler
on Apr 15, 2025
added a commit that references this issue on May 9, 2025

Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…

fac15db
added a commit that references this issue on May 9, 2025

Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…

7a5bbe0
added a commit that references this issue on May 9, 2025

Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…

c4c4266

2 remaining items

Loading
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-CLIArea: Command-line interface (CLI) to the compilerA-doctestsArea: Documentation tests, run by rustdocC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @GuillaumeGomez@weihanglo@fmease

        Issue actions

          Tracking Issue for rustdoc `--doctest-build-arg` command line option · Issue #134172 · rust-lang/rust