aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar/items/structs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar/items/structs.rs')
-rw-r--r--src/parser/grammar/items/structs.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/parser/grammar/items/structs.rs b/src/parser/grammar/items/structs.rs
index 640b940e4..eca0d2e64 100644
--- a/src/parser/grammar/items/structs.rs
+++ b/src/parser/grammar/items/structs.rs
@@ -4,9 +4,7 @@ pub(super) fn struct_item(p: &mut Parser) {
4 assert!(p.at(STRUCT_KW)); 4 assert!(p.at(STRUCT_KW));
5 p.bump(); 5 p.bump();
6 6
7 if !p.expect(IDENT) { 7 name(p);
8 return;
9 }
10 type_params::list(p); 8 type_params::list(p);
11 match p.current() { 9 match p.current() {
12 WHERE_KW => { 10 WHERE_KW => {
@@ -43,7 +41,7 @@ pub(super) fn struct_item(p: &mut Parser) {
43pub(super) fn enum_item(p: &mut Parser) { 41pub(super) fn enum_item(p: &mut Parser) {
44 assert!(p.at(ENUM_KW)); 42 assert!(p.at(ENUM_KW));
45 p.bump(); 43 p.bump();
46 p.expect(IDENT); 44 name(p);
47 type_params::list(p); 45 type_params::list(p);
48 type_params::where_clause(p); 46 type_params::where_clause(p);
49 if p.expect(L_CURLY) { 47 if p.expect(L_CURLY) {
@@ -88,7 +86,8 @@ fn named_fields(p: &mut Parser) {
88 fn named_field(p: &mut Parser) { 86 fn named_field(p: &mut Parser) {
89 let field = p.start(); 87 let field = p.start();
90 visibility(p); 88 visibility(p);
91 if p.expect(IDENT) { 89 if p.at(IDENT) {
90 name(p);
92 p.expect(COLON); 91 p.expect(COLON);
93 types::type_ref(p); 92 types::type_ref(p);
94 field.complete(p, NAMED_FIELD); 93 field.complete(p, NAMED_FIELD);