Skip to content

Commit

Permalink
Correctly handle "--open" option when building compiler docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Sep 17, 2021
1 parent bc49c3b commit 57ee7a6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,24 @@ impl Step for Rustc {
}
}

let mut to_open = None;
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);
if to_open.is_none() {
to_open = Some(krate);
}
}

builder.run(&mut cargo.into());
// Let's open the first crate documentation page:
if let Some(krate) = to_open {
let index = out.join(krate).join("index.html");
open(builder, &index);
}
}
}

Expand Down

0 comments on commit 57ee7a6

Please sign in to comment.