aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/grammar')
-rw-r--r--crates/libsyntax2/src/grammar/paths.rs2
-rw-r--r--crates/libsyntax2/src/grammar/patterns.rs6
-rw-r--r--crates/libsyntax2/src/grammar/type_params.rs7
-rw-r--r--crates/libsyntax2/src/grammar/types.rs7
4 files changed, 17 insertions, 5 deletions
diff --git a/crates/libsyntax2/src/grammar/paths.rs b/crates/libsyntax2/src/grammar/paths.rs
index c277e2a6b..aa5ecf4b8 100644
--- a/crates/libsyntax2/src/grammar/paths.rs
+++ b/crates/libsyntax2/src/grammar/paths.rs
@@ -62,7 +62,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
62 } 62 }
63 SELF_KW | SUPER_KW => p.bump(), 63 SELF_KW | SUPER_KW => p.bump(),
64 _ => { 64 _ => {
65 p.error("expected identifier"); 65 p.err_and_bump("expected identifier");
66 } 66 }
67 }; 67 };
68 segment.complete(p, PATH_SEGMENT); 68 segment.complete(p, PATH_SEGMENT);
diff --git a/crates/libsyntax2/src/grammar/patterns.rs b/crates/libsyntax2/src/grammar/patterns.rs
index 436f3b26d..220f36db7 100644
--- a/crates/libsyntax2/src/grammar/patterns.rs
+++ b/crates/libsyntax2/src/grammar/patterns.rs
@@ -60,6 +60,7 @@ fn atom_pat(p: &mut Parser) -> Option<CompletedMarker> {
60// let Bar(..) = (); 60// let Bar(..) = ();
61// } 61// }
62fn path_pat(p: &mut Parser) -> CompletedMarker { 62fn path_pat(p: &mut Parser) -> CompletedMarker {
63 assert!(paths::is_path_start(p));
63 let m = p.start(); 64 let m = p.start();
64 paths::expr_path(p); 65 paths::expr_path(p);
65 let kind = match p.current() { 66 let kind = match p.current() {
@@ -116,8 +117,11 @@ fn struct_pat_fields(p: &mut Parser) {
116 p.bump(); 117 p.bump();
117 pattern(p); 118 pattern(p);
118 } 119 }
119 _ => { 120 REF_KW | MUT_KW | IDENT => {
120 bind_pat(p, false); 121 bind_pat(p, false);
122 },
123 _ => {
124 p.err_and_bump("expected ident");
121 } 125 }
122 } 126 }
123 if !p.at(R_CURLY) { 127 if !p.at(R_CURLY) {
diff --git a/crates/libsyntax2/src/grammar/type_params.rs b/crates/libsyntax2/src/grammar/type_params.rs
index 0a3e8fd07..32b69dc5b 100644
--- a/crates/libsyntax2/src/grammar/type_params.rs
+++ b/crates/libsyntax2/src/grammar/type_params.rs
@@ -121,7 +121,12 @@ fn where_predicate(p: &mut Parser) {
121 lifetime_bounds(p) 121 lifetime_bounds(p)
122 } else { 122 } else {
123 types::path_type(p); 123 types::path_type(p);
124 bounds(p); 124 if p.at(COLON) {
125 bounds(p);
126 } else {
127 p.error("expected colon")
128 }
129
125 } 130 }
126 m.complete(p, WHERE_PRED); 131 m.complete(p, WHERE_PRED);
127} 132}
diff --git a/crates/libsyntax2/src/grammar/types.rs b/crates/libsyntax2/src/grammar/types.rs
index 5ba3fcca0..88631fefe 100644
--- a/crates/libsyntax2/src/grammar/types.rs
+++ b/crates/libsyntax2/src/grammar/types.rs
@@ -166,8 +166,11 @@ fn fn_pointer_type(p: &mut Parser) {
166 p.error("expected `fn`"); 166 p.error("expected `fn`");
167 return; 167 return;
168 } 168 }
169 169 if p.at(L_PAREN) {
170 params::param_list_opt_patterns(p); 170 params::param_list_opt_patterns(p);
171 } else {
172 p.error("expected parameters")
173 }
171 // test fn_pointer_type_with_ret 174 // test fn_pointer_type_with_ret
172 // type F = fn() -> (); 175 // type F = fn() -> ();
173 fn_ret_type(p); 176 fn_ret_type(p);