Skip to content

Commit 40b63d0

Browse files
authored
Rollup merge of rust-lang#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 😄 . This fixes rust-lang#107392
2 parents 33da3c3 + 65186e0 commit 40b63d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/bootstrap/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1431,6 +1431,13 @@ impl Build {
14311431
return Vec::new();
14321432
}
14331433

1434+
if !stamp.exists() {
1435+
eprintln!(
1436+
"Warning: Unable to find the stamp file, did you try to keep a nonexistent build stage?"
1437+
);
1438+
crate::detail_exit(1);
1439+
}
1440+
14341441
let mut paths = Vec::new();
14351442
let contents = t!(fs::read(stamp), &stamp);
14361443
// This is the method we use for extracting paths from the stamp file passed to us. See

0 commit comments

Comments
 (0)