Skip to content

bootstrap: expand '@argfile' arguments to rustc shim#159036

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lambdageek:rustc-shim-expand-argfile
Jul 10, 2026
Merged

bootstrap: expand '@argfile' arguments to rustc shim#159036
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
lambdageek:rustc-shim-expand-argfile

Conversation

@lambdageek

@lambdageek lambdageek commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

When cargo invokes rustc, if the command line exceeds some system defined limit, cargo will try again and pass the arguments in an argfile.

When the bootstrap rustc shim tries to detect --target, it does not account for @argfile arguments. As a result, the shim doesn't find --target and incorrectly sets is_build_script to true, as well as passing the RUSTC_HOST_FLAGS to the underlying compiler

This PR makes the shim read all the arguments from every @argfile.

Previous work #155439 already updated the shim to use ArgFileCommand to pass arguments down to the underlying rustc.

r? kobzol

@rustbot rustbot added 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) labels Jul 9, 2026
@rustbot

rustbot commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

kobzol is not on the review rotation at the moment.
They may take a while to respond.

@lambdageek lambdageek force-pushed the rustc-shim-expand-argfile branch from fde5874 to b6ec7d2 Compare July 9, 2026 19:49

@Kobzol Kobzol left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks simple enough, thank you! Could you please add the same code to src/bin/rustdoc.rs (the rustdoc shim), for consistency? You can share the two functions in utils/shared_helpers.rs, to avoid the copy-paste.

View changes since this review

When cargo invokes `rustc`, if the command line exceeds some system defined limit, `cargo`
will try again and pass the arguments in an argfile.

When the bootstrap rustc shim tries to detect `--target`, it does not account for
`@argfile` arguments.  As a result, the shim doesn't find `--target` and incorrectly sets
`is_build_script` to true, as well as passing the `RUSTC_HOST_FLAGS` to the underlying
compiler

This PR makes the shim read all the arguments from every `@argfile`.

Previous work already updated the shim to use `ArgFileCommand` to pass arguments down to
the underlying `rustc`.
@lambdageek lambdageek force-pushed the rustc-shim-expand-argfile branch from b6ec7d2 to e7d2e3d Compare July 9, 2026 20:22
@Kobzol

Kobzol commented Jul 9, 2026

Copy link
Copy Markdown
Member

Thank you! :)

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e7d2e3d has been approved by Kobzol

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 9, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 9, 2026
…le, r=Kobzol

bootstrap: expand '@argfile' arguments to rustc shim

When cargo invokes `rustc`, if the command line exceeds some system defined limit, `cargo` will try again and pass the arguments in an argfile.

When the bootstrap rustc shim tries to detect `--target`, it does not account for `@argfile` arguments.  As a result, the shim doesn't find `--target` and incorrectly sets `is_build_script` to true, as well as passing the `RUSTC_HOST_FLAGS` to the underlying compiler

This PR makes the shim read all the arguments from every `@argfile`.

Previous work rust-lang#155439 already updated the shim to use `ArgFileCommand` to pass arguments down to the underlying `rustc`.

r? kobzol
rust-bors Bot pushed a commit that referenced this pull request Jul 10, 2026
Rollup of 24 pull requests

Successful merges:

 - #150946 (intrinsics: Add a fallback for non-const libm float functions)
 - #158541 (Move `std::io::Write` to `core::io`)
 - #156027 (Consider captured regions for opaque type region liveness.)
 - #156370 (Reject linked dylib EII default overrides)
 - #156508 (Infer all anonymous lifetimes in assoc consts as `'static`)
 - #157561 (rustdoc: do not include extra stuff in span)
 - #158617 (allow mGCA const arguments to fall back to anon consts)
 - #158645 (Fix splat ICEs and ban it in closures)
 - #158859 (Improve `-Zls` diagnostic message on `.rs` files)
 - #158988 (Redo `TokenStreamIter`)
 - #158347 (Improve generic parameters handling for #[diagnostic::on_const])
 - #158384 (Allow BackwardIncompatibleDropHint in polonius legacy)
 - #158722 (delegation: do not always inherit `ConstArgHasType` predicates)
 - #158739 (view-types: HIR lowering)
 - #158877 (borrowck: Keep returned `path` from `best_blame_constraint()` consistent)
 - #158883 (tests: fix enum-match.rs to handle LLVM 23)
 - #158886 (Add documentation for the `no_std` attribute)
 - #158940 (Implement feature `char_to_u32`)
 - #158951 (Merge three `MaxUniverse`s into one)
 - #158960 (Fix bootstrap submodule path prefix matching)
 - #158961 (Reapply "LLVM 23: Run AssignGUIDPass in some places")
 - #158995 (Use REST API in linkchecker script)
 - #158996 ([compiler] Implement `PartialOrd` via `Ord` for `Span` and newtype_indexes)
 - #159036 (bootstrap: expand '@argfile' arguments to rustc shim)
@rust-bors rust-bors Bot merged commit 589dd84 into rust-lang:main Jul 10, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 10, 2026
rust-timer added a commit that referenced this pull request Jul 10, 2026
Rollup merge of #159036 - lambdageek:rustc-shim-expand-argfile, r=Kobzol

bootstrap: expand '@argfile' arguments to rustc shim

When cargo invokes `rustc`, if the command line exceeds some system defined limit, `cargo` will try again and pass the arguments in an argfile.

When the bootstrap rustc shim tries to detect `--target`, it does not account for `@argfile` arguments.  As a result, the shim doesn't find `--target` and incorrectly sets `is_build_script` to true, as well as passing the `RUSTC_HOST_FLAGS` to the underlying compiler

This PR makes the shim read all the arguments from every `@argfile`.

Previous work #155439 already updated the shim to use `ArgFileCommand` to pass arguments down to the underlying `rustc`.

r? kobzol
@lambdageek lambdageek deleted the rustc-shim-expand-argfile branch July 10, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants