Rollup merge of #63198 - rbartlensky:fix-macro-trailing-comma, r=petrochenkov

Allow trailing comma in macro 2.0 declarations.

This should hopefully close #63102.
This commit is contained in:
Mazdak Farrokhzad 2019-08-02 12:14:20 +02:00 committed by GitHub
commit 89dce46efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -282,7 +282,10 @@ pub fn compile(
quoted::TokenTree::Sequence(
DelimSpan::dummy(),
Lrc::new(quoted::SequenceRepetition {
tts: vec![quoted::TokenTree::token(token::Semi, def.span)],
tts: vec![quoted::TokenTree::token(
if body.legacy { token::Semi } else { token::Comma },
def.span,
)],
separator: None,
kleene: quoted::KleeneToken::new(quoted::KleeneOp::ZeroOrMore, def.span),
num_captures: 0,

View File

@ -0,0 +1,8 @@
// check-pass
#![feature(decl_macro)]
macro foo {
() => {},
}
fn main() {}