From 3e482b5b59e972a4a1a9956dd953894b4c445f48 Mon Sep 17 00:00:00 2001 From: nickd-airo <124247818+nickd-airo@users.noreply.github.com> Date: Wed, 15 Nov 2023 10:24:40 +0800 Subject: [PATCH] Fix missing wake() in PendingOnce PendingOnce should wake() before returning Pending, otherwise executors may not poll() again. --- futures-util/src/async_await/pending.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/futures-util/src/async_await/pending.rs b/futures-util/src/async_await/pending.rs index 5d7a431811..daa18e6c1b 100644 --- a/futures-util/src/async_await/pending.rs +++ b/futures-util/src/async_await/pending.rs @@ -32,11 +32,12 @@ pub struct PendingOnce { impl Future for PendingOnce { type Output = (); - fn poll(mut self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll { + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { if self.is_ready { Poll::Ready(()) } else { self.is_ready = true; + cx.waker().wake_by_ref(); Poll::Pending } }