Skip to content

Use response files when spawning rustc commands when needed - #2789

Open
ranger-ross wants to merge 1 commit into
mozilla:mainfrom
ranger-ross:fix-arg-files
Open

Use response files when spawning rustc commands when needed#2789
ranger-ross wants to merge 1 commit into
mozilla:mainfrom
ranger-ross:fix-arg-files

Conversation

@ranger-ross

Copy link
Copy Markdown
Contributor

This is a follow up on #2782.

Unfortunately, I overlooked the fact that sccache modifies the args and does not pass the exact args to rustc that it receives.
This leads to the expanded args getting passed to rustc which blows up on windows when the command is large enough.

The solution is to have sccache create its own arg file (when needed) to pass the args to rustc.

fixes #2787
(I tested the repo in question and it fails without these changes and builds successfully with them)

Comment thread src/compiler/rust.rs
Comment on lines +1128 to +1138
// On Windows there is a hard limit of ~32KB, so we cut off at 30KB to
// give some buffer just incase.
#[cfg(windows)]
let threshold: usize = 30 * 1024;
// On unix the limit is defined by ARG_MAX. If its not explicitly set we set it to 1MB
// which is fairly large but lower than the ~2MB that it defaults to on most systems.
#[cfg(unix)]
let threshold: usize = std::env::var("ARG_MAX")
.ok()
.and_then(|v| v.parse().ok())
.unwrap_or(1024 * 1024);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@codecov-commenter

codecov-commenter commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.27273% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.31%. Comparing base (ed0dec7) to head (e02a9e9).

Files with missing lines Patch % Lines
src/compiler/rust.rs 63.82% 17 Missing ⚠️
src/dist/mod.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2789      +/-   ##
==========================================
- Coverage   74.32%   74.31%   -0.02%     
==========================================
  Files          72       72              
  Lines       40772    40821      +49     
==========================================
+ Hits        30305    30336      +31     
- Misses      10467    10485      +18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ranger-ross

Copy link
Copy Markdown
Contributor Author

CI failures should be unrelated to this change.
But I raised #2790 to fix it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust on Windows: failed to spawn Command

2 participants