From 96a77cf5a8388cea89e61e5d610f78bae1842d3a Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Mon, 31 Oct 2016 20:56:51 -0700 Subject: [PATCH] Remove Opaque --- openssl/src/lib.rs | 1 - openssl/src/opaque.rs | 6 ------ openssl/src/types.rs | 5 ++--- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 openssl/src/opaque.rs diff --git a/openssl/src/lib.rs b/openssl/src/lib.rs index 8fa53f3b..d053606f 100644 --- a/openssl/src/lib.rs +++ b/openssl/src/lib.rs @@ -59,7 +59,6 @@ macro_rules! type_ { } mod bio; -mod opaque; mod util; pub mod asn1; pub mod bn; diff --git a/openssl/src/opaque.rs b/openssl/src/opaque.rs deleted file mode 100644 index 9545471c..00000000 --- a/openssl/src/opaque.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::cell::UnsafeCell; - -/// This is intended to be used as the inner type for types designed to be pointed to by references -/// converted from raw C pointers. It has an `UnsafeCell` internally to inform the compiler about -/// aliasability and doesn't implement `Copy`, so it can't be dereferenced. -pub struct Opaque(UnsafeCell<()>); diff --git a/openssl/src/types.rs b/openssl/src/types.rs index 16829ea4..7302bca9 100644 --- a/openssl/src/types.rs +++ b/openssl/src/types.rs @@ -1,7 +1,6 @@ +use std::cell::UnsafeCell; use std::marker::PhantomData; -use opaque::Opaque; - pub unsafe trait OpenSslType { type CType; @@ -10,7 +9,7 @@ pub unsafe trait OpenSslType { fn as_ptr(&self) -> *mut Self::CType; } -pub struct Ref(Opaque, PhantomData); +pub struct Ref(UnsafeCell<()>, PhantomData); impl Ref { pub unsafe fn from_ptr<'a>(ptr: *mut T::CType) -> &'a Ref {