We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Send
SingleUseCell
Sync
1 parent df498d8 commit 23cf4c5Copy full SHA for 23cf4c5
src/lib.rs
@@ -166,8 +166,9 @@ impl<T> SingleUseCell<T> {
166
}
167
168
// SAFETY: Sharing a `SingleUseCell<T>` between threads is safe regardless of whether `T` is `Sync`
169
-// because we only expose the inner value once to one thread.
170
-unsafe impl<T> Sync for SingleUseCell<T> {}
+// because we only expose the inner value once to one thread. The `T: Send` bound makes sure that
+// sending a unique reference to another thread is safe.
171
+unsafe impl<T: Send> Sync for SingleUseCell<T> {}
172
173
// SAFETY: It's safe to send a `SingleUseCell<T>` to another thread if it's safe to send `T`.
174
unsafe impl<T: Send> Send for SingleUseCell<T> {}
0 commit comments