Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions diskann-vector/src/unaligned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: Send`,
/// which holds iff `T: Sync`.
unsafe impl<T> 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<T> Sync for UnalignedSlice<'_, T> where T: Sync {}

impl<'a, T> UnalignedSlice<'a, T> {
/// Construct a new [`UnalignedSlice`] over the region `[ptr, ptr.add(len))`.
///
Expand Down
Loading