feat: Mark StackSlot as Sync

Since it has no interior mutability it should be safe to share between
threads.

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2024-02-24 20:06:22 -08:00
parent 3a49a00639
commit 55d74a5fa1
No known key found for this signature in database
GPG Key ID: 2FE69973CFD64832
1 changed files with 5 additions and 0 deletions

View File

@ -84,6 +84,7 @@ mod sys;
mod notify;
#[cfg(not(feature = "std"))]
use alloc::boxed::Box;
use core::borrow::Borrow;
@ -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<()>>();
@ -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.