Skip to content

Commit 38e9a11

Browse files
committed
Auto merge of #14287 - Veykril:rustc_private-proc-macro, r=Veykril
minor: Fixup dylib extensions for rustc_private proc-macro loading Follow up to rust-lang/rust-analyzer#14282
2 parents 3d904e0 + 4ee2aba commit 38e9a11

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/project-model/src/build_scripts.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl WorkspaceBuildScripts {
416416
let path = dir_entry.path();
417417
tracing::info!("p{:?}", path);
418418
let extension = path.extension()?;
419-
if extension == "dll" || extension == "so" {
419+
if extension == std::env::consts::DLL_EXTENSION {
420420
let name = path.file_stem()?.to_str()?.split_once('-')?.0.to_owned();
421421
let path = AbsPathBuf::try_from(path).ok()?;
422422
return Some((name, path));
@@ -426,10 +426,13 @@ impl WorkspaceBuildScripts {
426426
})
427427
.collect();
428428
for p in rustc.packages() {
429-
if let Some((_, path)) =
430-
proc_macro_dylibs.iter().find(|(name, _)| *name == rustc[p].name)
431-
{
432-
bs.outputs[p].proc_macro_dylib_path = Some(path.clone());
429+
let package = &rustc[p];
430+
if package.targets.iter().any(|&it| rustc[it].is_proc_macro) {
431+
if let Some((_, path)) =
432+
proc_macro_dylibs.iter().find(|(name, _)| *name == package.name)
433+
{
434+
bs.outputs[p].proc_macro_dylib_path = Some(path.clone());
435+
}
433436
}
434437
}
435438

0 commit comments

Comments
 (0)