Skip to content

Commit fefcb46

Browse files
committed
Arc proc-macro expander paths
1 parent 45362de commit fefcb46

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/tools/rust-analyzer/crates/proc-macro-api/src/json.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//! Protocol functions for json.
12
use std::io::{self, BufRead, Write};
23

34
pub fn read_json<'a>(

src/tools/rust-analyzer/crates/proc-macro-api/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl MacroDylib {
6565
#[derive(Debug, Clone)]
6666
pub struct ProcMacro {
6767
process: Arc<ProcMacroProcessSrv>,
68-
dylib_path: AbsPathBuf,
68+
dylib_path: Arc<AbsPathBuf>,
6969
name: SmolStr,
7070
kind: ProcMacroKind,
7171
}
@@ -75,7 +75,7 @@ impl PartialEq for ProcMacro {
7575
fn eq(&self, other: &Self) -> bool {
7676
self.name == other.name
7777
&& self.kind == other.kind
78-
&& self.dylib_path == other.dylib_path
78+
&& Arc::ptr_eq(&self.dylib_path, &other.dylib_path)
7979
&& Arc::ptr_eq(&self.process, &other.process)
8080
}
8181
}
@@ -116,14 +116,15 @@ impl ProcMacroServer {
116116
let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered();
117117
let macros = self.process.find_proc_macros(&dylib.path)?;
118118

119+
let dylib_path = Arc::new(dylib.path);
119120
match macros {
120121
Ok(macros) => Ok(macros
121122
.into_iter()
122123
.map(|(name, kind)| ProcMacro {
123124
process: self.process.clone(),
124125
name: name.into(),
125126
kind,
126-
dylib_path: dylib.path.clone(),
127+
dylib_path: dylib_path.clone(),
127128
})
128129
.collect()),
129130
Err(message) => Err(ServerError { message, io: None }),

0 commit comments

Comments
 (0)