Rollup merge of #148224 - jyn514:doc-open, r=Kobzol

bootstrap: `ensure(doc::Std)` no longer opens a browser

In general, the rationale for `--open` is to only open HTML files if they were "explicitly" invoked from the CLI (e.g. `x doc --open library/core`). The existing logic did not do that. Instead it opened the docs unconditionally when a subset of the crates was requested. This is unfortunate for other Steps in bootstrap, which may wish to `ensure()` the standard library docs without opening them.

Change `Std` to check if it was explicitly invoked, rather than assuming it's the case.
This commit is contained in:
Matthias Krüger
2025-10-29 08:07:50 +01:00
committed by GitHub

View File

@@ -709,12 +709,12 @@ impl Step for Std {
if builder.paths.iter().any(|path| path.ends_with("library")) {
// For `x.py doc library --open`, open `std` by default.
let index = out.join("std").join("index.html");
builder.open_in_browser(index);
builder.maybe_open_in_browser::<Self>(index);
} else {
for requested_crate in crates {
if STD_PUBLIC_CRATES.iter().any(|&k| k == requested_crate) {
let index = out.join(requested_crate).join("index.html");
builder.open_in_browser(index);
builder.maybe_open_in_browser::<Self>(index);
break;
}
}