Skip to content

Commit 3dfaeab

Browse files
authored
Rollup merge of rust-lang#56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton
rustbuild: Fix issues with compiler docs * Create output directories for crates beforehand so rustdoc uses relative links (fixes rust-lang#56107) * Readd rustc_codegen_ssa (fixes rust-lang#56196) * Don't build out of tree dependencies for rustdoc like we don't for rustc
2 parents 8f746a6 + 3b705a0 commit 3dfaeab

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/bootstrap/doc.rs

+11-6
Original file line numberDiff line numberDiff line change
@@ -697,9 +697,6 @@ impl Step for Rustc {
697697
return;
698698
}
699699

700-
// Build libstd docs so that we generate relative links.
701-
builder.ensure(Std { stage, target });
702-
703700
// Build rustc.
704701
builder.ensure(compile::Rustc { compiler, target });
705702

@@ -718,12 +715,16 @@ impl Step for Rustc {
718715

719716
// Find dependencies for top level crates.
720717
let mut compiler_crates = HashSet::new();
721-
for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
718+
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
722719
let interned_root_crate = INTERNER.intern_str(root_crate);
723720
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
724721
}
725722

726723
for krate in &compiler_crates {
724+
// Create all crate output directories first to make sure rustdoc uses
725+
// relative links.
726+
// FIXME: Cargo should probably do this itself.
727+
t!(fs::create_dir_all(out_dir.join(krate)));
727728
cargo.arg("-p").arg(krate);
728729
}
729730

@@ -797,8 +798,8 @@ impl Step for Rustdoc {
797798
return;
798799
}
799800

800-
// Build libstd docs so that we generate relative links.
801-
builder.ensure(Std { stage, target });
801+
// Build rustc docs so that we generate relative links.
802+
builder.ensure(Rustc { stage, target });
802803

803804
// Build rustdoc.
804805
builder.ensure(tool::Rustdoc { host: compiler.host });
@@ -822,6 +823,10 @@ impl Step for Rustdoc {
822823
&[]
823824
);
824825

826+
// Only include compiler crates, no dependencies of those, such as `libc`.
827+
cargo.arg("--no-deps");
828+
cargo.arg("-p").arg("rustdoc");
829+
825830
cargo.env("RUSTDOCFLAGS", "--document-private-items");
826831
builder.run(&mut cargo);
827832
}

0 commit comments

Comments
 (0)