Add response-file support for large Windows workspaces - #7027
Closed
psandana wants to merge 1 commit into
Closed
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>
Contributor
|
Going to close this one for now. I personally don't think we'll move forward with the |
Author
|
Updated the implementation to use the explicit --args-file option suggested in #6934 (comment). This removes the breaking interpretation of filenames beginning with @; @source.rs remains an ordinary positional filename. |
Author
|
Replacement PR #7028 implements the suggested explicit --args-file design and leaves @-prefixed filenames unchanged. |
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 revision implements the explicit argument-file option suggested in #6934 (comment).
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.The issue reproducer contains 918 targets and exceeds that limit under a typical absolute checkout path.
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.