Skip to content

parse error in select!/select_biased! macro #2824

Closed
@antonok-edm

Description

@antonok-edm

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() => {}
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions