From 4e19f8f2be44cf488aa545172c440ac9113fe03e Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Mon, 6 Nov 2023 18:57:55 -0600 Subject: [PATCH] make GenerationalBoxId send and sync --- packages/generational-box/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/generational-box/src/lib.rs b/packages/generational-box/src/lib.rs index d358e78e0..77e209b22 100644 --- a/packages/generational-box/src/lib.rs +++ b/packages/generational-box/src/lib.rs @@ -150,6 +150,10 @@ pub struct GenerationalBoxId { generation: u32, } +// Safety: GenerationalBoxId is Send and Sync because there is no way to access the pointer. +unsafe impl Send for GenerationalBoxId {} +unsafe impl Sync for GenerationalBoxId {} + impl Debug for GenerationalBoxId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { #[cfg(any(debug_assertions, feature = "check_generation"))]