internal: Add version info to unsupported proc macro abi error
This commit is contained in:
parent
add85397ae
commit
6b4b7d81e4
@ -117,7 +117,7 @@ impl Abi {
|
|||||||
let inner = unsafe { Abi_1_63::from_lib(lib, symbol_name) }?;
|
let inner = unsafe { Abi_1_63::from_lib(lib, symbol_name) }?;
|
||||||
Ok(Abi::Abi1_63(inner))
|
Ok(Abi::Abi1_63(inner))
|
||||||
}
|
}
|
||||||
_ => Err(LoadProcMacroDylibError::UnsupportedABI),
|
_ => Err(LoadProcMacroDylibError::UnsupportedABI(info.version_string.clone())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ fn load_library(file: &Path) -> Result<Library, libloading::Error> {
|
|||||||
pub enum LoadProcMacroDylibError {
|
pub enum LoadProcMacroDylibError {
|
||||||
Io(io::Error),
|
Io(io::Error),
|
||||||
LibLoading(libloading::Error),
|
LibLoading(libloading::Error),
|
||||||
UnsupportedABI,
|
UnsupportedABI(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for LoadProcMacroDylibError {
|
impl fmt::Display for LoadProcMacroDylibError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Io(e) => e.fmt(f),
|
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),
|
Self::LibLoading(e) => e.fmt(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,12 +113,12 @@ impl ProcMacroSrv {
|
|||||||
|
|
||||||
fn expander(&mut self, path: &Path) -> Result<&dylib::Expander, String> {
|
fn expander(&mut self, path: &Path) -> Result<&dylib::Expander, String> {
|
||||||
let time = fs::metadata(path).and_then(|it| it.modified()).map_err(|err| {
|
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)) {
|
Ok(match self.expanders.entry((path.to_path_buf(), time)) {
|
||||||
Entry::Vacant(v) => v.insert(dylib::Expander::new(path).map_err(|err| {
|
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(),
|
Entry::Occupied(e) => e.into_mut(),
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user