From 8d37afc510b06fbf42af5ffbe445c664189cb21b Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 23 Nov 2021 18:59:09 +1300 Subject: [PATCH] Make `ClassMetadata: Send + Sync` (#111) This wasn't the case because of `PhantomData` inside the metadata. Replacing this with `PhantomData>` ensures that the metadata will always be `Send + Sync`. --- src/class.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/class.rs b/src/class.rs index fda4a65..868f3bf 100644 --- a/src/class.rs +++ b/src/class.rs @@ -85,7 +85,10 @@ pub struct ClassMetadata { handlers: MaybeUninit, ce: AtomicPtr, - phantom: PhantomData, + // `AtomicPtr` is used here because it is `Send + Sync`. + // fn() -> T could have been used but that is incompatible with const fns at + // the moment. + phantom: PhantomData>, } impl ClassMetadata {