From 3b705a0ece15843e6deef6833025f8548f4348c5 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sun, 2 Dec 2018 16:55:00 +0000 Subject: [PATCH] rustbuild: Fix issues with compiler docs * Create output directories for crates beforehand so rustdoc uses relative links * Readd rustc_codegen_ssa * Don't build out of tree dependencies for rustdoc like we don't for rustc --- src/bootstrap/doc.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index f9b19ffb10d..c1361b57680 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -696,9 +696,6 @@ fn run(self, builder: &Builder) { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); - // Build rustc. builder.ensure(compile::Rustc { compiler, target }); @@ -717,12 +714,16 @@ fn run(self, builder: &Builder) { // Find dependencies for top level crates. let mut compiler_crates = HashSet::new(); - for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] { + for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] { let interned_root_crate = INTERNER.intern_str(root_crate); find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates); } for krate in &compiler_crates { + // Create all crate output directories first to make sure rustdoc uses + // relative links. + // FIXME: Cargo should probably do this itself. + t!(fs::create_dir_all(out_dir.join(krate))); cargo.arg("-p").arg(krate); } @@ -796,8 +797,8 @@ fn run(self, builder: &Builder) { return; } - // Build libstd docs so that we generate relative links. - builder.ensure(Std { stage, target }); + // Build rustc docs so that we generate relative links. + builder.ensure(Rustc { stage, target }); // Build rustdoc. builder.ensure(tool::Rustdoc { host: compiler.host }); @@ -821,6 +822,10 @@ fn run(self, builder: &Builder) { &[] ); + // Only include compiler crates, no dependencies of those, such as `libc`. + cargo.arg("--no-deps"); + cargo.arg("-p").arg("rustdoc"); + cargo.env("RUSTDOCFLAGS", "--document-private-items"); builder.run(&mut cargo); }