Conversation
Use crossbeam-utils::sync::ShardedLock behind a new crossbeam feature when parking_lot is off. Keep the existing wrapper API, document the feature, and fail fast when both lock backends are enabled.
There was a problem hiding this comment.
Pull request overview
Adds an optional crossbeam feature to use crossbeam_utils::sync::ShardedLock as the crate’s internal RwLock implementation when parking_lot is disabled.
Changes:
- Introduce
crossbeamCargo feature and optionalcrossbeam-utilsdependency. - Switch
RwLockbackend toShardedLockundercfg(all(not(feature="parking_lot"), feature="crossbeam")). - Update crate docs and add a
compile_error!guard for mutually exclusiveparking_lot/crossbeamfeatures.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/rw_lock.rs |
Adds crossbeam-based RwLock type aliases and adjusts RwLock::new const-ness under crossbeam. |
src/lib.rs |
Documents the new backend selection and adds a mutual-exclusion compile-time check. |
Cargo.toml |
Defines the crossbeam feature and adds crossbeam-utils as an optional dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
This PR adds an alternative RwLock backend based on crossbeam_utils::sync::ShardedLock, selectable via a new crossbeam Cargo feature when parking_lot is disabled, while keeping the existing wrapper API and documenting the feature behavior.
Changes:
- Add a
crossbeamfeature and optionalcrossbeam-utilsdependency to supportShardedLockas theRwLockbackend. - Document the new feature and add a compile-time error when
parking_lotandcrossbeamare both enabled. - Update CI to compile/test the new
crossbeamconfiguration and avoid invalid--all-featuresruns.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/rw_lock.rs |
Adds ShardedLock as an alternate RwLock implementation behind the crossbeam feature. |
src/lib.rs |
Documents the new backend selection and enforces mutual exclusivity via compile_error!. |
Cargo.toml |
Introduces the crossbeam feature and optional crossbeam-utils dependency. |
.github/workflows/ci.yml |
Adjusts CI commands to cover the new feature without using --all-features. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
7fc637f to
a23c3aa
Compare
Use crossbeam-utils::sync::ShardedLock behind a new crossbeam feature when parking_lot is off.
Keep the existing wrapper API, document the feature, and fail fast when both lock backends are enabled.
Discussion in #108