Skip to content

Commit 18be436

Browse files
authored
2 parents cefe40b + 82acbc8 commit 18be436

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/bootstrap/doc.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -500,18 +500,17 @@ impl Step for Rustc {
500500
let target = self.target;
501501
builder.info(&format!("Documenting stage{} compiler ({})", stage, target));
502502

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-
509503
if !builder.config.compiler_docs {
510504
builder.info("\tskipping - compiler/librustdoc docs disabled");
511505
return;
512506
}
513507

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+
514512
// Build rustc.
513+
let compiler = builder.compiler(stage, builder.config.build);
515514
builder.ensure(compile::Rustc { compiler, target });
516515

517516
// This uses a shared directory so that librustdoc documentation gets
@@ -521,6 +520,10 @@ impl Step for Rustc {
521520
// merging the search index, or generating local (relative) links.
522521
let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target.triple).join("doc");
523522
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));
524527

525528
// Build cargo command.
526529
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");

0 commit comments

Comments
 (0)