Skip to content

Commit 43bc2dd

Browse files
committed
ensure existence of the tool crate dir before linking
Signed-off-by: onur-ozkan <[email protected]>
1 parent a348b00 commit 43bc2dd

File tree

1 file changed

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

1 file changed

+12
-18
lines changed

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

+12-18
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,6 @@ impl Step for Rustc {
685685
target,
686686
);
687687

688-
let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target.triple).join("doc");
689-
690688
// Build cargo command.
691689
let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
692690
cargo.rustdocflag("--document-private-items");
@@ -713,6 +711,7 @@ impl Step for Rustc {
713711

714712
let mut to_open = None;
715713

714+
let out_dir = builder.stage_out(compiler, Mode::Rustc).join(target.triple).join("doc");
716715
for krate in &*self.crates {
717716
// Create all crate output directories first to make sure rustdoc uses
718717
// relative links.
@@ -822,22 +821,6 @@ macro_rules! tool_doc {
822821
SourceType::Submodule
823822
};
824823

825-
// Symlink compiler docs to the output directory of rustdoc documentation.
826-
let out_dirs = [
827-
builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc"),
828-
// Cargo uses a different directory for proc macros.
829-
builder.stage_out(compiler, Mode::ToolRustc).join("doc"),
830-
];
831-
832-
$(for krate in $crates {
833-
let dir_name = krate.replace("-", "_");
834-
t!(fs::create_dir_all(&out.join(dir_name)));
835-
})?
836-
837-
for out_dir in out_dirs {
838-
symlink_dir_force(&builder.config, &out, &out_dir);
839-
}
840-
841824
// Build cargo command.
842825
let mut cargo = prepare_tool_cargo(
843826
builder,
@@ -870,6 +853,17 @@ macro_rules! tool_doc {
870853
cargo.rustdocflag("--generate-link-to-definition");
871854
cargo.rustdocflag("-Zunstable-options");
872855

856+
let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target.triple).join("doc");
857+
$(for krate in $crates {
858+
let dir_name = krate.replace("-", "_");
859+
t!(fs::create_dir_all(out_dir.join(&*dir_name)));
860+
})?
861+
862+
// Symlink compiler docs to the output directory of rustdoc documentation.
863+
symlink_dir_force(&builder.config, &out, &out_dir);
864+
let proc_macro_out_dir = builder.stage_out(compiler, Mode::ToolRustc).join("doc");
865+
symlink_dir_force(&builder.config, &out, &proc_macro_out_dir);
866+
873867
let _guard = builder.msg_doc(compiler, stringify!($tool).to_lowercase(), target);
874868
builder.run(&mut cargo.into());
875869

0 commit comments

Comments
 (0)