Skip to content

Commit 71b2336

Browse files
committed
Auto merge of rust-lang#14404 - Veykril:proc-macro-loading, r=Veykril
Remove client side proc-macro version check The server already verifies versions due to ABI picking now so there shouldn't be a need for the client side check anymore
2 parents 992a0fc + 3ae9bfe commit 71b2336

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

crates/proc-macro-api/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,8 @@ pub struct MacroDylib {
5454
}
5555

5656
impl MacroDylib {
57-
// FIXME: this is buggy due to TOCTOU, we should check the version in the
58-
// macro process instead.
59-
pub fn new(path: AbsPathBuf) -> io::Result<MacroDylib> {
60-
let _p = profile::span("MacroDylib::new");
61-
62-
let info = version::read_dylib_info(&path)?;
63-
if info.version.0 < 1 || info.version.1 < 47 {
64-
let msg = format!("proc-macro {} built by {info:#?} is not supported by rust-analyzer, please update your Rust version.", path.display());
65-
return Err(io::Error::new(io::ErrorKind::InvalidData, msg));
66-
}
67-
68-
Ok(MacroDylib { path })
57+
pub fn new(path: AbsPathBuf) -> MacroDylib {
58+
MacroDylib { path }
6959
}
7060
}
7161

crates/rust-analyzer/src/reload.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,7 @@ pub(crate) fn load_proc_macro(
648648
) -> ProcMacroLoadResult {
649649
let server = server.map_err(ToOwned::to_owned)?;
650650
let res: Result<Vec<_>, String> = (|| {
651-
let dylib = MacroDylib::new(path.to_path_buf())
652-
.map_err(|io| format!("Proc-macro dylib loading failed: {io}"))?;
651+
let dylib = MacroDylib::new(path.to_path_buf());
653652
let vec = server.load_dylib(dylib).map_err(|e| format!("{e}"))?;
654653
if vec.is_empty() {
655654
return Err("proc macro library returned no proc macros".to_string());

0 commit comments

Comments
 (0)