From 55d74a5fa1ae0431f7b8b0e556d33c48823966fe Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sat, 24 Feb 2024 20:06:22 -0800 Subject: [PATCH] feat: Mark StackSlot as Sync Since it has no interior mutability it should be safe to share between threads. Signed-off-by: John Nunley --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d0af19f..645f0b2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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() {} _assert_send::>(); + _assert_sync::>(); + _assert_send::>(); + _assert_sync::>(); _assert_send::>(); _assert_sync::>(); _assert_send::>(); @@ -1410,6 +1414,7 @@ pub mod __private { impl core::panic::UnwindSafe for StackSlot<'_, T> {} impl core::panic::RefUnwindSafe for StackSlot<'_, T> {} unsafe impl Send for StackSlot<'_, T> {} + unsafe impl Sync for StackSlot<'_, T> {} impl<'ev, T> StackSlot<'ev, T> { /// Create a new `StackSlot` on the stack.