Arc proc-macro expander paths

This commit is contained in:
Lukas Wirth 2024-06-30 17:03:03 +02:00
parent c236190b60
commit 956c8521a9
2 changed files with 5 additions and 3 deletions

View file

@ -1,3 +1,4 @@
//! Protocol functions for json.
use std::io::{self, BufRead, Write}; use std::io::{self, BufRead, Write};
pub fn read_json<'a>( pub fn read_json<'a>(

View file

@ -65,7 +65,7 @@ impl MacroDylib {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ProcMacro { pub struct ProcMacro {
process: Arc<ProcMacroProcessSrv>, process: Arc<ProcMacroProcessSrv>,
dylib_path: AbsPathBuf, dylib_path: Arc<AbsPathBuf>,
name: SmolStr, name: SmolStr,
kind: ProcMacroKind, kind: ProcMacroKind,
} }
@ -75,7 +75,7 @@ impl PartialEq for ProcMacro {
fn eq(&self, other: &Self) -> bool { fn eq(&self, other: &Self) -> bool {
self.name == other.name self.name == other.name
&& self.kind == other.kind && self.kind == other.kind
&& self.dylib_path == other.dylib_path && Arc::ptr_eq(&self.dylib_path, &other.dylib_path)
&& Arc::ptr_eq(&self.process, &other.process) && Arc::ptr_eq(&self.process, &other.process)
} }
} }
@ -116,6 +116,7 @@ impl ProcMacroServer {
let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered(); let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered();
let macros = self.process.find_proc_macros(&dylib.path)?; let macros = self.process.find_proc_macros(&dylib.path)?;
let dylib_path = Arc::new(dylib.path);
match macros { match macros {
Ok(macros) => Ok(macros Ok(macros) => Ok(macros
.into_iter() .into_iter()
@ -123,7 +124,7 @@ impl ProcMacroServer {
process: self.process.clone(), process: self.process.clone(),
name: name.into(), name: name.into(),
kind, kind,
dylib_path: dylib.path.clone(), dylib_path: dylib_path.clone(),
}) })
.collect()), .collect()),
Err(message) => Err(ServerError { message, io: None }), Err(message) => Err(ServerError { message, io: None }),