Skip to content

Commit

Permalink
feat: Mark StackSlot as Sync
Browse files Browse the repository at this point in the history
Since it has no interior mutability it should be safe to share between
threads.

Signed-off-by: John Nunley <[email protected]>
  • Loading branch information
notgull committed Feb 25, 2024
1 parent 3a49a00 commit 55d74a5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ mod sys;

mod notify;

#[cfg(not(feature = "std"))]
use alloc::boxed::Box;

use core::borrow::Borrow;
Expand Down Expand Up @@ -1365,6 +1366,9 @@ fn __test_send_and_sync() {
fn _assert_sync<T: Sync>() {}

_assert_send::<crate::__private::StackSlot<'_, ()>>();
_assert_sync::<crate::__private::StackSlot<'_, ()>>();
_assert_send::<crate::__private::StackListener<'_, '_, ()>>();
_assert_sync::<crate::__private::StackListener<'_, '_, ()>>();
_assert_send::<Event<()>>();
_assert_sync::<Event<()>>();
_assert_send::<EventListener<()>>();
Expand Down Expand Up @@ -1410,6 +1414,7 @@ pub mod __private {
impl<T> core::panic::UnwindSafe for StackSlot<'_, T> {}
impl<T> core::panic::RefUnwindSafe for StackSlot<'_, T> {}
unsafe impl<T> Send for StackSlot<'_, T> {}
unsafe impl<T> Sync for StackSlot<'_, T> {}

impl<'ev, T> StackSlot<'ev, T> {
/// Create a new `StackSlot` on the stack.
Expand Down

0 comments on commit 55d74a5

Please sign in to comment.