Repository navigation
Add support for arg files in Rust - #2782
Conversation
| }; | ||
|
|
||
| let mut contents = String::new(); | ||
| let res = fs_err::File::open(&file).and_then(|mut f| f.read_to_string(&mut contents)); |
There was a problem hiding this comment.
This should probably be wrapped in a BufReader, to avoid doing many syscalls for each read? Not sure if read_to_string already handles that.
There was a problem hiding this comment.
good point! The arg files can be decently large so seems like a good idea to do that.
There are some other reads in this file that as use read_to_string() but I think those are reading much smaller files so the they probably get everything in one syscall.
Updated in the latest push
6b927a5 to
fe3f126
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2782 +/- ##
==========================================
- Coverage 70.90% 62.47% -8.44%
==========================================
Files 71 71
Lines 40393 35979 -4414
==========================================
- Hits 28642 22479 -6163
- Misses 11751 13500 +1749 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 45.99%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | lru_sequential_scan_pattern |
128 B | 260 B | -50.77% |
| ❌ | Memory | lru_hotcold_access_pattern |
128 B | 260 B | -50.77% |
| ❌ | Memory | hash_multiple_files |
128 B | 260 B | -50.77% |
| ❌ | Memory | time_macro_finder_chunked |
128 B | 260 B | -50.77% |
| ❌ | Memory | lru_cache_get_hit |
128 B | 260 B | -50.77% |
| ❌ | Memory | hash_large_data |
192 B | 324 B | -40.74% |
| ❌ | Memory | hash_header_file |
192 B | 324 B | -40.74% |
| ❌ | Memory | cache_key_generation |
192 B | 324 B | -40.74% |
| ❌ | Memory | time_macro_finder_with_macros |
192 B | 324 B | -40.74% |
| ❌ | Memory | time_macro_finder_no_macros |
192 B | 324 B | -40.74% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ranger-ross:rust-arg-file (fe3f126) with main (7cd4f2c)
Footnotes
-
6 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [mozilla/sccache](https://github.com/mozilla/sccache) | minor | `0.16.0` → `0.17.0` | --- ### Release Notes <details> <summary>mozilla/sccache (mozilla/sccache)</summary> ### [`v0.17.0`](https://github.com/mozilla/sccache/releases/tag/v0.17.0) [Compare Source](mozilla/sccache@v0.16.0...v0.17.0) ##### sccache 0.17.0 ##### Summary sccache 0.17.0 is a significant release: it introduces a **new client-side architecture**. Until now, every compilation was handed off to the long-lived sccache server, which did the cache lookup and ran the compiler. In client-side mode, the client process does that work itself - the server is only consulted for the shared state it owns (compiler info, dist client, stats). This removes a round-trip and the server-side bottleneck, and gives noticeably better results on developer workstations. Client-side mode is opt-in for now: enable it with the `SCCACHE_CLIENT_SIDE` environment variable (or the `client_side_mode` config key). See [docs/Architecture.md](https://github.com/mozilla/sccache/blob/main/docs/Architecture.md#client-side-mode-sccache_client_side) for the details. Other highlights: - **Response files**: gcc/clang builds using quoted `@response` files are now cached and distributed correctly ([#​2755](mozilla/sccache#2755), [#​2772](mozilla/sccache#2772)), and Rust `@argfile` arguments are supported ([#​2782](mozilla/sccache#2782)). - **Distributed compilation**: compile tasks and their subprocesses are now aborted when a client disconnects, instead of running to completion on the build server ([#​2761](mozilla/sccache#2761), [#​2774](mozilla/sccache#2774)). The `ToolchainPackager` cfg gate was fixed so the dist code builds on ppc64le and s390x ([#​2749](mozilla/sccache#2749)). - **S3 SSE-KMS**: server-side encryption with KMS keys is now supported ([#​2770](mozilla/sccache#2770)). - **Diagnostics**: gcc color diagnostics now behave the same way as rustc's ([#​2758](mozilla/sccache#2758)). - **Preprocessor correctness**: `-ivfsoverlay` is treated as a preprocessor-only argument ([#​2767](mozilla/sccache#2767)). Welcome to 4 new contributors! ##### Client-side mode - Initial client-side implementation by [@​glandium](https://github.com/glandium) in [#​2735](mozilla/sccache#2735) - doc: document client-side and direct modes in Architecture.md by [@​sylvestre](https://github.com/sylvestre) in [#​2752](mozilla/sccache#2752) ##### Features - gcc/clang: cache and distribute builds using quoted [@​response](https://github.com/response) files by [@​avikivity](https://github.com/avikivity) in [#​2755](mozilla/sccache#2755) - Add support for arg files in Rust by [@​ranger-ross](https://github.com/ranger-ross) in [#​2782](mozilla/sccache#2782) - feat: support S3 SSE-KMS by [@​jpadilla](https://github.com/jpadilla) in [#​2770](mozilla/sccache#2770) - Make gcc diagnostics color output work the same as for rustc by [@​jwidauer](https://github.com/jwidauer) in [#​2758](mozilla/sccache#2758) - Abort compile tasks and associated subprocesses when a client disconnects by [@​trxcllnt](https://github.com/trxcllnt) in [#​2761](mozilla/sccache#2761) ##### Fixes - Fix ToolchainPackager cfg gate to build on ppc64le/s390x by [@​cryptomilk](https://github.com/cryptomilk) in [#​2749](mozilla/sccache#2749) - treat -ivfsoverlay as a preprocessor-only argument by [@​glandium](https://github.com/glandium) in [#​2767](mozilla/sccache#2767) - gcc: refine response-file tokenizer visibility and whitespace handling by [@​sylvestre](https://github.com/sylvestre) in [#​2772](mozilla/sccache#2772) - Fix description of Unix socket-based Redis connection by [@​Toorero](https://github.com/Toorero) in [#​2769](mozilla/sccache#2769) ##### Cleanup - Simplify the code from pr [#​2761](mozilla/sccache#2761) by [@​sylvestre](https://github.com/sylvestre) in [#​2774](mozilla/sccache#2774) - tests: pin libc in the dist test crate by [@​sylvestre](https://github.com/sylvestre) in [#​2784](mozilla/sccache#2784) - Release 0.17.0 by [@​sylvestre](https://github.com/sylvestre) in [#​2783](mozilla/sccache#2783) ##### New Contributors - [@​jwidauer](https://github.com/jwidauer) made their first contribution in [#​2758](mozilla/sccache#2758) - [@​jpadilla](https://github.com/jpadilla) made their first contribution in [#​2770](mozilla/sccache#2770) - [@​ranger-ross](https://github.com/ranger-ross) made their first contribution in [#​2782](mozilla/sccache#2782) - [@​Toorero](https://github.com/Toorero) made their first contribution in [#​2769](mozilla/sccache#2769) **Full Changelog**: <mozilla/sccache@v0.16.0...v0.17.0> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> --------- Co-authored-by: Renovate Bot <[email protected]> Reviewed-on: https://gitea.endsy.me/op/red/pulls/24
sccache 0.17.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre># sccache 0.17.0 ## Summary sccache 0.17.0 is a significant release: it introduces a **new client-side architecture**. Until now, every compilation was handed off to the long-lived sccache server, which did the cache lookup and ran the compiler. In client-side mode, the client process does that work itself - the server is only consulted for the shared state it owns (compiler info, dist client, stats). This removes a round-trip and the server-side bottleneck, and gives noticeably better results on developer workstations. Client-side mode is opt-in for now: enable it with the `SCCACHE_CLIENT_SIDE` environment variable (or the `client_side_mode` config key). See [docs/Architecture.md](https://github.com/mozilla/sccache/blob/main/docs/Architecture.md#client-side-mode-sccache_client_side) for the details. Other highlights: - **Response files**: gcc/clang builds using quoted `@response` files are now cached and distributed correctly (#2755, #2772), and Rust `@argfile` arguments are supported (#2782). - **Distributed compilation**: compile tasks and their subprocesses are now aborted when a client disconnects, instead of running to completion on the build server (#2761, #2774). The `ToolchainPackager` cfg gate was fixed so the dist code builds on ppc64le and s390x (#2749). - **S3 SSE-KMS**: server-side encryption with KMS keys is now supported (#2770). - **Diagnostics**: gcc color diagnostics now behave the same way as rustc's (#2758). - **Preprocessor correctness**: `-ivfsoverlay` is treated as a preprocessor-only argument (#2767). Welcome to 4 new contributors! ## Client-side mode * Initial client-side implementation by @glandium in mozilla/sccache#2735 * doc: document client-side and direct modes in Architecture.md by @sylvestre in mozilla/sccache#2752 ## Features * gcc/clang: cache and distribute builds using quoted @response files by @avikivity in mozilla/sccache#2755 * Add support for arg files in Rust by @ranger-ross in mozilla/sccache#2782 * feat: support S3 SSE-KMS by @jpadilla in mozilla/sccache#2770 * Make gcc diagnostics color output work the same as for rustc by @jwidauer in mozilla/sccache#2758 * Abort compile tasks and associated subprocesses when a client disconnects by @trxcllnt in mozilla/sccache#2761 ## Fixes * Fix ToolchainPackager cfg gate to build on ppc64le/s390x by @cryptomilk in mozilla/sccache#2749 * treat -ivfsoverlay as a preprocessor-only argument by @glandium in mozilla/sccache#2767 * gcc: refine response-file tokenizer visibility and whitespace handling by @sylvestre in mozilla/sccache#2772 * Fix description of Unix socket-based Redis connection by @Toorero in mozilla/sccache#2769 ## Cleanup * Simplify the code from pr #2761 by @sylvestre in mozilla/sccache#2774 * tests: pin libc in the dist test crate by @sylvestre in mozilla/sccache#2784 * Release 0.17.0 by @sylvestre in mozilla/sccache#2783 ## New Contributors * @jwidauer made their first contribution in mozilla/sccache#2758 * @jpadilla made their first contribution in mozilla/sccache#2770 * @ranger-ross made their first contribution in mozilla/sccache#2782 * @Toorero made their first contribution in mozilla/sccache#2769 **Full Changelog**: https://github.com/mozilla/sccache/compare/v0.16.0...v0.17.0</pre> <p>View the full release notes at <a href="https://github.com/mozilla/sccache/releases/tag/v0.17.0">https://github.com/mozilla/sccache/releases/tag/v0.17.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!15423
A rustc command line that Windows cannot spawn -- `CreateProcessW` takes at most 32,767 characters and fails with os error 206 above that -- now goes to rustc as a single `@<path>`, the way cargo spawns rustc itself when its command line is too long. sccache expands an `@file` argument to see the arguments it holds (mozilla#2782), but spawned rustc with the expanded list, so every compile cargo could only spawn through a response file failed under sccache (mozilla#2787): `cargo build --target wasm32-unknown-unknown` of a crate depending on web-sys failed with `sccache: failed to spawn rustc ... (os error 206)`, where the command line is 43,897 characters, 40,932 of them the `--check-cfg` of web-sys' 1,500 features. This is a regression of v0.17.0 over v0.16.0, which passed the `@file` through to rustc as one argument that it could not parse. The three places that spawn rustc with the arguments of the compile -- the `--emit dep-info` run for the source files (where the failure above came from), the `--print file-names` run for the outputs, and the compile itself -- now collapse them back into a response file when the command line is too long for the platform. The response file is the arguments themselves, so the compile that runs is the one that was asked for, and the cache key, taken from the arguments, is the same either way, so CACHE_VERSION does not change. Arguments a response file cannot hold unchanged (a newline, surrounding whitespace, an empty argument, a leading `@`, or bytes that are not UTF-8) keep the whole command line as it is, where the spawn fails as it would have without sccache, rather than compiling something else than what was asked: what rustc will read back is compared against the arguments before the file is used. Unix passes the arguments as a vector, under a limit (`ARG_MAX`) that no rustc command line comes near, and is left alone. Tests: `cargo test --locked --lib --bins` 637 passed, 0 failed, exit 0; `cargo fmt -- --check` and the AGENTS.md clippy line are clean. The new `test_generate_compile_commands_response_file` fails without the fix (`spawned with one @file rather than 2011 arguments`, exit 101, checked by putting the limit back to `None`). The dep-info mock of the test harness now expands a response file, as rustc does, rather than failing to find `-o` in the arguments, and `hash_key_with` is split into a `hash_result_with` that the new test uses for the compilation. Fixes mozilla#2787 Co-Authored-By: Claude Opus 5 <[email protected]>
A rustc command line that Windows cannot spawn -- `CreateProcessW` takes at most 32,767 characters and fails with os error 206 above that -- now goes to rustc as a single `@<path>`, the way cargo spawns rustc itself when its command line is too long. sccache expands an `@file` argument to see the arguments it holds (#2782), but spawned rustc with the expanded list, so every compile cargo could only spawn through a response file failed under sccache (#2787): `cargo build --target wasm32-unknown-unknown` of a crate depending on web-sys failed with `sccache: failed to spawn rustc ... (os error 206)`, where the command line is 43,897 characters, 40,932 of them the `--check-cfg` of web-sys' 1,500 features. This is a regression of v0.17.0 over v0.16.0, which passed the `@file` through to rustc as one argument that it could not parse. The three places that spawn rustc with the arguments of the compile -- the `--emit dep-info` run for the source files (where the failure above came from), the `--print file-names` run for the outputs, and the compile itself -- now collapse them back into a response file when the command line is too long for the platform. The response file is the arguments themselves, so the compile that runs is the one that was asked for, and the cache key, taken from the arguments, is the same either way, so CACHE_VERSION does not change. Arguments a response file cannot hold unchanged (a newline, surrounding whitespace, an empty argument, a leading `@`, or bytes that are not UTF-8) keep the whole command line as it is, where the spawn fails as it would have without sccache, rather than compiling something else than what was asked: what rustc will read back is compared against the arguments before the file is used. Unix passes the arguments as a vector, under a limit (`ARG_MAX`) that no rustc command line comes near, and is left alone. Tests: `cargo test --locked --lib --bins` 637 passed, 0 failed, exit 0; `cargo fmt -- --check` and the AGENTS.md clippy line are clean. The new `test_generate_compile_commands_response_file` fails without the fix (`spawned with one @file rather than 2011 arguments`, exit 101, checked by putting the limit back to `None`). The dep-info mock of the test harness now expands a response file, as rustc does, rather than failing to find `-o` in the arguments, and `hash_key_with` is split into a `hash_result_with` that the new test uses for the compilation. Fixes #2787 Co-Authored-By: Claude Opus 5 <[email protected]>
This PR adds support for arg files (aka response files) in Rust.
Cargo is planning to make some changes in rust-lang/cargo#15010 which will likely increase the total number of args passed to rustc, making sccache's lack of support for arg files more painful to users. (especially to windows users)