Skip to content

refactor(rwlock): remove redundant unsafe trait impls - #357

Merged
tisonkun merged 2 commits into
apache:mainfrom
tisonkun:codex/rwlock-token-cleanup
Oct 11, 2026
Merged

tisonkun merged 2 commits into
apache:mainfrom
tisonkun:codex/rwlock-token-cleanup

Conversation

@tisonkun

Copy link
Copy Markdown
Member

Summary

Remove five redundant unsafe impls from RwLock guards and let their access-token fields determine the same Send/Sync bounds. Keep the borrowed read guard's explicit Send implementation, which only requires T: Sync.

Clarify permit-release responsibility during borrowed token conversion and trim the RwLock modification notes in LICENSE, retaining Tokio attribution and the existing license terms.

Validation: cargo x test (593 passed), cargo x check, and cargo x lint.

@tisonkun
tisonkun marked this pull request as ready for review October 11, 2026 08:47
Comment on lines -76 to -77
unsafe impl<T: ?Sized + Send + Sync> Send for OwnedRwLockWriteGuard<T> {}
unsafe impl<T: ?Sized + Send + Sync> Sync for OwnedRwLockWriteGuard<T> {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We have trait_tests.rs and compile_fail_tests to guard these traits.

@tisonkun
tisonkun merged commit 6e8762c into apache:main Oct 11, 2026
9 checks passed
@tisonkun
tisonkun deleted the codex/rwlock-token-cleanup branch October 11, 2026 09:14
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.

1 participant