From d78b4a93509174bed2080b627d74c956d2654366 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 1 Mar 2016 21:09:36 -0500 Subject: [PATCH] change compile_flags to eagerly split into a vector on whitespace --- src/compiletest/header.rs | 12 +++++++----- src/compiletest/runtest.rs | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index d5745ab8b34..26567e12ea7 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -22,7 +22,7 @@ pub struct TestProps { // Lines that should be expected, in order, on standard out pub error_patterns: Vec , // Extra flags to pass to the compiler - pub compile_flags: Option, + pub compile_flags: Vec, // Extra flags to pass when the compiled code is run (such as --bench) pub run_flags: Option, // If present, the name of a file that this test should match when @@ -57,7 +57,6 @@ pub fn load_props(testfile: &Path) -> TestProps { let error_patterns = Vec::new(); let aux_builds = Vec::new(); let exec_env = Vec::new(); - let compile_flags = None; let run_flags = None; let pp_exact = None; let check_lines = Vec::new(); @@ -70,7 +69,7 @@ pub fn load_props(testfile: &Path) -> TestProps { let forbid_output = Vec::new(); let mut props = TestProps { error_patterns: error_patterns, - compile_flags: compile_flags, + compile_flags: vec![], run_flags: run_flags, pp_exact: pp_exact, aux_builds: aux_builds, @@ -95,8 +94,11 @@ pub fn load_props_into(props: &mut TestProps, testfile: &Path) { props.error_patterns.push(ep); } - if props.compile_flags.is_none() { - props.compile_flags = parse_compile_flags(ln); + if let Some(flags) = parse_compile_flags(ln) { + props.compile_flags.extend( + flags + .split_whitespace() + .map(|s| s.to_owned())); } if props.run_flags.is_none() { diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 7cad5a4391c..4ebfce86381 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -275,7 +275,7 @@ fn make_pp_args(config: &Config, "-L".to_owned(), aux_dir.to_str().unwrap().to_owned()); args.extend(split_maybe_args(&config.target_rustcflags)); - args.extend(split_maybe_args(&props.compile_flags)); + args.extend(props.compile_flags.iter().cloned()); return ProcArgs { prog: config.rustc_path.to_str().unwrap().to_owned(), args: args, @@ -322,7 +322,7 @@ fn make_typecheck_args(config: &Config, props: &TestProps, testpaths: &TestPaths "-L".to_owned(), aux_dir.to_str().unwrap().to_owned()); args.extend(split_maybe_args(&config.target_rustcflags)); - args.extend(split_maybe_args(&props.compile_flags)); + args.extend(props.compile_flags.iter().cloned()); // FIXME (#9639): This needs to handle non-utf8 paths return ProcArgs { prog: config.rustc_path.to_str().unwrap().to_owned(), @@ -1184,7 +1184,7 @@ fn document(config: &Config, "-o".to_owned(), out_dir.to_str().unwrap().to_owned(), testpaths.file.to_str().unwrap().to_owned()]; - args.extend(split_maybe_args(&props.compile_flags)); + args.extend(props.compile_flags.iter().cloned()); let args = ProcArgs { prog: config.rustdoc_path.to_str().unwrap().to_owned(), args: args, @@ -1369,7 +1369,7 @@ fn make_compile_args(config: &Config, } else { args.extend(split_maybe_args(&config.target_rustcflags)); } - args.extend(split_maybe_args(&props.compile_flags)); + args.extend(props.compile_flags.iter().cloned()); return ProcArgs { prog: config.rustc_path.to_str().unwrap().to_owned(), args: args, -- 2.44.0