diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a11a90b..58e4502fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.0.1] - 2020-10-01 + +### Changed +- Improved panic error message when calling an unloaded function + ## [1.0.0] - 2020-07-14 ### Changed diff --git a/Cargo.toml b/Cargo.toml index 93f215629..18b5c1a8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "clang-sys" authors = ["Kyle Mayes "] -version = "1.0.0" +version = "1.0.1" readme = "README.md" license = "Apache-2.0" diff --git a/src/link.rs b/src/link.rs index 3471549b1..3230e4a0e 100644 --- a/src/link.rs +++ b/src/link.rs @@ -155,10 +155,12 @@ macro_rules! link { $(#[doc=$doc] #[cfg($cfg)])* pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* { let f = with_library(|l| { - match l.functions.$name { - Some(f) => f, - _ => panic!(concat!("function not loaded: ", stringify!($name))), - } + l.functions.$name.expect(concat!( + "`libclang` function not loaded: `", + stringify!($name), + "`. This crate requires that `libclang` 3.9 or later be installed on your ", + "system. For more information on how to accomplish this, see here: ", + "https://rust-lang.github.io/rust-bindgen/requirements.html#installing-clang-39")) }).expect("a `libclang` shared library is not loaded on this thread"); f($($pname), *) }