Amanieu / intrusive-rs

Intrusive collections for Rust
Apache License 2.0
400 stars 47 forks source link

Unsound trait implementation in `UnsafeRef` #92

Closed cblichmann closed 2 weeks ago

cblichmann commented 1 month ago

This came up in an internal unsafe review:

In src/unsafe_ref.rs:107

unsafe impl<T: ?Sized + Send> Send for UnsafeRef<T> {}

Unsafe Rust review: this is unsound -- UnsafeRef<T> should only implement Send if T is Send + Sync (what Arc does), since sending one instance to another thread would allow it to be referenced from two different threads.