Skip to content

Commit 5c6bae0

Browse files
authored
Merge pull request #18693 from Veykril/push-wzoomkkmuolm
fix: Fix proc-macro dylib names on windows
2 parents d501b3c + 31a462f commit 5c6bae0

File tree

1 file changed

+3
-6
lines changed
  • src/tools/rust-analyzer/crates/proc-macro-srv/src

1 file changed

+3
-6
lines changed

Diff for: src/tools/rust-analyzer/crates/proc-macro-srv/src/dylib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,15 @@ fn ensure_file_with_lock_free_access(path: &Utf8Path) -> io::Result<Utf8PathBuf>
199199
to.push("rust-analyzer-proc-macros");
200200
_ = fs::create_dir(&to);
201201

202-
let file_name = path.file_name().ok_or_else(|| {
202+
let file_name = path.file_stem().ok_or_else(|| {
203203
io::Error::new(io::ErrorKind::InvalidInput, format!("File path is invalid: {path}"))
204204
})?;
205205

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

0 commit comments

Comments
 (0)