@@ -441,7 +441,6 @@ impl Step for Std {
441
441
t ! ( fs:: create_dir_all( & out) ) ;
442
442
let compiler = builder. compiler ( stage, builder. config . build ) ;
443
443
444
- builder. ensure ( compile:: Std { compiler, target } ) ;
445
444
let out_dir = builder. stage_out ( compiler, Mode :: Std ) . join ( target. triple ) . join ( "doc" ) ;
446
445
447
446
t ! ( fs:: copy( builder. src. join( "src/doc/rust.css" ) , out. join( "rust.css" ) ) ) ;
@@ -548,7 +547,6 @@ impl Step for Rustc {
548
547
fn run ( self , builder : & Builder < ' _ > ) {
549
548
let stage = self . stage ;
550
549
let target = self . target ;
551
- builder. info ( & format ! ( "Documenting stage{} compiler ({})" , stage, target) ) ;
552
550
553
551
let paths = builder
554
552
. paths
@@ -563,9 +561,12 @@ impl Step for Rustc {
563
561
let out = builder. compiler_doc_out ( target) ;
564
562
t ! ( fs:: create_dir_all( & out) ) ;
565
563
566
- // Build rustc.
564
+ // Build the standard library, so that proc-macros can use it.
565
+ // (Normally, only the metadata would be necessary, but proc-macros are special since they run at compile-time.)
567
566
let compiler = builder. compiler ( stage, builder. config . build ) ;
568
- builder. ensure ( compile:: Rustc { compiler, target } ) ;
567
+ builder. ensure ( compile:: Std { compiler, target : builder. config . build } ) ;
568
+
569
+ builder. info ( & format ! ( "Documenting stage{} compiler ({})" , stage, target) ) ;
569
570
570
571
// This uses a shared directory so that librustdoc documentation gets
571
572
// correctly built and merged with the rustc documentation. This is
@@ -642,7 +643,6 @@ macro_rules! tool_doc {
642
643
( $tool: ident, $should_run: literal, $path: literal, [ $( $krate: literal) ,+ $( , ) ?] $( , ) ?) => {
643
644
#[ derive( Debug , Copy , Clone , Hash , PartialEq , Eq ) ]
644
645
pub struct $tool {
645
- stage: u32 ,
646
646
target: TargetSelection ,
647
647
}
648
648
@@ -657,7 +657,7 @@ macro_rules! tool_doc {
657
657
}
658
658
659
659
fn make_run( run: RunConfig <' _>) {
660
- run. builder. ensure( $tool { stage : run . builder . top_stage , target: run. target } ) ;
660
+ run. builder. ensure( $tool { target: run. target } ) ;
661
661
}
662
662
663
663
/// Generates compiler documentation.
@@ -667,8 +667,21 @@ macro_rules! tool_doc {
667
667
/// we do not merge it with the other documentation from std, test and
668
668
/// proc_macros. This is largely just a wrapper around `cargo doc`.
669
669
fn run( self , builder: & Builder <' _>) {
670
- let stage = self . stage ;
670
+ let stage = builder . top_stage ;
671
671
let target = self . target;
672
+
673
+ // This is the intended out directory for compiler documentation.
674
+ let out = builder. compiler_doc_out( target) ;
675
+ t!( fs:: create_dir_all( & out) ) ;
676
+
677
+ // Build rustc docs so that we generate relative links.
678
+ builder. ensure( Rustc { stage, target } ) ;
679
+ // Rustdoc needs the rustc sysroot available to build.
680
+ // FIXME: is there a way to only ensure `check::Rustc` here? Last time I tried it failed
681
+ // with strange errors, but only on a full bors test ...
682
+ let compiler = builder. compiler( stage, builder. config. build) ;
683
+ builder. ensure( compile:: Rustc { compiler, target } ) ;
684
+
672
685
builder. info(
673
686
& format!(
674
687
"Documenting stage{} {} ({})" ,
@@ -678,15 +691,6 @@ macro_rules! tool_doc {
678
691
) ,
679
692
) ;
680
693
681
- // This is the intended out directory for compiler documentation.
682
- let out = builder. compiler_doc_out( target) ;
683
- t!( fs:: create_dir_all( & out) ) ;
684
-
685
- let compiler = builder. compiler( stage, builder. config. build) ;
686
-
687
- // Build rustc docs so that we generate relative links.
688
- builder. ensure( Rustc { stage, target } ) ;
689
-
690
694
// Symlink compiler docs to the output directory of rustdoc documentation.
691
695
let out_dir = builder. stage_out( compiler, Mode :: ToolRustc ) . join( target. triple) . join( "doc" ) ;
692
696
t!( fs:: create_dir_all( & out_dir) ) ;
0 commit comments