Skip to content

Commit efe5652

Browse files
committed
Remove run and rename run_tracked to run
1 parent 591d335 commit efe5652

File tree

3 files changed

+23
-32
lines changed

3 files changed

+23
-32
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
156156
let _guard =
157157
builder.msg(Kind::Test, compiler.stage, "Linkcheck", bootstrap_host, bootstrap_host);
158158
let _time = helpers::timeit(builder);
159-
builder.run_tracked(
159+
builder.run(
160160
BootstrapCommand::from(linkchecker.arg(builder.out.join(host.triple).join("doc")))
161161
.delay_failure(),
162162
);
@@ -216,7 +216,7 @@ impl Step for HtmlCheck {
216216
builder,
217217
));
218218

219-
builder.run_tracked(
219+
builder.run(
220220
BootstrapCommand::from(
221221
builder.tool_cmd(Tool::HtmlChecker).arg(builder.doc_out(self.target)),
222222
)
@@ -267,7 +267,7 @@ impl Step for Cargotest {
267267
.env("RUSTC", builder.rustc(compiler))
268268
.env("RUSTDOC", builder.rustdoc(compiler));
269269
add_rustdoc_cargo_linker_args(cmd, builder, compiler.host, LldThreads::No);
270-
builder.run_tracked(BootstrapCommand::from(cmd).delay_failure());
270+
builder.run(BootstrapCommand::from(cmd).delay_failure());
271271
}
272272
}
273273

@@ -766,7 +766,7 @@ impl Step for Clippy {
766766
let _guard = builder.msg_sysroot_tool(Kind::Test, compiler.stage, "clippy", host, host);
767767

768768
// Clippy reports errors if it blessed the outputs
769-
if builder.run_tracked(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
769+
if builder.run(BootstrapCommand::from(&mut cargo).allow_failure()).is_success() {
770770
// The tests succeeded; nothing to do.
771771
return;
772772
}
@@ -819,7 +819,7 @@ impl Step for RustdocTheme {
819819
.env("RUSTC_BOOTSTRAP", "1");
820820
cmd.args(linker_args(builder, self.compiler.host, LldThreads::No));
821821

822-
builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
822+
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
823823
}
824824
}
825825

@@ -1099,7 +1099,7 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
10991099
}
11001100

11011101
builder.info("tidy check");
1102-
builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
1102+
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
11031103

11041104
builder.info("x.py completions check");
11051105
let [bash, zsh, fish, powershell] = ["x.py.sh", "x.py.zsh", "x.py.fish", "x.py.ps1"]
@@ -2186,11 +2186,8 @@ impl BookTest {
21862186
);
21872187
let _time = helpers::timeit(builder);
21882188
let cmd = BootstrapCommand::from(&mut rustbook_cmd).delay_failure();
2189-
let toolstate = if builder.run_tracked(cmd).is_success() {
2190-
ToolState::TestPass
2191-
} else {
2192-
ToolState::TestFail
2193-
};
2189+
let toolstate =
2190+
if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
21942191
builder.save_toolstate(self.name, toolstate);
21952192
}
21962193

@@ -2319,8 +2316,7 @@ impl Step for ErrorIndex {
23192316
let guard =
23202317
builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host);
23212318
let _time = helpers::timeit(builder);
2322-
builder
2323-
.run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
2319+
builder.run(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
23242320
drop(guard);
23252321
// The tests themselves need to link to std, so make sure it is
23262322
// available.
@@ -2353,7 +2349,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
23532349
if !builder.config.verbose_tests {
23542350
cmd = cmd.quiet();
23552351
}
2356-
builder.run_tracked(cmd).is_success()
2352+
builder.run(cmd).is_success()
23572353
}
23582354

