Auto merge of #14287 - Veykril:rustc_private-proc-macro, r=Veykril

minor: Fixup dylib extensions for rustc_private proc-macro loading

Follow up to https://github.com/rust-lang/rust-analyzer/pull/14282
This commit is contained in:
bors 2023-03-08 13:56:45 +00:00
commit 38e9a110d4

View File

@ -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());
}
}
}