Closed
Description
I noticed that in the select!
/select_biased!
macros, the unit type (()
) only works for the pattern-side of a branch in the first position.
Consider the following minimal example:
use futures::{future::pending, select, FutureExt};
async fn foo() {
select! {
() = pending::<()>().fuse() => {}
() = pending::<()>().fuse() => {}
}
}
It produces the following error (note: line 6 is the second branch):
error: expected `,`
--> src/lib.rs:6:37
|
6 | () = ready::<()>(()).fuse() => {}
| ^
This version compiles without issues:
use futures::{future::ready, select, FutureExt};
async fn foo() {
select! {
() = ready::<()>(()).fuse() => {}
_ = ready::<()>(()).fuse() => {}
}
}