about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-04-21 23:06:23 +0200
committerGitHub <noreply@github.com>2021-04-21 23:06:23 +0200
commit0749ea7cb83a242311da795a2dd4467715464f86 (patch)
treea72ec8ade6cb7c9756bcf6d56a5616700755d6ff /src
parent49a5c80a3bbe96903be207ec04bb08bfd14cb9e4 (diff)
parentcc44ce0a3f379bc6e8a4078ee6f0b1a4237fa975 (diff)
downloadrust-0749ea7cb83a242311da795a2dd4467715464f86.tar.gz
rust-0749ea7cb83a242311da795a2dd4467715464f86.zip
Rollup merge of #84393 - GuillaumeGomez:better-open-handling, r=jyn514
Support `x.py doc std --open`

I usually run this command:

```
./x.py doc std --stage 1 --jobs 8
```

Then I gave a try to `--open` and realized it wasn't working. I finally realized it was simply because it was only handling paths starting with `library`. This PR allows to handle both kinds of paths.

cc ``@jyn514``
r? ``@Mark-Simulacrum``
Diffstat (limited to 'src')
-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 87f8cf160e0..a32b92ef1af 100644
--- a/src/bootstrap/doc.rs
+++ b/src/bootstrap/doc.rs
@@ -470,12 +470,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);
             }
         }
     }