@@ -888,12 +888,11 @@ impl Step for Rustc {
888888macro_rules! tool_doc {
889889 (
890890 $tool: ident,
891- $should_run: literal,
892891 $path: literal,
893892 $( rustc_tool = $rustc_tool: literal, ) ?
894- $( in_tree = $in_tree: literal , ) ?
895893 $( is_library = $is_library: expr, ) ?
896894 $( crates = $crates: expr) ?
895+ $( , submodule $( = $submodule: literal) ? ) ?
897896 ) => {
898897 #[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
899898 pub struct $tool {
@@ -907,7 +906,7 @@ macro_rules! tool_doc {
907906
908907 fn should_run( run: ShouldRun <' _>) -> ShouldRun <' _> {
909908 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)
911910 }
912911
913912 fn make_run( run: RunConfig <' _>) {
@@ -921,6 +920,15 @@ macro_rules! tool_doc {
921920 /// we do not merge it with the other documentation from std, test and
922921 /// proc_macros. This is largely just a wrapper around `cargo doc`.
923922 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+
924932 let stage = builder. top_stage;
925933 let target = self . target;
926934
@@ -941,12 +949,6 @@ macro_rules! tool_doc {
941949 builder. ensure( compile:: Rustc :: new( compiler, target) ) ;
942950 }
943951
944- let source_type = if true $( && $in_tree) ? {
945- SourceType :: InTree
946- } else {
947- SourceType :: Submodule
948- } ;
949-
950952 // Build cargo command.
951953 let mut cargo = prepare_tool_cargo(
952954 builder,
@@ -1008,21 +1010,14 @@ macro_rules! tool_doc {
10081010 }
10091011}
10101012
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" ] ) ;
10201017tool_doc ! (
10211018 Cargo ,
1022- "cargo" ,
10231019 "src/tools/cargo" ,
10241020 rustc_tool = false ,
1025- in_tree = false ,
10261021 crates = [
10271022 "cargo" ,
10281023 "cargo-credential" ,
@@ -1034,20 +1029,19 @@ tool_doc!(
10341029 "crates-io" ,
10351030 "mdman" ,
10361031 "rustfix" ,
1037- ]
1032+ ] ,
1033+ submodule = "src/tools/cargo"
10381034) ;
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" ] ) ;
10401036tool_doc ! (
10411037 Bootstrap ,
1042- "bootstrap" ,
10431038 "src/bootstrap" ,
10441039 rustc_tool = false ,
10451040 is_library = true ,
10461041 crates = [ "bootstrap" ]
10471042) ;
10481043tool_doc ! (
10491044 RunMakeSupport ,
1050- "run_make_support" ,
10511045 "src/tools/run-make-support" ,
10521046 rustc_tool = false ,
10531047 is_library = true ,
0 commit comments