about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2023-03-25 15:43:58 +0100
committerLukas Wirth <lukastw97@gmail.com>2023-03-25 15:43:58 +0100
commit3ae9bfe2661c4a3542a5b44cb1f9700cb17d8f30 (patch)
tree579b2fefcbb4e0b1bef72f2927f8b6f68ef40114
parent39e86e78c3e3a8fb35b93ac5e658b3379e1f9e6e (diff)
downloadrust-3ae9bfe2661c4a3542a5b44cb1f9700cb17d8f30.tar.gz
rust-3ae9bfe2661c4a3542a5b44cb1f9700cb17d8f30.zip
Remove client side proc-macro version check
-rw-r--r--crates/proc-macro-api/src/lib.rs14
-rw-r--r--crates/rust-analyzer/src/reload.rs3
2 files changed, 3 insertions, 14 deletions
diff --git a/crates/proc-macro-api/src/lib.rs b/crates/proc-macro-api/src/lib.rs
index 90d06967e8f..4525d9dfdd7 100644
--- a/crates/proc-macro-api/src/lib.rs
+++ b/crates/proc-macro-api/src/lib.rs
@@ -54,18 +54,8 @@ pub struct MacroDylib {
 }
 
 impl MacroDylib {
-    // FIXME: this is buggy due to TOCTOU, we should check the version in the
-    // macro process instead.
-    pub fn new(path: AbsPathBuf) -> io::Result<MacroDylib> {
-        let _p = profile::span("MacroDylib::new");
-
-        let info = version::read_dylib_info(&path)?;
-        if info.version.0 < 1 || info.version.1 < 47 {
-            let msg = format!("proc-macro {} built by {info:#?} is not supported by rust-analyzer, please update your Rust version.", path.display());
-            return Err(io::Error::new(io::ErrorKind::InvalidData, msg));
-        }
-
-        Ok(MacroDylib { path })
+    pub fn new(path: AbsPathBuf) -> MacroDylib {
+        MacroDylib { path }
     }
 }
 
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 1a6e1af2eb7..138b8446b90 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -648,8 +648,7 @@ pub(crate) fn load_proc_macro(
 ) -> ProcMacroLoadResult {
     let server = server.map_err(ToOwned::to_owned)?;
     let res: Result<Vec<_>, String> = (|| {
-        let dylib = MacroDylib::new(path.to_path_buf())
-            .map_err(|io| format!("Proc-macro dylib loading failed: {io}"))?;
+        let dylib = MacroDylib::new(path.to_path_buf());
         let vec = server.load_dylib(dylib).map_err(|e| format!("{e}"))?;
         if vec.is_empty() {
             return Err("proc macro library returned no proc macros".to_string());