From ea5b0ea5414e591de23bfef32c2b8c5e640892da Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Mon, 2 Dec 2024 13:09:50 -0500 Subject: [PATCH] Conditionalize cancel-safety on Future cancel safety --- futures-util/src/stream/futures_unordered/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/futures-util/src/stream/futures_unordered/mod.rs b/futures-util/src/stream/futures_unordered/mod.rs index 0fcf92cb3..7f7a00018 100644 --- a/futures-util/src/stream/futures_unordered/mod.rs +++ b/futures-util/src/stream/futures_unordered/mod.rs @@ -56,10 +56,11 @@ use self::ready_to_run_queue::{Dequeue, ReadyToRunQueue}; /// /// # Cancel safety /// -/// This type is cancellation-safe. If [`poll_next`](Stream::poll_next) is -/// called (either directly or via [`crate::StreamExt::next`]) and it returns -/// [`Poll::Pending`], no values will be dropped if `poll_next` is not called -/// again. +/// This type is cancellation-safe when the inner [`Future`] is +/// cancellation-safe. If the future type is cancellation-safe, and +/// [`poll_next`](Stream::poll_next) is called (either directly or via +/// [`crate::StreamExt::next`]) and returns [`Poll::Pending`], no values will be +/// dropped if `poll_next` is not called again. #[must_use = "streams do nothing unless polled"] pub struct FuturesUnordered { ready_to_run_queue: Arc>,