@@ -1117,6 +1117,7 @@ macro_rules! tool_extended {
11171117 tool_name: $tool_name: expr,
11181118 stable: $stable: expr
11191119 $( , add_bins_to_sysroot: $add_bins_to_sysroot: expr ) ?
1120+ $( , add_features: $add_features: expr ) ?
11201121 $( , ) ?
11211122 }
11221123 ) => {
@@ -1156,6 +1157,7 @@ macro_rules! tool_extended {
11561157 $tool_name,
11571158 $path,
11581159 None $( . or( Some ( & $add_bins_to_sysroot) ) ) ?,
1160+ None $( . or( Some ( $add_features) ) ) ?,
11591161 )
11601162 }
11611163 }
@@ -1193,15 +1195,21 @@ fn run_tool_build_step(
11931195 tool_name : & ' static str ,
11941196 path : & ' static str ,
11951197 add_bins_to_sysroot : Option < & [ & str ] > ,
1198+ add_features : Option < fn ( & Builder < ' _ > , TargetSelection , & mut Vec < String > ) > ,
11961199) -> ToolBuildResult {
1200+ let mut extra_features = Vec :: new ( ) ;
1201+ if let Some ( func) = add_features {
1202+ func ( builder, target, & mut extra_features) ;
1203+ }
1204+
11971205 let ToolBuildResult { tool_path, build_compiler, target_compiler } =
11981206 builder. ensure ( ToolBuild {
11991207 compiler,
12001208 target,
12011209 tool : tool_name,
12021210 mode : Mode :: ToolRustc ,
12031211 path,
1204- extra_features : vec ! [ ] ,
1212+ extra_features,
12051213 source_type : SourceType :: InTree ,
12061214 allow_features : "" ,
12071215 cargo_args : vec ! [ ] ,
@@ -1244,7 +1252,12 @@ tool_extended!(Clippy {
12441252 path: "src/tools/clippy" ,
12451253 tool_name: "clippy-driver" ,
12461254 stable: true ,
1247- add_bins_to_sysroot: [ "clippy-driver" ]
1255+ add_bins_to_sysroot: [ "clippy-driver" ] ,
1256+ add_features: |builder, target, features| {
1257+ if builder. config. jemalloc( target) {
1258+ features. push( "jemalloc" . to_string( ) ) ;
1259+ }
1260+ }
12481261} ) ;
12491262tool_extended ! ( Miri {
12501263 path: "src/tools/miri" ,
0 commit comments