Skip to content

Commit 5e2de47

Browse files
committed
Ensure compiler crate paths are generated before linking
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 2db26d3 commit 5e2de47

File tree

1 file changed

+12
-11
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+12
-11
lines changed

src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -685,18 +685,7 @@ impl Step for Rustc {
685685
target,
686686
);
687687

688-
// This uses a shared directory so that librustdoc documentation gets
689-
// correctly built and merged with the rustc documentation. This is
690-
// needed because rustdoc is built in a different directory from
691-
// rustc. rustdoc needs to be able to see everything, for example when
692-
// merging the search index, or generating local (relative) links.
693688
let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target.triple).join("doc");
694-
t!(fs::create_dir_all(out_dir.parent().unwrap()));
695-
symlink_dir_force(&builder.config, &out, &out_dir);
696-
// Cargo puts proc macros in `target/doc` even if you pass `--target`
697-
// explicitly (https://github.com/rust-lang/cargo/issues/7677).
698-
let proc_macro_out_dir = builder.stage_out(compiler, Mode::Rustc).join("doc");
699-
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
700689

701690
// Build cargo command.
702691
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
@@ -736,6 +725,18 @@ impl Step for Rustc {
736725
}
737726
}
738727

728+
// This uses a shared directory so that librustdoc documentation gets
729+
// correctly built and merged with the rustc documentation.
730+
//
731+
// This is needed because rustdoc is built in a different directory from
732+
// rustc. rustdoc needs to be able to see everything, for example when
733+
// merging the search index, or generating local (relative) links.
734+
symlink_dir_force(&builder.config, &out, &out_dir);
735+
// Cargo puts proc macros in `target/doc` even if you pass `--target`
736+
// explicitly (https://github.com/rust-lang/cargo/issues/7677).
737+
let proc_macro_out_dir = builder.stage_out(compiler, Mode::Rustc).join("doc");
738+
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
739+
739740
builder.run(&mut cargo.into());
740741

741742
if builder.paths.iter().any(|path| path.ends_with("compiler")) {

0 commit comments

Comments
 (0)