Skip to content

Remove Send from Entry/LruEntry, relax Sync bounds#34

Merged
SF-Zhou merged 3 commits intomainfrom
copilot/update-entry-lruentry-usage
Mar 10, 2026
Merged

Remove Send from Entry/LruEntry, relax Sync bounds#34
SF-Zhou merged 3 commits intomainfrom
copilot/update-entry-lruentry-usage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 10, 2026

Entry and LruEntry are RAII lock guards holding raw pointers into internal state. They should be !Send (like MutexGuard), and their Sync impl only needs K: Sync + V: Sync — sharing &Entry involves shared references, not ownership transfer, so Send bounds on K/V are unnecessary.

Changes

  • Remove unsafe impl Send for Entry and LruEntry — raw pointer fields restore default !Send
  • Relax Sync bounds from K: Send + Sync, V: Send + Sync to K: Sync, V: Sync
  • Add compile-time Sync trait assertions in tests
  • Bump version 0.2.00.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.

… 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
@SF-Zhou SF-Zhou requested a review from Copilot March 10, 2026 09:29
@SF-Zhou SF-Zhou marked this pull request as ready for review March 10, 2026 09:29
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e085689) to head (5de2774).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Send for Entry and LruEntry and relaxes their Sync bounds to K: Sync, V: Sync.
  • Adds compile-time Sync trait assertions in each module’s tests.
  • Bumps crate version from 0.2.0 to 0.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.

Comment thread src/lru_lockmap.rs Outdated
Comment thread src/lockmap.rs
Comment thread src/lockmap.rs Outdated
Comment thread src/lru_lockmap.rs
@SF-Zhou SF-Zhou merged commit b407654 into main Mar 10, 2026
12 checks passed
@SF-Zhou SF-Zhou deleted the copilot/update-entry-lruentry-usage branch March 10, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants