From a63e2de11c87b992ceb894d086ba99fca0ad21de Mon Sep 17 00:00:00 2001 From: Nur Date: Sun, 1 Feb 2026 19:35:03 +0600 Subject: [PATCH] Add safety note on `take` --- local-waker/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local-waker/src/lib.rs b/local-waker/src/lib.rs index bc2f141a..b131df84 100644 --- a/local-waker/src/lib.rs +++ b/local-waker/src/lib.rs @@ -75,6 +75,8 @@ impl LocalWaker { /// If a waker has not been registered, this returns `None`. #[inline] pub fn take(&self) -> Option { + // SAFETY: This can cause data races if called from a separate thread, + // but `LocalWaker` is `!Send` + `!Sync` so this won't happen. unsafe { (*self.waker.get()).take() } } }