diff --git a/diskann-vector/src/unaligned.rs b/diskann-vector/src/unaligned.rs index 26dec240a3..6318c9c855 100644 --- a/diskann-vector/src/unaligned.rs +++ b/diskann-vector/src/unaligned.rs @@ -22,6 +22,14 @@ pub struct UnalignedSlice<'a, T> { _lifetime: PhantomData<&'a T>, } +/// SAFETY: `UnalignedSlice` is like a `&[T]`: it can be sent to other threads when `&T` is +/// send - implying the bound `T: Sync`. +unsafe impl Send for UnalignedSlice<'_, T> where T: Sync {} + +/// SAFETY: `UnalignedSlice` is like a `&[T]`: it can be shared with other threads when `&T` +/// is send, implying the bound `T: Sync`. +unsafe impl Sync for UnalignedSlice<'_, T> where T: Sync {} + impl<'a, T> UnalignedSlice<'a, T> { /// Construct a new [`UnalignedSlice`] over the region `[ptr, ptr.add(len))`. ///