Don't pass (self, builder) identifiers to tool_extended!

This commit is contained in:
Zalathar 2025-01-01 23:39:55 +11:00
parent b84c54ac87
commit bba24a2ffe

View file

@ -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"];