diff --git a/libffi-rs/src/high/types.rs b/libffi-rs/src/high/types.rs index f698b033..ec87b60f 100644 --- a/libffi-rs/src/high/types.rs +++ b/libffi-rs/src/high/types.rs @@ -12,7 +12,7 @@ use super::super::middle; #[derive(Clone, Debug)] pub struct Type { untyped: middle::Type, - _marker: PhantomData<*mut T>, + _marker: PhantomData T>, } impl Type { diff --git a/libffi-rs/src/middle/mod.rs b/libffi-rs/src/middle/mod.rs index 1d34b1ce..9e9a92ee 100644 --- a/libffi-rs/src/middle/mod.rs +++ b/libffi-rs/src/middle/mod.rs @@ -82,6 +82,9 @@ pub struct Cif { result: Type, } +unsafe impl Send for Cif {} +unsafe impl Sync for Cif {} + // To clone a Cif we need to clone the types and then make sure the new // ffi_cif refers to the clones of the types. impl Clone for Cif { diff --git a/libffi-rs/src/middle/types.rs b/libffi-rs/src/middle/types.rs index d6ad4983..ac86ce0d 100644 --- a/libffi-rs/src/middle/types.rs +++ b/libffi-rs/src/middle/types.rs @@ -52,12 +52,18 @@ type Owned = T; /// ``` pub struct Type(Unique); +unsafe impl Send for Type {} +unsafe impl Sync for Type {} + /// Represents a sequence of C types. /// /// This can be used to construct a struct type or as the arguments /// when creating a [`Cif`]. pub struct TypeArray(Unique<*mut low::ffi_type>); +unsafe impl Send for TypeArray {} +unsafe impl Sync for TypeArray {} + impl fmt::Debug for Type { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { formatter.write_fmt(format_args!("Type({:?})", *self.0))