From bba24a2ffeb279dd09e4f93029569ae57c980cb0 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Wed, 1 Jan 2025 23:39:55 +1100 Subject: [PATCH] Don't pass `(self, builder)` identifiers to `tool_extended!` --- src/bootstrap/src/core/build_steps/tool.rs | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs index 75fad34bb5a9..d276d5b6e621 100644 --- a/src/bootstrap/src/core/build_steps/tool.rs +++ b/src/bootstrap/src/core/build_steps/tool.rs @@ -1007,7 +1007,7 @@ fn run(self, builder: &Builder<'_>) -> LibcxxVersion { } macro_rules! tool_extended { - (($sel:ident, $builder:ident), + ( $($name:ident, $path:expr, $tool_name:expr, @@ -1052,10 +1052,11 @@ fn make_run(run: RunConfig<'_>) { } #[allow(unused_mut)] - fn run(mut $sel, $builder: &Builder<'_>) -> PathBuf { - let tool = $builder.ensure(ToolBuild { - compiler: $sel.compiler, - target: $sel.target, + fn run(self, builder: &Builder<'_>) -> PathBuf { + let Self { compiler, target } = self; + let tool = builder.ensure(ToolBuild { + compiler, + target, tool: $tool_name, mode: Mode::ToolRustc, path: $path, @@ -1065,21 +1066,21 @@ fn run(mut $sel, $builder: &Builder<'_>) -> PathBuf { cargo_args: vec![] }); - if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 { - let bindir = $builder.sysroot($sel.compiler).join("bin"); + if (false $(|| !$add_bins_to_sysroot.is_empty())?) && compiler.stage > 0 { + let bindir = builder.sysroot(compiler).join("bin"); t!(fs::create_dir_all(&bindir)); #[allow(unused_variables)] - let tools_out = $builder - .cargo_out($sel.compiler, Mode::ToolRustc, $sel.target); + let tools_out = builder + .cargo_out(compiler, Mode::ToolRustc, target); $(for add_bin in $add_bins_to_sysroot { - let bin_source = tools_out.join(exe(add_bin, $sel.target)); - let bin_destination = bindir.join(exe(add_bin, $sel.compiler.host)); - $builder.copy_link(&bin_source, &bin_destination); + let bin_source = tools_out.join(exe(add_bin, target)); + let bin_destination = bindir.join(exe(add_bin, compiler.host)); + builder.copy_link(&bin_source, &bin_destination); })? - let tool = bindir.join(exe($tool_name, $sel.compiler.host)); + let tool = bindir.join(exe($tool_name, compiler.host)); tool } else { tool @@ -1090,7 +1091,7 @@ fn run(mut $sel, $builder: &Builder<'_>) -> PathBuf { } } -tool_extended!((self, builder), +tool_extended!( Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true; CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true; Clippy, "src/tools/clippy", "clippy-driver", stable=true, add_bins_to_sysroot = ["clippy-driver", "cargo-clippy"];