about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2025-05-07 22:34:56 +0300
committeronur-ozkan <work@onurozkan.dev>2025-05-07 23:37:30 +0300
commit34c42c8f314af939e2f28f46f96293642516aa97 (patch)
tree76ea1ef1146733e455173253cad9671764a3af3f /src
parent3ef8e64ce9f72ee8d600d55bc43b36eed069b252 (diff)
downloadrust-34c42c8f314af939e2f28f46f96293642516aa97.tar.gz
rust-34c42c8f314af939e2f28f46f96293642516aa97.zip
do not allow stage > 0 on `x fmt`
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/format.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs
index 9da8b27a917..ca8414530a5 100644
--- a/src/bootstrap/src/core/build_steps/format.rs
+++ b/src/bootstrap/src/core/build_steps/format.rs
@@ -9,7 +9,7 @@ use std::sync::mpsc::SyncSender;
 use build_helper::git::get_git_modified_files;
 use ignore::WalkBuilder;
 
-use crate::core::builder::Builder;
+use crate::core::builder::{Builder, Kind};
 use crate::utils::build_stamp::BuildStamp;
 use crate::utils::exec::command;
 use crate::utils::helpers::{self, t};
@@ -122,6 +122,11 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
 }
 
 pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
+    if build.kind == Kind::Format && build.top_stage != 0 {
+        eprintln!("ERROR: `x fmt` only supports stage 0.");
+        crate::exit!(1);
+    }
+
     if !paths.is_empty() {
         eprintln!(
             "fmt error: path arguments are no longer accepted; use `--all` to format everything"