Skip to content

Commit b6c1ef3

Browse files
authored
Auto merge of #34801 - TimNN:rustbuild-doc-fixes, r=alexcrichton
rustbuild: doc fixes This fixes two issues rustbuild currently has when building documentation: 1. It fixes standalone builds of `doc-test` and `doc-rustc`. 2. It actually builds the compiler docs if requested in the config. Closes #34275.
2 parents 3e15fcc + 3c0c663 commit b6c1ef3

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/bootstrap/doc.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ pub fn std(build: &Build, stage: u32, target: &str, out: &Path) {
155155
/// is largely just a wrapper around `cargo doc`.
156156
pub fn test(build: &Build, stage: u32, target: &str, out: &Path) {
157157
println!("Documenting stage{} test ({})", stage, target);
158+
t!(fs::create_dir_all(out));
158159
let compiler = Compiler::new(stage, &build.config.build);
159160
let out_dir = build.stage_out(&compiler, Mode::Libtest)
160161
.join(target).join("doc");
@@ -175,11 +176,12 @@ pub fn test(build: &Build, stage: u32, target: &str, out: &Path) {
175176
/// dependencies. This is largely just a wrapper around `cargo doc`.
176177
pub fn rustc(build: &Build, stage: u32, target: &str, out: &Path) {
177178
println!("Documenting stage{} compiler ({})", stage, target);
179+
t!(fs::create_dir_all(out));
178180
let compiler = Compiler::new(stage, &build.config.build);
179181
let out_dir = build.stage_out(&compiler, Mode::Librustc)
180182
.join(target).join("doc");
181183
let rustdoc = build.rustdoc(&compiler);
182-
if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) {
184+
if !up_to_date(&rustdoc, &out_dir.join("rustc/index.html")) && out_dir.exists() {
183185
t!(fs::remove_dir_all(&out_dir));
184186
}
185187
let mut cargo = build.cargo(&compiler, Mode::Librustc, target, "doc");

src/bootstrap/step.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,18 @@ impl<'a> Step<'a> {
380380
vec![self.doc_test(stage)]
381381
}
382382
Source::Doc { stage } => {
383-
vec![self.doc_book(stage), self.doc_nomicon(stage),
384-
self.doc_style(stage), self.doc_standalone(stage),
385-
self.doc_std(stage),
386-
self.doc_error_index(stage)]
383+
let mut deps = vec![
384+
self.doc_book(stage), self.doc_nomicon(stage),
385+
self.doc_style(stage), self.doc_standalone(stage),
386+
self.doc_std(stage),
387+
self.doc_error_index(stage),
388+
];
389+
390+
if build.config.compiler_docs {
391+
deps.push(self.doc_rustc(stage));
392+
}
393+
394+
deps
387395
}
388396
Source::Check { stage, compiler } => {
389397
// Check is just a pseudo step which means check all targets,

0 commit comments

Comments
 (0)