Pass jemalloc feature to Clippy in bootstrap

This commit is contained in:
Jakub Beránek 2025-06-10 11:19:46 +02:00
parent 3d9c46e13c
commit 723dae84c1
No known key found for this signature in database
GPG key ID: 909CD0D26483516B

View file

@ -1117,6 +1117,7 @@ macro_rules! tool_extended {
tool_name: $tool_name:expr,
stable: $stable:expr
$( , add_bins_to_sysroot: $add_bins_to_sysroot:expr )?
$( , add_features: $add_features:expr )?
$( , )?
}
) => {
@ -1156,6 +1157,7 @@ macro_rules! tool_extended {
$tool_name,
$path,
None $( .or(Some(&$add_bins_to_sysroot)) )?,
None $( .or(Some($add_features)) )?,
)
}
}
@ -1193,7 +1195,13 @@ fn run_tool_build_step(
tool_name: &'static str,
path: &'static str,
add_bins_to_sysroot: Option<&[&str]>,
add_features: Option<fn(&Builder<'_>, TargetSelection, &mut Vec<String>)>,
) -> ToolBuildResult {
let mut extra_features = Vec::new();
if let Some(func) = add_features {
func(builder, target, &mut extra_features);
}
let ToolBuildResult { tool_path, build_compiler, target_compiler } =
builder.ensure(ToolBuild {
compiler,
@ -1201,7 +1209,7 @@ fn run_tool_build_step(
tool: tool_name,
mode: Mode::ToolRustc,
path,
extra_features: vec![],
extra_features,
source_type: SourceType::InTree,
allow_features: "",
cargo_args: vec![],
@ -1244,7 +1252,12 @@ tool_extended!(Clippy {
path: "src/tools/clippy",
tool_name: "clippy-driver",
stable: true,
add_bins_to_sysroot: ["clippy-driver"]
add_bins_to_sysroot: ["clippy-driver"],
add_features: |builder, target, features| {
if builder.config.jemalloc(target) {
features.push("jemalloc".to_string());
}
}
});
tool_extended!(Miri {
path: "src/tools/miri",