Skip to content

Commit 45ec315

Browse files
committed
Auto merge of rust-lang#13607 - Veykril:proc-macro-error, r=Veykril
internal: Add version info to unsupported proc macro abi error cc rust-lang/rust-analyzer#13589 (comment)
2 parents 2656303 + 6b4b7d8 commit 45ec315

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

crates/proc-macro-srv/src/abis/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl Abi {
117117
let inner = unsafe { Abi_1_63::from_lib(lib, symbol_name) }?;
118118
Ok(Abi::Abi1_63(inner))
119119
}
120-
_ => Err(LoadProcMacroDylibError::UnsupportedABI),
120+
_ => Err(LoadProcMacroDylibError::UnsupportedABI(info.version_string.clone())),
121121
}
122122
}
123123

crates/proc-macro-srv/src/dylib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,14 @@ fn load_library(file: &Path) -> Result<Library, libloading::Error> {
8080
pub enum LoadProcMacroDylibError {
8181
Io(io::Error),
8282
LibLoading(libloading::Error),
83-
UnsupportedABI,
83+
UnsupportedABI(String),
8484
}
8585

8686
impl fmt::Display for LoadProcMacroDylibError {
8787
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8888
match self {
8989
Self::Io(e) => e.fmt(f),
90-
Self::UnsupportedABI => write!(f, "unsupported ABI version"),
90+
Self::UnsupportedABI(v) => write!(f, "unsupported ABI `{v}`"),
9191
Self::LibLoading(e) => e.fmt(f),
9292
}
9393
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ impl ProcMacroSrv {
113113

114114
fn expander(&mut self, path: &Path) -> Result<&dylib::Expander, String> {
115115
let time = fs::metadata(path).and_then(|it| it.modified()).map_err(|err| {
116-
format!("Failed to get file metadata for {}: {:?}", path.display(), err)
116+
format!("Failed to get file metadata for {}: {}", path.display(), err)
117117
})?;
118118

119119
Ok(match self.expanders.entry((path.to_path_buf(), time)) {
120120
Entry::Vacant(v) => v.insert(dylib::Expander::new(path).map_err(|err| {
121-
format!("Cannot create expander for {}: {:?}", path.display(), err)
121+
format!("Cannot create expander for {}: {}", path.display(), err)
122122
})?),
123123
Entry::Occupied(e) => e.into_mut(),
124124
})

0 commit comments

Comments
 (0)