Skip to content

Commit f394933

Browse files
committed
Allow optional comma before with in FRU. Closes #2463.
1 parent abef5f5 commit f394933

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,12 @@ class parser {
724724
let mut fields = [self.parse_field(token::COLON)];
725725
let mut base = none;
726726
while self.token != token::RBRACE {
727+
// optional comma before "with"
728+
if self.token == token::COMMA
729+
&& self.token_is_keyword("with",
730+
self.look_ahead(1u)) {
731+
self.bump();
732+
}
727733
if self.eat_keyword("with") {
728734
base = some(self.parse_expr()); break;
729735
}

src/test/run-pass/issue-2463.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
fn main() {
2+
3+
let x = {
4+
f: 0,
5+
g: 0,
6+
};
7+
8+
let y = {
9+
f: 1,
10+
g: 1,
11+
with x
12+
};
13+
14+
let z = {
15+
f: 1,
16+
with x
17+
};
18+
19+
}

0 commit comments

Comments
 (0)