From eddb1cd1dafbd8cd5ebde72ad312306f14d5964b Mon Sep 17 00:00:00 2001 From: Tobias Furuholm Date: Fri, 27 Dec 2019 08:40:07 +0100 Subject: [PATCH] Move static_assertion closer to where it is needed --- libsignal-protocol/src/context.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libsignal-protocol/src/context.rs b/libsignal-protocol/src/context.rs index 0d796617aa..5473be8585 100644 --- a/libsignal-protocol/src/context.rs +++ b/libsignal-protocol/src/context.rs @@ -308,14 +308,6 @@ impl Default for Context { } } -// Assert that Context does not implement [`Send`] and [`Sync`] to guarantee -// that each [`Context`] instance is only used within a single thread. This allows -// locking to be omitted (see lock_function below). -// -// See https://github.com/Michael-F-Bryan/libsignal-protocol-rs/issues/49 -// for details. -static_assertions::assert_not_impl_all!(Context: Send, Sync); - /// Our Rust wrapper around the [`sys::signal_context`]. /// /// # Safety @@ -431,6 +423,13 @@ fn translate_log_level(raw: c_int) -> Level { } } +// Assert that Context does not implement [`Send`] and [`Sync`] to guarantee +// that each [`Context`] instance is only used within a single thread. +// +// See https://github.com/Michael-F-Bryan/libsignal-protocol-rs/issues/49 +// for details. +static_assertions::assert_not_impl_all!(Context: Send, Sync); + unsafe extern "C" fn lock_function(_user_data: *mut c_void) { // Locking is not required as [`Context`] cannot be shared between // threads as long as it does not implement [`Sync`] and [`Send`].