Skip to content

Commit cf5bbb3

Browse files
committed
Remove run and rename run_tracked to run
1 parent 903d6a9 commit cf5bbb3

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

@@ -1097,7 +1097,7 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
10971097
}
10981098

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

11021102
builder.info("x.py completions check");
11031103
let [bash, zsh, fish, powershell] = ["x.py.sh", "x.py.zsh", "x.py.fish", "x.py.ps1"]
@@ -2184,11 +2184,8 @@ impl BookTest {
21842184
);
21852185
let _time = helpers::timeit(builder);
21862186
let cmd = BootstrapCommand::from(&mut rustbook_cmd).delay_failure();
2187-
let toolstate = if builder.run_tracked(cmd).is_success() {
2188-
ToolState::TestPass
2189-
} else {
2190-
ToolState::TestFail
2191-
};
2187+
let toolstate =
2188+
if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
21922189
builder.save_toolstate(self.name, toolstate);
21932190
}
21942191

@@ -2317,8 +2314,7 @@ impl Step for ErrorIndex {
23172314
let guard =
23182315
builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host);
23192316
let _time = helpers::timeit(builder);
2320-
builder
2321-
.run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
2317+
builder.run(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
23222318
drop(guard);
23232319
// The tests themselves need to link to std, so make sure it is
23242320
// available.
@@ -2351,7 +2347,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
23512347
if !builder.config.verbose_tests {
23522348
cmd = cmd.quiet();
23532349
}
2354-
builder.run_tracked(cmd).is_success()
2350+
builder.run(cmd).is_success()
23552351
}
23562352

23572353
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -2377,11 +2373,8 @@ impl Step for RustcGuide {
23772373
let src = builder.src.join(relative_path);
23782374
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
23792375
let cmd = BootstrapCommand::from(rustbook_cmd.arg("linkcheck").arg(&src)).delay_failure();
2380-
let toolstate = if builder.run_tracked(cmd).is_success() {
2381-
ToolState::TestPass
2382-
} else {
2383-
ToolState::TestFail
2384-
};
2376+
let toolstate =
2377+
if builder.run(cmd).is_success() { ToolState::TestPass } else { ToolState::TestFail };
23852378
builder.save_toolstate("rustc-dev-guide", toolstate);
23862379
}
23872380
}
@@ -2994,7 +2987,7 @@ impl Step for Bootstrap {
29942987
.current_dir(builder.src.join("src/bootstrap/"));
29952988
// NOTE: we intentionally don't pass test_args here because the args for unittest and cargo test are mutually incompatible.
29962989
// Use `python -m unittest` manually if you want to pass arguments.
2997-
builder.run_tracked(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
2990+
builder.run(BootstrapCommand::from(&mut check_bootstrap).delay_failure());
29982991

29992992
let mut cmd = Command::new(&builder.initial_cargo);
30002993
cmd.arg("test")
@@ -3071,7 +3064,7 @@ impl Step for TierCheck {
30713064
self.compiler.host,
30723065
self.compiler.host,
30733066
);
3074-
builder.run_tracked(BootstrapCommand::from(&mut cargo.into()).delay_failure());
3067+
builder.run(BootstrapCommand::from(&mut cargo.into()).delay_failure());
30753068
}
30763069
}
30773070

@@ -3157,7 +3150,7 @@ impl Step for RustInstaller {
31573150
cmd.env("CARGO", &builder.initial_cargo);
31583151
cmd.env("RUSTC", &builder.initial_rustc);
31593152
cmd.env("TMP_DIR", &tmpdir);
3160-
builder.run_tracked(BootstrapCommand::from(&mut cmd).delay_failure());
3153+
builder.run(BootstrapCommand::from(&mut cmd).delay_failure());
31613154
}
31623155

31633156
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -3352,7 +3345,7 @@ impl Step for CodegenCranelift {
33523345
cargo.args(builder.config.test_args());
33533346

33543347
let mut cmd: Command = cargo.into();
3355-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
3348+
builder.run(BootstrapCommand::from(&mut cmd));
33563349
}
33573350
}
33583351

@@ -3478,6 +3471,6 @@ impl Step for CodegenGCC {
34783471
cargo.args(builder.config.test_args());
34793472

34803473
let mut cmd: Command = cargo.into();
3481-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
3474+
builder.run(BootstrapCommand::from(&mut cmd));
34823475
}
34833476
}

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

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

921-
builder.run_tracked(BootstrapCommand::from(&mut cmd));
921+
builder.run(BootstrapCommand::from(&mut cmd));
922922

923923
if !executable.exists() {
924924
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
@@ -581,7 +581,7 @@ impl Build {
581581
// Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
582582
// diff-index reports the modifications through the exit status
583583
let has_local_modifications = self
584-
.run_tracked(
584+
.run(
585585
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
586586
.allow_failure(),
587587
)
@@ -959,11 +959,14 @@ impl Build {
959959
}
960960

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

968+
let command = command.into();
969+
967970
self.verbose(|| println!("running: {command:?}"));
968971

969972
let output_mode = command.output_mode.unwrap_or_else(|| match self.is_verbose() {
@@ -1022,11 +1025,6 @@ impl Build {
10221025
output
10231026
}
10241027

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

0 commit comments

Comments
 (0)