Make UnalignedSlice Send and Sync. - #1348
Open
Mark Hildebrand (hildebrandmw) wants to merge 1 commit into
Open
Conversation
Mark Hildebrand (hildebrandmw)
requested review from
a team
and
a lite review from Copilot
August 21, 2026 22:16
Copilot started reviewing on behalf of
Mark Hildebrand (hildebrandmw)
August 21, 2026 22:17
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes diskann-vector::UnalignedSlice explicitly Send and Sync (with T: Sync bounds), enabling it to be moved/shared across threads for upcoming in-memory quantization work.
Changes:
- Add
unsafe impl SendforUnalignedSlice<'_, T>whereT: Sync. - Add
unsafe impl SyncforUnalignedSlice<'_, T>whereT: Sync.
Suppressed comments (1)
diskann-vector/src/unaligned.rs:31
- The SAFETY comment for the
Syncimpl currently refers to "&Tis send"; forSyncit’s clearer to justify the bound directly asT: Sync(equivalently,&T: Send). This helps avoid confusion between theSendandSyncauto-traits.
/// 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 {}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+25
to
+27
| /// SAFETY: `UnalignedSlice` is like a `&[T]`: it can be sent to other threads when `&T` is | ||
| /// send - implying the bound `T: Sync`. | ||
| unsafe impl<T> Send for UnalignedSlice<'_, T> where T: Sync {} |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1348 +/- ##
==========================================
- Coverage 91.55% 91.55% -0.01%
==========================================
Files 521 521
Lines 100347 100347
==========================================
- Hits 91877 91874 -3
- Misses 8470 8473 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Needed for the inmem2 quantization work.