Skip to content

Commit ac0e874

Browse files
committed
Ignore blank lines in response files
Fixes #116068
1 parent cdddcd3 commit ac0e874

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

compiler/rustc_driver_impl/src/args.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ fn arg_expand(arg: String) -> Result<Vec<String>, Error> {
1414
}
1515
Err(err) => return Err(Error::IOError(path.to_string(), err)),
1616
};
17-
Ok(file.lines().map(ToString::to_string).collect())
17+
Ok(file
18+
.lines()
19+
.map(str::trim)
20+
.filter_map(|s| (!s.is_empty()).then(|| s.to_string()))
21+
.collect())
1822
} else {
1923
Ok(vec![arg])
2024
}

tests/ui/empty/response-file

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
-v
4+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// check-pass
2+
// compile-flags: @tests/ui/empty/response-file
3+
4+
// Check that blank lines as well as leading and trailing whitespace in response
5+
// files are ignored
6+
#![crate_type = "lib"]

0 commit comments

Comments
 (0)