-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add support for arms in macros and quotes, fix a pretty printer bug, and other minor features #16037
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
Conversation
This looks like it also adds a |
@alexcrichton: oops, it wasn't, but that could be useful. For now I'll factor that bit out and see if I can add support for it in a future PR. |
Oooh, if |
@killerswan: I hope so! I using it to great effect in https://github.com/erickt/rust-serde/blob/master/serde_macros/src/lib.rs#L381. It really helps to simplify down complex syntax extensions. Plus it makes the extensions a bit more independent from the actual ast, which is also handy. |
@alexcrichton: It turns out it was pretty simple to add |
I don't think we've extended the macro matchers much recently, but it may be RFC-worty to add an |
This also always puts a trailing comma on the last non-block expr.
@bors: retry |
This adds support for `quote_arm!(cx, $pat => $expr)`, and `macro_rules!(($a:arm) => (...))`. It also fixes a bug in pretty printing, where this would generate invalid code: ``` match { 5i } { 1 => 2, _ => 3, } ``` It would generate this code: ``` match { 5i } { 1 => 2 _ => 3 } ``` Finally, it adds a couple helper methods to `ExtCtxt`.
fix: Don't print proc-macro panic backtraces in the logs Fixes rust-lang/rust-analyzer#9859
This adds support for
quote_arm!(cx, $pat => $expr)
, andmacro_rules!(($a:arm) => (...))
. It also fixes a bug in pretty printing, where this would generate invalid code:It would generate this code:
Finally, it adds a couple helper methods to
ExtCtxt
.