about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-01-01 23:39:55 +1100
committerZalathar <Zalathar@users.noreply.github.com>2025-01-02 17:47:13 +1100
commitbba24a2ffeb279dd09e4f93029569ae57c980cb0 (patch)
tree2b4d496ca901bc061c22e76138b698aa63bcee84
parentb84c54ac878d9e5acf8f2af416e7b6c32446205d (diff)
downloadrust-bba24a2ffeb279dd09e4f93029569ae57c980cb0.tar.gz
rust-bba24a2ffeb279dd09e4f93029569ae57c980cb0.zip
Don't pass `(self, builder)` identifiers to `tool_extended!`
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs29
1 files 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 75fad34bb5a..d276d5b6e62 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1007,7 +1007,7 @@ impl Step for LibcxxVersionTool {
 }
 
 macro_rules! tool_extended {
-    (($sel:ident, $builder:ident),
+    (
        $($name:ident,
        $path:expr,
        $tool_name:expr,
@@ -1052,10 +1052,11 @@ macro_rules! tool_extended {
             }
 
             #[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 @@ macro_rules! tool_extended {
                     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 @@ macro_rules! tool_extended {
     }
 }
 
-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"];