aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-31 17:50:43 +0100
committerGitHub <[email protected]>2020-07-31 17:50:43 +0100
commit5d9145ce10c7dff6caa397b7a6c561848399e4f9 (patch)
tree8db83308ee58e07dcfd5071462460a8a50f1ce91
parent0392a894b7284b13a88a13171e6b8b29764921be (diff)
parentc1c97b289662501cea93fdc10760e08702ff5950 (diff)
Merge #5629
5629: Finalize Path grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_assists/src/ast_transform.rs18
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_def/src/path.rs2
-rw-r--r--crates/ra_hir_def/src/path/lower.rs46
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs2
-rw-r--r--crates/ra_ide/src/extend_selection.rs2
-rw-r--r--crates/ra_parser/src/grammar/type_args.rs4
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_ssr/src/matching.rs4
-rw-r--r--crates/ra_ssr/src/resolving.rs2
-rw-r--r--crates/ra_syntax/src/ast/edit.rs8
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs1129
-rw-r--r--crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast5
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0032_where_for.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast2
-rw-r--r--xtask/src/ast_src.rs2
-rw-r--r--xtask/src/codegen/rust.ungram60
41 files changed, 716 insertions, 654 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index 3265bd406..0a7be87a0 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -79,19 +79,25 @@ impl<'a> SubstituteTypeParams<'a> {
79 }; 79 };
80 80
81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the 81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
82 // trait ref, and then go from the types in the substs back to the syntax) 82 // trait ref, and then go from the types in the substs back to the syntax).
83 fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> { 83 fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> {
84 let target_trait = impl_def.target_trait()?; 84 let target_trait = impl_def.target_trait()?;
85 let path_type = match target_trait { 85 let path_type = match target_trait {
86 ast::Type::PathType(path) => path, 86 ast::Type::PathType(path) => path,
87 _ => return None, 87 _ => return None,
88 }; 88 };
89 let type_arg_list = path_type.path()?.segment()?.type_arg_list()?; 89 let generic_arg_list = path_type.path()?.segment()?.generic_arg_list()?;
90
90 let mut result = Vec::new(); 91 let mut result = Vec::new();
91 for type_arg in type_arg_list.type_args() { 92 for generic_arg in generic_arg_list.generic_args() {
92 let type_arg: ast::TypeArg = type_arg; 93 match generic_arg {
93 result.push(type_arg.ty()?); 94 ast::GenericArg::TypeArg(type_arg) => result.push(type_arg.ty()?),
95 ast::GenericArg::AssocTypeArg(_)
96 | ast::GenericArg::LifetimeArg(_)
97 | ast::GenericArg::ConstArg(_) => (),
98 }
94 } 99 }
100
95 Some(result) 101 Some(result)
96 } 102 }
97 } 103 }
@@ -157,7 +163,7 @@ impl<'a> QualifyPaths<'a> {
157 163
158 let type_args = p 164 let type_args = p
159 .segment() 165 .segment()
160 .and_then(|s| s.type_arg_list()) 166 .and_then(|s| s.generic_arg_list())
161 .map(|arg_list| apply(self, arg_list)); 167 .map(|arg_list| apply(self, arg_list));
162 if let Some(type_args) = type_args { 168 if let Some(type_args) = type_args {
163 let last_segment = path.segment().unwrap(); 169 let last_segment = path.segment().unwrap();
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 0cacc63ef..6bedc6b56 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -337,7 +337,7 @@ impl ExprCollector<'_> {
337 }; 337 };
338 let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); 338 let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
339 let generic_args = 339 let generic_args =
340 e.type_arg_list().and_then(|it| GenericArgs::from_ast(&self.ctx(), it)); 340 e.generic_arg_list().and_then(|it| GenericArgs::from_ast(&self.ctx(), it));
341 self.alloc_expr( 341 self.alloc_expr(
342 Expr::MethodCall { receiver, method_name, args, generic_args }, 342 Expr::MethodCall { receiver, method_name, args, generic_args },
343 syntax_ptr, 343 syntax_ptr,
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 68b9f89c3..cc1726e9e 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -258,7 +258,7 @@ impl<'a> PathSegments<'a> {
258} 258}
259 259
260impl GenericArgs { 260impl GenericArgs {
261 pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::TypeArgList) -> Option<GenericArgs> { 261 pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::GenericArgList) -> Option<GenericArgs> {
262 lower::lower_generic_args(lower_ctx, node) 262 lower::lower_generic_args(lower_ctx, node)
263 } 263 }
264 264
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs
index 257f9a033..d09fc66e4 100644
--- a/crates/ra_hir_def/src/path/lower.rs
+++ b/crates/ra_hir_def/src/path/lower.rs
@@ -41,7 +41,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
41 match hygiene.name_ref_to_name(name_ref) { 41 match hygiene.name_ref_to_name(name_ref) {
42 Either::Left(name) => { 42 Either::Left(name) => {
43 let args = segment 43 let args = segment
44 .type_arg_list() 44 .generic_arg_list()
45 .and_then(|it| lower_generic_args(&ctx, it)) 45 .and_then(|it| lower_generic_args(&ctx, it))
46 .or_else(|| { 46 .or_else(|| {
47 lower_generic_args_from_fn_path( 47 lower_generic_args_from_fn_path(
@@ -148,33 +148,37 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
148 148
149pub(super) fn lower_generic_args( 149pub(super) fn lower_generic_args(
150 lower_ctx: &LowerCtx, 150 lower_ctx: &LowerCtx,
151 node: ast::TypeArgList, 151 node: ast::GenericArgList,
152) -> Option<GenericArgs> { 152) -> Option<GenericArgs> {
153 let mut args = Vec::new(); 153 let mut args = Vec::new();
154 for type_arg in node.type_args() {
155 let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
156 args.push(GenericArg::Type(type_ref));
157 }
158 // lifetimes ignored for now
159 let mut bindings = Vec::new(); 154 let mut bindings = Vec::new();
160 for assoc_type_arg in node.assoc_type_args() { 155 for generic_arg in node.generic_args() {
161 let assoc_type_arg: ast::AssocTypeArg = assoc_type_arg; 156 match generic_arg {
162 if let Some(name_ref) = assoc_type_arg.name_ref() { 157 ast::GenericArg::TypeArg(type_arg) => {
163 let name = name_ref.as_name(); 158 let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
164 let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it)); 159 args.push(GenericArg::Type(type_ref));
165 let bounds = if let Some(l) = assoc_type_arg.type_bound_list() { 160 }
166 l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect() 161 ast::GenericArg::AssocTypeArg(assoc_type_arg) => {
167 } else { 162 if let Some(name_ref) = assoc_type_arg.name_ref() {
168 Vec::new() 163 let name = name_ref.as_name();
169 }; 164 let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
170 bindings.push(AssociatedTypeBinding { name, type_ref, bounds }); 165 let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
166 l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
167 } else {
168 Vec::new()
169 };
170 bindings.push(AssociatedTypeBinding { name, type_ref, bounds });
171 }
172 }
173 // Lifetimes and constants are ignored for now.
174 ast::GenericArg::LifetimeArg(_) | ast::GenericArg::ConstArg(_) => (),
171 } 175 }
172 } 176 }
177
173 if args.is_empty() && bindings.is_empty() { 178 if args.is_empty() && bindings.is_empty() {
174 None 179 return None;
175 } else {
176 Some(GenericArgs { args, has_self_type: false, bindings })
177 } 180 }
181 Some(GenericArgs { args, has_self_type: false, bindings })
178} 182}
179 183
180/// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y) 184/// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y)
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 2113abbb2..2a5f3c3d2 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -377,7 +377,7 @@ impl<'a> CompletionContext<'a> {
377 path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some(); 377 path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some();
378 378
379 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); 379 self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some();
380 self.has_type_args = segment.type_arg_list().is_some(); 380 self.has_type_args = segment.generic_arg_list().is_some();
381 381
382 #[allow(deprecated)] 382 #[allow(deprecated)]
383 if let Some(path) = hir::Path::from_ast(path.clone()) { 383 if let Some(path) = hir::Path::from_ast(path.clone()) {
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index fc81b48cc..319fd500d 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -45,7 +45,7 @@ fn try_extend_selection(
45 VARIANT_LIST, 45 VARIANT_LIST,
46 USE_TREE_LIST, 46 USE_TREE_LIST,
47 GENERIC_PARAM_LIST, 47 GENERIC_PARAM_LIST,
48 TYPE_ARG_LIST, 48 GENERIC_ARG_LIST,
49 TYPE_BOUND_LIST, 49 TYPE_BOUND_LIST,
50 PARAM_LIST, 50 PARAM_LIST,
51 ARG_LIST, 51 ARG_LIST,
diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs
index 2d61f9d80..aef7cd6fb 100644
--- a/crates/ra_parser/src/grammar/type_args.rs
+++ b/crates/ra_parser/src/grammar/type_args.rs
@@ -22,7 +22,7 @@ pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) {
22 } 22 }
23 } 23 }
24 p.expect(T![>]); 24 p.expect(T![>]);
25 m.complete(p, TYPE_ARG_LIST); 25 m.complete(p, GENERIC_ARG_LIST);
26} 26}
27 27
28// test type_arg 28// test type_arg
@@ -52,7 +52,7 @@ fn type_arg(p: &mut Parser) {
52 m.complete(p, CONST_ARG); 52 m.complete(p, CONST_ARG);
53 } 53 }
54 k if k.is_literal() => { 54 k if k.is_literal() => {
55 p.bump(k); 55 expressions::literal(p);
56 m.complete(p, CONST_ARG); 56 m.complete(p, CONST_ARG);
57 } 57 }
58 _ => { 58 _ => {
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 2830c0d74..c3670fb62 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -235,7 +235,7 @@ pub enum SyntaxKind {
235 LIFETIME_PARAM, 235 LIFETIME_PARAM,
236 TYPE_PARAM, 236 TYPE_PARAM,
237 CONST_PARAM, 237 CONST_PARAM,
238 TYPE_ARG_LIST, 238 GENERIC_ARG_LIST,
239 LIFETIME_ARG, 239 LIFETIME_ARG,
240 TYPE_ARG, 240 TYPE_ARG,
241 ASSOC_TYPE_ARG, 241 ASSOC_TYPE_ARG,
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs
index 74e15c631..0f72fea69 100644
--- a/crates/ra_ssr/src/matching.rs
+++ b/crates/ra_ssr/src/matching.rs
@@ -348,8 +348,8 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
348 // separately via comparing what the path resolves to below. 348 // separately via comparing what the path resolves to below.
349 self.attempt_match_opt( 349 self.attempt_match_opt(
350 phase, 350 phase,
351 pattern_segment.type_arg_list(), 351 pattern_segment.generic_arg_list(),
352 code_segment.type_arg_list(), 352 code_segment.generic_arg_list(),
353 )?; 353 )?;
354 self.attempt_match_opt( 354 self.attempt_match_opt(
355 phase, 355 phase,
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs
index 78d456546..c2fd3b905 100644
--- a/crates/ra_ssr/src/resolving.rs
+++ b/crates/ra_ssr/src/resolving.rs
@@ -217,7 +217,7 @@ fn pick_node_for_resolution(node: SyntaxNode) -> SyntaxNode {
217fn path_contains_type_arguments(path: Option<ast::Path>) -> bool { 217fn path_contains_type_arguments(path: Option<ast::Path>) -> bool {
218 if let Some(path) = path { 218 if let Some(path) = path {
219 if let Some(segment) = path.segment() { 219 if let Some(segment) = path.segment() {
220 if segment.type_arg_list().is_some() { 220 if segment.generic_arg_list().is_some() {
221 mark::hit!(type_arguments_within_path); 221 mark::hit!(type_arguments_within_path);
222 return true; 222 return true;
223 } 223 }
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 8d3e42f25..04746ef8f 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -237,17 +237,17 @@ impl ast::Path {
237 237
238impl ast::PathSegment { 238impl ast::PathSegment {
239 #[must_use] 239 #[must_use]
240 pub fn with_type_args(&self, type_args: ast::TypeArgList) -> ast::PathSegment { 240 pub fn with_type_args(&self, type_args: ast::GenericArgList) -> ast::PathSegment {
241 self._with_type_args(type_args, false) 241 self._with_type_args(type_args, false)
242 } 242 }
243 243
244 #[must_use] 244 #[must_use]
245 pub fn with_turbo_fish(&self, type_args: ast::TypeArgList) -> ast::PathSegment { 245 pub fn with_turbo_fish(&self, type_args: ast::GenericArgList) -> ast::PathSegment {
246 self._with_type_args(type_args, true) 246 self._with_type_args(type_args, true)
247 } 247 }
248 248
249 fn _with_type_args(&self, type_args: ast::TypeArgList, turbo: bool) -> ast::PathSegment { 249 fn _with_type_args(&self, type_args: ast::GenericArgList, turbo: bool) -> ast::PathSegment {
250 if let Some(old) = self.type_arg_list() { 250 if let Some(old) = self.generic_arg_list() {
251 return self.replace_children( 251 return self.replace_children(
252 single_node(old.syntax().clone()), 252 single_node(old.syntax().clone()),
253 iter::once(type_args.syntax().clone().into()), 253 iter::once(type_args.syntax().clone().into()),
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index e049548c9..c25fa7d5f 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -6,6 +6,116 @@ use crate::{
6 SyntaxNode, SyntaxToken, T, 6 SyntaxNode, SyntaxToken, T,
7}; 7};
8#[derive(Debug, Clone, PartialEq, Eq, Hash)] 8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct Path {
10 pub(crate) syntax: SyntaxNode,
11}
12impl Path {
13 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
14 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
15 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
16}
17#[derive(Debug, Clone, PartialEq, Eq, Hash)]
18pub struct PathSegment {
19 pub(crate) syntax: SyntaxNode,
20}
21impl PathSegment {
22 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
23 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
24 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
25 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
26 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
27 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
28 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
29 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
30 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
31 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
32 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
33 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
34}
35#[derive(Debug, Clone, PartialEq, Eq, Hash)]
36pub struct NameRef {
37 pub(crate) syntax: SyntaxNode,
38}
39impl NameRef {
40 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
41}
42#[derive(Debug, Clone, PartialEq, Eq, Hash)]
43pub struct GenericArgList {
44 pub(crate) syntax: SyntaxNode,
45}
46impl GenericArgList {
47 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
48 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
49 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
50 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
51}
52#[derive(Debug, Clone, PartialEq, Eq, Hash)]
53pub struct ParamList {
54 pub(crate) syntax: SyntaxNode,
55}
56impl ParamList {
57 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
58 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
59 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
60 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
61 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
62}
63#[derive(Debug, Clone, PartialEq, Eq, Hash)]
64pub struct RetType {
65 pub(crate) syntax: SyntaxNode,
66}
67impl RetType {
68 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
69 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
70}
71#[derive(Debug, Clone, PartialEq, Eq, Hash)]
72pub struct PathType {
73 pub(crate) syntax: SyntaxNode,
74}
75impl PathType {
76 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
77}
78#[derive(Debug, Clone, PartialEq, Eq, Hash)]
79pub struct TypeArg {
80 pub(crate) syntax: SyntaxNode,
81}
82impl TypeArg {
83 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
84}
85#[derive(Debug, Clone, PartialEq, Eq, Hash)]
86pub struct AssocTypeArg {
87 pub(crate) syntax: SyntaxNode,
88}
89impl ast::TypeBoundsOwner for AssocTypeArg {}
90impl AssocTypeArg {
91 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
92 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
93 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
94}
95#[derive(Debug, Clone, PartialEq, Eq, Hash)]
96pub struct LifetimeArg {
97 pub(crate) syntax: SyntaxNode,
98}
99impl LifetimeArg {
100 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
101 support::token(&self.syntax, T![lifetime])
102 }
103}
104#[derive(Debug, Clone, PartialEq, Eq, Hash)]
105pub struct ConstArg {
106 pub(crate) syntax: SyntaxNode,
107}
108impl ConstArg {
109 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
110}
111#[derive(Debug, Clone, PartialEq, Eq, Hash)]
112pub struct TypeBoundList {
113 pub(crate) syntax: SyntaxNode,
114}
115impl TypeBoundList {
116 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
117}
118#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct SourceFile { 119pub struct SourceFile {
10 pub(crate) syntax: SyntaxNode, 120 pub(crate) syntax: SyntaxNode,
11} 121}
@@ -256,13 +366,6 @@ impl ItemList {
256 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 366 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
257} 367}
258#[derive(Debug, Clone, PartialEq, Eq, Hash)] 368#[derive(Debug, Clone, PartialEq, Eq, Hash)]
259pub struct NameRef {
260 pub(crate) syntax: SyntaxNode,
261}
262impl NameRef {
263 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
264}
265#[derive(Debug, Clone, PartialEq, Eq, Hash)]
266pub struct Rename { 369pub struct Rename {
267 pub(crate) syntax: SyntaxNode, 370 pub(crate) syntax: SyntaxNode,
268} 371}
@@ -283,15 +386,6 @@ impl UseTree {
283 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } 386 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
284} 387}
285#[derive(Debug, Clone, PartialEq, Eq, Hash)] 388#[derive(Debug, Clone, PartialEq, Eq, Hash)]
286pub struct Path {
287 pub(crate) syntax: SyntaxNode,
288}
289impl Path {
290 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
291 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
292 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
293}
294#[derive(Debug, Clone, PartialEq, Eq, Hash)]
295pub struct UseTreeList { 389pub struct UseTreeList {
296 pub(crate) syntax: SyntaxNode, 390 pub(crate) syntax: SyntaxNode,
297} 391}
@@ -317,25 +411,6 @@ impl GenericParamList {
317 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } 411 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
318} 412}
319#[derive(Debug, Clone, PartialEq, Eq, Hash)] 413#[derive(Debug, Clone, PartialEq, Eq, Hash)]
320pub struct ParamList {
321 pub(crate) syntax: SyntaxNode,
322}
323impl ParamList {
324 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
325 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
326 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
327 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
328 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
329}
330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
331pub struct RetType {
332 pub(crate) syntax: SyntaxNode,
333}
334impl RetType {
335 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
336 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
337}
338#[derive(Debug, Clone, PartialEq, Eq, Hash)]
339pub struct WhereClause { 414pub struct WhereClause {
340 pub(crate) syntax: SyntaxNode, 415 pub(crate) syntax: SyntaxNode,
341} 416}
@@ -381,13 +456,6 @@ impl Param {
381 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } 456 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
382} 457}
383#[derive(Debug, Clone, PartialEq, Eq, Hash)] 458#[derive(Debug, Clone, PartialEq, Eq, Hash)]
384pub struct TypeBoundList {
385 pub(crate) syntax: SyntaxNode,
386}
387impl TypeBoundList {
388 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
389}
390#[derive(Debug, Clone, PartialEq, Eq, Hash)]
391pub struct RecordFieldList { 459pub struct RecordFieldList {
392 pub(crate) syntax: SyntaxNode, 460 pub(crate) syntax: SyntaxNode,
393} 461}
@@ -731,7 +799,7 @@ impl MethodCallExpr {
731 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 799 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
732 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 800 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
733 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 801 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
734 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } 802 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
735} 803}
736#[derive(Debug, Clone, PartialEq, Eq, Hash)] 804#[derive(Debug, Clone, PartialEq, Eq, Hash)]
737pub struct ParenExpr { 805pub struct ParenExpr {
@@ -866,19 +934,6 @@ impl ArgList {
866 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 934 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
867} 935}
868#[derive(Debug, Clone, PartialEq, Eq, Hash)] 936#[derive(Debug, Clone, PartialEq, Eq, Hash)]
869pub struct TypeArgList {
870 pub(crate) syntax: SyntaxNode,
871}
872impl TypeArgList {
873 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
874 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
875 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
876 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
877 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
878 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
879 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
880}
881#[derive(Debug, Clone, PartialEq, Eq, Hash)]
882pub struct Condition { 937pub struct Condition {
883 pub(crate) syntax: SyntaxNode, 938 pub(crate) syntax: SyntaxNode,
884} 939}
@@ -991,13 +1046,6 @@ impl ParenType {
991 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1046 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
992} 1047}
993#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1048#[derive(Debug, Clone, PartialEq, Eq, Hash)]
994pub struct PathType {
995 pub(crate) syntax: SyntaxNode,
996}
997impl PathType {
998 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
999}
1000#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1001pub struct PointerType { 1049pub struct PointerType {
1002 pub(crate) syntax: SyntaxNode, 1050 pub(crate) syntax: SyntaxNode,
1003} 1051}
@@ -1220,74 +1268,12 @@ impl MacroStmts {
1220 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1268 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1221} 1269}
1222#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1270#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1223pub struct PathSegment { 1271pub enum GenericArg {
1224 pub(crate) syntax: SyntaxNode, 1272 TypeArg(TypeArg),
1225} 1273 AssocTypeArg(AssocTypeArg),
1226impl PathSegment { 1274 LifetimeArg(LifetimeArg),
1227 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } 1275 ConstArg(ConstArg),
1228 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
1229 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
1230 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
1231 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
1232 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1233 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1234 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1235 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1236 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
1237 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
1238}
1239#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1240pub struct TypeArg {
1241 pub(crate) syntax: SyntaxNode,
1242}
1243impl TypeArg {
1244 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1245}
1246#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1247pub struct LifetimeArg {
1248 pub(crate) syntax: SyntaxNode,
1249}
1250impl LifetimeArg {
1251 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1252 support::token(&self.syntax, T![lifetime])
1253 }
1254}
1255#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1256pub struct AssocTypeArg {
1257 pub(crate) syntax: SyntaxNode,
1258}
1259impl ast::TypeBoundsOwner for AssocTypeArg {}
1260impl AssocTypeArg {
1261 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1262 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1263 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1264}
1265#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1266pub struct ConstArg {
1267 pub(crate) syntax: SyntaxNode,
1268}
1269impl ConstArg {
1270 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1271 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
1272}
1273#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1274pub enum Item {
1275 Const(Const),
1276 Enum(Enum),
1277 ExternBlock(ExternBlock),
1278 ExternCrate(ExternCrate),
1279 Fn(Fn),
1280 Impl(Impl),
1281 MacroCall(MacroCall),
1282 Module(Module),
1283 Static(Static),
1284 Struct(Struct),
1285 Trait(Trait),
1286 TypeAlias(TypeAlias),
1287 Union(Union),
1288 Use(Use),
1289} 1276}
1290impl ast::AttrsOwner for Item {}
1291#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1277#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1292pub enum Type { 1278pub enum Type {
1293 ArrayType(ArrayType), 1279 ArrayType(ArrayType),
@@ -1305,29 +1291,6 @@ pub enum Type {
1305 TupleType(TupleType), 1291 TupleType(TupleType),
1306} 1292}
1307#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1293#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1308pub enum Pat {
1309 OrPat(OrPat),
1310 ParenPat(ParenPat),
1311 RefPat(RefPat),
1312 BoxPat(BoxPat),
1313 BindPat(BindPat),
1314 PlaceholderPat(PlaceholderPat),
1315 DotDotPat(DotDotPat),
1316 PathPat(PathPat),
1317 RecordPat(RecordPat),
1318 TupleStructPat(TupleStructPat),
1319 TuplePat(TuplePat),
1320 SlicePat(SlicePat),
1321 RangePat(RangePat),
1322 LiteralPat(LiteralPat),
1323 MacroPat(MacroPat),
1324}
1325#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1326pub enum FieldList {
1327 RecordFieldList(RecordFieldList),
1328 TupleFieldList(TupleFieldList),
1329}
1330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1331pub enum Expr { 1294pub enum Expr {
1332 ArrayExpr(ArrayExpr), 1295 ArrayExpr(ArrayExpr),
1333 AwaitExpr(AwaitExpr), 1296 AwaitExpr(AwaitExpr),
@@ -1361,6 +1324,47 @@ pub enum Expr {
1361 WhileExpr(WhileExpr), 1324 WhileExpr(WhileExpr),
1362} 1325}
1363#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1326#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1327pub enum Item {
1328 Const(Const),
1329 Enum(Enum),
1330 ExternBlock(ExternBlock),
1331 ExternCrate(ExternCrate),
1332 Fn(Fn),
1333 Impl(Impl),
1334 MacroCall(MacroCall),
1335 Module(Module),
1336 Static(Static),
1337 Struct(Struct),
1338 Trait(Trait),
1339 TypeAlias(TypeAlias),
1340 Union(Union),
1341 Use(Use),
1342}
1343impl ast::AttrsOwner for Item {}
1344#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1345pub enum Pat {
1346 OrPat(OrPat),
1347 ParenPat(ParenPat),
1348 RefPat(RefPat),
1349 BoxPat(BoxPat),
1350 BindPat(BindPat),
1351 PlaceholderPat(PlaceholderPat),
1352 DotDotPat(DotDotPat),
1353 PathPat(PathPat),
1354 RecordPat(RecordPat),
1355 TupleStructPat(TupleStructPat),
1356 TuplePat(TuplePat),
1357 SlicePat(SlicePat),
1358 RangePat(RangePat),
1359 LiteralPat(LiteralPat),
1360 MacroPat(MacroPat),
1361}
1362#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1363pub enum FieldList {
1364 RecordFieldList(RecordFieldList),
1365 TupleFieldList(TupleFieldList),
1366}
1367#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1364pub enum AdtDef { 1368pub enum AdtDef {
1365 Enum(Enum), 1369 Enum(Enum),
1366 Struct(Struct), 1370 Struct(Struct),
@@ -1400,6 +1404,138 @@ pub enum Stmt {
1400 Item(Item), 1404 Item(Item),
1401 LetStmt(LetStmt), 1405 LetStmt(LetStmt),
1402} 1406}
1407impl AstNode for Path {
1408 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1409 fn cast(syntax: SyntaxNode) -> Option<Self> {
1410 if Self::can_cast(syntax.kind()) {
1411 Some(Self { syntax })
1412 } else {
1413 None
1414 }
1415 }
1416 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1417}
1418impl AstNode for PathSegment {
1419 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
1420 fn cast(syntax: SyntaxNode) -> Option<Self> {
1421 if Self::can_cast(syntax.kind()) {
1422 Some(Self { syntax })
1423 } else {
1424 None
1425 }
1426 }
1427 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1428}
1429impl AstNode for NameRef {
1430 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
1431 fn cast(syntax: SyntaxNode) -> Option<Self> {
1432 if Self::can_cast(syntax.kind()) {
1433 Some(Self { syntax })
1434 } else {
1435 None
1436 }
1437 }
1438 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1439}
1440impl AstNode for GenericArgList {
1441 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST }
1442 fn cast(syntax: SyntaxNode) -> Option<Self> {
1443 if Self::can_cast(syntax.kind()) {
1444 Some(Self { syntax })
1445 } else {
1446 None
1447 }
1448 }
1449 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1450}
1451impl AstNode for ParamList {
1452 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
1453 fn cast(syntax: SyntaxNode) -> Option<Self> {
1454 if Self::can_cast(syntax.kind()) {
1455 Some(Self { syntax })
1456 } else {
1457 None
1458 }
1459 }
1460 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1461}
1462impl AstNode for RetType {
1463 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
1464 fn cast(syntax: SyntaxNode) -> Option<Self> {
1465 if Self::can_cast(syntax.kind()) {
1466 Some(Self { syntax })
1467 } else {
1468 None
1469 }
1470 }
1471 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1472}
1473impl AstNode for PathType {
1474 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
1475 fn cast(syntax: SyntaxNode) -> Option<Self> {
1476 if Self::can_cast(syntax.kind()) {
1477 Some(Self { syntax })
1478 } else {
1479 None
1480 }
1481 }
1482 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1483}
1484impl AstNode for TypeArg {
1485 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
1486 fn cast(syntax: SyntaxNode) -> Option<Self> {
1487 if Self::can_cast(syntax.kind()) {
1488 Some(Self { syntax })
1489 } else {
1490 None
1491 }
1492 }
1493 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1494}
1495impl AstNode for AssocTypeArg {
1496 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
1497 fn cast(syntax: SyntaxNode) -> Option<Self> {
1498 if Self::can_cast(syntax.kind()) {
1499 Some(Self { syntax })
1500 } else {
1501 None
1502 }
1503 }
1504 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1505}
1506impl AstNode for LifetimeArg {
1507 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
1508 fn cast(syntax: SyntaxNode) -> Option<Self> {
1509 if Self::can_cast(syntax.kind()) {
1510 Some(Self { syntax })
1511 } else {
1512 None
1513 }
1514 }
1515 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1516}
1517impl AstNode for ConstArg {
1518 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
1519 fn cast(syntax: SyntaxNode) -> Option<Self> {
1520 if Self::can_cast(syntax.kind()) {
1521 Some(Self { syntax })
1522 } else {
1523 None
1524 }
1525 }
1526 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1527}
1528impl AstNode for TypeBoundList {
1529 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
1530 fn cast(syntax: SyntaxNode) -> Option<Self> {
1531 if Self::can_cast(syntax.kind()) {
1532 Some(Self { syntax })
1533 } else {
1534 None
1535 }
1536 }
1537 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1538}
1403impl AstNode for SourceFile { 1539impl AstNode for SourceFile {
1404 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } 1540 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
1405 fn cast(syntax: SyntaxNode) -> Option<Self> { 1541 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -1609,17 +1745,6 @@ impl AstNode for ItemList {
1609 } 1745 }
1610 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1746 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1611} 1747}
1612impl AstNode for NameRef {
1613 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
1614 fn cast(syntax: SyntaxNode) -> Option<Self> {
1615 if Self::can_cast(syntax.kind()) {
1616 Some(Self { syntax })
1617 } else {
1618 None
1619 }
1620 }
1621 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1622}
1623impl AstNode for Rename { 1748impl AstNode for Rename {
1624 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } 1749 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME }
1625 fn cast(syntax: SyntaxNode) -> Option<Self> { 1750 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -1642,17 +1767,6 @@ impl AstNode for UseTree {
1642 } 1767 }
1643 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1768 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1644} 1769}
1645impl AstNode for Path {
1646 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1647 fn cast(syntax: SyntaxNode) -> Option<Self> {
1648 if Self::can_cast(syntax.kind()) {
1649 Some(Self { syntax })
1650 } else {
1651 None
1652 }
1653 }
1654 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1655}
1656impl AstNode for UseTreeList { 1770impl AstNode for UseTreeList {
1657 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } 1771 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
1658 fn cast(syntax: SyntaxNode) -> Option<Self> { 1772 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -1686,28 +1800,6 @@ impl AstNode for GenericParamList {
1686 } 1800 }
1687 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1801 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1688} 1802}
1689impl AstNode for ParamList {
1690 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
1691 fn cast(syntax: SyntaxNode) -> Option<Self> {
1692 if Self::can_cast(syntax.kind()) {
1693 Some(Self { syntax })
1694 } else {
1695 None
1696 }
1697 }
1698 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1699}
1700impl AstNode for RetType {
1701 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
1702 fn cast(syntax: SyntaxNode) -> Option<Self> {
1703 if Self::can_cast(syntax.kind()) {
1704 Some(Self { syntax })
1705 } else {
1706 None
1707 }
1708 }
1709 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1710}
1711impl AstNode for WhereClause { 1803impl AstNode for WhereClause {
1712 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } 1804 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
1713 fn cast(syntax: SyntaxNode) -> Option<Self> { 1805 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -1752,17 +1844,6 @@ impl AstNode for Param {
1752 } 1844 }
1753 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1845 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1754} 1846}
1755impl AstNode for TypeBoundList {
1756 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
1757 fn cast(syntax: SyntaxNode) -> Option<Self> {
1758 if Self::can_cast(syntax.kind()) {
1759 Some(Self { syntax })
1760 } else {
1761 None
1762 }
1763 }
1764 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1765}
1766impl AstNode for RecordFieldList { 1847impl AstNode for RecordFieldList {
1767 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } 1848 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
1768 fn cast(syntax: SyntaxNode) -> Option<Self> { 1849 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -2280,17 +2361,6 @@ impl AstNode for ArgList {
2280 } 2361 }
2281 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2362 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2282} 2363}
2283impl AstNode for TypeArgList {
2284 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST }
2285 fn cast(syntax: SyntaxNode) -> Option<Self> {
2286 if Self::can_cast(syntax.kind()) {
2287 Some(Self { syntax })
2288 } else {
2289 None
2290 }
2291 }
2292 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2293}
2294impl AstNode for Condition { 2364impl AstNode for Condition {
2295 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } 2365 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
2296 fn cast(syntax: SyntaxNode) -> Option<Self> { 2366 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -2423,17 +2493,6 @@ impl AstNode for ParenType {
2423 } 2493 }
2424 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2494 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2425} 2495}
2426impl AstNode for PathType {
2427 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
2428 fn cast(syntax: SyntaxNode) -> Option<Self> {
2429 if Self::can_cast(syntax.kind()) {
2430 Some(Self { syntax })
2431 } else {
2432 None
2433 }
2434 }
2435 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2436}
2437impl AstNode for PointerType { 2496impl AstNode for PointerType {
2438 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } 2497 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE }
2439 fn cast(syntax: SyntaxNode) -> Option<Self> { 2498 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -2709,147 +2768,41 @@ impl AstNode for MacroStmts {
2709 } 2768 }
2710 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2769 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2711} 2770}
2712impl AstNode for PathSegment { 2771impl From<TypeArg> for GenericArg {
2713 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } 2772 fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
2714 fn cast(syntax: SyntaxNode) -> Option<Self> {
2715 if Self::can_cast(syntax.kind()) {
2716 Some(Self { syntax })
2717 } else {
2718 None
2719 }
2720 }
2721 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2722}
2723impl AstNode for TypeArg {
2724 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
2725 fn cast(syntax: SyntaxNode) -> Option<Self> {
2726 if Self::can_cast(syntax.kind()) {
2727 Some(Self { syntax })
2728 } else {
2729 None
2730 }
2731 }
2732 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2733}
2734impl AstNode for LifetimeArg {
2735 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
2736 fn cast(syntax: SyntaxNode) -> Option<Self> {
2737 if Self::can_cast(syntax.kind()) {
2738 Some(Self { syntax })
2739 } else {
2740 None
2741 }
2742 }
2743 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2744}
2745impl AstNode for AssocTypeArg {
2746 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
2747 fn cast(syntax: SyntaxNode) -> Option<Self> {
2748 if Self::can_cast(syntax.kind()) {
2749 Some(Self { syntax })
2750 } else {
2751 None
2752 }
2753 }
2754 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2755}
2756impl AstNode for ConstArg {
2757 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
2758 fn cast(syntax: SyntaxNode) -> Option<Self> {
2759 if Self::can_cast(syntax.kind()) {
2760 Some(Self { syntax })
2761 } else {
2762 None
2763 }
2764 }
2765 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2766}
2767impl From<Const> for Item {
2768 fn from(node: Const) -> Item { Item::Const(node) }
2769}
2770impl From<Enum> for Item {
2771 fn from(node: Enum) -> Item { Item::Enum(node) }
2772}
2773impl From<ExternBlock> for Item {
2774 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) }
2775}
2776impl From<ExternCrate> for Item {
2777 fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) }
2778}
2779impl From<Fn> for Item {
2780 fn from(node: Fn) -> Item { Item::Fn(node) }
2781}
2782impl From<Impl> for Item {
2783 fn from(node: Impl) -> Item { Item::Impl(node) }
2784}
2785impl From<MacroCall> for Item {
2786 fn from(node: MacroCall) -> Item { Item::MacroCall(node) }
2787}
2788impl From<Module> for Item {
2789 fn from(node: Module) -> Item { Item::Module(node) }
2790}
2791impl From<Static> for Item {
2792 fn from(node: Static) -> Item { Item::Static(node) }
2793}
2794impl From<Struct> for Item {
2795 fn from(node: Struct) -> Item { Item::Struct(node) }
2796} 2773}
2797impl From<Trait> for Item { 2774impl From<AssocTypeArg> for GenericArg {
2798 fn from(node: Trait) -> Item { Item::Trait(node) } 2775 fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
2799} 2776}
2800impl From<TypeAlias> for Item { 2777impl From<LifetimeArg> for GenericArg {
2801 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } 2778 fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) }
2802} 2779}
2803impl From<Union> for Item { 2780impl From<ConstArg> for GenericArg {
2804 fn from(node: Union) -> Item { Item::Union(node) } 2781 fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) }
2805}
2806impl From<Use> for Item {
2807 fn from(node: Use) -> Item { Item::Use(node) }
2808} 2782}
2809impl AstNode for Item { 2783impl AstNode for GenericArg {
2810 fn can_cast(kind: SyntaxKind) -> bool { 2784 fn can_cast(kind: SyntaxKind) -> bool {
2811 match kind { 2785 match kind {
2812 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE 2786 TYPE_ARG | ASSOC_TYPE_ARG | LIFETIME_ARG | CONST_ARG => true,
2813 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
2814 _ => false, 2787 _ => false,
2815 } 2788 }
2816 } 2789 }
2817 fn cast(syntax: SyntaxNode) -> Option<Self> { 2790 fn cast(syntax: SyntaxNode) -> Option<Self> {
2818 let res = match syntax.kind() { 2791 let res = match syntax.kind() {
2819 CONST => Item::Const(Const { syntax }), 2792 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
2820 ENUM => Item::Enum(Enum { syntax }), 2793 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
2821 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), 2794 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
2822 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), 2795 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
2823 FN => Item::Fn(Fn { syntax }),
2824 IMPL => Item::Impl(Impl { syntax }),
2825 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
2826 MODULE => Item::Module(Module { syntax }),
2827 STATIC => Item::Static(Static { syntax }),
2828 STRUCT => Item::Struct(Struct { syntax }),
2829 TRAIT => Item::Trait(Trait { syntax }),
2830 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
2831 UNION => Item::Union(Union { syntax }),
2832 USE => Item::Use(Use { syntax }),
2833 _ => return None, 2796 _ => return None,
2834 }; 2797 };
2835 Some(res) 2798 Some(res)
2836 } 2799 }
2837 fn syntax(&self) -> &SyntaxNode { 2800 fn syntax(&self) -> &SyntaxNode {
2838 match self { 2801 match self {
2839 Item::Const(it) => &it.syntax, 2802 GenericArg::TypeArg(it) => &it.syntax,
2840 Item::Enum(it) => &it.syntax, 2803 GenericArg::AssocTypeArg(it) => &it.syntax,
2841 Item::ExternBlock(it) => &it.syntax, 2804 GenericArg::LifetimeArg(it) => &it.syntax,
2842 Item::ExternCrate(it) => &it.syntax, 2805 GenericArg::ConstArg(it) => &it.syntax,
2843 Item::Fn(it) => &it.syntax,
2844 Item::Impl(it) => &it.syntax,
2845 Item::MacroCall(it) => &it.syntax,
2846 Item::Module(it) => &it.syntax,
2847 Item::Static(it) => &it.syntax,
2848 Item::Struct(it) => &it.syntax,
2849 Item::Trait(it) => &it.syntax,
2850 Item::TypeAlias(it) => &it.syntax,
2851 Item::Union(it) => &it.syntax,
2852 Item::Use(it) => &it.syntax,
2853 } 2806 }
2854 } 2807 }
2855} 2808}
@@ -2938,129 +2891,6 @@ impl AstNode for Type {
2938 } 2891 }
2939 } 2892 }
2940} 2893}
2941impl From<OrPat> for Pat {
2942 fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
2943}
2944impl From<ParenPat> for Pat {
2945 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
2946}
2947impl From<RefPat> for Pat {
2948 fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
2949}
2950impl From<BoxPat> for Pat {
2951 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
2952}
2953impl From<BindPat> for Pat {
2954 fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
2955}
2956impl From<PlaceholderPat> for Pat {
2957 fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
2958}
2959impl From<DotDotPat> for Pat {
2960 fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
2961}
2962impl From<PathPat> for Pat {
2963 fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
2964}
2965impl From<RecordPat> for Pat {
2966 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
2967}
2968impl From<TupleStructPat> for Pat {
2969 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
2970}
2971impl From<TuplePat> for Pat {
2972 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
2973}
2974impl From<SlicePat> for Pat {
2975 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
2976}
2977impl From<RangePat> for Pat {
2978 fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
2979}
2980impl From<LiteralPat> for Pat {
2981 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
2982}
2983impl From<MacroPat> for Pat {
2984 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
2985}
2986impl AstNode for Pat {
2987 fn can_cast(kind: SyntaxKind) -> bool {
2988 match kind {
2989 OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
2990 | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
2991 | LITERAL_PAT | MACRO_PAT => true,
2992 _ => false,
2993 }
2994 }
2995 fn cast(syntax: SyntaxNode) -> Option<Self> {
2996 let res = match syntax.kind() {
2997 OR_PAT => Pat::OrPat(OrPat { syntax }),
2998 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
2999 REF_PAT => Pat::RefPat(RefPat { syntax }),
3000 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
3001 BIND_PAT => Pat::BindPat(BindPat { syntax }),
3002 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
3003 DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
3004 PATH_PAT => Pat::PathPat(PathPat { syntax }),
3005 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
3006 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
3007 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
3008 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
3009 RANGE_PAT => Pat::RangePat(RangePat { syntax }),
3010 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
3011 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
3012 _ => return None,
3013 };
3014 Some(res)
3015 }
3016 fn syntax(&self) -> &SyntaxNode {
3017 match self {
3018 Pat::OrPat(it) => &it.syntax,
3019 Pat::ParenPat(it) => &it.syntax,
3020 Pat::RefPat(it) => &it.syntax,
3021 Pat::BoxPat(it) => &it.syntax,
3022 Pat::BindPat(it) => &it.syntax,
3023 Pat::PlaceholderPat(it) => &it.syntax,
3024 Pat::DotDotPat(it) => &it.syntax,
3025 Pat::PathPat(it) => &it.syntax,
3026 Pat::RecordPat(it) => &it.syntax,
3027 Pat::TupleStructPat(it) => &it.syntax,
3028 Pat::TuplePat(it) => &it.syntax,
3029 Pat::SlicePat(it) => &it.syntax,
3030 Pat::RangePat(it) => &it.syntax,
3031 Pat::LiteralPat(it) => &it.syntax,
3032 Pat::MacroPat(it) => &it.syntax,
3033 }
3034 }
3035}
3036impl From<RecordFieldList> for FieldList {
3037 fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
3038}
3039impl From<TupleFieldList> for FieldList {
3040 fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
3041}
3042impl AstNode for FieldList {
3043 fn can_cast(kind: SyntaxKind) -> bool {
3044 match kind {
3045 RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
3046 _ => false,
3047 }
3048 }
3049 fn cast(syntax: SyntaxNode) -> Option<Self> {
3050 let res = match syntax.kind() {
3051 RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
3052 TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
3053 _ => return None,
3054 };
3055 Some(res)
3056 }
3057 fn syntax(&self) -> &SyntaxNode {
3058 match self {
3059 FieldList::RecordFieldList(it) => &it.syntax,
3060 FieldList::TupleFieldList(it) => &it.syntax,
3061 }
3062 }
3063}
3064impl From<ArrayExpr> for Expr { 2894impl From<ArrayExpr> for Expr {
3065 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } 2895 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
3066} 2896}
@@ -3233,6 +3063,218 @@ impl AstNode for Expr {
3233 } 3063 }
3234 } 3064 }
3235} 3065}
3066impl From<Const> for Item {
3067 fn from(node: Const) -> Item { Item::Const(node) }
3068}
3069impl From<Enum> for Item {
3070 fn from(node: Enum) -> Item { Item::Enum(node) }
3071}
3072impl From<ExternBlock> for Item {
3073 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) }
3074}
3075impl From<ExternCrate> for Item {
3076 fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) }
3077}
3078impl From<Fn> for Item {
3079 fn from(node: Fn) -> Item { Item::Fn(node) }
3080}
3081impl From<Impl> for Item {
3082 fn from(node: Impl) -> Item { Item::Impl(node) }
3083}
3084impl From<MacroCall> for Item {
3085 fn from(node: MacroCall) -> Item { Item::MacroCall(node) }
3086}
3087impl From<Module> for Item {
3088 fn from(node: Module) -> Item { Item::Module(node) }
3089}
3090impl From<Static> for Item {
3091 fn from(node: Static) -> Item { Item::Static(node) }
3092}
3093impl From<Struct> for Item {
3094 fn from(node: Struct) -> Item { Item::Struct(node) }
3095}
3096impl From<Trait> for Item {
3097 fn from(node: Trait) -> Item { Item::Trait(node) }
3098}
3099impl From<TypeAlias> for Item {
3100 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
3101}
3102impl From<Union> for Item {
3103 fn from(node: Union) -> Item { Item::Union(node) }
3104}
3105impl From<Use> for Item {
3106 fn from(node: Use) -> Item { Item::Use(node) }
3107}
3108impl AstNode for Item {
3109 fn can_cast(kind: SyntaxKind) -> bool {
3110 match kind {
3111 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE
3112 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
3113 _ => false,
3114 }
3115 }
3116 fn cast(syntax: SyntaxNode) -> Option<Self> {
3117 let res = match syntax.kind() {
3118 CONST => Item::Const(Const { syntax }),
3119 ENUM => Item::Enum(Enum { syntax }),
3120 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
3121 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
3122 FN => Item::Fn(Fn { syntax }),
3123 IMPL => Item::Impl(Impl { syntax }),
3124 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
3125 MODULE => Item::Module(Module { syntax }),
3126 STATIC => Item::Static(Static { syntax }),
3127 STRUCT => Item::Struct(Struct { syntax }),
3128 TRAIT => Item::Trait(Trait { syntax }),
3129 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
3130 UNION => Item::Union(Union { syntax }),
3131 USE => Item::Use(Use { syntax }),
3132 _ => return None,
3133 };
3134 Some(res)
3135 }
3136 fn syntax(&self) -> &SyntaxNode {
3137 match self {
3138 Item::Const(it) => &it.syntax,
3139 Item::Enum(it) => &it.syntax,
3140 Item::ExternBlock(it) => &it.syntax,
3141 Item::ExternCrate(it) => &it.syntax,
3142 Item::Fn(it) => &it.syntax,
3143 Item::Impl(it) => &it.syntax,
3144 Item::MacroCall(it) => &it.syntax,
3145 Item::Module(it) => &it.syntax,
3146 Item::Static(it) => &it.syntax,
3147 Item::Struct(it) => &it.syntax,
3148 Item::Trait(it) => &it.syntax,
3149 Item::TypeAlias(it) => &it.syntax,
3150 Item::Union(it) => &it.syntax,
3151 Item::Use(it) => &it.syntax,
3152 }
3153 }
3154}
3155impl From<OrPat> for Pat {
3156 fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
3157}
3158impl From<ParenPat> for Pat {
3159 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
3160}
3161impl From<RefPat> for Pat {
3162 fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
3163}
3164impl From<BoxPat> for Pat {
3165 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
3166}
3167impl From<BindPat> for Pat {
3168 fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
3169}
3170impl From<PlaceholderPat> for Pat {
3171 fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
3172}
3173impl From<DotDotPat> for Pat {
3174 fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
3175}
3176impl From<PathPat> for Pat {
3177 fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
3178}
3179impl From<RecordPat> for Pat {
3180 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
3181}
3182impl From<TupleStructPat> for Pat {
3183 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
3184}
3185impl From<TuplePat> for Pat {
3186 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
3187}
3188impl From<SlicePat> for Pat {
3189 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
3190}
3191impl From<RangePat> for Pat {
3192 fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
3193}
3194impl From<LiteralPat> for Pat {
3195 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
3196}
3197impl From<MacroPat> for Pat {
3198 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
3199}
3200impl AstNode for Pat {
3201 fn can_cast(kind: SyntaxKind) -> bool {
3202 match kind {
3203 OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
3204 | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
3205 | LITERAL_PAT | MACRO_PAT => true,
3206 _ => false,
3207 }
3208 }
3209 fn cast(syntax: SyntaxNode) -> Option<Self> {
3210 let res = match syntax.kind() {
3211 OR_PAT => Pat::OrPat(OrPat { syntax }),
3212 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
3213 REF_PAT => Pat::RefPat(RefPat { syntax }),
3214 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
3215 BIND_PAT => Pat::BindPat(BindPat { syntax }),
3216 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
3217 DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
3218 PATH_PAT => Pat::PathPat(PathPat { syntax }),
3219 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
3220 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
3221 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
3222 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
3223 RANGE_PAT => Pat::RangePat(RangePat { syntax }),
3224 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
3225 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
3226 _ => return None,
3227 };
3228 Some(res)
3229 }
3230 fn syntax(&self) -> &SyntaxNode {
3231 match self {
3232 Pat::OrPat(it) => &it.syntax,
3233 Pat::ParenPat(it) => &it.syntax,
3234 Pat::RefPat(it) => &it.syntax,
3235 Pat::BoxPat(it) => &it.syntax,
3236 Pat::BindPat(it) => &it.syntax,
3237 Pat::PlaceholderPat(it) => &it.syntax,
3238 Pat::DotDotPat(it) => &it.syntax,
3239 Pat::PathPat(it) => &it.syntax,
3240 Pat::RecordPat(it) => &it.syntax,
3241 Pat::TupleStructPat(it) => &it.syntax,
3242 Pat::TuplePat(it) => &it.syntax,
3243 Pat::SlicePat(it) => &it.syntax,
3244 Pat::RangePat(it) => &it.syntax,
3245 Pat::LiteralPat(it) => &it.syntax,
3246 Pat::MacroPat(it) => &it.syntax,
3247 }
3248 }
3249}
3250impl From<RecordFieldList> for FieldList {
3251 fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
3252}
3253impl From<TupleFieldList> for FieldList {
3254 fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
3255}
3256impl AstNode for FieldList {
3257 fn can_cast(kind: SyntaxKind) -> bool {
3258 match kind {
3259 RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
3260 _ => false,
3261 }
3262 }
3263 fn cast(syntax: SyntaxNode) -> Option<Self> {
3264 let res = match syntax.kind() {
3265 RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
3266 TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
3267 _ => return None,
3268 };
3269 Some(res)
3270 }
3271 fn syntax(&self) -> &SyntaxNode {
3272 match self {
3273 FieldList::RecordFieldList(it) => &it.syntax,
3274 FieldList::TupleFieldList(it) => &it.syntax,
3275 }
3276 }
3277}
3236impl From<Enum> for AdtDef { 3278impl From<Enum> for AdtDef {
3237 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } 3279 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) }
3238} 3280}
@@ -3379,7 +3421,7 @@ impl From<Item> for Stmt {
3379impl From<LetStmt> for Stmt { 3421impl From<LetStmt> for Stmt {
3380 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } 3422 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3381} 3423}
3382impl std::fmt::Display for Item { 3424impl std::fmt::Display for GenericArg {
3383 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3425 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3384 std::fmt::Display::fmt(self.syntax(), f) 3426 std::fmt::Display::fmt(self.syntax(), f)
3385 } 3427 }
@@ -3389,17 +3431,22 @@ impl std::fmt::Display for Type {
3389 std::fmt::Display::fmt(self.syntax(), f) 3431 std::fmt::Display::fmt(self.syntax(), f)
3390 } 3432 }
3391} 3433}
3392impl std::fmt::Display for Pat { 3434impl std::fmt::Display for Expr {
3393 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3435 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3394 std::fmt::Display::fmt(self.syntax(), f) 3436 std::fmt::Display::fmt(self.syntax(), f)
3395 } 3437 }
3396} 3438}
3397impl std::fmt::Display for FieldList { 3439impl std::fmt::Display for Item {
3398 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3399 std::fmt::Display::fmt(self.syntax(), f) 3441 std::fmt::Display::fmt(self.syntax(), f)
3400 } 3442 }
3401} 3443}
3402impl std::fmt::Display for Expr { 3444impl std::fmt::Display for Pat {
3445 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3446 std::fmt::Display::fmt(self.syntax(), f)
3447 }
3448}
3449impl std::fmt::Display for FieldList {
3403 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3450 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3404 std::fmt::Display::fmt(self.syntax(), f) 3451 std::fmt::Display::fmt(self.syntax(), f)
3405 } 3452 }
@@ -3429,6 +3476,66 @@ impl std::fmt::Display for Stmt {
3429 std::fmt::Display::fmt(self.syntax(), f) 3476 std::fmt::Display::fmt(self.syntax(), f)
3430 } 3477 }
3431} 3478}
3479impl std::fmt::Display for Path {
3480 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3481 std::fmt::Display::fmt(self.syntax(), f)
3482 }
3483}
3484impl std::fmt::Display for PathSegment {
3485 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3486 std::fmt::Display::fmt(self.syntax(), f)
3487 }
3488}
3489impl std::fmt::Display for NameRef {
3490 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3491 std::fmt::Display::fmt(self.syntax(), f)
3492 }
3493}
3494impl std::fmt::Display for GenericArgList {
3495 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3496 std::fmt::Display::fmt(self.syntax(), f)
3497 }
3498}
3499impl std::fmt::Display for ParamList {
3500 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3501 std::fmt::Display::fmt(self.syntax(), f)
3502 }
3503}
3504impl std::fmt::Display for RetType {
3505 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3506 std::fmt::Display::fmt(self.syntax(), f)
3507 }
3508}
3509impl std::fmt::Display for PathType {
3510 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3511 std::fmt::Display::fmt(self.syntax(), f)
3512 }
3513}
3514impl std::fmt::Display for TypeArg {
3515 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3516 std::fmt::Display::fmt(self.syntax(), f)
3517 }
3518}
3519impl std::fmt::Display for AssocTypeArg {
3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3521 std::fmt::Display::fmt(self.syntax(), f)
3522 }
3523}
3524impl std::fmt::Display for LifetimeArg {
3525 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3526 std::fmt::Display::fmt(self.syntax(), f)
3527 }
3528}
3529impl std::fmt::Display for ConstArg {
3530 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3531 std::fmt::Display::fmt(self.syntax(), f)
3532 }
3533}
3534impl std::fmt::Display for TypeBoundList {
3535 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3536 std::fmt::Display::fmt(self.syntax(), f)
3537 }
3538}
3432impl std::fmt::Display for SourceFile { 3539impl std::fmt::Display for SourceFile {
3433 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3540 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3434 std::fmt::Display::fmt(self.syntax(), f) 3541 std::fmt::Display::fmt(self.syntax(), f)
@@ -3524,11 +3631,6 @@ impl std::fmt::Display for ItemList {
3524 std::fmt::Display::fmt(self.syntax(), f) 3631 std::fmt::Display::fmt(self.syntax(), f)
3525 } 3632 }
3526} 3633}
3527impl std::fmt::Display for NameRef {
3528 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3529 std::fmt::Display::fmt(self.syntax(), f)
3530 }
3531}
3532impl std::fmt::Display for Rename { 3634impl std::fmt::Display for Rename {
3533 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3635 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3534 std::fmt::Display::fmt(self.syntax(), f) 3636 std::fmt::Display::fmt(self.syntax(), f)
@@ -3539,11 +3641,6 @@ impl std::fmt::Display for UseTree {
3539 std::fmt::Display::fmt(self.syntax(), f) 3641 std::fmt::Display::fmt(self.syntax(), f)
3540 } 3642 }
3541} 3643}
3542impl std::fmt::Display for Path {
3543 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3544 std::fmt::Display::fmt(self.syntax(), f)
3545 }
3546}
3547impl std::fmt::Display for UseTreeList { 3644impl std::fmt::Display for UseTreeList {
3548 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3645 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3549 std::fmt::Display::fmt(self.syntax(), f) 3646 std::fmt::Display::fmt(self.syntax(), f)
@@ -3559,16 +3656,6 @@ impl std::fmt::Display for GenericParamList {
3559 std::fmt::Display::fmt(self.syntax(), f) 3656 std::fmt::Display::fmt(self.syntax(), f)
3560 } 3657 }
3561} 3658}
3562impl std::fmt::Display for ParamList {
3563 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3564 std::fmt::Display::fmt(self.syntax(), f)
3565 }
3566}
3567impl std::fmt::Display for RetType {
3568 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3569 std::fmt::Display::fmt(self.syntax(), f)
3570 }
3571}
3572impl std::fmt::Display for WhereClause { 3659impl std::fmt::Display for WhereClause {
3573 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3660 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3574 std::fmt::Display::fmt(self.syntax(), f) 3661 std::fmt::Display::fmt(self.syntax(), f)
@@ -3589,11 +3676,6 @@ impl std::fmt::Display for Param {
3589 std::fmt::Display::fmt(self.syntax(), f) 3676 std::fmt::Display::fmt(self.syntax(), f)
3590 } 3677 }
3591} 3678}
3592impl std::fmt::Display for TypeBoundList {
3593 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3594 std::fmt::Display::fmt(self.syntax(), f)
3595 }
3596}
3597impl std::fmt::Display for RecordFieldList { 3679impl std::fmt::Display for RecordFieldList {
3598 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3680 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3599 std::fmt::Display::fmt(self.syntax(), f) 3681 std::fmt::Display::fmt(self.syntax(), f)
@@ -3829,11 +3911,6 @@ impl std::fmt::Display for ArgList {
3829 std::fmt::Display::fmt(self.syntax(), f) 3911 std::fmt::Display::fmt(self.syntax(), f)
3830 } 3912 }
3831} 3913}
3832impl std::fmt::Display for TypeArgList {
3833 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3834 std::fmt::Display::fmt(self.syntax(), f)
3835 }
3836}
3837impl std::fmt::Display for Condition { 3914impl std::fmt::Display for Condition {
3838 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3915 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3839 std::fmt::Display::fmt(self.syntax(), f) 3916 std::fmt::Display::fmt(self.syntax(), f)
@@ -3894,11 +3971,6 @@ impl std::fmt::Display for ParenType {
3894 std::fmt::Display::fmt(self.syntax(), f) 3971 std::fmt::Display::fmt(self.syntax(), f)
3895 } 3972 }
3896} 3973}
3897impl std::fmt::Display for PathType {
3898 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3899 std::fmt::Display::fmt(self.syntax(), f)
3900 }
3901}
3902impl std::fmt::Display for PointerType { 3974impl std::fmt::Display for PointerType {
3903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3975 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3904 std::fmt::Display::fmt(self.syntax(), f) 3976 std::fmt::Display::fmt(self.syntax(), f)
@@ -4024,28 +4096,3 @@ impl std::fmt::Display for MacroStmts {
4024 std::fmt::Display::fmt(self.syntax(), f) 4096 std::fmt::Display::fmt(self.syntax(), f)
4025 } 4097 }
4026} 4098}
4027impl std::fmt::Display for PathSegment {
4028 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4029 std::fmt::Display::fmt(self.syntax(), f)
4030 }
4031}
4032impl std::fmt::Display for TypeArg {
4033 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4034 std::fmt::Display::fmt(self.syntax(), f)
4035 }
4036}
4037impl std::fmt::Display for LifetimeArg {
4038 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4039 std::fmt::Display::fmt(self.syntax(), f)
4040 }
4041}
4042impl std::fmt::Display for AssocTypeArg {
4043 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4044 std::fmt::Display::fmt(self.syntax(), f)
4045 }
4046}
4047impl std::fmt::Display for ConstArg {
4048 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4049 std::fmt::Display::fmt(self.syntax(), f)
4050 }
4051}
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
index 0afa24b77..307d9b31b 100644
--- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
+++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
@@ -25,7 +25,7 @@ [email protected]
25 [email protected] 25 [email protected]
26 [email protected] 26 [email protected]
27 [email protected] "Sink" 27 [email protected] "Sink"
28 TYP[email protected] 28 GENERIC[email protected]
29 [email protected] 29 [email protected]
30 [email protected] 30 [email protected]
31 [email protected] "'a" 31 [email protected] "'a"
@@ -79,7 +79,7 @@ [email protected]
79 [email protected] 79 [email protected]
80 [email protected] 80 [email protected]
81 [email protected] "Vec" 81 [email protected] "Vec"
82 TYP[email protected] 82 GENERIC[email protected]
83 [email protected] 83 [email protected]
84 [email protected] 84 [email protected]
85 [email protected] 85 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
index 3eef848fc..f48ab6e71 100644
--- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
+++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "RefCell" 18 [email protected] "RefCell"
19 TYP[email protected] 19 GENERIC[email protected]
20 [email protected] "<" 20 [email protected] "<"
21 [email protected] 21 [email protected]
22 [email protected] 22 [email protected]
@@ -24,7 +24,7 @@ [email protected]
24 [email protected] 24 [email protected]
25 [email protected] 25 [email protected]
26 [email protected] "HashMap" 26 [email protected] "HashMap"
27 TYP[email protected] 27 GENERIC[email protected]
28 [email protected] "<" 28 [email protected] "<"
29 [email protected] "\n " 29 [email protected] "\n "
30 [email protected] 30 [email protected]
@@ -41,7 +41,7 @@ [email protected]
41 [email protected] 41 [email protected]
42 [email protected] 42 [email protected]
43 [email protected] "Box" 43 [email protected] "Box"
44 TYP[email protected] 44 GENERIC[email protected]
45 [email protected] "<" 45 [email protected] "<"
46 [email protected] 46 [email protected]
47 [email protected] 47 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
index 4c2d1ad68..1cb1e9757 100644
--- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
+++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast
@@ -50,7 +50,7 @@ [email protected]
50 [email protected] 50 [email protected]
51 [email protected] 51 [email protected]
52 [email protected] "Trait" 52 [email protected] "Trait"
53 TYP[email protected] 53 GENERIC[email protected]
54 [email protected] "<" 54 [email protected] "<"
55 [email protected] 55 [email protected]
56 [email protected] "\'a" 56 [email protected] "\'a"
@@ -92,7 +92,7 @@ [email protected]
92 [email protected] 92 [email protected]
93 [email protected] 93 [email protected]
94 [email protected] "Box" 94 [email protected] "Box"
95 TYP[email protected] 95 GENERIC[email protected]
96 [email protected] "<" 96 [email protected] "<"
97 [email protected] 97 [email protected]
98 [email protected] 98 [email protected]
@@ -133,7 +133,7 @@ [email protected]
133 [email protected] 133 [email protected]
134 [email protected] 134 [email protected]
135 [email protected] "Trait" 135 [email protected] "Trait"
136 TYP[email protected] 136 GENERIC[email protected]
137 [email protected] "<" 137 [email protected] "<"
138 [email protected] 138 [email protected]
139 [email protected] "\'a" 139 [email protected] "\'a"
@@ -156,7 +156,7 @@ [email protected]
156 [email protected] 156 [email protected]
157 [email protected] 157 [email protected]
158 [email protected] "Box" 158 [email protected] "Box"
159 TYP[email protected] 159 GENERIC[email protected]
160 [email protected] "<" 160 [email protected] "<"
161 [email protected] 161 [email protected]
162 [email protected] 162 [email protected]
@@ -235,7 +235,7 @@ [email protected]
235 [email protected] 235 [email protected]
236 [email protected] 236 [email protected]
237 [email protected] "Box" 237 [email protected] "Box"
238 TYP[email protected] 238 GENERIC[email protected]
239 [email protected] "<" 239 [email protected] "<"
240 [email protected] 240 [email protected]
241 [email protected] 241 [email protected]
@@ -253,7 +253,7 @@ [email protected]
253 [email protected] 253 [email protected]
254 [email protected] 254 [email protected]
255 [email protected] "Trait" 255 [email protected] "Trait"
256 TYP[email protected] 256 GENERIC[email protected]
257 [email protected] "<" 257 [email protected] "<"
258 [email protected] 258 [email protected]
259 [email protected] "\'a" 259 [email protected] "\'a"
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
index 7e4b11c27..1b08c834e 100644
--- a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
@@ -31,7 +31,7 @@ [email protected]
31 [email protected] 31 [email protected]
32 [email protected] 32 [email protected]
33 [email protected] "OnceCell" 33 [email protected] "OnceCell"
34 TYP[email protected] 34 GENERIC[email protected]
35 [email protected] "<" 35 [email protected] "<"
36 [email protected] 36 [email protected]
37 [email protected] 37 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
index 0678d4278..7a5e115bc 100644
--- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
@@ -62,7 +62,7 @@ [email protected]
62 [email protected] "." 62 [email protected] "."
63 [email protected] 63 [email protected]
64 [email protected] "max" 64 [email protected] "max"
65 TYP[email protected] 65 GENERIC[email protected]
66 [email protected] "::" 66 [email protected] "::"
67 [email protected] "<" 67 [email protected] "<"
68 [email protected] 68 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast b/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast
index 8831cfa6c..38c15b581 100644
--- a/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast
+++ b/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast
@@ -3,7 +3,7 @@ [email protected]
3 [email protected] 3 [email protected]
4 [email protected] 4 [email protected]
5 [email protected] "Result" 5 [email protected] "Result"
6 TYP[email protected] 6 GENERIC[email protected]
7 [email protected] "<" 7 [email protected] "<"
8 [email protected] 8 [email protected]
9 [email protected] 9 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
index ace8ad050..44d92aedb 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] 13 [email protected]
14 [email protected] "Box" 14 [email protected] "Box"
15 TYP[email protected] 15 GENERIC[email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
index 20b2b6c19..1b31aa95a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
@@ -53,7 +53,7 @@ [email protected]
53 [email protected] 53 [email protected]
54 [email protected] 54 [email protected]
55 [email protected] "Box" 55 [email protected] "Box"
56 TYP[email protected] 56 GENERIC[email protected]
57 [email protected] "<" 57 [email protected] "<"
58 [email protected] 58 [email protected]
59 [email protected] 59 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
index f45f3cab8..32b2959bd 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] "Iterator" 19 [email protected] "Iterator"
20 TYP[email protected] 20 GENERIC[email protected]
21 [email protected] "<" 21 [email protected] "<"
22 [email protected] 22 [email protected]
23 [email protected] 23 [email protected]
@@ -28,7 +28,7 @@ [email protected]
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Foo" 30 [email protected] "Foo"
31 TYP[email protected] 31 GENERIC[email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] "\'a" 34 [email protected] "\'a"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
index 2185d3c91..69e98b9d6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] 13 [email protected]
14 [email protected] "B" 14 [email protected] "B"
15 TYP[email protected] 15 GENERIC[email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] "\'static" 18 [email protected] "\'static"
@@ -27,7 +27,8 @@ [email protected]
27 [email protected] "," 27 [email protected] ","
28 [email protected] " " 28 [email protected] " "
29 [email protected] 29 [email protected]
30 [email protected] "1" 30 [email protected]
31 [email protected] "1"
31 [email protected] "," 32 [email protected] ","
32 [email protected] " " 33 [email protected] " "
33 [email protected] 34 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
index d4235a8b1..c100d1c71 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast
@@ -30,7 +30,7 @@ [email protected]
30 [email protected] 30 [email protected]
31 [email protected] 31 [email protected]
32 [email protected] "Foo" 32 [email protected] "Foo"
33 TYP[email protected] 33 GENERIC[email protected]
34 [email protected] "<" 34 [email protected] "<"
35 [email protected] 35 [email protected]
36 [email protected] "\'a" 36 [email protected] "\'a"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
index 37757ccd4..4d8404e7c 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "Box" 18 [email protected] "Box"
19 TYP[email protected] 19 GENERIC[email protected]
20 [email protected] "<" 20 [email protected] "<"
21 [email protected] 21 [email protected]
22 [email protected] 22 [email protected]
@@ -55,7 +55,7 @@ [email protected]
55 [email protected] 55 [email protected]
56 [email protected] 56 [email protected]
57 [email protected] "Box" 57 [email protected] "Box"
58 TYP[email protected] 58 GENERIC[email protected]
59 [email protected] "<" 59 [email protected] "<"
60 [email protected] 60 [email protected]
61 [email protected] 61 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
index 2bfb52453..de2016f18 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast
@@ -60,7 +60,7 @@ [email protected]
60 [email protected] "::" 60 [email protected] "::"
61 [email protected] 61 [email protected]
62 [email protected] "a" 62 [email protected] "a"
63 TYP[email protected] 63 GENERIC[email protected]
64 [email protected] "::" 64 [email protected] "::"
65 [email protected] "<" 65 [email protected] "<"
66 [email protected] 66 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
index 629fea99d..3a7fcfe24 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
19 [email protected] "Iterator" 19 [email protected] "Iterator"
20 TYP[email protected] 20 GENERIC[email protected]
21 [email protected] "<" 21 [email protected] "<"
22 [email protected] 22 [email protected]
23 [email protected] 23 [email protected]
@@ -28,7 +28,7 @@ [email protected]
28 [email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Foo" 30 [email protected] "Foo"
31 TYP[email protected] 31 GENERIC[email protected]
32 [email protected] "<" 32 [email protected] "<"
33 [email protected] 33 [email protected]
34 [email protected] "\'a" 34 [email protected] "\'a"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
index e7629ac03..5f4807522 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast
@@ -95,7 +95,7 @@ [email protected]
95 [email protected] 95 [email protected]
96 [email protected] 96 [email protected]
97 [email protected] "PartialEq" 97 [email protected] "PartialEq"
98 TYP[email protected] 98 GENERIC[email protected]
99 [email protected] "<" 99 [email protected] "<"
100 [email protected] 100 [email protected]
101 [email protected] 101 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
index 3f53d60c0..1244a5031 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] 12 [email protected]
13 [email protected] 13 [email protected]
14 [email protected] "Box" 14 [email protected] "Box"
15 TYP[email protected] 15 GENERIC[email protected]
16 [email protected] "<" 16 [email protected] "<"
17 [email protected] 17 [email protected]
18 [email protected] 18 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
index b2961b0ff..be8365e05 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast
@@ -36,7 +36,7 @@ [email protected]
36 [email protected] "." 36 [email protected] "."
37 [email protected] 37 [email protected]
38 [email protected] "bar" 38 [email protected] "bar"
39 TYP[email protected] 39 GENERIC[email protected]
40 [email protected] "::" 40 [email protected] "::"
41 [email protected] "<" 41 [email protected] "<"
42 [email protected] 42 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast
index 157513565..e0a82df75 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast
@@ -18,7 +18,7 @@ [email protected]
18 [email protected] 18 [email protected]
19 [email protected] 19 [email protected]
20 [email protected] "Iterator" 20 [email protected] "Iterator"
21 TYP[email protected] 21 GENERIC[email protected]
22 [email protected] "<" 22 [email protected] "<"
23 [email protected] 23 [email protected]
24 [email protected] 24 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
index 8f197a19d..12194abda 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
@@ -22,7 +22,7 @@ [email protected]
22 [email protected] 22 [email protected]
23 [email protected] 23 [email protected]
24 [email protected] "Bar" 24 [email protected] "Bar"
25 TYP[email protected] 25 GENERIC[email protected]
26 [email protected] "<" 26 [email protected] "<"
27 [email protected] 27 [email protected]
28 [email protected] 28 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
index cc220e534..dac50410e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] 20 [email protected]
21 [email protected] 21 [email protected]
22 [email protected] "T" 22 [email protected] "T"
23 TYP[email protected] 23 GENERIC[email protected]
24 [email protected] "<" 24 [email protected] "<"
25 [email protected] 25 [email protected]
26 [email protected] 26 [email protected]
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] 52 [email protected]
53 [email protected] 53 [email protected]
54 [email protected] "T" 54 [email protected] "T"
55 TYP[email protected] 55 GENERIC[email protected]
56 [email protected] "<" 56 [email protected] "<"
57 [email protected] 57 [email protected]
58 [email protected] 58 [email protected]
@@ -115,7 +115,7 @@ [email protected]
115 [email protected] 115 [email protected]
116 [email protected] 116 [email protected]
117 [email protected] "T" 117 [email protected] "T"
118 TYP[email protected] 118 GENERIC[email protected]
119 [email protected] "<" 119 [email protected] "<"
120 [email protected] 120 [email protected]
121 [email protected] 121 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast
index 10da87c71..d59548f21 100644
--- a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast
@@ -49,7 +49,7 @@ [email protected]
49 [email protected] 49 [email protected]
50 [email protected] 50 [email protected]
51 [email protected] "Deserialize" 51 [email protected] "Deserialize"
52 TYP[email protected] 52 GENERIC[email protected]
53 [email protected] "<" 53 [email protected] "<"
54 [email protected] 54 [email protected]
55 [email protected] "\'de" 55 [email protected] "\'de"
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
index 1d75ed08f..0e0c8c9dc 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -249,7 +249,7 @@ [email protected]
249 [email protected] 249 [email protected]
250 [email protected] 250 [email protected]
251 [email protected] "Cell" 251 [email protected] "Cell"
252 TYP[email protected] 252 GENERIC[email protected]
253 [email protected] "<" 253 [email protected] "<"
254 [email protected] 254 [email protected]
255 [email protected] 255 [email protected]
@@ -1588,7 +1588,7 @@ [email protected]
1588 [email protected] 1588 [email protected]
1589 [email protected] 1589 [email protected]
1590 [email protected] "union" 1590 [email protected] "union"
1591 TYP[email protected] 1591 GENERIC[email protected]
1592 [email protected] "<" 1592 [email protected] "<"
1593 [email protected] 1593 [email protected]
1594 [email protected] "\'union" 1594 [email protected] "\'union"
diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
index 139ce9046..bd152ffa3 100644
--- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
@@ -141,7 +141,7 @@ [email protected]
141 [email protected] 141 [email protected]
142 [email protected] 142 [email protected]
143 [email protected] "Event" 143 [email protected] "Event"
144 TYP[email protected] 144 GENERIC[email protected]
145 [email protected] "<" 145 [email protected] "<"
146 [email protected] 146 [email protected]
147 [email protected] 147 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast
index 798e81ca6..48e1f07d1 100644
--- a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast
@@ -32,7 +32,7 @@ [email protected]
32 [email protected] 32 [email protected]
33 [email protected] 33 [email protected]
34 [email protected] "Future" 34 [email protected] "Future"
35 TYP[email protected] 35 GENERIC[email protected]
36 [email protected] "<" 36 [email protected] "<"
37 [email protected] 37 [email protected]
38 [email protected] 38 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
index 2cc849784..706ccdc39 100644
--- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -172,7 +172,7 @@ [email protected]
172 [email protected] 172 [email protected]
173 [email protected] 173 [email protected]
174 [email protected] "Foo" 174 [email protected] "Foo"
175 TYP[email protected] 175 GENERIC[email protected]
176 [email protected] "<" 176 [email protected] "<"
177 [email protected] 177 [email protected]
178 [email protected] "\'a" 178 [email protected] "\'a"
@@ -490,7 +490,7 @@ [email protected]
490 [email protected] 490 [email protected]
491 [email protected] 491 [email protected]
492 [email protected] "Rc" 492 [email protected] "Rc"
493 TYP[email protected] 493 GENERIC[email protected]
494 [email protected] "<" 494 [email protected] "<"
495 [email protected] 495 [email protected]
496 [email protected] 496 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast
index a30000398..fd4f4f242 100644
--- a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast
@@ -50,7 +50,7 @@ [email protected]
50 [email protected] "." 50 [email protected] "."
51 [email protected] 51 [email protected]
52 [email protected] "sum" 52 [email protected] "sum"
53 TYP[email protected] 53 GENERIC[email protected]
54 [email protected] "::" 54 [email protected] "::"
55 [email protected] "<" 55 [email protected] "<"
56 [email protected] 56 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast
index e3997ac5b..0d48c7e81 100644
--- a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast
@@ -16,7 +16,7 @@ [email protected]
16 [email protected] 16 [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "Foo" 18 [email protected] "Foo"
19 TYP[email protected] 19 GENERIC[email protected]
20 [email protected] "<" 20 [email protected] "<"
21 [email protected] 21 [email protected]
22 [email protected] 22 [email protected]
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 427406249..762d9265e 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -208,7 +208,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
208 "LIFETIME_PARAM", 208 "LIFETIME_PARAM",
209 "TYPE_PARAM", 209 "TYPE_PARAM",
210 "CONST_PARAM", 210 "CONST_PARAM",
211 "TYPE_ARG_LIST", 211 "GENERIC_ARG_LIST",
212 "LIFETIME_ARG", 212 "LIFETIME_ARG",
213 "TYPE_ARG", 213 "TYPE_ARG",
214 "ASSOC_TYPE_ARG", 214 "ASSOC_TYPE_ARG",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index bc1dd6761..1d8bed0b4 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -1,3 +1,34 @@
1Path =
2 (qualifier:Path '::')? segment:PathSegment
3
4PathSegment =
5 'crate' | 'self' | 'super'
6| '::' NameRef
7| NameRef GenericArgList?
8| NameRef ParamList RetType?
9| '<' PathType ('as' PathType)? '>'
10
11GenericArgList =
12 '::'? '<' (GenericArg (',' GenericArg)* ','?)? '>'
13
14GenericArg =
15 TypeArg
16| AssocTypeArg
17| LifetimeArg
18| ConstArg
19
20TypeArg =
21 Type
22
23AssocTypeArg =
24 NameRef (':' TypeBoundList | '=' Type)
25
26LifetimeArg =
27 'lifetime'
28
29ConstArg =
30 Expr
31
1SourceFile = 32SourceFile =
2 'shebang'? 33 'shebang'?
3 Attr* 34 Attr*
@@ -318,7 +349,7 @@ ArgList =
318 '(' args:(Expr (',' Expr)* ','?)? ')' 349 '(' args:(Expr (',' Expr)* ','?)? ')'
319 350
320MethodCallExpr = 351MethodCallExpr =
321 Attr* Expr '.' NameRef TypeArgList? ArgList 352 Attr* Expr '.' NameRef GenericArgList? ArgList
322 353
323FieldExpr = 354FieldExpr =
324 Attr* Expr '.' NameRef 355 Attr* Expr '.' NameRef
@@ -521,33 +552,6 @@ MacroStmts =
521 statements:Stmt* 552 statements:Stmt*
522 Expr? 553 Expr?
523 554
524Path =
525 (qualifier:Path '::')? segment:PathSegment
526
527PathSegment =
528 '::' | 'crate' | 'self' | 'super'
529| '<' NameRef TypeArgList ParamList RetType PathType '>'
530
531TypeArgList =
532 '::'? '<'
533 TypeArg*
534 LifetimeArg*
535 AssocTypeArg*
536 ConstArg*
537 '>'
538
539TypeArg =
540 Type
541
542AssocTypeArg =
543 NameRef (':' TypeBoundList | '=' Type)
544
545LifetimeArg =
546 'lifetime'
547
548ConstArg =
549 Literal | BlockExpr BlockExpr
550
551Pat = 555Pat =
552 OrPat 556 OrPat
553| ParenPat 557| ParenPat