mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-19 16:44:21 +00:00
Auto merge of #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
This commit is contained in:
commit
71b23360e7
2 changed files with 3 additions and 14 deletions
|
@ -54,18 +54,8 @@ pub struct MacroDylib {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MacroDylib {
|
impl MacroDylib {
|
||||||
// FIXME: this is buggy due to TOCTOU, we should check the version in the
|
pub fn new(path: AbsPathBuf) -> MacroDylib {
|
||||||
// macro process instead.
|
MacroDylib { path }
|
||||||
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 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -648,8 +648,7 @@ pub(crate) fn load_proc_macro(
|
||||||
) -> ProcMacroLoadResult {
|
) -> ProcMacroLoadResult {
|
||||||
let server = server.map_err(ToOwned::to_owned)?;
|
let server = server.map_err(ToOwned::to_owned)?;
|
||||||
let res: Result<Vec<_>, String> = (|| {
|
let res: Result<Vec<_>, String> = (|| {
|
||||||
let dylib = MacroDylib::new(path.to_path_buf())
|
let dylib = MacroDylib::new(path.to_path_buf());
|
||||||
.map_err(|io| format!("Proc-macro dylib loading failed: {io}"))?;
|
|
||||||
let vec = server.load_dylib(dylib).map_err(|e| format!("{e}"))?;
|
let vec = server.load_dylib(dylib).map_err(|e| format!("{e}"))?;
|
||||||
if vec.is_empty() {
|
if vec.is_empty() {
|
||||||
return Err("proc macro library returned no proc macros".to_string());
|
return Err("proc macro library returned no proc macros".to_string());
|
||||||
|
|
Loading…
Reference in a new issue