Skip to content

Commit

Permalink
Silence unsafe FFI warnings
Browse files Browse the repository at this point in the history
The rust compiler is issuing false positive improper_ctypes warning, but
this is not an issue because only pointers are being passed to mbedtls,
and they are used completely opaquely.
  • Loading branch information
Goirad committed Nov 12, 2019
1 parent 71bad0c commit 307d388
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mbedtls/src/threading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ pub static mut mbedtls_mutex_lock: unsafe extern "C" fn(mutex: *mut *mut StaticM
pub static mut mbedtls_mutex_unlock: unsafe extern "C" fn(mutex: *mut *mut StaticMutex) -> c_int =
StaticMutex::unlock;

// The nightly compiler complains that StaticMutex has no representation hint,
// but this is not an issue because this pointer is opaque to mbedtls
#[allow(improper_ctypes)]
impl StaticMutex {
unsafe extern "C" fn init(mutex: *mut *mut StaticMutex) {
if let Some(m) = mutex.as_mut() {
Expand Down

0 comments on commit 307d388

Please sign in to comment.