Skip to content

Commit

Permalink
Rollup merge of #107397 - Teapot4195:issue-107392-fix, r=albertlarsan68
Browse files Browse the repository at this point in the history
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 #107392
  • Loading branch information
matthiaskrgr authored Jan 29, 2023
2 parents 33da3c3 + 65186e0 commit 40b63d0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40b63d0

Please sign in to comment.