From 04d01a00a2924525658b19794534bec5672500e6 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 8 Dec 2023 00:42:09 +0900 Subject: [PATCH] FuturesOrdered: Use 64-bit index --- futures-util/src/stream/futures_ordered.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/futures-util/src/stream/futures_ordered.rs b/futures-util/src/stream/futures_ordered.rs index 3aaef8bde..2cc144e81 100644 --- a/futures-util/src/stream/futures_ordered.rs +++ b/futures-util/src/stream/futures_ordered.rs @@ -19,7 +19,8 @@ pin_project! { struct OrderWrapper { #[pin] data: T, // A future or a future's output - index: isize, + // Use i64 for index since isize may overflow in 32-bit targets. + index: i64, } } @@ -98,8 +99,8 @@ where pub struct FuturesOrdered { in_progress_queue: FuturesUnordered>, queued_outputs: BinaryHeap>, - next_incoming_index: isize, - next_outgoing_index: isize, + next_incoming_index: i64, + next_outgoing_index: i64, } impl Unpin for FuturesOrdered {}