Skip to content

Conversation

@soulsource
Copy link
Contributor

This is an attempt to support explicit type annotations in do-notation.

I am not happy with the syntax, as it requires extra parentheses, but I don't know how to convince Rust's macro matcher to accept a closure-parameter-like syntax otherwise...

The simple idea $binding:pat_param $(: $exp_ty:ty) <= .... does not work, as a pat_param fragment must not be followed by a colon (though the language's own closure parameter syntax does that), and a ty fragment must not be followed by <=....

However, while writing the test for this I noticed that my previous pull request for pattern matching also requires extra parentheses for patterns that aren't tuples - due to the reliance on token-tree fragments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant