Add args-file support for large Windows workspaces - #7028
Open
psandana wants to merge 3 commits into
Open
Conversation
Expand rustc-style @argument files in rustfmt and have cargo-fmt use a temporary response file when a Windows command would reach the CreateProcessW limit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace @response-file parsing with --args-file so source files beginning with @ retain their existing meaning. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Aug 11, 2026
|
May want to verify a UTF-8 args file starting with a byte-order mark ( |
Strip a leading UTF-8 byte-order mark before parsing the first argument line and cover both rustfmt and cargo-fmt paths. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Author
|
Added UTF-8 BOM coverage in b7922a7. Argument-file readers now strip a leading EF BB BF, with unit coverage for both rustfmt and cargo-fmt plus BOM-enabled integration tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6934.
This implements the explicit argument-file option suggested in #6934 (comment) and replaces the closed #7027 approach.
Problem
cargo-fmtpasses every target path for an edition directly to onerustfmtprocess. Windows limits the completeCreateProcessWcommand line to 32,767 UTF-16 code units, so large workspaces fail with OS error 206 before rustfmt starts.Solution
Rustfmt gains an explicit argument-file option:
Argument files are UTF-8 with one argument per line. They may be nested up to 16 levels, and
--terminates option and argument-file expansion globally. Ordinary filenames beginning with@retain their existing meaning; no existing positional syntax is reinterpreted.On Windows,
cargo-fmtcalculates the command-line length using Rust's Windows quoting rules. Only when an invocation would reach 32,767 UTF-16 code units does it write the complete rustfmt argument vector to a temporary file and invokerustfmt --args-file <temporary-path>.Keeping one rustfmt process per edition preserves existing session, ordering, JSON, and checkstyle behavior. User-provided
--args-fileoptions are expanded before cargo-fmt creates its transport file, so behavior remains identical below and above the Windows threshold.Compatibility
@source.rsremains an ordinary source filename.Tests
=syntax, CRLF, blank arguments, missing files, nesting, and global--termination.@.cargo fmtfailure on Windows, too many command line args #6934 918-target reproducer.