Skip to content

fix rustfmt symlink exists check in bootstrap #108316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/bootstrap/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,13 @@ impl Config {
#[cfg(not(windows))]
{
let legacy_rustfmt = self.initial_rustc.with_file_name(exe("rustfmt", host));
if !legacy_rustfmt.exists() {

// Note: we check here whether the symlink itself exists. `Path::exists` would follow
// the symlink and return whether the linked file exists instead. If `rustfmt_path` does
// not exist but the `legacy_rustfmt` link does, we would recreate it. This was one of
// the perf.rlo errors related to issue #108258.
let symlink_exists = std::fs::read_link(&legacy_rustfmt).is_ok();
if !symlink_exists {
t!(self.symlink_file(&rustfmt_path, &legacy_rustfmt));
}
}
Expand Down