Skip to content

Commit 3c8ba2d

Browse files
committed
Accept a LHS formed of a single sequence TT in macro_rules!.
This was already accepted when checking that a macro definition was well-formed but not handled during expansion.
1 parent 5743564 commit 3c8ba2d

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt,
179179
for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers
180180
let lhs_tt = match *lhs {
181181
TokenTree::Delimited(_, ref delim) => &delim.tts[..],
182+
TokenTree::Sequence(..) => ref_slice(lhs),
182183
_ => cx.span_fatal(sp, "malformed macro lhs")
183184
};
184185

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
macro_rules! foo(
12+
$($i:ident),+ => ()
13+
);
14+
15+
fn main() {
16+
foo!(bar, baz);
17+
}

0 commit comments

Comments
 (0)