Skip to content

Commit 0749ea7

Browse files
authored
Rollup merge of rust-lang#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``
2 parents 49a5c80 + cc44ce0 commit 0749ea7

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/bootstrap/doc.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -470,12 +470,16 @@ impl Step for Std {
470470
// Look for library/std, library/core etc in the `x.py doc` arguments and
471471
// open the corresponding rendered docs.
472472
for path in builder.paths.iter().map(components_simplified) {
473-
if path.get(0) == Some(&"library") {
474-
let requested_crate = &path[1];
475-
if krates.contains(&requested_crate) {
476-
let index = out.join(requested_crate).join("index.html");
477-
open(builder, &index);
478-
}
473+
let requested_crate = if path.get(0) == Some(&"library") {
474+
&path[1]
475+
} else if !path.is_empty() {
476+
&path[0]
477+
} else {
478+
continue;
479+
};
480+
if krates.contains(&requested_crate) {
481+
let index = out.join(requested_crate).join("index.html");
482+
open(builder, &index);
479483
}
480484
}
481485
}

0 commit comments

Comments
 (0)