Skip to content

Commit acf3d87

Browse files
committed
Clear rustc when dirty for all command modes, not just std
This avoids incremental ICEs when building with stage 1 (see 76720). This also checks for `check`, since `x.py check --stage 1` could also hit the same issue (now that `check` supports a --stage argument).
1 parent 3e1c75c commit acf3d87

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/bootstrap/builder.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,14 +1072,12 @@ impl<'a> Builder<'a> {
10721072
let libdir = self.rustc_libdir(compiler);
10731073

10741074
// Clear the output directory if the real rustc we're using has changed;
1075-
// Cargo cannot detect this as it thinks rustc is bootstrap/debug/rustc.
1075+
// Cargo usually cannot detect this because we use the same version string for all stage1
1076+
// builds, regardless of the git commit.
10761077
//
10771078
// Avoid doing this during dry run as that usually means the relevant
10781079
// compiler is not yet linked/copied properly.
1079-
//
1080-
// Only clear out the directory if we're compiling std; otherwise, we
1081-
// should let Cargo take care of things for us (via depdep info)
1082-
if !self.config.dry_run && mode == Mode::Std && cmd == "build" {
1080+
if !self.config.dry_run && ["build", "check"].contains(&cmd) {
10831081
self.clear_if_dirty(&out_dir, &self.rustc(compiler));
10841082
}
10851083

0 commit comments

Comments
 (0)