Merge pull request #18693 from Veykril/push-wzoomkkmuolm

fix: Fix proc-macro dylib names on windows
This commit is contained in:
Laurențiu Nicola 2024-12-15 18:32:38 +00:00 committed by GitHub
commit 27e824fad4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -199,18 +199,15 @@ fn ensure_file_with_lock_free_access(path: &Utf8Path) -> io::Result<Utf8PathBuf>
to.push("rust-analyzer-proc-macros"); to.push("rust-analyzer-proc-macros");
_ = fs::create_dir(&to); _ = fs::create_dir(&to);
let file_name = path.file_name().ok_or_else(|| { let file_name = path.file_stem().ok_or_else(|| {
io::Error::new(io::ErrorKind::InvalidInput, format!("File path is invalid: {path}")) io::Error::new(io::ErrorKind::InvalidInput, format!("File path is invalid: {path}"))
})?; })?;
to.push({ to.push({
// Generate a unique number by abusing `HashMap`'s hasher. // Generate a unique number by abusing `HashMap`'s hasher.
// Maybe this will also "inspire" a libs team member to finally put `rand` in libstd. // Maybe this will also "inspire" a libs team member to finally put `rand` in libstd.
let t = RandomState::new().build_hasher().finish(); let unique_name = RandomState::new().build_hasher().finish();
let mut unique_name = t.to_string(); format!("{file_name}-{unique_name}.dll")
unique_name.push_str(file_name);
unique_name.push('-');
unique_name
}); });
fs::copy(path, &to)?; fs::copy(path, &to)?;
Ok(to) Ok(to)