Rollup merge of #107876 - zephaniahong:issue-107547-fix, r=albertlarsan68

create symlink only for non-windows operating systems

Follow up on #107834
It's my first time using the #cfg attribute. Did I use it correctly?

Thank you!
This commit is contained in:
Matthias Krüger 2023-02-10 15:28:49 +01:00 committed by GitHub
commit 08ce17affc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,9 +340,12 @@ impl Config {
let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host));
let rustfmt_stamp = bin_root.join(".rustfmt-stamp");
let legacy_rustfmt = self.initial_rustc.with_file_name(exe("rustfmt", host));
if !legacy_rustfmt.exists() {
t!(self.symlink_file(&rustfmt_path, &legacy_rustfmt));
#[cfg(not(windows))]
{
let legacy_rustfmt = self.initial_rustc.with_file_name(exe("rustfmt", host));
if !legacy_rustfmt.exists() {
t!(self.symlink_file(&rustfmt_path, &legacy_rustfmt));
}
}
if rustfmt_path.exists() && !program_out_of_date(&rustfmt_stamp, &channel) {