Skip to content

Commit

Permalink
Auto merge of #13607 - Veykril:proc-macro-error, r=Veykril
Browse files Browse the repository at this point in the history
internal: Add version info to unsupported proc macro abi error

cc #13589 (comment)
  • Loading branch information
bors committed Nov 11, 2022
2 parents 2656303 + 6b4b7d8 commit 45ec315
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/proc-macro-srv/src/abis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Abi {
let inner = unsafe { Abi_1_63::from_lib(lib, symbol_name) }?;
Ok(Abi::Abi1_63(inner))
}
_ => Err(LoadProcMacroDylibError::UnsupportedABI),
_ => Err(LoadProcMacroDylibError::UnsupportedABI(info.version_string.clone())),
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/proc-macro-srv/src/dylib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ fn load_library(file: &Path) -> Result<Library, libloading::Error> {
pub enum LoadProcMacroDylibError {
Io(io::Error),
LibLoading(libloading::Error),
UnsupportedABI,
UnsupportedABI(String),
}

impl fmt::Display for LoadProcMacroDylibError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Io(e) => e.fmt(f),
Self::UnsupportedABI => write!(f, "unsupported ABI version"),
Self::UnsupportedABI(v) => write!(f, "unsupported ABI `{v}`"),
Self::LibLoading(e) => e.fmt(f),
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/proc-macro-srv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ impl ProcMacroSrv {

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

Ok(match self.expanders.entry((path.to_path_buf(), time)) {
Entry::Vacant(v) => v.insert(dylib::Expander::new(path).map_err(|err| {
format!("Cannot create expander for {}: {:?}", path.display(), err)
format!("Cannot create expander for {}: {}", path.display(), err)
})?),
Entry::Occupied(e) => e.into_mut(),
})
Expand Down

0 comments on commit 45ec315

Please sign in to comment.