Skip to content

Commit ddd3af5

Browse files
authored
Better panic message (#117)
* Improve panic message when calling unloaded function * Bump version
1 parent 3377ff2 commit ddd3af5

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.0.1] - 2020-10-01
2+
3+
### Changed
4+
- Improved panic error message when calling an unloaded function
5+
16
## [1.0.0] - 2020-07-14
27

38
### Changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name = "clang-sys"
44
authors = ["Kyle Mayes <[email protected]>"]
55

6-
version = "1.0.0"
6+
version = "1.0.1"
77

88
readme = "README.md"
99
license = "Apache-2.0"

src/link.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,12 @@ macro_rules! link {
155155
$(#[doc=$doc] #[cfg($cfg)])*
156156
pub unsafe fn $name($($pname: $pty), *) $(-> $ret)* {
157157
let f = with_library(|l| {
158-
match l.functions.$name {
159-
Some(f) => f,
160-
_ => panic!(concat!("function not loaded: ", stringify!($name))),
161-
}
158+
l.functions.$name.expect(concat!(
159+
"`libclang` function not loaded: `",
160+
stringify!($name),
161+
"`. This crate requires that `libclang` 3.9 or later be installed on your ",
162+
"system. For more information on how to accomplish this, see here: ",
163+
"https://rust-lang.github.io/rust-bindgen/requirements.html#installing-clang-39"))
162164
}).expect("a `libclang` shared library is not loaded on this thread");
163165
f($($pname), *)
164166
}

0 commit comments

Comments
 (0)