Skip to content

Commit 04d01a0

Browse files
committed
FuturesOrdered: Use 64-bit index
1 parent e4aa659 commit 04d01a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

futures-util/src/stream/futures_ordered.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ pin_project! {
1919
struct OrderWrapper<T> {
2020
#[pin]
2121
data: T, // A future or a future's output
22-
index: isize,
22+
// Use i64 for index since isize may overflow in 32-bit targets.
23+
index: i64,
2324
}
2425
}
2526

@@ -98,8 +99,8 @@ where
9899
pub struct FuturesOrdered<T: Future> {
99100
in_progress_queue: FuturesUnordered<OrderWrapper<T>>,
100101
queued_outputs: BinaryHeap<OrderWrapper<T::Output>>,
101-
next_incoming_index: isize,
102-
next_outgoing_index: isize,
102+
next_incoming_index: i64,
103+
next_outgoing_index: i64,
103104
}
104105

105106
impl<T: Future> Unpin for FuturesOrdered<T> {}

0 commit comments

Comments
 (0)