diff options
Diffstat (limited to 'crates/libsyntax2/src/grammar/items')
-rw-r--r-- | crates/libsyntax2/src/grammar/items/mod.rs | 10 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/items/structs.rs | 8 | ||||
-rw-r--r-- | crates/libsyntax2/src/grammar/items/traits.rs | 8 |
3 files changed, 13 insertions, 13 deletions
diff --git a/crates/libsyntax2/src/grammar/items/mod.rs b/crates/libsyntax2/src/grammar/items/mod.rs index d460612b4..18b681ee2 100644 --- a/crates/libsyntax2/src/grammar/items/mod.rs +++ b/crates/libsyntax2/src/grammar/items/mod.rs | |||
@@ -225,7 +225,7 @@ fn function(p: &mut Parser, flavor: ItemFlavor) { | |||
225 | name(p); | 225 | name(p); |
226 | // test function_type_params | 226 | // test function_type_params |
227 | // fn foo<T: Clone + Copy>(){} | 227 | // fn foo<T: Clone + Copy>(){} |
228 | type_params::type_param_list(p); | 228 | type_params::opt_type_param_list(p); |
229 | 229 | ||
230 | if p.at(L_PAREN) { | 230 | if p.at(L_PAREN) { |
231 | match flavor { | 231 | match flavor { |
@@ -240,11 +240,11 @@ fn function(p: &mut Parser, flavor: ItemFlavor) { | |||
240 | // test function_ret_type | 240 | // test function_ret_type |
241 | // fn foo() {} | 241 | // fn foo() {} |
242 | // fn bar() -> () {} | 242 | // fn bar() -> () {} |
243 | fn_ret_type(p); | 243 | opt_fn_ret_type(p); |
244 | 244 | ||
245 | // test function_where_clause | 245 | // test function_where_clause |
246 | // fn foo<T>() where T: Copy {} | 246 | // fn foo<T>() where T: Copy {} |
247 | type_params::where_clause(p); | 247 | type_params::opt_where_clause(p); |
248 | 248 | ||
249 | // test fn_decl | 249 | // test fn_decl |
250 | // trait T { fn foo(); } | 250 | // trait T { fn foo(); } |
@@ -263,7 +263,7 @@ fn type_def(p: &mut Parser) { | |||
263 | 263 | ||
264 | // test type_item_type_params | 264 | // test type_item_type_params |
265 | // type Result<T> = (); | 265 | // type Result<T> = (); |
266 | type_params::type_param_list(p); | 266 | type_params::opt_type_param_list(p); |
267 | 267 | ||
268 | if p.at(COLON) { | 268 | if p.at(COLON) { |
269 | type_params::bounds(p); | 269 | type_params::bounds(p); |
@@ -271,7 +271,7 @@ fn type_def(p: &mut Parser) { | |||
271 | 271 | ||
272 | // test type_item_where_clause | 272 | // test type_item_where_clause |
273 | // type Foo where Foo: Copy = (); | 273 | // type Foo where Foo: Copy = (); |
274 | type_params::where_clause(p); | 274 | type_params::opt_where_clause(p); |
275 | 275 | ||
276 | if p.eat(EQ) { | 276 | if p.eat(EQ) { |
277 | types::type_(p); | 277 | types::type_(p); |
diff --git a/crates/libsyntax2/src/grammar/items/structs.rs b/crates/libsyntax2/src/grammar/items/structs.rs index b3ed94fe3..cde9d0ae6 100644 --- a/crates/libsyntax2/src/grammar/items/structs.rs +++ b/crates/libsyntax2/src/grammar/items/structs.rs | |||
@@ -5,10 +5,10 @@ pub(super) fn struct_def(p: &mut Parser) { | |||
5 | p.bump(); | 5 | p.bump(); |
6 | 6 | ||
7 | name(p); | 7 | name(p); |
8 | type_params::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 => { |
11 | type_params::where_clause(p); | 11 | type_params::opt_where_clause(p); |
12 | match p.current() { | 12 | match p.current() { |
13 | SEMI => { | 13 | SEMI => { |
14 | p.bump(); | 14 | p.bump(); |
@@ -42,8 +42,8 @@ pub(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(p); |
45 | type_params::type_param_list(p); | 45 | type_params::opt_type_param_list(p); |
46 | type_params::where_clause(p); | 46 | type_params::opt_where_clause(p); |
47 | if p.expect(L_CURLY) { | 47 | if p.expect(L_CURLY) { |
48 | while !p.at(EOF) && !p.at(R_CURLY) { | 48 | while !p.at(EOF) && !p.at(R_CURLY) { |
49 | let var = p.start(); | 49 | let var = p.start(); |
diff --git a/crates/libsyntax2/src/grammar/items/traits.rs b/crates/libsyntax2/src/grammar/items/traits.rs index daecaff5c..73ecd4bef 100644 --- a/crates/libsyntax2/src/grammar/items/traits.rs +++ b/crates/libsyntax2/src/grammar/items/traits.rs | |||
@@ -6,11 +6,11 @@ pub(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(p); |
9 | type_params::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); |
12 | } | 12 | } |
13 | type_params::where_clause(p); | 13 | type_params::opt_where_clause(p); |
14 | p.expect(L_CURLY); | 14 | p.expect(L_CURLY); |
15 | // test trait_item_items | 15 | // test trait_item_items |
16 | // impl F { | 16 | // impl F { |
@@ -31,7 +31,7 @@ pub(super) fn impl_item(p: &mut Parser) { | |||
31 | assert!(p.at(IMPL_KW)); | 31 | assert!(p.at(IMPL_KW)); |
32 | p.bump(); | 32 | p.bump(); |
33 | if choose_type_params_over_qpath(p) { | 33 | if choose_type_params_over_qpath(p) { |
34 | type_params::type_param_list(p); | 34 | type_params::opt_type_param_list(p); |
35 | } | 35 | } |
36 | 36 | ||
37 | // TODO: never type | 37 | // TODO: never type |
@@ -44,7 +44,7 @@ pub(super) fn impl_item(p: &mut Parser) { | |||
44 | if p.eat(FOR_KW) { | 44 | if p.eat(FOR_KW) { |
45 | types::type_(p); | 45 | types::type_(p); |
46 | } | 46 | } |
47 | type_params::where_clause(p); | 47 | type_params::opt_where_clause(p); |
48 | p.expect(L_CURLY); | 48 | p.expect(L_CURLY); |
49 | 49 | ||
50 | // test impl_item_items | 50 | // test impl_item_items |