Skip to content

Commit 6f041ec

Browse files
committed
fix rustfmt symlink exists check in bootstrap
1 parent 3200982 commit 6f041ec

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bootstrap/download.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,13 @@ impl Config {
342342
#[cfg(not(windows))]
343343
{
344344
let legacy_rustfmt = self.initial_rustc.with_file_name(exe("rustfmt", host));
345-
if !legacy_rustfmt.exists() {
345+
346+
// Note: we check here whether the symlink itself exists. `Path::exists` would follow
347+
// the symlink and return whether the linked file exists instead. If `rustfmt_path` does
348+
// not exist but the `legacy_rustfmt` link does, we would recreate it. This was one of
349+
// the perf.rlo errors related to issue #108258.
350+
let symlink_exists = std::fs::read_link(&legacy_rustfmt).is_ok();
351+
if !symlink_exists {
346352
t!(self.symlink_file(&rustfmt_path, &legacy_rustfmt));
347353
}
348354
}

0 commit comments

Comments
 (0)