diff options
Diffstat (limited to 'src/parser/grammar')
-rw-r--r-- | src/parser/grammar/types.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/parser/grammar/types.rs b/src/parser/grammar/types.rs index c25517a51..bcdc3ef97 100644 --- a/src/parser/grammar/types.rs +++ b/src/parser/grammar/types.rs | |||
@@ -10,7 +10,7 @@ pub(super) fn type_(p: &mut Parser) { | |||
10 | UNDERSCORE => placeholder_type(p), | 10 | UNDERSCORE => placeholder_type(p), |
11 | FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p), | 11 | FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p), |
12 | FOR_KW => for_type(p), | 12 | FOR_KW => for_type(p), |
13 | IDENT => path_type(p), | 13 | _ if paths::is_path_start(p) => path_type(p), |
14 | _ => { | 14 | _ => { |
15 | p.error("expected type"); | 15 | p.error("expected type"); |
16 | } | 16 | } |
@@ -178,8 +178,13 @@ fn for_type(p: &mut Parser) { | |||
178 | m.complete(p, FOR_TYPE); | 178 | m.complete(p, FOR_TYPE); |
179 | } | 179 | } |
180 | 180 | ||
181 | // test path_type | ||
182 | // type A = Foo; | ||
183 | // type B = ::Foo; | ||
184 | // type C = self::Foo; | ||
185 | // type D = super::Foo; | ||
181 | fn path_type(p: &mut Parser) { | 186 | fn path_type(p: &mut Parser) { |
182 | assert!(p.at(IDENT)); | 187 | assert!(paths::is_path_start(p)); |
183 | let m = p.start(); | 188 | let m = p.start(); |
184 | paths::type_path(p); | 189 | paths::type_path(p); |
185 | m.complete(p, PATH_TYPE); | 190 | m.complete(p, PATH_TYPE); |