Macro future proofing#550
Macro future proofing#550nrc merged 13 commits intorust-lang:masterfrom emberian:macro-future-proofing
Conversation
text/0000-macro-future-proofing.md
Outdated
There was a problem hiding this comment.
Forgot one, of course: =
|
Oh, and a massive +1 to the overall idea here. |
|
+1, I'm convinced this is necessary. Detailed futures of some NTs are a bit unclear, though. |
|
@cmr are there any changes you'd like to make to this RFC before we merge it? |
|
@nick29581 maybe. The algorithm here no longer reflects the implementation, and the follow sets are subtly incorrect. |
|
@cmr Ok, ping me when you are happy and I'll merge it |
|
@nick29581 this is ready. |
There was a problem hiding this comment.
@cmr, was there a reason for not including Semicolon on this list as well?
It's handy when defining matchers like $( fn $n:ident( $(p:ident : $t:ty),* ) -> $r:ty ; )* (note the trailing 'ty')
There was a problem hiding this comment.
No, that was indeed an oversight
sent from my phone
On Jan 23, 2015 12:24 AM, "Vadim Chugunov" notifications@github.com wrote:
In text/0000-macro-future-proofing.md
#550 (comment):
continue, else, reject.
- If
Thas the form$(...)U+or$(...)U*for some tokenU, runthe algorithm on the contents with `F` set to `U`. If it accepts,check that the last token in the sequence can be followed by `F`. Ifso, accept. Otherwise, reject.+This algorithm should be run on every matcher in every
macro_rules
+invocation, withFasEOF. If it rejects a matcher, an error should be
+emitted and compilation should not complete.
+
+The current legal fragment specifiers are:item,block,stmt,pat,
+expr,ty,ident,path,meta, andtt.
+
+-FOLLOW(pat)={FatArrow, Comma, Eq}
+-FOLLOW(expr)={FatArrow, Comma, Semicolon}
+-FOLLOW(ty)={Comma, FatArrow, Colon, Eq, Gt, Ident(as)}@cmr https://github.com/cmr, was there a reason for not including
Semicolon on this list as well?
It's handy when defining matchers like $( fn$n:ident( $ (p:ident :
$t:ty),* ) -> $r:ty ; )* (note the trailing 'ty')—
Reply to this email directly or view it on GitHub
https://github.com/rust-lang/rfcs/pull/550/files#r23432570.
(RFC was accepted and has been heavily amended since; current text is: https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md )
Rendered
Implementation: https://github.com/cmr/rust/tree/macro-input-future-proofing