Skip to content

Commit 80972ae

Browse files
Rollup merge of #143001 - Shourya742:2025-06-25-rename-run-always, r=Kobzol
Rename run always This PR renames run_always to run_to_dry_run for better clarity, making the field's purpose more explicit and avoiding confusion with command caching behavior. r? ``````@Kobzol``````
2 parents d386600 + f908939 commit 80972ae

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

src/bootstrap/src/core/build_steps/setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn rustup_installed(builder: &Builder<'_>) -> bool {
272272
let mut rustup = command("rustup");
273273
rustup.arg("--version");
274274

275-
rustup.allow_failure().run_always().run_capture_stdout(builder).is_success()
275+
rustup.allow_failure().run_in_dry_run().run_capture_stdout(builder).is_success()
276276
}
277277

278278
fn stage_dir_exists(stage_path: &str) -> bool {

src/bootstrap/src/core/config/config.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ impl Config {
809809
config.initial_sysroot = t!(PathBuf::from_str(
810810
command(&config.initial_rustc)
811811
.args(["--print", "sysroot"])
812-
.run_always()
812+
.run_in_dry_run()
813813
.run_capture_stdout(&config)
814814
.stdout()
815815
.trim()
@@ -1391,11 +1391,11 @@ impl Config {
13911391
// all the git commands below are actually executed, because some follow-up code
13921392
// in bootstrap might depend on the submodules being checked out. Furthermore, not all
13931393
// the command executions below work with an empty output (produced during dry run).
1394-
// Therefore, all commands below are marked with `run_always()`, so that they also run in
1394+
// Therefore, all commands below are marked with `run_in_dry_run()`, so that they also run in
13951395
// dry run mode.
13961396
let submodule_git = || {
13971397
let mut cmd = helpers::git(Some(&absolute_path));
1398-
cmd.run_always();
1398+
cmd.run_in_dry_run();
13991399
cmd
14001400
};
14011401

@@ -1405,7 +1405,7 @@ impl Config {
14051405
let checked_out_hash = checked_out_hash.trim_end();
14061406
// Determine commit that the submodule *should* have.
14071407
let recorded = helpers::git(Some(&self.src))
1408-
.run_always()
1408+
.run_in_dry_run()
14091409
.args(["ls-tree", "HEAD"])
14101410
.arg(relative_path)
14111411
.run_capture_stdout(self)
@@ -1425,7 +1425,7 @@ impl Config {
14251425

14261426
helpers::git(Some(&self.src))
14271427
.allow_failure()
1428-
.run_always()
1428+
.run_in_dry_run()
14291429
.args(["submodule", "-q", "sync"])
14301430
.arg(relative_path)
14311431
.run(self);
@@ -1436,12 +1436,12 @@ impl Config {
14361436
// even though that has no relation to the upstream for the submodule.
14371437
let current_branch = helpers::git(Some(&self.src))
14381438
.allow_failure()
1439-
.run_always()
1439+
.run_in_dry_run()
14401440
.args(["symbolic-ref", "--short", "HEAD"])
14411441
.run_capture(self);
14421442

14431443
let mut git = helpers::git(Some(&self.src)).allow_failure();
1444-
git.run_always();
1444+
git.run_in_dry_run();
14451445
if current_branch.is_success() {
14461446
// If there is a tag named after the current branch, git will try to disambiguate by prepending `heads/` to the branch name.
14471447
// This syntax isn't accepted by `branch.{branch}`. Strip it.

src/bootstrap/src/core/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ fn workspace_members(build: &Build) -> Vec<Package> {
8888
.arg("--no-deps")
8989
.arg("--manifest-path")
9090
.arg(build.src.join(manifest_path));
91-
let metadata_output = cargo.run_always().run_capture_stdout(build).stdout();
91+
let metadata_output = cargo.run_in_dry_run().run_capture_stdout(build).stdout();
9292
let Output { packages, .. } = t!(serde_json::from_str(&metadata_output));
9393
packages
9494
};

src/bootstrap/src/core/sanity.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ than building it.
202202

203203
let stage0_supported_target_list: HashSet<String> = command(&build.config.initial_rustc)
204204
.args(["--print", "target-list"])
205-
.run_always()
205+
.run_in_dry_run()
206206
.run_capture_stdout(&build)
207207
.stdout()
208208
.lines()
@@ -366,7 +366,7 @@ than building it.
366366
// Cygwin. The Cygwin build does not have generators for Visual
367367
// Studio, so detect that here and error.
368368
let out =
369-
command("cmake").arg("--help").run_always().run_capture_stdout(&build).stdout();
369+
command("cmake").arg("--help").run_in_dry_run().run_capture_stdout(&build).stdout();
370370
if !out.contains("Visual Studio") {
371371
panic!(
372372
"

src/bootstrap/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Build {
383383
let in_tree_gcc_info = config.in_tree_gcc_info.clone();
384384

385385
let initial_target_libdir = command(&config.initial_rustc)
386-
.run_always()
386+
.run_in_dry_run()
387387
.args(["--print", "target-libdir"])
388388
.run_capture_stdout(&config)
389389
.stdout()
@@ -490,7 +490,7 @@ impl Build {
490490
// If local-rust is the same major.minor as the current version, then force a
491491
// local-rebuild
492492
let local_version_verbose = command(&build.initial_rustc)
493-
.run_always()
493+
.run_in_dry_run()
494494
.args(["--version", "--verbose"])
495495
.run_capture_stdout(&build)
496496
.stdout();
@@ -949,7 +949,7 @@ impl Build {
949949
static SYSROOT_CACHE: OnceLock<PathBuf> = OnceLock::new();
950950
SYSROOT_CACHE.get_or_init(|| {
951951
command(&self.initial_rustc)
952-
.run_always()
952+
.run_in_dry_run()
953953
.args(["--print", "sysroot"])
954954
.run_capture_stdout(self)
955955
.stdout()
@@ -1512,7 +1512,7 @@ impl Build {
15121512
"refs/remotes/origin/{}..HEAD",
15131513
self.config.stage0_metadata.config.nightly_branch
15141514
))
1515-
.run_always()
1515+
.run_in_dry_run()
15161516
.run_capture(self)
15171517
.stdout()
15181518
});

src/bootstrap/src/utils/channel.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,22 @@ impl GitInfo {
6666
.arg("-1")
6767
.arg("--date=short")
6868
.arg("--pretty=format:%cd")
69-
.run_always()
69+
.run_in_dry_run()
7070
.start_capture_stdout(&exec_ctx);
7171

7272
let mut git_hash_cmd = helpers::git(Some(dir));
73-
let ver_hash =
74-
git_hash_cmd.arg("rev-parse").arg("HEAD").run_always().start_capture_stdout(&exec_ctx);
73+
let ver_hash = git_hash_cmd
74+
.arg("rev-parse")
75+
.arg("HEAD")
76+
.run_in_dry_run()
77+
.start_capture_stdout(&exec_ctx);
7578

7679
let mut git_short_hash_cmd = helpers::git(Some(dir));
7780
let short_ver_hash = git_short_hash_cmd
7881
.arg("rev-parse")
7982
.arg("--short=9")
8083
.arg("HEAD")
81-
.run_always()
84+
.run_in_dry_run()
8285
.start_capture_stdout(&exec_ctx);
8386

8487
GitInfo::Present(Some(Info {

src/bootstrap/src/utils/exec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub struct BootstrapCommand {
6666
command: Command,
6767
pub failure_behavior: BehaviorOnFailure,
6868
// Run the command even during dry run
69-
pub run_always: bool,
69+
pub run_in_dry_run: bool,
7070
// This field makes sure that each command is executed (or disarmed) before it is dropped,
7171
// to avoid forgetting to execute a command.
7272
drop_bomb: DropBomb,
@@ -138,8 +138,8 @@ impl<'a> BootstrapCommand {
138138
Self { failure_behavior: BehaviorOnFailure::Ignore, ..self }
139139
}
140140

141-
pub fn run_always(&mut self) -> &mut Self {
142-
self.run_always = true;
141+
pub fn run_in_dry_run(&mut self) -> &mut Self {
142+
self.run_in_dry_run = true;
143143
self
144144
}
145145

@@ -228,7 +228,7 @@ impl From<Command> for BootstrapCommand {
228228
Self {
229229
command,
230230
failure_behavior: BehaviorOnFailure::Exit,
231-
run_always: false,
231+
run_in_dry_run: false,
232232
drop_bomb: DropBomb::arm(program),
233233
}
234234
}

src/bootstrap/src/utils/execution_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl ExecutionContext {
9393
let created_at = command.get_created_location();
9494
let executed_at = std::panic::Location::caller();
9595

96-
if self.dry_run() && !command.run_always {
96+
if self.dry_run() && !command.run_in_dry_run {
9797
return DeferredCommand { process: None, stdout, stderr, command, executed_at };
9898
}
9999

0 commit comments

Comments
 (0)