Skip to content

Commit d78b4a9

Browse files
committed
change compile_flags to eagerly split into a vector on whitespace
1 parent c761257 commit d78b4a9

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/compiletest/header.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct TestProps {
2222
// Lines that should be expected, in order, on standard out
2323
pub error_patterns: Vec<String> ,
2424
// Extra flags to pass to the compiler
25-
pub compile_flags: Option<String>,
25+
pub compile_flags: Vec<String>,
2626
// Extra flags to pass when the compiled code is run (such as --bench)
2727
pub run_flags: Option<String>,
2828
// If present, the name of a file that this test should match when
@@ -57,7 +57,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
5757
let error_patterns = Vec::new();
5858
let aux_builds = Vec::new();
5959
let exec_env = Vec::new();
60-
let compile_flags = None;
6160
let run_flags = None;
6261
let pp_exact = None;
6362
let check_lines = Vec::new();
@@ -70,7 +69,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
7069
let forbid_output = Vec::new();
7170
let mut props = TestProps {
7271
error_patterns: error_patterns,
73-
compile_flags: compile_flags,
72+
compile_flags: vec![],
7473
run_flags: run_flags,
7574
pp_exact: pp_exact,
7675
aux_builds: aux_builds,
@@ -95,8 +94,11 @@ pub fn load_props_into(props: &mut TestProps, testfile: &Path) {
9594
props.error_patterns.push(ep);
9695
}
9796

98-
if props.compile_flags.is_none() {
99-
props.compile_flags = parse_compile_flags(ln);
97+
if let Some(flags) = parse_compile_flags(ln) {
98+
props.compile_flags.extend(
99+
flags
100+
.split_whitespace()
101+
.map(|s| s.to_owned()));
100102
}
101103

102104
if props.run_flags.is_none() {

src/compiletest/runtest.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
275275
"-L".to_owned(),
276276
aux_dir.to_str().unwrap().to_owned());
277277
args.extend(split_maybe_args(&config.target_rustcflags));
278-
args.extend(split_maybe_args(&props.compile_flags));
278+
args.extend(props.compile_flags.iter().cloned());
279279
return ProcArgs {
280280
prog: config.rustc_path.to_str().unwrap().to_owned(),
281281
args: args,
@@ -322,7 +322,7 @@ actual:\n\
322322
"-L".to_owned(),
323323
aux_dir.to_str().unwrap().to_owned());
324324
args.extend(split_maybe_args(&config.target_rustcflags));
325-
args.extend(split_maybe_args(&props.compile_flags));
325+
args.extend(props.compile_flags.iter().cloned());
326326
// FIXME (#9639): This needs to handle non-utf8 paths
327327
return ProcArgs {
328328
prog: config.rustc_path.to_str().unwrap().to_owned(),
@@ -1184,7 +1184,7 @@ fn document(config: &Config,
11841184
"-o".to_owned(),
11851185
out_dir.to_str().unwrap().to_owned(),
11861186
testpaths.file.to_str().unwrap().to_owned()];
1187-
args.extend(split_maybe_args(&props.compile_flags));
1187+
args.extend(props.compile_flags.iter().cloned());
11881188
let args = ProcArgs {
11891189
prog: config.rustdoc_path.to_str().unwrap().to_owned(),
11901190
args: args,
@@ -1369,7 +1369,7 @@ fn make_compile_args<F>(config: &Config,
13691369
} else {
13701370
args.extend(split_maybe_args(&config.target_rustcflags));
13711371
}
1372-
args.extend(split_maybe_args(&props.compile_flags));
1372+
args.extend(props.compile_flags.iter().cloned());
13731373
return ProcArgs {
13741374
prog: config.rustc_path.to_str().unwrap().to_owned(),
13751375
args: args,

0 commit comments

Comments
 (0)