about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-01-29 06:14:18 +0100
committerGitHub <noreply@github.com>2023-01-29 06:14:18 +0100
commit40b63d03a35d86e175ab9931499e893fa52a93f8 (patch)
tree610328c7818f087ca28f065d354077712d9d6376 /src
parent33da3c3df02bb4108af3ac726eabe759109dc972 (diff)
parent65186e01285ba20e966e06f505f0e89e06694601 (diff)
downloadrust-40b63d03a35d86e175ab9931499e893fa52a93f8.tar.gz
rust-40b63d03a35d86e175ab9931499e893fa52a93f8.zip
Rollup merge of #107397 - Teapot4195:issue-107392-fix, r=albertlarsan68
Gracefully exit if --keep-stage flag is used on a clean source tree

Instead of quitting with an obscure No such file or directory error, give the user a clearer and easier to understand error (as well as suggesting a possible cause for the error).

This is the first time I have written rust since 2020, and the first PR I will ever make to rust, so please do point out any mistakes I have made :smile: .

This fixes #107392
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index d44b96cfb99..522b3b7e851 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1431,6 +1431,13 @@ impl Build {
             return Vec::new();
         }
 
+        if !stamp.exists() {
+            eprintln!(
+                "Warning: Unable to find the stamp file, did you try to keep a nonexistent build stage?"
+            );
+            crate::detail_exit(1);
+        }
+
         let mut paths = Vec::new();
         let contents = t!(fs::read(stamp), &stamp);
         // This is the method we use for extracting paths from the stamp file passed to us. See