From bd3e8577377a2b684b50fc0cb50d98f03ad09703 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 6 Jan 2025 22:19:53 +0100 Subject: [PATCH] runtime: move `is_join_waker_set` assertion in `unset_waker` (#7072) --- tokio/src/runtime/task/state.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tokio/src/runtime/task/state.rs b/tokio/src/runtime/task/state.rs index 037c1c90c61..da3e8d38d91 100644 --- a/tokio/src/runtime/task/state.rs +++ b/tokio/src/runtime/task/state.rs @@ -446,12 +446,15 @@ impl State { pub(super) fn unset_waker(&self) -> UpdateResult { self.fetch_update(|curr| { assert!(curr.is_join_interested()); - assert!(curr.is_join_waker_set()); if curr.is_complete() { return None; } + // If the task is completed, this bit may have been unset by + // `unset_waker_after_complete`. + assert!(curr.is_join_waker_set()); + let mut next = curr; next.unset_join_waker();