@@ -888,12 +888,11 @@ impl Step for Rustc {
888
888
macro_rules! tool_doc {
889
889
(
890
890
$tool: ident,
891
- $should_run: literal,
892
891
$path: literal,
893
892
$( rustc_tool = $rustc_tool: literal, ) ?
894
- $( in_tree = $in_tree: literal , ) ?
895
893
$( is_library = $is_library: expr, ) ?
896
894
$( crates = $crates: expr) ?
895
+ $( , submodule $( = $submodule: literal) ? ) ?
897
896
) => {
898
897
#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
899
898
pub struct $tool {
@@ -907,7 +906,7 @@ macro_rules! tool_doc {
907
906
908
907
fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
909
908
let builder = run. builder;
910
- run. crate_or_deps ( $should_run ) . default_condition( builder. config. compiler_docs)
909
+ run. path ( $path ) . default_condition( builder. config. compiler_docs)
911
910
}
912
911
913
912
fn make_run( run: RunConfig <' _>) {
@@ -921,6 +920,15 @@ macro_rules! tool_doc {
921
920
/// we do not merge it with the other documentation from std, test and
922
921
/// proc_macros. This is largely just a wrapper around `cargo doc`.
923
922
fn run( self , builder: & Builder <' _>) {
923
+ let source_type = SourceType :: InTree ;
924
+ $(
925
+ let _ = source_type; // silence the "unused variable" warning
926
+ let source_type = SourceType :: Submodule ;
927
+
928
+ let path = Path :: new( submodule_helper!( $path, submodule $( = $submodule ) ? ) ) ;
929
+ builder. update_submodule( & path) ;
930
+ ) ?
931
+
924
932
let stage = builder. top_stage;
925
933
let target = self . target;
926
934
@@ -941,12 +949,6 @@ macro_rules! tool_doc {
941
949
builder. ensure( compile:: Rustc :: new( compiler, target) ) ;
942
950
}
943
951
944
- let source_type = if true $( && $in_tree) ? {
945
- SourceType :: InTree
946
- } else {
947
- SourceType :: Submodule
948
- } ;
949
-
950
952
// Build cargo command.
951
953
let mut cargo = prepare_tool_cargo(
952
954
builder,
@@ -1008,21 +1010,14 @@ macro_rules! tool_doc {
1008
1010
}
1009
1011
}
1010
1012
1011
- tool_doc ! ( Rustdoc , "rustdoc-tool" , "src/tools/rustdoc" , crates = [ "rustdoc" , "rustdoc-json-types" ] ) ;
1012
- tool_doc ! (
1013
- Rustfmt ,
1014
- "rustfmt-nightly" ,
1015
- "src/tools/rustfmt" ,
1016
- crates = [ "rustfmt-nightly" , "rustfmt-config_proc_macro" ]
1017
- ) ;
1018
- tool_doc ! ( Clippy , "clippy" , "src/tools/clippy" , crates = [ "clippy_config" , "clippy_utils" ] ) ;
1019
- tool_doc ! ( Miri , "miri" , "src/tools/miri" , crates = [ "miri" ] ) ;
1013
+ tool_doc ! ( Rustdoc , "src/tools/rustdoc" , crates = [ "rustdoc" , "rustdoc-json-types" ] ) ;
1014
+ tool_doc ! ( Rustfmt , "src/tools/rustfmt" , crates = [ "rustfmt-nightly" , "rustfmt-config_proc_macro" ] ) ;
1015
+ tool_doc ! ( Clippy , "src/tools/clippy" , crates = [ "clippy_config" , "clippy_utils" ] ) ;
1016
+ tool_doc ! ( Miri , "src/tools/miri" , crates = [ "miri" ] ) ;
1020
1017
tool_doc ! (
1021
1018
Cargo ,
1022
- "cargo" ,
1023
1019
"src/tools/cargo" ,
1024
1020
rustc_tool = false ,
1025
- in_tree = false ,
1026
1021
crates = [
1027
1022
"cargo" ,
1028
1023
"cargo-credential" ,
@@ -1034,20 +1029,19 @@ tool_doc!(
1034
1029
"crates-io" ,
1035
1030
"mdman" ,
1036
1031
"rustfix" ,
1037
- ]
1032
+ ] ,
1033
+ submodule = "src/tools/cargo"
1038
1034
) ;
1039
- tool_doc ! ( Tidy , "tidy" , " src/tools/tidy", rustc_tool = false , crates = [ "tidy" ] ) ;
1035
+ tool_doc ! ( Tidy , "src/tools/tidy" , rustc_tool = false , crates = [ "tidy" ] ) ;
1040
1036
tool_doc ! (
1041
1037
Bootstrap ,
1042
- "bootstrap" ,
1043
1038
"src/bootstrap" ,
1044
1039
rustc_tool = false ,
1045
1040
is_library = true ,
1046
1041
crates = [ "bootstrap" ]
1047
1042
) ;
1048
1043
tool_doc ! (
1049
1044
RunMakeSupport ,
1050
- "run_make_support" ,
1051
1045
"src/tools/run-make-support" ,
1052
1046
rustc_tool = false ,
1053
1047
is_library = true ,
0 commit comments