23592355
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2379,11 +2375,8 @@ impl Step for RustcGuide {
23792375
let src = builder.src.join(relative_path);
23802376
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
23812377
let cmd = BootstrapCommand::from(rustbook_cmd.arg("linkcheck").arg(&src)).delay_failure();
2382-
let toolstate = if builder.run_tracked(cmd).is_success() {
2383-
ToolState::TestPass
2384-
} else {
2385-
ToolState::TestFail
2386-
};
2378+
let toolstate =
2379+
if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
23872380
builder.save_toolstate("rustc-dev-guide", toolstate);
23882381
}
23892382
}
@@ -2993,7 +2986,7 @@ impl Step for Bootstrap {
29932986
.current_dir(builder.src.join("src/bootstrap/"));
29942987
// NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible.
29952988
// Use `python -m unittest` manually if you want to pass arguments.
2996-
builder.run_tracked(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
2989+
builder.run(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
29972990

29982991
let mut cmd = Command::new(&builder.initial_cargo);
29992992
cmd.arg("test")
@@ -3070,7 +3063,7 @@ impl Step for TierCheck {
30703063
self.compiler.host,
30713064
self.compiler.host,
30723065
);
3073-
builder.run_tracked(BootstrapCommand::from(&mut cargo.into()).delay_failure());
3066+
builder.run(BootstrapCommand::from(&mut cargo.into()).delay_failure());
30743067
}
30753068
}
30763069

@@ -3156,7 +3149,7 @@ impl Step for RustInstaller {
31563149
cmd.env("CARGO", &builder.initial_cargo);
31573150
cmd.env("RUSTC", &builder.initial_rustc);
31583151
cmd.env("TMP_DIR", &tmpdir);
3159-
builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
3152+
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
31603153
}
31613154

31623155
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -3351,7 +3344,7 @@ impl Step for CodegenCranelift {
33513344
cargo.args(builder.config.test_args());
33523345

33533346
let mut cmd: Command = cargo.into();
3354-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
3347+
builder.run(BootstrapCommand::from(&mut cmd));
33553348
}
33563349
}
33573350

@@ -3477,6 +3470,6 @@ impl Step for CodegenGCC {
34773470
cargo.args(builder.config.test_args());
34783471

34793472
let mut cmd: Command = cargo.into();
3480-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
3473+
builder.run(BootstrapCommand::from(&mut cmd));
34813474
}
34823475
}

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ impl Step for LibcxxVersionTool {
842842
.arg(&executable)
843843
.arg(builder.src.join("src/tools/libcxx-version/main.cpp"));
844844

845-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
845+
builder.run(BootstrapCommand::from(&mut cmd));
846846

847847
if !executable.exists() {
848848
panic!("Something went wrong. {} is not present", executable.display());

src/bootstrap/src/lib.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ impl Build {
582582
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
583583
// diff-index reports the modifications through the exit status
584584
let has_local_modifications = self
585-
.run_tracked(
585+
.run(
586586
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
587587
.allow_failure(),
588588
)
@@ -957,11 +957,14 @@ impl Build {
957957
}
958958

959959
/// Execute a command and return its output.
960-
fn run_tracked(&self, command: BootstrapCommand<'_>) -> CommandOutput {
960+
/// This method should be used for all command executions in bootstrap.
961+
fn run<'a, C: Into<BootstrapCommand<'a>>>(&self, command: C) -> CommandOutput {
961962
if self.config.dry_run() {
962963
return CommandOutput::default();
963964
}
964965

966+
let command = command.into();
967+
965968
self.verbose(|| println!("running: {command:?}"));
966969

967970
let output_mode = command.output_mode.unwrap_or_else(|| match self.is_verbose() {
@@ -1020,11 +1023,6 @@ impl Build {
10201023
output
10211024
}
10221025

1023-
/// Runs a command, printing out nice contextual information if it fails.
1024-
fn run(&self, cmd: &mut Command) {
1025-
self.run_tracked(BootstrapCommand::from(cmd));
1026-
}
1027-
10281026
/// Check if verbosity is greater than the `level`
10291027
pub fn is_verbose_than(&self, level: usize) -> bool {
10301028
self.verbosity > level

0 commit comments

Comments
 (0)