From 57ee7a63ebc28e9ed645702fa152b8f35a0cd538 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 5 Sep 2021 17:24:09 +0200 Subject: [PATCH] Correctly handle "--open" option when building compiler docs --- src/bootstrap/doc.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 5a1593d74052..a1a954fdfceb 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -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); + } } }