aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/proc_macro_api/src/lib.rs')
-rw-r--r--crates/proc_macro_api/src/lib.rs22
1 files changed, 19 insertions, 3 deletions
diff --git a/crates/proc_macro_api/src/lib.rs b/crates/proc_macro_api/src/lib.rs
index 2ea456fb0..941d0fe9e 100644
--- a/crates/proc_macro_api/src/lib.rs
+++ b/crates/proc_macro_api/src/lib.rs
@@ -5,10 +5,12 @@
5//! is used to provide basic infrastructure for communication between two 5//! is used to provide basic infrastructure for communication between two
6//! processes: Client (RA itself), Server (the external program) 6//! processes: Client (RA itself), Server (the external program)
7 7
8mod rpc;
9mod process;
10pub mod msg; 8pub mod msg;
9mod process;
10mod rpc;
11mod version;
11 12
13use base_db::{Env, ProcMacro};
12use std::{ 14use std::{
13 ffi::OsStr, 15 ffi::OsStr,
14 io, 16 io,
@@ -16,7 +18,6 @@ use std::{
16 sync::Arc, 18 sync::Arc,
17}; 19};
18 20
19use base_db::{Env, ProcMacro};
20use tt::{SmolStr, Subtree}; 21use tt::{SmolStr, Subtree};
21 22
22use crate::process::{ProcMacroProcessSrv, ProcMacroProcessThread}; 23use crate::process::{ProcMacroProcessSrv, ProcMacroProcessThread};
@@ -75,6 +76,21 @@ impl ProcMacroClient {
75 } 76 }
76 77
77 pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<ProcMacro> { 78 pub fn by_dylib_path(&self, dylib_path: &Path) -> Vec<ProcMacro> {
79 match version::read_info(dylib_path) {
80 Ok(info) => {
81 if info.version.0 < 1 || info.version.1 < 47 {
82 eprintln!("proc-macro {} built by {:#?} is not supported by Rust Analyzer, please update your rust version.", dylib_path.to_string_lossy(), info);
83 }
84 }
85 Err(err) => {
86 eprintln!(
87 "proc-macro {} failed to find the given version. Reason: {}",
88 dylib_path.to_string_lossy(),
89 err
90 );
91 }
92 }
93
78 let macros = match self.process.find_proc_macros(dylib_path) { 94 let macros = match self.process.find_proc_macros(dylib_path) {
79 Err(err) => { 95 Err(err) => {
80 eprintln!("Failed to find proc macros. Error: {:#?}", err); 96 eprintln!("Failed to find proc macros. Error: {:#?}", err);