@@ -17,6 +17,7 @@ use build_helper::{t, up_to_date};
17
17
18
18
use crate :: builder:: { Builder , Compiler , RunConfig , ShouldRun , Step } ;
19
19
use crate :: cache:: { Interned , INTERNER } ;
20
+ use crate :: check;
20
21
use crate :: compile;
21
22
use crate :: config:: { Config , TargetSelection } ;
22
23
use crate :: tool:: { self , prepare_tool_cargo, SourceType , Tool } ;
@@ -438,7 +439,6 @@ impl Step for Std {
438
439
t ! ( fs:: create_dir_all( & out) ) ;
439
440
let compiler = builder. compiler ( stage, builder. config . build ) ;
440
441
441
- builder. ensure ( compile:: Std { compiler, target } ) ;
442
442
let out_dir = builder. stage_out ( compiler, Mode :: Std ) . join ( target. triple ) . join ( "doc" ) ;
443
443
444
444
t ! ( fs:: copy( builder. src. join( "src/doc/rust.css" ) , out. join( "rust.css" ) ) ) ;
@@ -569,9 +569,10 @@ impl Step for Rustc {
569
569
let out = builder. compiler_doc_out ( target) ;
570
570
t ! ( fs:: create_dir_all( & out) ) ;
571
571
572
- // Build rustc.
572
+ // Build the standard library, so that proc-macros can use it.
573
+ // (Normally, only the metadata would be necessary, but proc-macros are special since they run at compile-time.)
573
574
let compiler = builder. compiler ( stage, builder. config . build ) ;
574
- builder. ensure ( compile:: Rustc { compiler, target } ) ;
575
+ builder. ensure ( compile:: Std { compiler, target : builder . config . build } ) ;
575
576
576
577
// This uses a shared directory so that librustdoc documentation gets
577
578
// correctly built and merged with the rustc documentation. This is
@@ -699,21 +700,22 @@ macro_rules! tool_doc {
699
700
) ,
700
701
) ;
701
702
702
- // This is the intended out directory for compiler documentation.
703
- let out = builder. compiler_doc_out( target) ;
704
- t!( fs:: create_dir_all( & out) ) ;
705
-
706
- let compiler = builder. compiler( stage, builder. config. build) ;
707
-
708
703
if !builder. config. compiler_docs && !builder. was_invoked_explicitly:: <Self >( ) {
709
704
builder. info( "\t skipping - compiler/tool docs disabled" ) ;
710
705
return ;
711
706
}
712
707
708
+ // This is the intended out directory for compiler documentation.
709
+ let out = builder. compiler_doc_out( target) ;
710
+ t!( fs:: create_dir_all( & out) ) ;
711
+
713
712
// Build rustc docs so that we generate relative links.
714
713
builder. ensure( Rustc { stage, target } ) ;
714
+ // Rustdoc needs the rustc sysroot available to build.
715
+ builder. ensure( check:: Rustc { target } ) ;
715
716
716
717
// Symlink compiler docs to the output directory of rustdoc documentation.
718
+ let compiler = builder. compiler( stage, builder. config. build) ;
717
719
let out_dir = builder. stage_out( compiler, Mode :: ToolRustc ) . join( target. triple) . join( "doc" ) ;
718
720
t!( fs:: create_dir_all( & out_dir) ) ;
719
721
t!( symlink_dir_force( & builder. config, & out, & out_dir) ) ;
0 commit comments