Skip to content

Macros in match blocks can't expand to a pattern *and* block #26330

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

Closed
reem opened this issue Jun 16, 2015 · 3 comments
Closed

Macros in match blocks can't expand to a pattern *and* block #26330

reem opened this issue Jun 16, 2015 · 3 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@reem
Copy link
Contributor

reem commented Jun 16, 2015

Example of incorrect behavior: http://is.gd/WmvsML

In the above example, the branch! macro should expand to a pattern and block, but rustc insists that it only expands into a pattern, and still expects further patterns or a block.

@reem
Copy link
Contributor Author

reem commented Jun 17, 2015

@cmr told me on IRC this is because macros must produce a single valid AST node, and we don't have an AST node for "match arm".

@steveklabnik steveklabnik added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Jun 23, 2015
@lambda-fairy
Copy link
Contributor

Is there any workaround for this? A macro that I'm writing works this way.

@Mark-Simulacrum
Copy link
Member

Closing in favor of #12832.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

4 participants