aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar/types.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/grammar/types.rs')
-rw-r--r--crates/libsyntax2/src/grammar/types.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar/types.rs b/crates/libsyntax2/src/grammar/types.rs
index 0d8c6bfba..5ba3fcca0 100644
--- a/crates/libsyntax2/src/grammar/types.rs
+++ b/crates/libsyntax2/src/grammar/types.rs
@@ -11,9 +11,10 @@ pub(super) fn type_(p: &mut Parser) {
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 IMPL_KW => impl_trait_type(p), 13 IMPL_KW => impl_trait_type(p),
14 DYN_KW => dyn_trait_type(p),
14 _ if paths::is_path_start(p) => path_type(p), 15 _ if paths::is_path_start(p) => path_type(p),
15 _ => { 16 _ => {
16 p.error("expected type"); 17 p.err_and_bump("expected type");
17 } 18 }
18 } 19 }
19} 20}
@@ -194,6 +195,16 @@ fn impl_trait_type(p: &mut Parser) {
194 m.complete(p, IMPL_TRAIT_TYPE); 195 m.complete(p, IMPL_TRAIT_TYPE);
195} 196}
196 197
198// test dyn_trait_type
199// type A = dyn Iterator<Item=Foo<'a>> + 'a;
200fn dyn_trait_type(p: &mut Parser) {
201 assert!(p.at(DYN_KW));
202 let m = p.start();
203 p.bump();
204 type_params::bounds_without_colon(p);
205 m.complete(p, DYN_TRAIT_TYPE);
206}
207
197// test path_type 208// test path_type
198// type A = Foo; 209// type A = Foo;
199// type B = ::Foo; 210// type B = ::Foo;