Skip to content

Commit c89fe80

Browse files
committed
Rename extended rustc tool macros
1 parent 5a30e43 commit c89fe80

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Step for RustAnalyzer {
383383
let stage = self.stage;
384384
let host = self.host;
385385
let compiler = builder.compiler(stage, host);
386-
let compiler = tool::get_tool_rustc_compiler(builder, compiler);
386+
let compiler = tool::get_tool_rustc_build_compiler(builder, compiler);
387387

388388
// We don't need to build the whole Rust Analyzer for the proc-macro-srv test suite,
389389
// but we do need the standard library to be present.

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl Step for ToolBuild {
115115

116116
let target_compiler = self.build_compiler;
117117
self.build_compiler = if self.mode == Mode::ToolRustc {
118-
get_tool_rustc_compiler(builder, self.build_compiler)
118+
get_tool_rustc_build_compiler(builder, self.build_compiler)
119119
} else {
120120
self.build_compiler
121121
};
@@ -347,7 +347,7 @@ pub fn prepare_tool_cargo(
347347
}
348348

349349
/// Handle stage-off logic for `ToolRustc` tools when necessary.
350-
pub(crate) fn get_tool_rustc_compiler(
350+
pub(crate) fn get_tool_rustc_build_compiler(
351351
builder: &Builder<'_>,
352352
target_compiler: Compiler,
353353
) -> Compiler {
@@ -1302,7 +1302,9 @@ impl Step for LibcxxVersionTool {
13021302
}
13031303
}
13041304

1305-
macro_rules! tool_extended {
1305+
/// Creates a step that builds an extended `Mode::ToolRustc` tool
1306+
/// and installs it into the sysroot of a corresponding compiler.
1307+
macro_rules! tool_rustc_extended {
13061308
(
13071309
$name:ident {
13081310
path: $path:expr,
@@ -1326,7 +1328,7 @@ macro_rules! tool_extended {
13261328
const ONLY_HOSTS: bool = true;
13271329

13281330
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
1329-
should_run_tool_build_step(
1331+
should_run_extended_rustc_tool(
13301332
run,
13311333
$tool_name,
13321334
$path,
@@ -1343,7 +1345,7 @@ macro_rules! tool_extended {
13431345

13441346
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
13451347
let Self { compiler, target } = self;
1346-
run_tool_build_step(
1348+
build_extended_rustc_tool(
13471349
builder,
13481350
compiler,
13491351
target,
@@ -1367,7 +1369,7 @@ macro_rules! tool_extended {
13671369
}
13681370
}
13691371

1370-
fn should_run_tool_build_step<'a>(
1372+
fn should_run_extended_rustc_tool<'a>(
13711373
run: ShouldRun<'a>,
13721374
tool_name: &'static str,
13731375
path: &'static str,
@@ -1392,7 +1394,7 @@ fn should_run_tool_build_step<'a>(
13921394
}
13931395

13941396
#[expect(clippy::too_many_arguments)] // silence overeager clippy lint
1395-
fn run_tool_build_step(
1397+
fn build_extended_rustc_tool(
13961398
builder: &Builder<'_>,
13971399
compiler: Compiler,
13981400
target: TargetSelection,
@@ -1441,19 +1443,19 @@ fn run_tool_build_step(
14411443
}
14421444
}
14431445

1444-
tool_extended!(Cargofmt {
1446+
tool_rustc_extended!(Cargofmt {
14451447
path: "src/tools/rustfmt",
14461448
tool_name: "cargo-fmt",
14471449
stable: true,
14481450
add_bins_to_sysroot: ["cargo-fmt"]
14491451
});
1450-
tool_extended!(CargoClippy {
1452+
tool_rustc_extended!(CargoClippy {
14511453
path: "src/tools/clippy",
14521454
tool_name: "cargo-clippy",
14531455
stable: true,
14541456
add_bins_to_sysroot: ["cargo-clippy"]
14551457
});
1456-
tool_extended!(Clippy {
1458+
tool_rustc_extended!(Clippy {
14571459
path: "src/tools/clippy",
14581460
tool_name: "clippy-driver",
14591461
stable: true,
@@ -1464,21 +1466,21 @@ tool_extended!(Clippy {
14641466
}
14651467
}
14661468
});
1467-
tool_extended!(Miri {
1469+
tool_rustc_extended!(Miri {
14681470
path: "src/tools/miri",
14691471
tool_name: "miri",
14701472
stable: false,
14711473
add_bins_to_sysroot: ["miri"],
14721474
// Always compile also tests when building miri. Otherwise feature unification can cause rebuilds between building and testing miri.
14731475
cargo_args: &["--all-targets"],
14741476
});
1475-
tool_extended!(CargoMiri {
1477+
tool_rustc_extended!(CargoMiri {
14761478
path: "src/tools/miri/cargo-miri",
14771479
tool_name: "cargo-miri",
14781480
stable: false,
14791481
add_bins_to_sysroot: ["cargo-miri"]
14801482
});
1481-
tool_extended!(Rustfmt {
1483+
tool_rustc_extended!(Rustfmt {
14821484
path: "src/tools/rustfmt",
14831485
tool_name: "rustfmt",
14841486
stable: true,

src/bootstrap/src/core/builder/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,12 @@ fn test_get_tool_rustc_compiler() {
580580

581581
let compiler = Compiler::new(2, target_triple_1);
582582
let expected = Compiler::new(1, target_triple_1);
583-
let actual = tool::get_tool_rustc_compiler(&builder, compiler);
583+
let actual = tool::get_tool_rustc_build_compiler(&builder, compiler);
584584
assert_eq!(expected, actual);
585585

586586
let compiler = Compiler::new(1, target_triple_1);
587587
let expected = Compiler::new(0, target_triple_1);
588-
let actual = tool::get_tool_rustc_compiler(&builder, compiler);
588+
let actual = tool::get_tool_rustc_build_compiler(&builder, compiler);
589589
assert_eq!(expected, actual);
590590

591591
let mut config = configure("build", &[], &[]);
@@ -595,7 +595,7 @@ fn test_get_tool_rustc_compiler() {
595595

596596
let compiler = Compiler::new(1, target_triple_1);
597597
let expected = Compiler::new(1, target_triple_1);
598-
let actual = tool::get_tool_rustc_compiler(&builder, compiler);
598+
let actual = tool::get_tool_rustc_build_compiler(&builder, compiler);
599599
assert_eq!(expected, actual);
600600
}
601601

0 commit comments

Comments
 (0)