Skip to content

Allow ExprLit expression macros to be used in patterns. #16891

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
wants to merge 1 commit into from

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Aug 30, 2014

Enables any macros using MacExpr to be treated as patterns when
they produce a literal in the form ExprLit (e.g. stringify! or line!).

Fixes #16876.

@lilyball
Copy link
Contributor

This seems reasonable to me.

@ghost
Copy link

ghost commented Sep 1, 2014

If it's desirable, this could use the existing expression to pattern mapping in const_eval::const_expr_to_pat so that match arm macros could expand to a broader range of expressions.

@eddyb
Copy link
Member Author

eddyb commented Sep 1, 2014

@jakub- This is just for built-in macros, macro_rules macros can already be parsed as a pattern, if used in a pattern position.

bors added a commit that referenced this pull request Sep 1, 2014
Enables any macros using `MacExpr` to be treated as patterns when
they produce a literal in the form `ExprLit` (e.g. `stringify!` or `line!`).

Fixes #16876.
@bors bors closed this Sep 1, 2014
@eddyb eddyb deleted the patlit-from-expr-macros branch September 1, 2014 19:51
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 31, 2024
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.

String literal macros
3 participants