about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-04-21 14:20:56 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-04-21 14:36:26 +0200
commitcc44ce0a3f379bc6e8a4078ee6f0b1a4237fa975 (patch)
treee5261977ee4c8dbb6db418bb3c165144c3095ab6
parent62652865b6029b4776a7c03efa13a37b15c9b953 (diff)
downloadrust-cc44ce0a3f379bc6e8a4078ee6f0b1a4237fa975.tar.gz
rust-cc44ce0a3f379bc6e8a4078ee6f0b1a4237fa975.zip
Correctly handle --open argument on doc command
-rw-r--r--src/bootstrap/doc.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs
index dc96fd819d5..50370a5ffb6 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -479,12 +479,16 @@ impl Step for Std {
         // Look for library/std, library/core etc in the `x.py doc` arguments and
         // open the corresponding rendered docs.
         for path in builder.paths.iter().map(components_simplified) {
-            if path.get(0) == Some(&"library") {
-                let requested_crate = &path[1];
-                if krates.contains(&requested_crate) {
-                    let index = out.join(requested_crate).join("index.html");
-                    open(builder, &index);
-                }
+            let requested_crate = if path.get(0) == Some(&"library") {
+                &path[1]
+            } else if !path.is_empty() {
+                &path[0]
+            } else {
+                continue;
+            };
+            if krates.contains(&requested_crate) {
+                let index = out.join(requested_crate).join("index.html");
+                open(builder, &index);
             }
         }
     }