Skip to content

Commit 9ff2d19

Browse files
committedJul 13, 2015
Auto merge of #27000 - alexcrichton:semi-after-type, r=cmr
This commit expands the follow set of the `ty` and `path` macro fragments to include the semicolon token as well. A semicolon is already allowed after these tokens, so it's currently a little too restrictive to not have a semicolon allowed. For example: extern { fn foo() -> i32; // semicolon after type } fn main() { struct Foo; Foo; // semicolon after path }
2 parents df39a92 + af55623 commit 9ff2d19

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
 

‎src/libsyntax/ext/tt/macro_rules.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
501501
},
502502
"path" | "ty" => {
503503
match *tok {
504-
Comma | FatArrow | Colon | Eq | Gt => Ok(true),
504+
Comma | FatArrow | Colon | Eq | Gt | Semi => Ok(true),
505505
Ident(i, _) if i.as_str() == "as" => Ok(true),
506506
_ => Ok(false)
507507
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2015 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+
($t:ty; $p:path;) => {}
13+
}
14+
15+
fn main() {
16+
foo!(i32; i32;);
17+
}

0 commit comments

Comments
 (0)
Please sign in to comment.