aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/grammar.ron2
-rw-r--r--crates/libsyntax2/src/grammar/types.rs13
-rw-r--r--crates/libsyntax2/src/syntax_kinds/generated.rs6
3 files changed, 20 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron
index ee231931e..c07ed4203 100644
--- a/crates/libsyntax2/src/grammar.ron
+++ b/crates/libsyntax2/src/grammar.ron
@@ -55,6 +55,7 @@ Grammar(
55 "enum", 55 "enum",
56 "trait", 56 "trait",
57 "impl", 57 "impl",
58 "dyn",
58 "true", 59 "true",
59 "false", 60 "false",
60 "as", 61 "as",
@@ -134,6 +135,7 @@ Grammar(
134 "FN_POINTER_TYPE", 135 "FN_POINTER_TYPE",
135 "FOR_TYPE", 136 "FOR_TYPE",
136 "IMPL_TRAIT_TYPE", 137 "IMPL_TRAIT_TYPE",
138 "DYN_TRAIT_TYPE",
137 139
138 "REF_PAT", 140 "REF_PAT",
139 "BIND_PAT", 141 "BIND_PAT",
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;
diff --git a/crates/libsyntax2/src/syntax_kinds/generated.rs b/crates/libsyntax2/src/syntax_kinds/generated.rs
index c45a4800c..f5f8fe1ef 100644
--- a/crates/libsyntax2/src/syntax_kinds/generated.rs
+++ b/crates/libsyntax2/src/syntax_kinds/generated.rs
@@ -62,6 +62,7 @@ pub enum SyntaxKind {
62 ENUM_KW, 62 ENUM_KW,
63 TRAIT_KW, 63 TRAIT_KW,
64 IMPL_KW, 64 IMPL_KW,
65 DYN_KW,
65 TRUE_KW, 66 TRUE_KW,
66 FALSE_KW, 67 FALSE_KW,
67 AS_KW, 68 AS_KW,
@@ -133,6 +134,7 @@ pub enum SyntaxKind {
133 FN_POINTER_TYPE, 134 FN_POINTER_TYPE,
134 FOR_TYPE, 135 FOR_TYPE,
135 IMPL_TRAIT_TYPE, 136 IMPL_TRAIT_TYPE,
137 DYN_TRAIT_TYPE,
136 REF_PAT, 138 REF_PAT,
137 BIND_PAT, 139 BIND_PAT,
138 PLACEHOLDER_PAT, 140 PLACEHOLDER_PAT,
@@ -210,6 +212,7 @@ impl SyntaxKind {
210 | ENUM_KW 212 | ENUM_KW
211 | TRAIT_KW 213 | TRAIT_KW
212 | IMPL_KW 214 | IMPL_KW
215 | DYN_KW
213 | TRUE_KW 216 | TRUE_KW
214 | FALSE_KW 217 | FALSE_KW
215 | AS_KW 218 | AS_KW
@@ -297,6 +300,7 @@ impl SyntaxKind {
297 ENUM_KW => &SyntaxInfo { name: "ENUM_KW" }, 300 ENUM_KW => &SyntaxInfo { name: "ENUM_KW" },
298 TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" }, 301 TRAIT_KW => &SyntaxInfo { name: "TRAIT_KW" },
299 IMPL_KW => &SyntaxInfo { name: "IMPL_KW" }, 302 IMPL_KW => &SyntaxInfo { name: "IMPL_KW" },
303 DYN_KW => &SyntaxInfo { name: "DYN_KW" },
300 TRUE_KW => &SyntaxInfo { name: "TRUE_KW" }, 304 TRUE_KW => &SyntaxInfo { name: "TRUE_KW" },
301 FALSE_KW => &SyntaxInfo { name: "FALSE_KW" }, 305 FALSE_KW => &SyntaxInfo { name: "FALSE_KW" },
302 AS_KW => &SyntaxInfo { name: "AS_KW" }, 306 AS_KW => &SyntaxInfo { name: "AS_KW" },
@@ -368,6 +372,7 @@ impl SyntaxKind {
368 FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" }, 372 FN_POINTER_TYPE => &SyntaxInfo { name: "FN_POINTER_TYPE" },
369 FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" }, 373 FOR_TYPE => &SyntaxInfo { name: "FOR_TYPE" },
370 IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" }, 374 IMPL_TRAIT_TYPE => &SyntaxInfo { name: "IMPL_TRAIT_TYPE" },
375 DYN_TRAIT_TYPE => &SyntaxInfo { name: "DYN_TRAIT_TYPE" },
371 REF_PAT => &SyntaxInfo { name: "REF_PAT" }, 376 REF_PAT => &SyntaxInfo { name: "REF_PAT" },
372 BIND_PAT => &SyntaxInfo { name: "BIND_PAT" }, 377 BIND_PAT => &SyntaxInfo { name: "BIND_PAT" },
373 PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" }, 378 PLACEHOLDER_PAT => &SyntaxInfo { name: "PLACEHOLDER_PAT" },
@@ -445,6 +450,7 @@ impl SyntaxKind {
445 "enum" => ENUM_KW, 450 "enum" => ENUM_KW,
446 "trait" => TRAIT_KW, 451 "trait" => TRAIT_KW,
447 "impl" => IMPL_KW, 452 "impl" => IMPL_KW,
453 "dyn" => DYN_KW,
448 "true" => TRUE_KW, 454 "true" => TRUE_KW,
449 "false" => FALSE_KW, 455 "false" => FALSE_KW,
450 "as" => AS_KW, 456 "as" => AS_KW,