diff options
Diffstat (limited to 'crates/proc_macro_api/src/lib.rs')
-rw-r--r-- | crates/proc_macro_api/src/lib.rs | 22 |
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 | ||
8 | mod rpc; | ||
9 | mod process; | ||
10 | pub mod msg; | 8 | pub mod msg; |
9 | mod process; | ||
10 | mod rpc; | ||
11 | mod version; | ||
11 | 12 | ||
13 | use base_db::{Env, ProcMacro}; | ||
12 | use std::{ | 14 | use 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 | ||
19 | use base_db::{Env, ProcMacro}; | ||
20 | use tt::{SmolStr, Subtree}; | 21 | use tt::{SmolStr, Subtree}; |
21 | 22 | ||
22 | use crate::process::{ProcMacroProcessSrv, ProcMacroProcessThread}; | 23 | use 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); |