Remove Send from Entry/LruEntry, relax Sync bounds#34
Merged
Conversation
… to 0.2.1 Entry and LruEntry are RAII lock guards that should not be Send (similar to MutexGuard). The Sync impl only needs K: Sync + V: Sync since sharing &Entry only involves shared references, not ownership transfer. Co-authored-by: SF-Zhou <7477599+SF-Zhou@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update Entry and LruEntry trait usage
Remove Send from Entry/LruEntry, relax Sync bounds
Mar 10, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 2
Lines 1533 1533
=========================================
Hits 1533 1533 ☔ View full report in Codecov by Sentry. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to adjust the auto-trait behavior of the RAII entry guards (Entry / LruEntry) to better match lock-guard semantics (non-transferable across threads) while relaxing the requirements for sharing references to those guards (Sync).
Changes:
- Removes explicit
unsafe impl SendforEntryandLruEntryand relaxes theirSyncbounds toK: Sync, V: Sync. - Adds compile-time
Synctrait assertions in each module’s tests. - Bumps crate version from
0.2.0to0.2.1.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/lockmap.rs |
Removes explicit Send for Entry, relaxes Sync bounds, adds compile-time Sync assertion in tests. |
src/lru_lockmap.rs |
Removes explicit Send for LruEntry, relaxes Sync bounds, adds compile-time Sync assertion in tests. |
Cargo.toml |
Version bump to 0.2.1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
EntryandLruEntryare RAII lock guards holding raw pointers into internal state. They should be!Send(likeMutexGuard), and theirSyncimpl only needsK: Sync + V: Sync— sharing&Entryinvolves shared references, not ownership transfer, soSendbounds onK/Vare unnecessary.Changes
unsafe impl SendforEntryandLruEntry— raw pointer fields restore default!SendSyncbounds fromK: Send + Sync, V: Send + SynctoK: Sync, V: SyncSynctrait assertions in tests0.2.0→0.2.1✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.