Skip to content

Commit b62997f

Browse files
authored
Rollup merge of #83172 - pnkfelix:bootstrap-tell-me-what-to-do-about-tidy-on-beta, r=Mark-Simulacrum
More informative diagnotic from `x.py test` attempt atop beta checkout Make bootstrap be more informative when one does `x.py test` on a beta checkout without other mods. To be clear, by default running `x.py test` on a checkout of the beta branch currently fails, and with this change will continue to fail, because `x.py tests` runs `x.py test src/tools/tidy` which tries to run `rustfmt` and that will fail because the `rustfmt` binary is pinned to the current nighlty and we do not attempt to distribute one for the beta builds. This change gives a better error message than the current message, which is just "./x.py fmt is not supported on this channel" without providing any hint about what one might do about that problem.
2 parents 70bacd6 + d6de60f commit b62997f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/bootstrap/test.rs

+13
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,19 @@ impl Step for Tidy {
791791

792792
if builder.config.channel == "dev" || builder.config.channel == "nightly" {
793793
builder.info("fmt check");
794+
if builder.config.initial_rustfmt.is_none() {
795+
let inferred_rustfmt_dir = builder.config.initial_rustc.parent().unwrap();
796+
eprintln!(
797+
"\
798+
error: no `rustfmt` binary found in {PATH}
799+
info: `rust.channel` is currently set to \"{CHAN}\"
800+
help: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file
801+
help: to skip test's attempt to check tidiness, pass `--exclude src/tools/tidy` to `x.py test`",
802+
PATH = inferred_rustfmt_dir.display(),
803+
CHAN = builder.config.channel,
804+
);
805+
std::process::exit(1);
806+
}
794807
crate::format::format(&builder.build, !builder.config.cmd.bless());
795808
}
796809
}

0 commit comments

Comments
 (0)