diff --git a/helper_crates/vtable/src/vrc.rs b/helper_crates/vtable/src/vrc.rs index 5d40859e7..d9cb40ee5 100644 --- a/helper_crates/vtable/src/vrc.rs +++ b/helper_crates/vtable/src/vrc.rs @@ -29,7 +29,8 @@ pub unsafe trait VTableMetaDropInPlace: VTableMeta { /// This is a marker type to be used in [`VRc`] and [`VWeak`] to mean that the /// actual type is not known. -pub struct Dyn(()); +// Note the use of PhantomData to make this type not Send, as a VRc cannot be send between thread +pub struct Dyn(PhantomData<*mut ()>); /// Similar to [`core::alloc::Layout`], but `repr(C)` #[repr(C)] @@ -270,8 +271,14 @@ impl*/> Deref for V } // Safety: we use atomic reference count for the internal things -unsafe impl Send for VRc {} -unsafe impl Sync for VRc {} +unsafe impl Send + for VRc +{ +} +unsafe impl Sync + for VRc +{ +} /// Weak pointer for the [`VRc`] where `VTable` is a VTable struct, and /// `X` is the type of the instance, or [`Dyn`] if it is not known