Skip to content

Ignore blank lines in response files #116610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/rustc_driver_impl/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ fn arg_expand(arg: String) -> Result<Vec<String>, Error> {
}
Err(err) => return Err(Error::IOError(path.to_string(), err)),
};
Ok(file.lines().map(ToString::to_string).collect())
Ok(file
.lines()
.map(str::trim)
.filter_map(|s| (!s.is_empty()).then(|| s.to_string()))
.collect())
} else {
Ok(vec![arg])
}
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/empty/response-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


-v

6 changes: 6 additions & 0 deletions tests/ui/empty/response-file-ignores-spaces.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// check-pass
// compile-flags: @{{src-base}}/empty/response-file

// Check that blank lines as well as leading and trailing whitespace in response
// files are ignored
#![crate_type = "lib"]