Skip to content

Commit

Permalink
Merge pull request #18693 from Veykril/push-wzoomkkmuolm
Browse files Browse the repository at this point in the history
fix: Fix proc-macro dylib names on windows
  • Loading branch information
lnicola authored Dec 15, 2024
2 parents 30311ec + 6c6779e commit 27e824f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/proc-macro-srv/src/dylib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,15 @@ fn ensure_file_with_lock_free_access(path: &Utf8Path) -> io::Result<Utf8PathBuf>
to.push("rust-analyzer-proc-macros");
_ = 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}"))
})?;

to.push({
// Generate a unique number by abusing `HashMap`'s hasher.
// Maybe this will also "inspire" a libs team member to finally put `rand` in libstd.
let t = RandomState::new().build_hasher().finish();
let mut unique_name = t.to_string();
unique_name.push_str(file_name);
unique_name.push('-');
unique_name
let unique_name = RandomState::new().build_hasher().finish();
format!("{file_name}-{unique_name}.dll")
});
fs::copy(path, &to)?;
Ok(to)
Expand Down

0 comments on commit 27e824f

Please sign in to comment.