You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use std::future::ready;use std::collections::VecDeque;use futures::stream::{FuturesOrdered,StreamExt};#[tokio::main]asyncfnmain(){letmut set = VecDeque::new();
set.push_back(2);// should be the last
set.push_front(1);// should be the second
set.push_front(0);// should be the firstlet x:Vec<i32> = set.into_iter().collect();assert_eq!(x,[0,1,2]);letmut set = FuturesOrdered::new();
set.push_back(ready(2));// should be the last
set.push_front(ready(1));// should be the second
set.push_front(ready(0));// should be the firstlet x:Vec<i32> = set.collect().await;assert_eq!(x,[0,1,2]);}
You see the assertion on the VecDeque passes, but the same assertion through FuturesOrdered fails.
Running this code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=30c5f139539ccf5dd237299c88b56a2e
You see the assertion on the VecDeque passes, but the same assertion through FuturesOrdered fails.
I noticed this working on my own implementation in https://github.com/conradludgate/futures-buffered - I found that turning the
usize
counters intoisize
fixes it with no noticeable downsides.The text was updated successfully, but these errors were encountered: