Open michael-temp opened 1 year ago
My code looks like:
if let Ok((i, Ok(..))) = notifiers
.iter_mut()
.enumerate()
.map(|(i, notifier)| async move { (i, notifier.receiver.recv().await) })
.collect_vec()
.race()
.timeout(Duration::from_millis(500))
.await
{
has_update[i] = true;
}
I suspect its an empty vec issue like #153 :)
In case it helps
#[tokio::test]
// #[ignore]
async fn test_race_empty_vec() -> Result<()> {
// https://github.com/yoshuawuyts/futures-concurrency/issues/156
_ = Vec::<AbortOnDrop<()>>::new().race().timeout(DurationF::from_millis(500)).await;
Ok(())
}
Thanks for reporting this! I wasn't aware of this behavior. I've filed a bug against rustc to document that this method may in fact panic here: https://github.com/rust-lang/rust/issues/116063. I'll work on a fix in our code here for this next.
Seems to occur here https://github.com/yoshuawuyts/futures-concurrency/blob/a2a7f6a17ada682e01a0096e0b2a223c886eba39/src/utils/indexer.rs#L20C41-L20C53
Will add more details shortly