diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index a52573837db56..eee1aa521fa90 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1668,11 +1668,6 @@ Executed at: {executed_at}"#, if let Err(e) = fs::remove_file(dst) { if cfg!(windows) && e.kind() != io::ErrorKind::NotFound { - // workaround for https://github.com/rust-lang/rust/issues/127126 - // if removing the file fails, attempt to rename it instead. - let now = t!(SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)); - let _ = fs::rename(dst, format!("{}-{}", dst.display(), now.as_nanos())); - #[cfg(windows)] { eprintln!( @@ -1727,6 +1722,11 @@ Executed at: {executed_at}"#, } } } + + // workaround for https://github.com/rust-lang/rust/issues/127126 + // if removing the file fails, attempt to rename it instead. + let now = t!(SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)); + let _ = fs::rename(dst, format!("{}-{}", dst.display(), now.as_nanos())); } } let metadata = t!(src.symlink_metadata(), format!("src = {}", src.display()));