From cb684fdce856275521f88c3cf08f304f380f917f Mon Sep 17 00:00:00 2001 From: HBR <115722879+haroldbruintjes@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:19:07 +0100 Subject: [PATCH] Change condition for is_terminated in Zip The condition for `is_terminated` in the `FusedStream` impl for `Zip` should check if either child stream has terminated. Otherwise, one stream may be polled even after it has been terminated if the other has not. --- futures-util/src/stream/stream/zip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/futures-util/src/stream/stream/zip.rs b/futures-util/src/stream/stream/zip.rs index 25a47e96b..2dfed9843 100644 --- a/futures-util/src/stream/stream/zip.rs +++ b/futures-util/src/stream/stream/zip.rs @@ -64,7 +64,7 @@ where St2: Stream, { fn is_terminated(&self) -> bool { - self.stream1.is_terminated() && self.stream2.is_terminated() + self.stream1.is_terminated() || self.stream2.is_terminated() } }