aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar/items
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/grammar/items')
-rw-r--r--crates/libsyntax2/src/grammar/items/mod.rs6
-rw-r--r--crates/libsyntax2/src/grammar/items/structs.rs4
-rw-r--r--crates/libsyntax2/src/grammar/items/traits.rs2
3 files changed, 8 insertions, 4 deletions
diff --git a/crates/libsyntax2/src/grammar/items/mod.rs b/crates/libsyntax2/src/grammar/items/mod.rs
index 7c6f7b63e..e672aa419 100644
--- a/crates/libsyntax2/src/grammar/items/mod.rs
+++ b/crates/libsyntax2/src/grammar/items/mod.rs
@@ -24,6 +24,10 @@ pub(super) enum ItemFlavor {
24 Mod, Trait 24 Mod, Trait
25} 25}
26 26
27const ITEM_RECOVERY_SET: TokenSet =
28 token_set![FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW,
29 MOD_KW, PUB_KW, CRATE_KW];
30
27pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemFlavor) { 31pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemFlavor) {
28 let m = p.start(); 32 let m = p.start();
29 match maybe_item(p, flavor) { 33 match maybe_item(p, flavor) {
@@ -231,7 +235,7 @@ fn fn_def(p: &mut Parser, flavor: ItemFlavor) {
231 assert!(p.at(FN_KW)); 235 assert!(p.at(FN_KW));
232 p.bump(); 236 p.bump();
233 237
234 name(p); 238 name_r(p, ITEM_RECOVERY_SET);
235 // test function_type_params 239 // test function_type_params
236 // fn foo<T: Clone + Copy>(){} 240 // fn foo<T: Clone + Copy>(){}
237 type_params::opt_type_param_list(p); 241 type_params::opt_type_param_list(p);
diff --git a/crates/libsyntax2/src/grammar/items/structs.rs b/crates/libsyntax2/src/grammar/items/structs.rs
index 180205393..f1e78865c 100644
--- a/crates/libsyntax2/src/grammar/items/structs.rs
+++ b/crates/libsyntax2/src/grammar/items/structs.rs
@@ -4,7 +4,7 @@ pub(super) fn struct_def(p: &mut Parser) {
4 assert!(p.at(STRUCT_KW)); 4 assert!(p.at(STRUCT_KW));
5 p.bump(); 5 p.bump();
6 6
7 name(p); 7 name_r(p, ITEM_RECOVERY_SET);
8 type_params::opt_type_param_list(p); 8 type_params::opt_type_param_list(p);
9 match p.current() { 9 match p.current() {
10 WHERE_KW => { 10 WHERE_KW => {
@@ -41,7 +41,7 @@ pub(super) fn struct_def(p: &mut Parser) {
41pub(super) fn enum_def(p: &mut Parser) { 41pub(super) fn enum_def(p: &mut Parser) {
42 assert!(p.at(ENUM_KW)); 42 assert!(p.at(ENUM_KW));
43 p.bump(); 43 p.bump();
44 name(p); 44 name_r(p, ITEM_RECOVERY_SET);
45 type_params::opt_type_param_list(p); 45 type_params::opt_type_param_list(p);
46 type_params::opt_where_clause(p); 46 type_params::opt_where_clause(p);
47 if p.at(L_CURLY) { 47 if p.at(L_CURLY) {
diff --git a/crates/libsyntax2/src/grammar/items/traits.rs b/crates/libsyntax2/src/grammar/items/traits.rs
index 01b79e3c9..9d21d4d36 100644
--- a/crates/libsyntax2/src/grammar/items/traits.rs
+++ b/crates/libsyntax2/src/grammar/items/traits.rs
@@ -5,7 +5,7 @@ use super::*;
5pub(super) fn trait_def(p: &mut Parser) { 5pub(super) fn trait_def(p: &mut Parser) {
6 assert!(p.at(TRAIT_KW)); 6 assert!(p.at(TRAIT_KW));
7 p.bump(); 7 p.bump();
8 name(p); 8 name_r(p, ITEM_RECOVERY_SET);
9 type_params::opt_type_param_list(p); 9 type_params::opt_type_param_list(p);
10 if p.at(COLON) { 10 if p.at(COLON) {
11 type_params::bounds(p); 11 type_params::bounds(p);