Skip to content

Commit d77acf7

Browse files
committed
libsyntax: Accept ',' to separate struct fields. Closes #3263.
1 parent 8ef4551 commit d77acf7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/libsyntax/parse/parser.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -2698,7 +2698,19 @@ struct parser {
26982698
!self.is_any_keyword(copy self.token)) &&
26992699
!self.token_is_pound_or_doc_comment(self.token) {
27002700
let a_var = self.parse_instance_var(vis);
2701-
self.expect(token::SEMI);
2701+
match self.token {
2702+
token::SEMI | token::COMMA => {
2703+
self.bump();
2704+
}
2705+
token::RBRACE => {}
2706+
_ => {
2707+
self.span_fatal(copy self.span,
2708+
fmt!("expected `;`, `,`, or '}' but \
2709+
found `%s`",
2710+
token_to_str(self.reader,
2711+
self.token)));
2712+
}
2713+
}
27022714
return a_var;
27032715
} else {
27042716
let m = self.parse_method(vis);

src/libsyntax/print/pprust.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ fn print_struct(s: ps, struct_def: @ast::struct_def, tps: ~[ast::ty_param],
646646
print_ident(s, ident);
647647
word_nbsp(s, ~":");
648648
print_type(s, field.node.ty);
649-
word(s.s, ~";");
649+
word(s.s, ~",");
650650
}
651651
}
652652
}

0 commit comments

Comments
 (0)