From 4dc8fe90836c622e57293c1262a9f7728e5edfc8 Mon Sep 17 00:00:00 2001 From: Mark Simulacrum Date: Tue, 27 Jun 2017 13:37:24 -0600 Subject: [PATCH] Store positive instead of negative fail_fast. This makes later negation much easier to interpret. --- src/bootstrap/check.rs | 10 +++++----- src/bootstrap/flags.rs | 8 ++++---- src/bootstrap/lib.rs | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 04ae7e1e009..1ee33c1f465 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -59,7 +59,7 @@ impl fmt::Display for TestKind { } fn try_run(build: &Build, cmd: &mut Command) { - if build.flags.cmd.no_fail_fast() { + if !build.fail_fast { if !build.try_run(cmd) { let failures = build.delayed_failures.get(); build.delayed_failures.set(failures + 1); @@ -70,7 +70,7 @@ fn try_run(build: &Build, cmd: &mut Command) { } fn try_run_quiet(build: &Build, cmd: &mut Command) { - if build.flags.cmd.no_fail_fast() { + if !build.fail_fast { if !build.try_run_quiet(cmd) { let failures = build.delayed_failures.get(); build.delayed_failures.set(failures + 1); @@ -128,7 +128,7 @@ pub fn cargo(build: &Build, stage: u32, host: &str) { let mut cargo = build.cargo(compiler, Mode::Tool, host, "test"); cargo.arg("--manifest-path").arg(build.src.join("src/tools/cargo/Cargo.toml")); - if build.flags.cmd.no_fail_fast() { + if !build.fail_fast { cargo.arg("--no-fail-fast"); } @@ -448,7 +448,7 @@ pub fn krate(build: &Build, cargo.arg("--manifest-path") .arg(build.src.join(path).join("Cargo.toml")) .arg("--features").arg(features); - if test_kind.subcommand() == "test" && build.flags.cmd.no_fail_fast() { + if test_kind.subcommand() == "test" && !build.fail_fast { cargo.arg("--no-fail-fast"); } @@ -669,7 +669,7 @@ pub fn bootstrap(build: &Build) { .env("CARGO_TARGET_DIR", build.out.join("bootstrap")) .env("RUSTC_BOOTSTRAP", "1") .env("RUSTC", &build.initial_rustc); - if build.flags.cmd.no_fail_fast() { + if !build.fail_fast { cmd.arg("--no-fail-fast"); } cmd.arg("--").args(&build.flags.cmd.test_args()); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 4541b6623c4..593b0651758 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -61,7 +61,7 @@ pub enum Subcommand { Test { paths: Vec, test_args: Vec, - no_fail_fast: bool, + fail_fast: bool, }, Bench { paths: Vec, @@ -278,7 +278,7 @@ Arguments: Subcommand::Test { paths: paths, test_args: matches.opt_strs("test-args"), - no_fail_fast: matches.opt_present("no-fail-fast"), + fail_fast: !matches.opt_present("no-fail-fast"), } } "bench" => { @@ -354,9 +354,9 @@ impl Subcommand { } } - pub fn no_fail_fast(&self) -> bool { + pub fn fail_fast(&self) -> bool { match *self { - Subcommand::Test { no_fail_fast, .. } => no_fail_fast, + Subcommand::Test { fail_fast, .. } => fail_fast, _ => false, } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index a6608972acd..978e1d2be16 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -167,6 +167,7 @@ pub struct Build { cargo_info: channel::GitInfo, rls_info: channel::GitInfo, local_rebuild: bool, + fail_fast: bool, // Stage 0 (downloaded) compiler and cargo or their local rust equivalents. initial_rustc: PathBuf, @@ -240,12 +241,12 @@ impl Build { let rust_info = channel::GitInfo::new(&src); let cargo_info = channel::GitInfo::new(&src.join("src/tools/cargo")); let rls_info = channel::GitInfo::new(&src.join("src/tools/rls")); - let src_is_git = src.join(".git").exists(); Build { initial_rustc: config.initial_rustc.clone(), initial_cargo: config.initial_cargo.clone(), local_rebuild: config.local_rebuild, + fail_fast: flags.cmd.fail_fast(), flags: flags, config: config,