From 94ca59d9b855cdc4f57bc5d6ec0db5f0fcf8a1c7 Mon Sep 17 00:00:00 2001 From: Oleg Nosov Date: Tue, 31 May 2022 10:22:16 +0200 Subject: [PATCH] Fix incorrect assumption (#2606) --- futures-util/src/stream/stream/flatten_unordered.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/futures-util/src/stream/stream/flatten_unordered.rs b/futures-util/src/stream/stream/flatten_unordered.rs index 8293983d84..88006cf235 100644 --- a/futures-util/src/stream/stream/flatten_unordered.rs +++ b/futures-util/src/stream/stream/flatten_unordered.rs @@ -99,10 +99,8 @@ impl SharedPollState { }) .ok()?; - debug_assert!(value & WAKING == NONE); - - // Only start the waking process if we're not in the polling phase and the stream isn't woken already - if value & (WOKEN | POLLING) == NONE { + // Only start the waking process if we're not in the polling/waking phase and the stream isn't woken already + if value & (WOKEN | POLLING | WAKING) == NONE { let bomb = PollStateBomb::new(self, SharedPollState::stop_waking); Some((value, bomb)) @@ -236,7 +234,7 @@ impl ArcWake for WrappedWaker { } pin_project! { - /// Future which contains optional stream. + /// Future which polls optional inner stream. /// /// If it's `Some`, it will attempt to call `poll_next` on it, /// returning `Some((item, next_item_fut))` in case of `Poll::Ready(Some(...))`