@@ -1117,6 +1117,7 @@ macro_rules! tool_extended {
1117
1117
tool_name: $tool_name: expr,
1118
1118
stable: $stable: expr
1119
1119
$( , add_bins_to_sysroot: $add_bins_to_sysroot: expr ) ?
1120
+ $( , add_features: $add_features: expr ) ?
1120
1121
$( , ) ?
1121
1122
}
1122
1123
) => {
@@ -1156,6 +1157,7 @@ macro_rules! tool_extended {
1156
1157
$tool_name,
1157
1158
$path,
1158
1159
None $( . or( Some ( & $add_bins_to_sysroot) ) ) ?,
1160
+ None $( . or( Some ( $add_features) ) ) ?,
1159
1161
)
1160
1162
}
1161
1163
}
@@ -1193,15 +1195,21 @@ fn run_tool_build_step(
1193
1195
tool_name : & ' static str ,
1194
1196
path : & ' static str ,
1195
1197
add_bins_to_sysroot : Option < & [ & str ] > ,
1198
+ add_features : Option < fn ( & Builder < ' _ > , TargetSelection , & mut Vec < String > ) > ,
1196
1199
) -> ToolBuildResult {
1200
+ let mut extra_features = Vec :: new ( ) ;
1201
+ if let Some ( func) = add_features {
1202
+ func ( builder, target, & mut extra_features) ;
1203
+ }
1204
+
1197
1205
let ToolBuildResult { tool_path, build_compiler, target_compiler } =
1198
1206
builder. ensure ( ToolBuild {
1199
1207
compiler,
1200
1208
target,
1201
1209
tool : tool_name,
1202
1210
mode : Mode :: ToolRustc ,
1203
1211
path,
1204
- extra_features : vec ! [ ] ,
1212
+ extra_features,
1205
1213
source_type : SourceType :: InTree ,
1206
1214
allow_features : "" ,
1207
1215
cargo_args : vec ! [ ] ,
@@ -1244,7 +1252,12 @@ tool_extended!(Clippy {
1244
1252
path: "src/tools/clippy" ,
1245
1253
tool_name: "clippy-driver" ,
1246
1254
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
+ }
1248
1261
} ) ;
1249
1262
tool_extended ! ( Miri {
1250
1263
path: "src/tools/miri" ,
0 commit comments