aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/grammar/type_args.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs
index adac73e7e..6b2217012 100644
--- a/src/parser/grammar/type_args.rs
+++ b/src/parser/grammar/type_args.rs
@@ -16,7 +16,7 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) {
16 }; 16 };
17 17
18 while !p.at(EOF) && !p.at(R_ANGLE) { 18 while !p.at(EOF) && !p.at(R_ANGLE) {
19 types::type_(p); 19 type_arg(p);
20 if !p.at(R_ANGLE) && !p.expect(COMMA) { 20 if !p.at(R_ANGLE) && !p.expect(COMMA) {
21 break; 21 break;
22 } 22 }
@@ -24,3 +24,25 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) {
24 p.expect(R_ANGLE); 24 p.expect(R_ANGLE);
25 m.complete(p, TYPE_ARG_LIST); 25 m.complete(p, TYPE_ARG_LIST);
26} 26}
27
28// test type_arg
29// type A = B<'static, i32, Item=u64>
30fn type_arg(p: &mut Parser) {
31 let m = p.start();
32 match p.current() {
33 LIFETIME => {
34 p.bump();
35 m.complete(p, LIFETIME_ARG);
36 },
37 IDENT if p.nth(1) == EQ => {
38 p.bump();
39 p.bump();
40 types::type_(p);
41 m.complete(p, ASSOC_TYPE_ARG);
42 },
43 _ => {
44 types::type_(p);
45 m.complete(p, TYPE_ARG);
46 },
47 }
48}