@@ -136,19 +136,6 @@ impl Step for ToolBuild {
136
136
_ => panic ! ( "unexpected Mode for tool build" ) ,
137
137
}
138
138
139
- // build.tool.TOOL_NAME.features in bootstrap.toml allows specifying which features to
140
- // enable for a specific tool. `extra_features` instead is not controlled by the toml and
141
- // provides features that are always enabled for a specific tool (e.g. "in-rust-tree" for
142
- // rust-analyzer). Finally, `prepare_tool_cargo` might add more features to adapt the build
143
- // to the chosen flags (e.g. "all-static" for cargo if `cargo_native_static` is true).
144
- let mut features = builder
145
- . config
146
- . tool
147
- . get ( self . tool )
148
- . and_then ( |tool| tool. features . clone ( ) )
149
- . unwrap_or_default ( ) ;
150
- features. extend ( self . extra_features . clone ( ) ) ;
151
-
152
139
let mut cargo = prepare_tool_cargo (
153
140
builder,
154
141
self . compiler ,
@@ -157,7 +144,7 @@ impl Step for ToolBuild {
157
144
Kind :: Build ,
158
145
path,
159
146
self . source_type ,
160
- & features ,
147
+ & self . extra_features ,
161
148
) ;
162
149
163
150
// The stage0 compiler changes infrequently and does not directly depend on code
@@ -244,7 +231,8 @@ pub fn prepare_tool_cargo(
244
231
) -> CargoCommand {
245
232
let mut cargo = builder:: Cargo :: new ( builder, compiler, mode, source_type, target, cmd_kind) ;
246
233
247
- let dir = builder. src . join ( path) ;
234
+ let path = PathBuf :: from ( path) ;
235
+ let dir = builder. src . join ( & path) ;
248
236
cargo. arg ( "--manifest-path" ) . arg ( dir. join ( "Cargo.toml" ) ) ;
249
237
250
238
let mut features = extra_features. to_vec ( ) ;
@@ -261,6 +249,18 @@ pub fn prepare_tool_cargo(
261
249
}
262
250
}
263
251
252
+ // build.tool.TOOL_NAME.features in bootstrap.toml allows specifying which features to enable
253
+ // for a specific tool. `extra_features` instead is not controlled by the toml and provides
254
+ // features that are always enabled for a specific tool (e.g. "in-rust-tree" for rust-analyzer).
255
+ // Finally, `prepare_tool_cargo` above here might add more features to adapt the build
256
+ // to the chosen flags (e.g. "all-static" for cargo if `cargo_native_static` is true).
257
+ builder
258
+ . config
259
+ . tool
260
+ . iter ( )
261
+ . filter ( |( tool_name, _) | path. ends_with ( tool_name) )
262
+ . for_each ( |( _, tool) | features. extend ( tool. features . clone ( ) . unwrap_or_default ( ) ) ) ;
263
+
264
264
// clippy tests need to know about the stage sysroot. Set them consistently while building to
265
265
// avoid rebuilding when running tests.
266
266
cargo. env ( "SYSROOT" , builder. sysroot ( compiler) ) ;
0 commit comments