Skip to content

Commit 7c9cb2b

Browse files
committed
Do not allow building anything on stage 0
1 parent b48bcb2 commit 7c9cb2b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/bootstrap/defaults/bootstrap.library.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# These defaults are meant for contributors to the standard library and documentation.
22
[build]
33
bench-stage = 1
4-
build-stage = 1
54
check-stage = 1
65
test-stage = 1
76

src/bootstrap/src/core/config/config.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ impl Config {
980980
|| install_stage.is_some()
981981
|| check_stage.is_some()
982982
|| bench_stage.is_some();
983-
// See https://github.com/rust-lang/compiler-team/issues/326
983+
984984
config.stage = match config.cmd {
985985
Subcommand::Check { .. } => flags.stage.or(check_stage).unwrap_or(0),
986986
Subcommand::Clippy { .. } | Subcommand::Fix => flags.stage.or(check_stage).unwrap_or(1),
@@ -1008,6 +1008,15 @@ impl Config {
10081008
| Subcommand::Vendor { .. } => flags.stage.unwrap_or(0),
10091009
};
10101010

1011+
// Now check that the selected stage makes sense, and if not, print a warning and end
1012+
match (config.stage, &config.cmd) {
1013+
(0, Subcommand::Build) => {
1014+
eprintln!("WARNING: cannot build anything on stage 0. Use at least stage 1.");
1015+
exit!(1)
1016+
}
1017+
_ => {}
1018+
}
1019+
10111020
// CI should always run stage 2 builds, unless it specifically states otherwise
10121021
#[cfg(not(test))]
10131022
if flags.stage.is_none() && config.is_running_on_ci {

0 commit comments

Comments
 (0)