Skip to content

Commit

Permalink
Arc proc-macro expander paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jun 30, 2024
1 parent c236190 commit 956c852
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions crates/proc-macro-api/src/json.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//! Protocol functions for json.
use std::io::{self, BufRead, Write};

pub fn read_json<'a>(
Expand Down
7 changes: 4 additions & 3 deletions crates/proc-macro-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl MacroDylib {
#[derive(Debug, Clone)]
pub struct ProcMacro {
process: Arc<ProcMacroProcessSrv>,
dylib_path: AbsPathBuf,
dylib_path: Arc<AbsPathBuf>,
name: SmolStr,
kind: ProcMacroKind,
}
Expand All @@ -75,7 +75,7 @@ impl PartialEq for ProcMacro {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
&& 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)
}
}
Expand Down Expand Up @@ -116,14 +116,15 @@ impl ProcMacroServer {
let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered();
let macros = self.process.find_proc_macros(&dylib.path)?;

let dylib_path = Arc::new(dylib.path);
match macros {
Ok(macros) => Ok(macros
.into_iter()
.map(|(name, kind)| ProcMacro {
process: self.process.clone(),
name: name.into(),
kind,
dylib_path: dylib.path.clone(),
dylib_path: dylib_path.clone(),
})
.collect()),
Err(message) => Err(ServerError { message, io: None }),
Expand Down

0 comments on commit 956c852

Please sign in to comment.