diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2021-02-19 19:59:49 +0100 |
---|---|---|
committer | Jeff Vander Stoep <jeffv@google.com> | 2021-02-19 20:26:15 +0100 |
commit | 582dabe84f21fbf55be0e2abd4ccf2f0bcd6e612 (patch) | |
tree | 68313dec40dcd5e31376b569b6fc43c9c06a667c | |
parent | 7b49646c5daa773237f4492599406b6a7ac27dde (diff) | |
download | clang-sys-582dabe84f21fbf55be0e2abd4ccf2f0bcd6e612.tar.gz |
Update libloading dep to 0.7
Cherry-pick of https://github.com/KyleMayes/clang-sys/pull/123
Test: atest
Change-Id: I66610794a04947d412836dca3bd5d1f99769276e
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | patches/libloading-0.7.diff | 47 | ||||
-rw-r--r-- | src/link.rs | 22 |
3 files changed, 60 insertions, 11 deletions
@@ -31,7 +31,7 @@ version = "0.2.39" default-features = false [dependencies.libloading] -version = "0.6" +version = "0.7" optional = true [build-dependencies.glob] version = "0.3" diff --git a/patches/libloading-0.7.diff b/patches/libloading-0.7.diff new file mode 100644 index 0000000..49fdc4c --- /dev/null +++ b/patches/libloading-0.7.diff @@ -0,0 +1,47 @@ +diff --git a/Cargo.toml b/Cargo.toml +index 1da2ac4..4af7f4d 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -31,7 +31,7 @@ version = "0.2.39" + default-features = false + + [dependencies.libloading] +-version = "0.6" ++version = "0.7" + optional = true + [build-dependencies.glob] + version = "0.3" +diff --git a/src/link.rs b/src/link.rs +index 3230e4a..64a3528 100644 +--- a/src/link.rs ++++ b/src/link.rs +@@ -195,17 +195,19 @@ macro_rules! link { + let (directory, filename) = build::dynamic::find(true)?; + let path = directory.join(filename); + +- let library = libloading::Library::new(&path).map_err(|e| { +- format!( +- "the `libclang` shared library at {} could not be opened: {}", +- path.display(), +- e, +- ) +- }); ++ unsafe { ++ let library = libloading::Library::new(&path).map_err(|e| { ++ format!( ++ "the `libclang` shared library at {} could not be opened: {}", ++ path.display(), ++ e, ++ ) ++ }); + +- let mut library = SharedLibrary::new(library?, path); +- $(load::$name(&mut library);)+ +- Ok(library) ++ let mut library = SharedLibrary::new(library?, path); ++ $(load::$name(&mut library);)+ ++ Ok(library) ++ } + } + + /// Loads a `libclang` shared library for use in the current thread. diff --git a/src/link.rs b/src/link.rs index 3230e4a..64a3528 100644 --- a/src/link.rs +++ b/src/link.rs @@ -195,17 +195,19 @@ macro_rules! link { let (directory, filename) = build::dynamic::find(true)?; let path = directory.join(filename); - let library = libloading::Library::new(&path).map_err(|e| { - format!( - "the `libclang` shared library at {} could not be opened: {}", - path.display(), - e, - ) - }); + unsafe { + let library = libloading::Library::new(&path).map_err(|e| { + format!( + "the `libclang` shared library at {} could not be opened: {}", + path.display(), + e, + ) + }); - let mut library = SharedLibrary::new(library?, path); - $(load::$name(&mut library);)+ - Ok(library) + let mut library = SharedLibrary::new(library?, path); + $(load::$name(&mut library);)+ + Ok(library) + } } /// Loads a `libclang` shared library for use in the current thread. |