@@ -500,18 +500,17 @@ impl Step for Rustc {
500
500
let target = self . target ;
501
501
builder. info ( & format ! ( "Documenting stage{} compiler ({})" , stage, target) ) ;
502
502
503
- // This is the intended out directory for compiler documentation.
504
- let out = builder. compiler_doc_out ( target) ;
505
- t ! ( fs:: create_dir_all( & out) ) ;
506
-
507
- let compiler = builder. compiler ( stage, builder. config . build ) ;
508
-
509
503
if !builder. config . compiler_docs {
510
504
builder. info ( "\t skipping - compiler/librustdoc docs disabled" ) ;
511
505
return ;
512
506
}
513
507
508
+ // This is the intended out directory for compiler documentation.
509
+ let out = builder. compiler_doc_out ( target) ;
510
+ t ! ( fs:: create_dir_all( & out) ) ;
511
+
514
512
// Build rustc.
513
+ let compiler = builder. compiler ( stage, builder. config . build ) ;
515
514
builder. ensure ( compile:: Rustc { compiler, target } ) ;
516
515
517
516
// This uses a shared directory so that librustdoc documentation gets
@@ -521,6 +520,10 @@ impl Step for Rustc {
521
520
// merging the search index, or generating local (relative) links.
522
521
let out_dir = builder. stage_out ( compiler, Mode :: Rustc ) . join ( target. triple ) . join ( "doc" ) ;
523
522
t ! ( symlink_dir_force( & builder. config, & out, & out_dir) ) ;
523
+ // Cargo puts proc macros in `target/doc` even if you pass `--target`
524
+ // explicitly (https://github.com/rust-lang/cargo/issues/7677).
525
+ let proc_macro_out_dir = builder. stage_out ( compiler, Mode :: Rustc ) . join ( "doc" ) ;
526
+ t ! ( symlink_dir_force( & builder. config, & out, & proc_macro_out_dir) ) ;
524
527
525
528
// Build cargo command.
526
529
let mut cargo = builder. cargo ( compiler, Mode :: Rustc , SourceType :: InTree , target, "doc" ) ;
0 commit comments