diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-06-16 17:12:42 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-06-23 10:11:01 +0200 |
| commit | ac8920fa4c931a1df2de11734177d08dcbbf1029 (patch) | |
| tree | 523800cf0f702b3387f1bb8580450db7791266ad | |
| parent | 9e08d8769d8b1ccdc21b8c587013a954ef8545b7 (diff) | |
| download | rust-ac8920fa4c931a1df2de11734177d08dcbbf1029.tar.gz rust-ac8920fa4c931a1df2de11734177d08dcbbf1029.zip | |
Do not allow building anything on stage 0
| -rw-r--r-- | src/bootstrap/defaults/bootstrap.library.toml | 1 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/bootstrap/defaults/bootstrap.library.toml b/src/bootstrap/defaults/bootstrap.library.toml index 895e50b9a20..6a867093b78 100644 --- a/src/bootstrap/defaults/bootstrap.library.toml +++ b/src/bootstrap/defaults/bootstrap.library.toml @@ -1,7 +1,6 @@ # These defaults are meant for contributors to the standard library and documentation. [build] bench-stage = 1 -build-stage = 1 check-stage = 1 test-stage = 1 diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index d3393afcae0..d7decaa8a98 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -1023,7 +1023,7 @@ impl Config { || install_stage.is_some() || check_stage.is_some() || bench_stage.is_some(); - // See https://github.com/rust-lang/compiler-team/issues/326 + config.stage = match config.cmd { Subcommand::Check { .. } => flags_stage.or(check_stage).unwrap_or(0), Subcommand::Clippy { .. } | Subcommand::Fix => flags_stage.or(check_stage).unwrap_or(1), @@ -1051,6 +1051,12 @@ impl Config { | Subcommand::Vendor { .. } => flags_stage.unwrap_or(0), }; + // Now check that the selected stage makes sense, and if not, print a warning and end + if let (0, Subcommand::Build) = (config.stage, &config.cmd) { + eprintln!("WARNING: cannot build anything on stage 0. Use at least stage 1."); + exit!(1); + } + // CI should always run stage 2 builds, unless it specifically states otherwise #[cfg(not(test))] if flags_stage.is_none() && config.is_running_on_ci { |
