@@ -16,7 +16,7 @@ use crate::util::{add_dylib_path, exe, CiEnv};
16
16
use crate :: Compiler ;
17
17
use crate :: Mode ;
18
18
19
- #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
19
+ #[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
20
20
pub enum SourceType {
21
21
InTree ,
22
22
Submodule ,
@@ -226,14 +226,10 @@ pub fn prepare_tool_cargo(
226
226
source_type : SourceType ,
227
227
extra_features : & [ String ] ,
228
228
) -> CargoCommand {
229
- let mut cargo = builder. cargo ( compiler, mode, target, command) ;
229
+ let mut cargo = builder. cargo ( compiler, mode, source_type , target, command) ;
230
230
let dir = builder. src . join ( path) ;
231
231
cargo. arg ( "--manifest-path" ) . arg ( dir. join ( "Cargo.toml" ) ) ;
232
232
233
- if source_type == SourceType :: Submodule {
234
- cargo. env ( "RUSTC_EXTERNAL_TOOL" , "1" ) ;
235
- }
236
-
237
233
let mut features = extra_features. to_vec ( ) ;
238
234
if builder. build . config . cargo_native_static {
239
235
if path. ends_with ( "cargo" )
@@ -596,6 +592,7 @@ macro_rules! tool_extended {
596
592
$path: expr,
597
593
$tool_name: expr,
598
594
stable = $stable: expr,
595
+ $( in_tree = $in_tree: expr, ) *
599
596
$extra_deps: block; ) +) => {
600
597
$(
601
598
#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
@@ -647,7 +644,11 @@ macro_rules! tool_extended {
647
644
path: $path,
648
645
extra_features: $sel. extra_features,
649
646
is_optional_tool: true ,
650
- source_type: SourceType :: Submodule ,
647
+ source_type: if false $( || $in_tree) * {
648
+ SourceType :: InTree
649
+ } else {
650
+ SourceType :: Submodule
651
+ } ,
651
652
} )
652
653
}
653
654
}
@@ -659,8 +660,8 @@ macro_rules! tool_extended {
659
660
// to make `./x.py build <tool>` work.
660
661
tool_extended ! ( ( self , builder) ,
661
662
Cargofmt , rustfmt, "src/tools/rustfmt" , "cargo-fmt" , stable=true , { } ;
662
- CargoClippy , clippy, "src/tools/clippy" , "cargo-clippy" , stable=true , { } ;
663
- Clippy , clippy, "src/tools/clippy" , "clippy-driver" , stable=true , { } ;
663
+ CargoClippy , clippy, "src/tools/clippy" , "cargo-clippy" , stable=true , in_tree= true , { } ;
664
+ Clippy , clippy, "src/tools/clippy" , "clippy-driver" , stable=true , in_tree= true , { } ;
664
665
Miri , miri, "src/tools/miri" , "miri" , stable=false , { } ;
665
666
CargoMiri , miri, "src/tools/miri/cargo-miri" , "cargo-miri" , stable=false , { } ;
666
667
Rls , rls, "src/tools/rls" , "rls" , stable=true , {
0 commit comments