Open
Description
A command line option to pass program arguments to the underlying compiler building doctests.
Original issue motivating this feature: #67533.
Steps
- Stabilization PR (see instructions on rustc-dev-guide)
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 torustc
not to split inside the argsfile)?
Implementation History
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status
Milestone
Relationships
Development
No branches or pull requests
Activity
--doctest-compilation-args
option to add compilation flags to doctest compilation #128780--doctest-compilation-args
option to add compilation flags to doctest compilation #134535Rollup merge of rust-lang#128780 - GuillaumeGomez:rustflags-doctests,…
Unrolled build for rust-lang#128780
weihanglo commentedon Dec 21, 2024
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!!
--doctest-compilation-args
with a simpler one:--doctest-build-arg
#139863Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…
Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…
Rollup merge of rust-lang#139863 - fmease:simp-doctest-build-arg-pass…
2 remaining items