-
Notifications
You must be signed in to change notification settings - Fork 628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse error in select!
/select_biased!
macro
#2824
Comments
I added the two dbg to the following code: futures-rs/futures-macro/src/select.rs Lines 60 to 62 in 0fa6a1a
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
// `=> <expr>`
input.parse::<Token![=>]>()?;
+ dbg!(&input);
let expr = input.parse::<Expr>()?;
+ dbg!(&input);
// Commas after the expression are only optional if it's a `Block`
// or it is the last branch in the `match`. And the output is:
It seems syn treats |
macro_rules! expr {
($e:expr) => {};
}
expr!({} () = pending::<()>().fuse()); To parse this in a way that uses the expression termination rules of match arms, what you could do is: after parsing your |
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:
It produces the following error (note: line 6 is the second branch):
This version compiles without issues:
The text was updated successfully, but these errors were encountered: