From 4ee2abaf388f2c9cc1260222e6ece305c2cd712d Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 8 Mar 2023 14:45:47 +0100 Subject: [PATCH] minor: Fixup dylib extensions for rustc_private proc-macro loading --- crates/project-model/src/build_scripts.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/project-model/src/build_scripts.rs b/crates/project-model/src/build_scripts.rs index 6930ed83731..38c1b37f0e3 100644 --- a/crates/project-model/src/build_scripts.rs +++ b/crates/project-model/src/build_scripts.rs @@ -416,7 +416,7 @@ pub(crate) fn rustc_crates( let path = dir_entry.path(); tracing::info!("p{:?}", path); let extension = path.extension()?; - if extension == "dll" || extension == "so" { + if extension == std::env::consts::DLL_EXTENSION { let name = path.file_stem()?.to_str()?.split_once('-')?.0.to_owned(); let path = AbsPathBuf::try_from(path).ok()?; return Some((name, path)); @@ -426,10 +426,13 @@ pub(crate) fn rustc_crates( }) .collect(); for p in rustc.packages() { - if let Some((_, path)) = - proc_macro_dylibs.iter().find(|(name, _)| *name == rustc[p].name) - { - bs.outputs[p].proc_macro_dylib_path = Some(path.clone()); + let package = &rustc[p]; + if package.targets.iter().any(|&it| rustc[it].is_proc_macro) { + if let Some((_, path)) = + proc_macro_dylibs.iter().find(|(name, _)| *name == package.name) + { + bs.outputs[p].proc_macro_dylib_path = Some(path.clone()); + } } }