about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2017-06-27 13:49:21 -0600
committerMark Simulacrum <mark.simulacrum@gmail.com>2017-07-04 07:31:56 -0600
commit39cf1da81c73e9bcd7b60dad927cbe1f360bc1f3 (patch)
tree45375783f507143d38e93eb672e85e093067c5f0 /src/bootstrap
parent4dc8fe90836c622e57293c1262a9f7728e5edfc8 (diff)
downloadrust-39cf1da81c73e9bcd7b60dad927cbe1f360bc1f3.tar.gz
rust-39cf1da81c73e9bcd7b60dad927cbe1f360bc1f3.zip
Store verbosity on Build
Prevents accidental mistakes in not using the right verbosity by going
to only config or flags.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/check.rs2
-rw-r--r--src/bootstrap/flags.rs10
-rw-r--r--src/bootstrap/lib.rs17
3 files changed, 14 insertions, 15 deletions
diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs
index 1ee33c1f465..a06d925e2ef 100644
--- a/src/bootstrap/check.rs
+++ b/src/bootstrap/check.rs
@@ -249,7 +249,7 @@ pub fn compiletest(build: &Build,
 
     cmd.args(&build.flags.cmd.test_args());
 
-    if build.config.verbose() || build.flags.verbose() {
+    if build.is_verbose() {
         cmd.arg("--verbose");
     }
 
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 593b0651758..5804df34e8b 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -41,16 +41,6 @@ pub struct Flags {
     pub incremental: bool,
 }
 
-impl Flags {
-    pub fn verbose(&self) -> bool {
-        self.verbose > 0
-    }
-
-    pub fn very_verbose(&self) -> bool {
-        self.verbose > 1
-    }
-}
-
 pub enum Subcommand {
     Build {
         paths: Vec<PathBuf>,
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 978e1d2be16..be28975c3ea 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -168,6 +168,7 @@ pub struct Build {
     rls_info: channel::GitInfo,
     local_rebuild: bool,
     fail_fast: bool,
+    verbosity: usize,
 
     // Stage 0 (downloaded) compiler and cargo or their local rust equivalents.
     initial_rustc: PathBuf,
@@ -247,6 +248,7 @@ impl Build {
             initial_cargo: config.initial_cargo.clone(),
             local_rebuild: config.local_rebuild,
             fail_fast: flags.cmd.fail_fast(),
+            verbosity: cmp::max(flags.verbose, config.verbose),
 
             flags: flags,
             config: config,
@@ -428,8 +430,7 @@ impl Build {
             cargo.env("RUSTC_ON_FAIL", on_fail);
         }
 
-        let verbose = cmp::max(self.config.verbose, self.flags.verbose);
-        cargo.env("RUSTC_VERBOSE", format!("{}", verbose));
+        cargo.env("RUSTC_VERBOSE", format!("{}", self.verbosity));
 
         // Specify some various options for build scripts used throughout
         // the build.
@@ -467,7 +468,7 @@ impl Build {
         // FIXME: should update code to not require this env var
         cargo.env("CFG_COMPILER_HOST_TRIPLE", target);
 
-        if self.config.verbose() || self.flags.verbose() {
+        if self.is_verbose() {
             cargo.arg("-v");
         }
         // FIXME: cargo bench does not accept `--release`
@@ -779,9 +780,17 @@ impl Build {
         try_run_suppressed(cmd)
     }
 
+    pub fn is_verbose(&self) -> bool {
+        self.verbosity > 0
+    }
+
+    pub fn is_very_verbose(&self) -> bool {
+        self.verbosity > 1
+    }
+
     /// Prints a message if this build is configured in verbose mode.
     fn verbose(&self, msg: &str) {
-        if self.flags.verbose() || self.config.verbose() {
+        if self.is_verbose() {
             println!("{}", msg);
         }
     }