Skip to content

Commit bba24a2

Browse files
committed
Don't pass (self, builder) identifiers to tool_extended!
1 parent b84c54a commit bba24a2

File tree

1 file changed

+15
-14
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+15
-14
lines changed

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ impl Step for LibcxxVersionTool {
10071007
}
10081008

10091009
macro_rules! tool_extended {
1010-
(($sel:ident, $builder:ident),
1010+
(
10111011
$($name:ident,
10121012
$path:expr,
10131013
$tool_name:expr,
@@ -1052,10 +1052,11 @@ macro_rules! tool_extended {
10521052
}
10531053

10541054
#[allow(unused_mut)]
1055-
fn run(mut $sel, $builder: &Builder<'_>) -> PathBuf {
1056-
let tool = $builder.ensure(ToolBuild {
1057-
compiler: $sel.compiler,
1058-
target: $sel.target,
1055+
fn run(self, builder: &Builder<'_>) -> PathBuf {
1056+
let Self { compiler, target } = self;
1057+
let tool = builder.ensure(ToolBuild {
1058+
compiler,
1059+
target,
10591060
tool: $tool_name,
10601061
mode: Mode::ToolRustc,
10611062
path: $path,
@@ -1065,21 +1066,21 @@ macro_rules! tool_extended {
10651066
cargo_args: vec![]
10661067
});
10671068

1068-
if (false $(|| !$add_bins_to_sysroot.is_empty())?) && $sel.compiler.stage > 0 {
1069-
let bindir = $builder.sysroot($sel.compiler).join("bin");
1069+
if (false $(|| !$add_bins_to_sysroot.is_empty())?) && compiler.stage > 0 {
1070+
let bindir = builder.sysroot(compiler).join("bin");
10701071
t!(fs::create_dir_all(&bindir));
10711072

10721073
#[allow(unused_variables)]
1073-
let tools_out = $builder
1074-
.cargo_out($sel.compiler, Mode::ToolRustc, $sel.target);
1074+
let tools_out = builder
1075+
.cargo_out(compiler, Mode::ToolRustc, target);
10751076

10761077
$(for add_bin in $add_bins_to_sysroot {
1077-
let bin_source = tools_out.join(exe(add_bin, $sel.target));
1078-
let bin_destination = bindir.join(exe(add_bin, $sel.compiler.host));
1079-
$builder.copy_link(&bin_source, &bin_destination);
1078+
let bin_source = tools_out.join(exe(add_bin, target));
1079+
let bin_destination = bindir.join(exe(add_bin, compiler.host));
1080+
builder.copy_link(&bin_source, &bin_destination);
10801081
})?
10811082

1082-
let tool = bindir.join(exe($tool_name, $sel.compiler.host));
1083+
let tool = bindir.join(exe($tool_name, compiler.host));
10831084
tool
10841085
} else {
10851086
tool
@@ -1090,7 +1091,7 @@ macro_rules! tool_extended {
10901091
}
10911092
}
10921093

1093-
tool_extended!((self, builder),
1094+
tool_extended!(
10941095
Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true;
10951096
CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true;
10961097
Clippy, "src/tools/clippy", "clippy-driver", stable=true, add_bins_to_sysroot = ["clippy-driver", "cargo-clippy"];

0 commit comments

Comments
 (0)