@@ -696,9 +696,6 @@ impl Step for Rustc {
696696 return ;
697697 }
698698
699- // Build libstd docs so that we generate relative links.
700- builder. ensure ( Std { stage, target } ) ;
701-
702699 // Build rustc.
703700 builder. ensure ( compile:: Rustc { compiler, target } ) ;
704701
@@ -717,12 +714,16 @@ impl Step for Rustc {
717714
718715 // Find dependencies for top level crates.
719716 let mut compiler_crates = HashSet :: new ( ) ;
720- for root_crate in & [ "rustc " , "rustc_driver " , "rustc_codegen_llvm " ] {
717+ for root_crate in & [ "rustc_driver " , "rustc_codegen_llvm " , "rustc_codegen_ssa " ] {
721718 let interned_root_crate = INTERNER . intern_str ( root_crate) ;
722719 find_compiler_crates ( builder, & interned_root_crate, & mut compiler_crates) ;
723720 }
724721
725722 for krate in & compiler_crates {
723+ // Create all crate output directories first to make sure rustdoc uses
724+ // relative links.
725+ // FIXME: Cargo should probably do this itself.
726+ t ! ( fs:: create_dir_all( out_dir. join( krate) ) ) ;
726727 cargo. arg ( "-p" ) . arg ( krate) ;
727728 }
728729
@@ -796,8 +797,8 @@ impl Step for Rustdoc {
796797 return ;
797798 }
798799
799- // Build libstd docs so that we generate relative links.
800- builder. ensure ( Std { stage, target } ) ;
800+ // Build rustc docs so that we generate relative links.
801+ builder. ensure ( Rustc { stage, target } ) ;
801802
802803 // Build rustdoc.
803804 builder. ensure ( tool:: Rustdoc { host : compiler. host } ) ;
@@ -821,6 +822,10 @@ impl Step for Rustdoc {
821822 & [ ]
822823 ) ;
823824
825+ // Only include compiler crates, no dependencies of those, such as `libc`.
826+ cargo. arg ( "--no-deps" ) ;
827+ cargo. arg ( "-p" ) . arg ( "rustdoc" ) ;
828+
824829 cargo. env ( "RUSTDOCFLAGS" , "--document-private-items" ) ;
825830 builder. run ( & mut cargo) ;
826831 }
0 commit comments