-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
struct Clang
should not implement Send
#26
Comments
Just in case you can now work around that problem in opencv crate with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Creating an instance of
Clang
involves callingclang-sys::load()
which dynamically loads the clang library for the currently executing thread.With
Clang: Send
(which is implemented automatically due to the auto-trait rules) the abstraction leaks when you do something like:When code is written this way,
clang
attempts to directly access functions fromlibclang
without checking whether the library is loaded and fail at the assert here.This bug occurred in actual code here https:/twistedfall/opencv-rust/blob/master/build.rs#L99-L116
Ultimately I think using thread-local storage here is really an instance of superfluous complexity and the library would be way better off with plain global shared variable with an atomic and a
std::sync::Once
or alazy_static
.The text was updated successfully, but these errors were encountered: