about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2024-06-22 09:44:04 +0200
committerJakub Beránek <berykubik@gmail.com>2024-06-28 12:42:52 +0200
commitcf5bbb3a0859c5e1854a1110b95fe25994fb091a (patch)
treeb81afd1ea41ea4998653b08de575fffa09335262
parent903d6a9d89c5feb936fa29f89246385c82d2db54 (diff)
downloadrust-cf5bbb3a0859c5e1854a1110b95fe25994fb091a.tar.gz
rust-cf5bbb3a0859c5e1854a1110b95fe25994fb091a.zip
Remove `run` and rename `run_tracked` to `run`
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs41
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs2
-rw-r--r--src/bootstrap/src/lib.rs12
3 files changed, 23 insertions, 32 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index d268149da70..eefeee8fb0d 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -156,7 +156,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
         let _guard =
             builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host);
         let _time = helpers::timeit(builder);
-        builder.run_tracked(
+        builder.run(
             BootstrapCommand::from(linkchecker.arg(builder.out.join(host.triple).join("doc")))
                 .delay_failure(),
         );
@@ -216,7 +216,7 @@ impl Step for HtmlCheck {
             builder,
         ));
 
-        builder.run_tracked(
+        builder.run(
             BootstrapCommand::from(
                 builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target)),
             )
@@ -267,7 +267,7 @@ impl Step for Cargotest {
             .env("RUSTC", builder.rustc(compiler))
             .env("RUSTDOC", builder.rustdoc(compiler));
         add_rustdoc_cargo_linker_args(cmd, builder, compiler.host, LldThreads::No);
-        builder.run_tracked(BootstrapCommand::from(cmd).delay_failure());
+        builder.run(BootstrapCommand::from(cmd).delay_failure());
     }
 }
 
@@ -766,7 +766,7 @@ impl Step for Clippy {
         let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
 
         // Clippy reports errors if it blessed the outputs
-        if builder.run_tracked(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
+        if builder.run(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
             // The tests succeeded; nothing to do.
             return;
         }
@@ -819,7 +819,7 @@ impl Step for RustdocTheme {
             .env("RUSTC_BOOTSTRAP", "1");
         cmd.args(linker_args(builder, self.compiler.host, LldThreads::No));
 
-        builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
+        builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
     }
 }
 
@@ -1097,7 +1097,7 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
         }
 
         builder.info("tidy check");
-        builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
+        builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
 
         builder.info("x.py completions check");
         let [bash, zsh, fish, powershell] = ["x.py.sh", "x.py.zsh", "x.py.fish", "x.py.ps1"]
@@ -2184,11 +2184,8 @@ impl BookTest {
         );
         let _time = helpers::timeit(builder);
         let cmd = BootstrapCommand::from(&mut rustbook_cmd).delay_failure();
-        let toolstate = if builder.run_tracked(cmd).is_success() {
-            ToolState::TestPass
-        } else {
-            ToolState::TestFail
-        };
+        let toolstate =
+            if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
         builder.save_toolstate(self.name, toolstate);
     }
 
@@ -2317,8 +2314,7 @@ impl Step for ErrorIndex {
         let guard =
             builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host);
         let _time = helpers::timeit(builder);
-        builder
-            .run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
+        builder.run(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
         drop(guard);
         // The tests themselves need to link to std, so make sure it is
         // available.
@@ -2351,7 +2347,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
     if !builder.config.verbose_tests {
         cmd = cmd.quiet();
     }
-    builder.run_tracked(cmd).is_success()
+    builder.run(cmd).is_success()
 }
 
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2377,11 +2373,8 @@ impl Step for RustcGuide {
         let src = builder.src.join(relative_path);
         let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
         let cmd = BootstrapCommand::from(rustbook_cmd.arg("linkcheck").arg(&src)).delay_failure();
-        let toolstate = if builder.run_tracked(cmd).is_success() {
-            ToolState::TestPass
-        } else {
-            ToolState::TestFail
-        };
+        let toolstate =
+            if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
         builder.save_toolstate("rustc-dev-guide", toolstate);
     }
 }
@@ -2994,7 +2987,7 @@ impl Step for Bootstrap {
             .current_dir(builder.src.join("src/bootstrap/"));
         // NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible.
         // Use `python -m unittest` manually if you want to pass arguments.
-        builder.run_tracked(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
+        builder.run(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
 
         let mut cmd = Command::new(&builder.initial_cargo);
         cmd.arg("test")
@@ -3071,7 +3064,7 @@ impl Step for TierCheck {
             self.compiler.host,
             self.compiler.host,
         );
-        builder.run_tracked(BootstrapCommand::from(&mut cargo.into()).delay_failure());
+        builder.run(BootstrapCommand::from(&mut cargo.into()).delay_failure());
     }
 }
 
@@ -3157,7 +3150,7 @@ impl Step for RustInstaller {
         cmd.env("CARGO", &builder.initial_cargo);
         cmd.env("RUSTC", &builder.initial_rustc);
         cmd.env("TMP_DIR", &tmpdir);
-        builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
+        builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
     }
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -3352,7 +3345,7 @@ impl Step for CodegenCranelift {
         cargo.args(builder.config.test_args());
 
         let mut cmd: Command = cargo.into();
-        builder.run_tracked(BootstrapCommand::from(&mut cmd));
+        builder.run(BootstrapCommand::from(&mut cmd));
     }
 }
 
@@ -3478,6 +3471,6 @@ impl Step for CodegenGCC {
         cargo.args(builder.config.test_args());
 
         let mut cmd: Command = cargo.into();
-        builder.run_tracked(BootstrapCommand::from(&mut cmd));
+        builder.run(BootstrapCommand::from(&mut cmd));
     }
 }
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index 6716caab69a..bf4ffc2096a 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -918,7 +918,7 @@ impl Step for LibcxxVersionTool {
                 .arg(&executable)
                 .arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
 
-            builder.run_tracked(BootstrapCommand::from(&mut cmd));
+            builder.run(BootstrapCommand::from(&mut cmd));
 
             if !executable.exists() {
                 panic!("Something went wrong. {} is not present", executable.display());
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index ed15088bc70..fdf5f48771a 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -581,7 +581,7 @@ impl Build {
         // Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
         // diff-index reports the modifications through the exit status
         let has_local_modifications = self
-            .run_tracked(
+            .run(
                 BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
                     .allow_failure(),
             )
@@ -959,11 +959,14 @@ impl Build {
     }
 
     /// Execute a command and return its output.
-    fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
+    /// This method should be used for all command executions in bootstrap.
+    fn run<'a, C: Into<BootstrapCommand<'a>>>(&self, command: C) -> CommandOutput {
         if self.config.dry_run() {
             return CommandOutput::default();
         }
 
+        let command = command.into();
+
         self.verbose(|| println!("running: {command:?}"));
 
         let output_mode = command.output_mode.unwrap_or_else(|| match self.is_verbose() {
@@ -1022,11 +1025,6 @@ impl Build {
         output
     }
 
-    /// Runs a command, printing out nice contextual information if it fails.
-    fn run(&self, cmd: &mut Command) {
-        self.run_tracked(BootstrapCommand::from(cmd));
-    }
-
     /// Check if verbosity is greater than the `level`
     pub fn is_verbose_than(&self, level: usize) -> bool {
         self.verbosity > level