diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 1ba1315072..ca0c6ac50d 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -4263,6 +4263,15 @@ impl Surface { #[repr(transparent)] pub struct Id(core::num::NonZeroU64, std::marker::PhantomData<*mut T>); +// SAFETY: `Id` is a bare `NonZeroU64`, the type parameter is a marker purely to avoid confusing Ids +// returned for different types , so `Id` can safely implement Send and Sync. +#[cfg(feature = "expose-ids")] +unsafe impl Send for Id {} + +// SAFETY: See the implementation for `Send`. +#[cfg(feature = "expose-ids")] +unsafe impl Sync for Id {} + #[cfg(feature = "expose-ids")] impl Clone for Id { fn clone(&self) -> Self {