From 4d2963bf49702d342ba66b42ca93bee9824ed06d Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Mon, 6 Jan 2025 11:44:43 +0100 Subject: [PATCH] runtime: move is_join_waker_set assertion in unset_waker --- 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();