aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/ast_transform.rs30
-rw-r--r--crates/ra_assists/src/handlers/add_explicit_type.rs4
-rw-r--r--crates/ra_assists/src/handlers/change_return_type_to_result.rs3
-rw-r--r--crates/ra_assists/src/handlers/early_return.rs4
-rw-r--r--crates/ra_assists/src/handlers/extract_variable.rs4
-rw-r--r--crates/ra_assists/src/handlers/fill_match_arms.rs24
-rw-r--r--crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs2
-rw-r--r--crates/ra_assists/src/handlers/inline_local_variable.rs2
-rw-r--r--crates/ra_assists/src/handlers/introduce_named_lifetime.rs2
-rw-r--r--crates/ra_assists/src/handlers/merge_match_arms.rs2
-rw-r--r--crates/ra_assists/src/handlers/reorder_fields.rs4
-rw-r--r--crates/ra_assists/src/handlers/replace_let_with_if_let.rs3
-rw-r--r--crates/ra_assists/src/utils.rs7
-rw-r--r--crates/ra_hir/src/code_model.rs2
-rw-r--r--crates/ra_hir/src/semantics.rs10
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs2
-rw-r--r--crates/ra_hir/src/source_analyzer.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs117
-rw-r--r--crates/ra_hir_def/src/generics.rs4
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs8
-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_hir_def/src/type_ref.rs31
-rw-r--r--crates/ra_hir_expand/src/db.rs2
-rw-r--r--crates/ra_hir_ty/src/diagnostics.rs2
-rw-r--r--crates/ra_hir_ty/src/diagnostics/expr.rs2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs10
-rw-r--r--crates/ra_ide/src/completion/patterns.rs4
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs6
-rw-r--r--crates/ra_ide/src/display/short_label.rs2
-rw-r--r--crates/ra_ide/src/extend_selection.rs4
-rw-r--r--crates/ra_ide/src/file_structure.rs6
-rw-r--r--crates/ra_ide/src/folding_ranges.rs2
-rw-r--r--crates/ra_ide/src/inlay_hints.rs14
-rw-r--r--crates/ra_ide/src/references.rs14
-rw-r--r--crates/ra_ide/src/references/rename.rs4
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs6
-rw-r--r--crates/ra_ide_db/src/defs.rs8
-rw-r--r--crates/ra_mbe/src/tests.rs4
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs2
-rw-r--r--crates/ra_parser/src/grammar/patterns.rs12
-rw-r--r--crates/ra_parser/src/grammar/type_args.rs4
-rw-r--r--crates/ra_parser/src/grammar/types.rs8
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs22
-rw-r--r--crates/ra_ssr/src/matching.rs4
-rw-r--r--crates/ra_ssr/src/parsing.rs4
-rw-r--r--crates/ra_ssr/src/resolving.rs4
-rw-r--r--crates/ra_ssr/src/tests.rs2
-rw-r--r--crates/ra_syntax/src/ast.rs12
-rw-r--r--crates/ra_syntax/src/ast/edit.rs10
-rw-r--r--crates/ra_syntax/src/ast/generated.rs41
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs2682
-rw-r--r--crates/ra_syntax/src/ast/make.rs12
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs50
-rw-r--r--crates/ra_syntax/src/lib.rs2
-rw-r--r--crates/ra_syntax/src/tests.rs2
-rw-r--r--crates/ra_syntax/src/validation.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast48
-rw-r--r--crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0019_let_recover.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/err/0025_nope.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0029_field_completion.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/fragments/pattern/ok/0000_enum.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/err/0003_pointer_type_no_mutability.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast4
-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/0030_cond.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast6
-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/0042_call_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast4
-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.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast6
-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/0066_match_arm.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast24
-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/0106_lambda_expr.rast18
-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/0109_label.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast92
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.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/inline/ok/0154_fn_pointer_param_ident_path.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast10
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast16
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_traits.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0031_extern.rast126
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0032_where_for.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0033_label_break.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast60
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast18
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast8
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast22
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast22
-rw-r--r--crates/rust-analyzer/src/bin/args.rs32
-rw-r--r--crates/rust-analyzer/src/bin/main.rs19
174 files changed, 2193 insertions, 2155 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index 5ea4f9f5b..28f3f3546 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -32,7 +32,7 @@ impl<'a> AstTransform<'a> for NullTransformer {
32 32
33pub struct SubstituteTypeParams<'a> { 33pub struct SubstituteTypeParams<'a> {
34 source_scope: &'a SemanticsScope<'a>, 34 source_scope: &'a SemanticsScope<'a>,
35 substs: FxHashMap<hir::TypeParam, ast::TypeRef>, 35 substs: FxHashMap<hir::TypeParam, ast::Type>,
36 previous: Box<dyn AstTransform<'a> + 'a>, 36 previous: Box<dyn AstTransform<'a> + 'a>,
37} 37}
38 38
@@ -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::TypeRef>> { 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.trait_()?;
85 let path_type = match target_trait { 85 let path_type = match target_trait {
86 ast::TypeRef::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.type_ref()?); 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 }
@@ -99,9 +105,9 @@ impl<'a> SubstituteTypeParams<'a> {
99 &self, 105 &self,
100 node: &ra_syntax::SyntaxNode, 106 node: &ra_syntax::SyntaxNode,
101 ) -> Option<ra_syntax::SyntaxNode> { 107 ) -> Option<ra_syntax::SyntaxNode> {
102 let type_ref = ast::TypeRef::cast(node.clone())?; 108 let type_ref = ast::Type::cast(node.clone())?;
103 let path = match &type_ref { 109 let path = match &type_ref {
104 ast::TypeRef::PathType(path_type) => path_type.path()?, 110 ast::Type::PathType(path_type) => path_type.path()?,
105 _ => return None, 111 _ => return None,
106 }; 112 };
107 // FIXME: use `hir::Path::from_src` instead. 113 // FIXME: use `hir::Path::from_src` instead.
@@ -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_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs
index e69f0a89b..135a2ac9c 100644
--- a/crates/ra_assists/src/handlers/add_explicit_type.rs
+++ b/crates/ra_assists/src/handlers/add_explicit_type.rs
@@ -27,7 +27,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
27 let expr = let_stmt.initializer()?; 27 let expr = let_stmt.initializer()?;
28 // Must be a binding 28 // Must be a binding
29 let pat = match let_stmt.pat()? { 29 let pat = match let_stmt.pat()? {
30 ast::Pat::BindPat(bind_pat) => bind_pat, 30 ast::Pat::IdentPat(bind_pat) => bind_pat,
31 _ => return None, 31 _ => return None,
32 }; 32 };
33 let pat_range = pat.syntax().text_range(); 33 let pat_range = pat.syntax().text_range();
@@ -46,7 +46,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio
46 // and it has no placeholders 46 // and it has no placeholders
47 let ascribed_ty = let_stmt.ty(); 47 let ascribed_ty = let_stmt.ty();
48 if let Some(ty) = &ascribed_ty { 48 if let Some(ty) = &ascribed_ty {
49 if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() { 49 if ty.syntax().descendants().find_map(ast::InferType::cast).is_none() {
50 return None; 50 return None;
51 } 51 }
52 } 52 }
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
index 167e162d8..b83c94404 100644
--- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs
+++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs
@@ -74,6 +74,7 @@ impl TailReturnCollector {
74 let expr = match &stmt { 74 let expr = match &stmt {
75 ast::Stmt::ExprStmt(stmt) => stmt.expr(), 75 ast::Stmt::ExprStmt(stmt) => stmt.expr(),
76 ast::Stmt::LetStmt(stmt) => stmt.initializer(), 76 ast::Stmt::LetStmt(stmt) => stmt.initializer(),
77 ast::Stmt::Item(_) => continue,
77 }; 78 };
78 if let Some(expr) = &expr { 79 if let Some(expr) = &expr {
79 self.handle_exprs(expr, collect_break); 80 self.handle_exprs(expr, collect_break);
@@ -94,6 +95,7 @@ impl TailReturnCollector {
94 let expr_stmt = match &expr_stmt { 95 let expr_stmt = match &expr_stmt {
95 ast::Stmt::ExprStmt(stmt) => stmt.expr(), 96 ast::Stmt::ExprStmt(stmt) => stmt.expr(),
96 ast::Stmt::LetStmt(stmt) => stmt.initializer(), 97 ast::Stmt::LetStmt(stmt) => stmt.initializer(),
98 ast::Stmt::Item(_) => None,
97 }; 99 };
98 if let Some(expr) = &expr_stmt { 100 if let Some(expr) = &expr_stmt {
99 self.handle_exprs(expr, collect_break); 101 self.handle_exprs(expr, collect_break);
@@ -239,7 +241,6 @@ fn get_tail_expr_from_block(expr: &Expr) -> Option<Vec<NodeType>> {
239 Expr::ArrayExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 241 Expr::ArrayExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
240 Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 242 Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
241 Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 243 Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
242 Expr::Label(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
243 Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 244 Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
244 Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 245 Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
245 Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), 246 Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]),
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs
index 3650289fd..69852b611 100644
--- a/crates/ra_assists/src/handlers/early_return.rs
+++ b/crates/ra_assists/src/handlers/early_return.rs
@@ -51,11 +51,11 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
51 // Check if there is an IfLet that we can handle. 51 // Check if there is an IfLet that we can handle.
52 let if_let_pat = match cond.pat() { 52 let if_let_pat = match cond.pat() {
53 None => None, // No IfLet, supported. 53 None => None, // No IfLet, supported.
54 Some(ast::Pat::TupleStructPat(pat)) if pat.args().count() == 1 => { 54 Some(ast::Pat::TupleStructPat(pat)) if pat.fields().count() == 1 => {
55 let path = pat.path()?; 55 let path = pat.path()?;
56 match path.qualifier() { 56 match path.qualifier() {
57 None => { 57 None => {
58 let bound_ident = pat.args().next().unwrap(); 58 let bound_ident = pat.fields().next().unwrap();
59 Some((path, bound_ident)) 59 Some((path, bound_ident))
60 } 60 }
61 Some(_) => return None, 61 Some(_) => return None,
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs
index b925a2884..cc62db0c4 100644
--- a/crates/ra_assists/src/handlers/extract_variable.rs
+++ b/crates/ra_assists/src/handlers/extract_variable.rs
@@ -1,7 +1,7 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, AstNode}, 2 ast::{self, AstNode},
3 SyntaxKind::{ 3 SyntaxKind::{
4 BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, 4 BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR,
5 }, 5 },
6 SyntaxNode, 6 SyntaxNode,
7}; 7};
@@ -148,7 +148,7 @@ impl Anchor {
148 } 148 }
149 149
150 if let Some(parent) = node.parent() { 150 if let Some(parent) = node.parent() {
151 if parent.kind() == MATCH_ARM || parent.kind() == LAMBDA_EXPR { 151 if parent.kind() == MATCH_ARM || parent.kind() == CLOSURE_EXPR {
152 return Some(Anchor::WrapInBlock(node)); 152 return Some(Anchor::WrapInBlock(node));
153 } 153 }
154 } 154 }
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs
index 708e1bc6c..b2e14f9d7 100644
--- a/crates/ra_assists/src/handlers/fill_match_arms.rs
+++ b/crates/ra_assists/src/handlers/fill_match_arms.rs
@@ -43,7 +43,7 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option<
43 43
44 let mut arms: Vec<MatchArm> = match_arm_list.arms().collect(); 44 let mut arms: Vec<MatchArm> = match_arm_list.arms().collect();
45 if arms.len() == 1 { 45 if arms.len() == 1 {
46 if let Some(Pat::PlaceholderPat(..)) = arms[0].pat() { 46 if let Some(Pat::WildcardPat(..)) = arms[0].pat() {
47 arms.clear(); 47 arms.clear();
48 } 48 }
49 } 49 }
@@ -116,17 +116,15 @@ pub(crate) fn fill_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option<
116 match (first_new_arm, ctx.config.snippet_cap) { 116 match (first_new_arm, ctx.config.snippet_cap) {
117 (Some(first_new_arm), Some(cap)) => { 117 (Some(first_new_arm), Some(cap)) => {
118 let extend_lifetime; 118 let extend_lifetime;
119 let cursor = match first_new_arm 119 let cursor =
120 .syntax() 120 match first_new_arm.syntax().descendants().find_map(ast::WildcardPat::cast)
121 .descendants() 121 {
122 .find_map(ast::PlaceholderPat::cast) 122 Some(it) => {
123 { 123 extend_lifetime = it.syntax().clone();
124 Some(it) => { 124 Cursor::Replace(&extend_lifetime)
125 extend_lifetime = it.syntax().clone(); 125 }
126 Cursor::Replace(&extend_lifetime) 126 None => Cursor::Before(first_new_arm.syntax()),
127 } 127 };
128 None => Cursor::Before(first_new_arm.syntax()),
129 };
130 let snippet = render_snippet(cap, new_arm_list.syntax(), cursor); 128 let snippet = render_snippet(cap, new_arm_list.syntax(), cursor);
131 builder.replace_snippet(cap, old_range, snippet); 129 builder.replace_snippet(cap, old_range, snippet);
132 } 130 }
@@ -152,7 +150,7 @@ fn does_pat_match_variant(pat: &Pat, var: &Pat) -> bool {
152 let first_node_text = |pat: &Pat| pat.syntax().first_child().map(|node| node.text()); 150 let first_node_text = |pat: &Pat| pat.syntax().first_child().map(|node| node.text());
153 151
154 let pat_head = match pat { 152 let pat_head = match pat {
155 Pat::BindPat(bind_pat) => { 153 Pat::IdentPat(bind_pat) => {
156 if let Some(p) = bind_pat.pat() { 154 if let Some(p) = bind_pat.pat() {
157 first_node_text(&p) 155 first_node_text(&p)
158 } else { 156 } else {
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
index 9da23640a..4c1aef8a2 100644
--- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -34,7 +34,7 @@ pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext
34 } 34 }
35 let field_type = field_list.fields().next()?.ty()?; 35 let field_type = field_list.fields().next()?.ty()?;
36 let path = match field_type { 36 let path = match field_type {
37 ast::TypeRef::PathType(it) => it, 37 ast::Type::PathType(it) => it,
38 _ => return None, 38 _ => return None,
39 }; 39 };
40 40
diff --git a/crates/ra_assists/src/handlers/inline_local_variable.rs b/crates/ra_assists/src/handlers/inline_local_variable.rs
index 2fdfabaf5..3c58020f8 100644
--- a/crates/ra_assists/src/handlers/inline_local_variable.rs
+++ b/crates/ra_assists/src/handlers/inline_local_variable.rs
@@ -29,7 +29,7 @@ use crate::{
29pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 29pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
30 let let_stmt = ctx.find_node_at_offset::<ast::LetStmt>()?; 30 let let_stmt = ctx.find_node_at_offset::<ast::LetStmt>()?;
31 let bind_pat = match let_stmt.pat()? { 31 let bind_pat = match let_stmt.pat()? {
32 ast::Pat::BindPat(pat) => pat, 32 ast::Pat::IdentPat(pat) => pat,
33 _ => return None, 33 _ => return None,
34 }; 34 };
35 if bind_pat.mut_token().is_some() { 35 if bind_pat.mut_token().is_some() {
diff --git a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
index c3134f64d..fbaf3c06b 100644
--- a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
+++ b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
@@ -68,7 +68,7 @@ fn generate_fn_def_assist(
68 let fn_params_without_lifetime: Vec<_> = param_list 68 let fn_params_without_lifetime: Vec<_> = param_list
69 .params() 69 .params()
70 .filter_map(|param| match param.ty() { 70 .filter_map(|param| match param.ty() {
71 Some(ast::TypeRef::ReferenceType(ascribed_type)) 71 Some(ast::Type::RefType(ascribed_type))
72 if ascribed_type.lifetime_token() == None => 72 if ascribed_type.lifetime_token() == None =>
73 { 73 {
74 Some(ascribed_type.amp_token()?.text_range().end()) 74 Some(ascribed_type.amp_token()?.text_range().end())
diff --git a/crates/ra_assists/src/handlers/merge_match_arms.rs b/crates/ra_assists/src/handlers/merge_match_arms.rs
index 186a1f618..563292282 100644
--- a/crates/ra_assists/src/handlers/merge_match_arms.rs
+++ b/crates/ra_assists/src/handlers/merge_match_arms.rs
@@ -86,7 +86,7 @@ pub(crate) fn merge_match_arms(acc: &mut Assists, ctx: &AssistContext) -> Option
86} 86}
87 87
88fn contains_placeholder(a: &ast::MatchArm) -> bool { 88fn contains_placeholder(a: &ast::MatchArm) -> bool {
89 matches!(a.pat(), Some(ast::Pat::PlaceholderPat(..))) 89 matches!(a.pat(), Some(ast::Pat::WildcardPat(..)))
90} 90}
91 91
92#[cfg(test)] 92#[cfg(test)]
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs
index 120250e79..c9b743a06 100644
--- a/crates/ra_assists/src/handlers/reorder_fields.rs
+++ b/crates/ra_assists/src/handlers/reorder_fields.rs
@@ -57,7 +57,7 @@ fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
57fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { 57fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> {
58 match node.kind() { 58 match node.kind() {
59 RECORD_EXPR => vec![RECORD_EXPR_FIELD], 59 RECORD_EXPR => vec![RECORD_EXPR_FIELD],
60 RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], 60 RECORD_PAT => vec![RECORD_PAT_FIELD, IDENT_PAT],
61 _ => vec![], 61 _ => vec![],
62 } 62 }
63} 63}
@@ -66,7 +66,7 @@ fn get_field_name(node: &SyntaxNode) -> String {
66 let res = match_ast! { 66 let res = match_ast! {
67 match node { 67 match node {
68 ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()), 68 ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()),
69 ast::RecordFieldPat(field) => field.field_name().map(|it| it.to_string()), 69 ast::RecordPatField(field) => field.field_name().map(|it| it.to_string()),
70 _ => None, 70 _ => None,
71 } 71 }
72 }; 72 };
diff --git a/crates/ra_assists/src/handlers/replace_let_with_if_let.rs b/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
index a49292c97..64ad15a23 100644
--- a/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
+++ b/crates/ra_assists/src/handlers/replace_let_with_if_let.rs
@@ -62,8 +62,7 @@ pub(crate) fn replace_let_with_if_let(acc: &mut Assists, ctx: &AssistContext) ->
62 let if_ = make::expr_if(make::condition(init, Some(with_placeholder)), block); 62 let if_ = make::expr_if(make::condition(init, Some(with_placeholder)), block);
63 let stmt = make::expr_stmt(if_); 63 let stmt = make::expr_stmt(if_);
64 64
65 let placeholder = 65 let placeholder = stmt.syntax().descendants().find_map(ast::WildcardPat::cast).unwrap();
66 stmt.syntax().descendants().find_map(ast::PlaceholderPat::cast).unwrap();
67 let stmt = stmt.replace_descendant(placeholder.into(), original_pat); 66 let stmt = stmt.replace_descendant(placeholder.into(), original_pat);
68 67
69 edit.replace_ast(ast::Stmt::from(let_stmt), ast::Stmt::from(stmt)); 68 edit.replace_ast(ast::Stmt::from(let_stmt), ast::Stmt::from(stmt));
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index bb16ebd4e..373de273c 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -111,11 +111,8 @@ pub(crate) fn resolve_target_trait(
111 sema: &Semantics<RootDatabase>, 111 sema: &Semantics<RootDatabase>,
112 impl_def: &ast::Impl, 112 impl_def: &ast::Impl,
113) -> Option<hir::Trait> { 113) -> Option<hir::Trait> {
114 let ast_path = impl_def 114 let ast_path =
115 .target_trait() 115 impl_def.trait_().map(|it| it.syntax().clone()).and_then(ast::PathType::cast)?.path()?;
116 .map(|it| it.syntax().clone())
117 .and_then(ast::PathType::cast)?
118 .path()?;
119 116
120 match sema.resolve_path(&ast_path) { 117 match sema.resolve_path(&ast_path) {
121 Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def), 118 Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def),
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 36c0bdc9e..27cdabea0 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1002,7 +1002,7 @@ impl Local {
1002 Type::new(db, krate, def, ty) 1002 Type::new(db, krate, def, ty)
1003 } 1003 }
1004 1004
1005 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::BindPat, ast::SelfParam>> { 1005 pub fn source(self, db: &dyn HirDatabase) -> InFile<Either<ast::IdentPat, ast::SelfParam>> {
1006 let (_body, source_map) = db.body_with_source_map(self.parent.into()); 1006 let (_body, source_map) = db.body_with_source_map(self.parent.into());
1007 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm... 1007 let src = source_map.pat_syntax(self.pat_id).unwrap(); // Hmm...
1008 let root = src.file_syntax(db.upcast()); 1008 let root = src.file_syntax(db.upcast());
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 6f3b3dc9a..307b336f2 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -216,7 +216,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
216 self.imp.resolve_record_field(field) 216 self.imp.resolve_record_field(field)
217 } 217 }
218 218
219 pub fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 219 pub fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
220 self.imp.resolve_record_field_pat(field) 220 self.imp.resolve_record_field_pat(field)
221 } 221 }
222 222
@@ -236,7 +236,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> {
236 self.imp.lower_path(path) 236 self.imp.lower_path(path)
237 } 237 }
238 238
239 pub fn resolve_bind_pat_to_const(&self, pat: &ast::BindPat) -> Option<ModuleDef> { 239 pub fn resolve_bind_pat_to_const(&self, pat: &ast::IdentPat) -> Option<ModuleDef> {
240 self.imp.resolve_bind_pat_to_const(pat) 240 self.imp.resolve_bind_pat_to_const(pat)
241 } 241 }
242 242
@@ -429,7 +429,7 @@ impl<'db> SemanticsImpl<'db> {
429 self.analyze(field.syntax()).resolve_record_field(self.db, field) 429 self.analyze(field.syntax()).resolve_record_field(self.db, field)
430 } 430 }
431 431
432 fn resolve_record_field_pat(&self, field: &ast::RecordFieldPat) -> Option<Field> { 432 fn resolve_record_field_pat(&self, field: &ast::RecordPatField) -> Option<Field> {
433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field) 433 self.analyze(field.syntax()).resolve_record_field_pat(self.db, field)
434 } 434 }
435 435
@@ -452,7 +452,7 @@ impl<'db> SemanticsImpl<'db> {
452 Path::from_src(path.clone(), &Hygiene::new(self.db.upcast(), src.file_id.into())) 452 Path::from_src(path.clone(), &Hygiene::new(self.db.upcast(), src.file_id.into()))
453 } 453 }
454 454
455 fn resolve_bind_pat_to_const(&self, pat: &ast::BindPat) -> Option<ModuleDef> { 455 fn resolve_bind_pat_to_const(&self, pat: &ast::IdentPat) -> Option<ModuleDef> {
456 self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) 456 self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat)
457 } 457 }
458 458
@@ -594,7 +594,7 @@ to_def_impls![
594 (crate::EnumVariant, ast::Variant, enum_variant_to_def), 594 (crate::EnumVariant, ast::Variant, enum_variant_to_def),
595 (crate::TypeParam, ast::TypeParam, type_param_to_def), 595 (crate::TypeParam, ast::TypeParam, type_param_to_def),
596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros 596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros
597 (crate::Local, ast::BindPat, bind_pat_to_def), 597 (crate::Local, ast::IdentPat, bind_pat_to_def),
598]; 598];
599 599
600fn find_root(node: &SyntaxNode) -> SyntaxNode { 600fn find_root(node: &SyntaxNode) -> SyntaxNode {
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index d1994e2e7..863e8e5ff 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -106,7 +106,7 @@ impl SourceToDefCtx<'_, '_> {
106 } 106 }
107 pub(super) fn bind_pat_to_def( 107 pub(super) fn bind_pat_to_def(
108 &mut self, 108 &mut self,
109 src: InFile<ast::BindPat>, 109 src: InFile<ast::IdentPat>,
110 ) -> Option<(DefWithBodyId, PatId)> { 110 ) -> Option<(DefWithBodyId, PatId)> {
111 let container = self.find_pat_container(src.as_ref().map(|it| it.syntax()))?; 111 let container = self.find_pat_container(src.as_ref().map(|it| it.syntax()))?;
112 let (_body, source_map) = self.db.body_with_source_map(container); 112 let (_body, source_map) = self.db.body_with_source_map(container);
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index f2e630ef1..d0cb62ef0 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -182,7 +182,7 @@ impl SourceAnalyzer {
182 pub(crate) fn resolve_record_field_pat( 182 pub(crate) fn resolve_record_field_pat(
183 &self, 183 &self,
184 _db: &dyn HirDatabase, 184 _db: &dyn HirDatabase,
185 field: &ast::RecordFieldPat, 185 field: &ast::RecordPatField,
186 ) -> Option<Field> { 186 ) -> Option<Field> {
187 let pat_id = self.pat_id(&field.pat()?)?; 187 let pat_id = self.pat_id(&field.pat()?)?;
188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?; 188 let struct_field = self.infer.as_ref()?.record_field_pat_resolution(pat_id)?;
@@ -202,7 +202,7 @@ impl SourceAnalyzer {
202 pub(crate) fn resolve_bind_pat_to_const( 202 pub(crate) fn resolve_bind_pat_to_const(
203 &self, 203 &self,
204 db: &dyn HirDatabase, 204 db: &dyn HirDatabase,
205 pat: &ast::BindPat, 205 pat: &ast::IdentPat,
206 ) -> Option<ModuleDef> { 206 ) -> Option<ModuleDef> {
207 let pat_id = self.pat_id(&pat.clone().into())?; 207 let pat_id = self.pat_id(&pat.clone().into())?;
208 let body = self.body.as_ref()?; 208 let body = self.body.as_ref()?;
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 827ced4ad..f5c37edb3 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -1,6 +1,8 @@
1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr` 1//! Transforms `ast::Expr` into an equivalent `hir_def::expr::Expr`
2//! representation. 2//! representation.
3 3
4use std::{any::type_name, sync::Arc};
5
4use either::Either; 6use either::Either;
5use hir_expand::{ 7use hir_expand::{
6 hygiene::Hygiene, 8 hygiene::Hygiene,
@@ -10,11 +12,12 @@ use hir_expand::{
10use ra_arena::Arena; 12use ra_arena::Arena;
11use ra_syntax::{ 13use ra_syntax::{
12 ast::{ 14 ast::{
13 self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, ModuleItemOwner, NameOwner, 15 self, ArgListOwner, ArrayExprKind, AstChildren, LiteralKind, LoopBodyOwner, NameOwner,
14 SlicePatComponents, 16 SlicePatComponents,
15 }, 17 },
16 AstNode, AstPtr, 18 AstNode, AstPtr,
17}; 19};
20use rustc_hash::FxHashMap;
18use test_utils::mark; 21use test_utils::mark;
19 22
20use crate::{ 23use crate::{
@@ -35,9 +38,6 @@ use crate::{
35}; 38};
36 39
37use super::{ExprSource, PatSource}; 40use super::{ExprSource, PatSource};
38use ast::AstChildren;
39use rustc_hash::FxHashMap;
40use std::{any::type_name, sync::Arc};
41 41
42pub(crate) struct LowerCtx { 42pub(crate) struct LowerCtx {
43 hygiene: Hygiene, 43 hygiene: Hygiene,
@@ -224,9 +224,22 @@ impl ExprCollector<'_> {
224 self.alloc_expr(Expr::Unsafe { body }, syntax_ptr) 224 self.alloc_expr(Expr::Unsafe { body }, syntax_ptr)
225 } 225 }
226 // FIXME: we need to record these effects somewhere... 226 // FIXME: we need to record these effects somewhere...
227 ast::Effect::Async(_) | ast::Effect::Label(_) => { 227 ast::Effect::Label(label) => match e.block_expr() {
228 self.collect_block_opt(e.block_expr()) 228 Some(block) => {
229 } 229 let res = self.collect_block(block);
230 match &mut self.body.exprs[res] {
231 Expr::Block { label: block_label, .. } => {
232 *block_label =
233 label.lifetime_token().map(|t| Name::new_lifetime(&t))
234 }
235 _ => unreachable!(),
236 }
237 res
238 }
239 None => self.missing_expr(),
240 },
241 // FIXME: we need to record these effects somewhere...
242 ast::Effect::Async(_) => self.collect_block_opt(e.block_expr()),
230 }, 243 },
231 ast::Expr::BlockExpr(e) => self.collect_block(e), 244 ast::Expr::BlockExpr(e) => self.collect_block(e),
232 ast::Expr::LoopExpr(e) => { 245 ast::Expr::LoopExpr(e) => {
@@ -324,7 +337,7 @@ impl ExprCollector<'_> {
324 }; 337 };
325 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);
326 let generic_args = 339 let generic_args =
327 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));
328 self.alloc_expr( 341 self.alloc_expr(
329 Expr::MethodCall { receiver, method_name, args, generic_args }, 342 Expr::MethodCall { receiver, method_name, args, generic_args },
330 syntax_ptr, 343 syntax_ptr,
@@ -460,7 +473,7 @@ impl ExprCollector<'_> {
460 self.alloc_expr(Expr::Missing, syntax_ptr) 473 self.alloc_expr(Expr::Missing, syntax_ptr)
461 } 474 }
462 } 475 }
463 ast::Expr::LambdaExpr(e) => { 476 ast::Expr::ClosureExpr(e) => {
464 let mut args = Vec::new(); 477 let mut args = Vec::new();
465 let mut arg_types = Vec::new(); 478 let mut arg_types = Vec::new();
466 if let Some(pl) = e.param_list() { 479 if let Some(pl) = e.param_list() {
@@ -483,7 +496,7 @@ impl ExprCollector<'_> {
483 self.alloc_expr(Expr::BinaryOp { lhs, rhs, op }, syntax_ptr) 496 self.alloc_expr(Expr::BinaryOp { lhs, rhs, op }, syntax_ptr)
484 } 497 }
485 ast::Expr::TupleExpr(e) => { 498 ast::Expr::TupleExpr(e) => {
486 let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect(); 499 let exprs = e.fields().map(|expr| self.collect_expr(expr)).collect();
487 self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr) 500 self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr)
488 } 501 }
489 ast::Expr::BoxExpr(e) => { 502 ast::Expr::BoxExpr(e) => {
@@ -556,9 +569,6 @@ impl ExprCollector<'_> {
556 } 569 }
557 } 570 }
558 } 571 }
559
560 // FIXME implement HIR for these:
561 ast::Expr::Label(_e) => self.alloc_expr(Expr::Missing, syntax_ptr),
562 } 572 }
563 } 573 }
564 574
@@ -601,26 +611,35 @@ impl ExprCollector<'_> {
601 self.collect_block_items(&block); 611 self.collect_block_items(&block);
602 let statements = block 612 let statements = block
603 .statements() 613 .statements()
604 .map(|s| match s { 614 .filter_map(|s| {
605 ast::Stmt::LetStmt(stmt) => { 615 let stmt = match s {
606 let pat = self.collect_pat_opt(stmt.pat()); 616 ast::Stmt::LetStmt(stmt) => {
607 let type_ref = stmt.ty().map(|it| TypeRef::from_ast(&self.ctx(), it)); 617 let pat = self.collect_pat_opt(stmt.pat());
608 let initializer = stmt.initializer().map(|e| self.collect_expr(e)); 618 let type_ref = stmt.ty().map(|it| TypeRef::from_ast(&self.ctx(), it));
609 Statement::Let { pat, type_ref, initializer } 619 let initializer = stmt.initializer().map(|e| self.collect_expr(e));
610 } 620 Statement::Let { pat, type_ref, initializer }
611 ast::Stmt::ExprStmt(stmt) => Statement::Expr(self.collect_expr_opt(stmt.expr())), 621 }
622 ast::Stmt::ExprStmt(stmt) => {
623 Statement::Expr(self.collect_expr_opt(stmt.expr()))
624 }
625 ast::Stmt::Item(_) => return None,
626 };
627 Some(stmt)
612 }) 628 })
613 .collect(); 629 .collect();
614 let tail = block.expr().map(|e| self.collect_expr(e)); 630 let tail = block.expr().map(|e| self.collect_expr(e));
615 let label = block.label().and_then(|l| l.lifetime_token()).map(|t| Name::new_lifetime(&t)); 631 self.alloc_expr(Expr::Block { statements, tail, label: None }, syntax_node_ptr)
616 self.alloc_expr(Expr::Block { statements, tail, label }, syntax_node_ptr)
617 } 632 }
618 633
619 fn collect_block_items(&mut self, block: &ast::BlockExpr) { 634 fn collect_block_items(&mut self, block: &ast::BlockExpr) {
620 let container = ContainerId::DefWithBodyId(self.def); 635 let container = ContainerId::DefWithBodyId(self.def);
621 636
622 let items = block 637 let items = block
623 .items() 638 .statements()
639 .filter_map(|stmt| match stmt {
640 ast::Stmt::Item(it) => Some(it),
641 ast::Stmt::LetStmt(_) | ast::Stmt::ExprStmt(_) => None,
642 })
624 .filter_map(|item| { 643 .filter_map(|item| {
625 let (def, name): (ModuleDefId, Option<ast::Name>) = match item { 644 let (def, name): (ModuleDefId, Option<ast::Name>) = match item {
626 ast::Item::Fn(def) => { 645 ast::Item::Fn(def) => {
@@ -704,7 +723,7 @@ impl ExprCollector<'_> {
704 723
705 fn collect_pat(&mut self, pat: ast::Pat) -> PatId { 724 fn collect_pat(&mut self, pat: ast::Pat) -> PatId {
706 let pattern = match &pat { 725 let pattern = match &pat {
707 ast::Pat::BindPat(bp) => { 726 ast::Pat::IdentPat(bp) => {
708 let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); 727 let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
709 let annotation = 728 let annotation =
710 BindingAnnotation::new(bp.mut_token().is_some(), bp.ref_token().is_some()); 729 BindingAnnotation::new(bp.mut_token().is_some(), bp.ref_token().is_some());
@@ -743,7 +762,7 @@ impl ExprCollector<'_> {
743 } 762 }
744 ast::Pat::TupleStructPat(p) => { 763 ast::Pat::TupleStructPat(p) => {
745 let path = p.path().and_then(|path| self.expander.parse_path(path)); 764 let path = p.path().and_then(|path| self.expander.parse_path(path));
746 let (args, ellipsis) = self.collect_tuple_pat(p.args()); 765 let (args, ellipsis) = self.collect_tuple_pat(p.fields());
747 Pat::TupleStruct { path, args, ellipsis } 766 Pat::TupleStruct { path, args, ellipsis }
748 } 767 }
749 ast::Pat::RefPat(p) => { 768 ast::Pat::RefPat(p) => {
@@ -761,40 +780,36 @@ impl ExprCollector<'_> {
761 } 780 }
762 ast::Pat::ParenPat(p) => return self.collect_pat_opt(p.pat()), 781 ast::Pat::ParenPat(p) => return self.collect_pat_opt(p.pat()),
763 ast::Pat::TuplePat(p) => { 782 ast::Pat::TuplePat(p) => {
764 let (args, ellipsis) = self.collect_tuple_pat(p.args()); 783 let (args, ellipsis) = self.collect_tuple_pat(p.fields());
765 Pat::Tuple { args, ellipsis } 784 Pat::Tuple { args, ellipsis }
766 } 785 }
767 ast::Pat::PlaceholderPat(_) => Pat::Wild, 786 ast::Pat::WildcardPat(_) => Pat::Wild,
768 ast::Pat::RecordPat(p) => { 787 ast::Pat::RecordPat(p) => {
769 let path = p.path().and_then(|path| self.expander.parse_path(path)); 788 let path = p.path().and_then(|path| self.expander.parse_path(path));
770 let record_field_pat_list = 789 let args: Vec<_> = p
771 p.record_field_pat_list().expect("every struct should have a field list"); 790 .record_pat_field_list()
772 let mut fields: Vec<_> = record_field_pat_list 791 .expect("every struct should have a field list")
773 .bind_pats() 792 .fields()
774 .filter_map(|bind_pat| { 793 .filter_map(|f| {
775 let ast_pat = 794 let ast_pat = f.pat()?;
776 ast::Pat::cast(bind_pat.syntax().clone()).expect("bind pat is a pat");
777 let pat = self.collect_pat(ast_pat); 795 let pat = self.collect_pat(ast_pat);
778 let name = bind_pat.name()?.as_name(); 796 let name = f.field_name()?.as_name();
779 Some(RecordFieldPat { name, pat }) 797 Some(RecordFieldPat { name, pat })
780 }) 798 })
781 .collect(); 799 .collect();
782 let iter = record_field_pat_list.record_field_pats().filter_map(|f| {
783 let ast_pat = f.pat()?;
784 let pat = self.collect_pat(ast_pat);
785 let name = f.field_name()?.as_name();
786 Some(RecordFieldPat { name, pat })
787 });
788 fields.extend(iter);
789 800
790 let ellipsis = record_field_pat_list.dotdot_token().is_some(); 801 let ellipsis = p
802 .record_pat_field_list()
803 .expect("every struct should have a field list")
804 .dotdot_token()
805 .is_some();
791 806
792 Pat::Record { path, args: fields, ellipsis } 807 Pat::Record { path, args, ellipsis }
793 } 808 }
794 ast::Pat::SlicePat(p) => { 809 ast::Pat::SlicePat(p) => {
795 let SlicePatComponents { prefix, slice, suffix } = p.components(); 810 let SlicePatComponents { prefix, slice, suffix } = p.components();
796 811
797 // FIXME properly handle `DotDotPat` 812 // FIXME properly handle `RestPat`
798 Pat::Slice { 813 Pat::Slice {
799 prefix: prefix.into_iter().map(|p| self.collect_pat(p)).collect(), 814 prefix: prefix.into_iter().map(|p| self.collect_pat(p)).collect(),
800 slice: slice.map(|p| self.collect_pat(p)), 815 slice: slice.map(|p| self.collect_pat(p)),
@@ -811,10 +826,10 @@ impl ExprCollector<'_> {
811 Pat::Missing 826 Pat::Missing
812 } 827 }
813 } 828 }
814 ast::Pat::DotDotPat(_) => { 829 ast::Pat::RestPat(_) => {
815 // `DotDotPat` requires special handling and should not be mapped 830 // `RestPat` requires special handling and should not be mapped
816 // to a Pat. Here we are using `Pat::Missing` as a fallback for 831 // to a Pat. Here we are using `Pat::Missing` as a fallback for
817 // when `DotDotPat` is mapped to `Pat`, which can easily happen 832 // when `RestPat` is mapped to `Pat`, which can easily happen
818 // when the source code being analyzed has a malformed pattern 833 // when the source code being analyzed has a malformed pattern
819 // which includes `..` in a place where it isn't valid. 834 // which includes `..` in a place where it isn't valid.
820 835
@@ -838,10 +853,10 @@ impl ExprCollector<'_> {
838 fn collect_tuple_pat(&mut self, args: AstChildren<ast::Pat>) -> (Vec<PatId>, Option<usize>) { 853 fn collect_tuple_pat(&mut self, args: AstChildren<ast::Pat>) -> (Vec<PatId>, Option<usize>) {
839 // Find the location of the `..`, if there is one. Note that we do not 854 // Find the location of the `..`, if there is one. Note that we do not
840 // consider the possiblity of there being multiple `..` here. 855 // consider the possiblity of there being multiple `..` here.
841 let ellipsis = args.clone().position(|p| matches!(p, ast::Pat::DotDotPat(_))); 856 let ellipsis = args.clone().position(|p| matches!(p, ast::Pat::RestPat(_)));
842 // We want to skip the `..` pattern here, since we account for it above. 857 // We want to skip the `..` pattern here, since we account for it above.
843 let args = args 858 let args = args
844 .filter(|p| !matches!(p, ast::Pat::DotDotPat(_))) 859 .filter(|p| !matches!(p, ast::Pat::RestPat(_)))
845 .map(|p| self.collect_pat(p)) 860 .map(|p| self.collect_pat(p))
846 .collect(); 861 .collect();
847 862
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index 8ea61fcf2..699ba9c92 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -253,7 +253,7 @@ impl GenericParams {
253 253
254 fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx, where_clause: ast::WhereClause) { 254 fn fill_where_predicates(&mut self, lower_ctx: &LowerCtx, where_clause: ast::WhereClause) {
255 for pred in where_clause.predicates() { 255 for pred in where_clause.predicates() {
256 let type_ref = match pred.type_ref() { 256 let type_ref = match pred.ty() {
257 Some(type_ref) => type_ref, 257 Some(type_ref) => type_ref,
258 None => continue, 258 None => continue,
259 }; 259 };
@@ -270,7 +270,7 @@ impl GenericParams {
270 bound: ast::TypeBound, 270 bound: ast::TypeBound,
271 type_ref: TypeRef, 271 type_ref: TypeRef,
272 ) { 272 ) {
273 if bound.question_token().is_some() { 273 if bound.question_mark_token().is_some() {
274 // FIXME: remove this bound 274 // FIXME: remove this bound
275 return; 275 return;
276 } 276 }
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index feb31579e..450ef8798 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -448,8 +448,8 @@ impl Ctx {
448 fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> { 448 fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> {
449 let generic_params = 449 let generic_params =
450 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); 450 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def);
451 let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); 451 let target_trait = impl_def.trait_().map(|tr| self.lower_type_ref(&tr));
452 let target_type = self.lower_type_ref(&impl_def.target_type()?); 452 let target_type = self.lower_type_ref(&impl_def.self_ty()?);
453 let is_negative = impl_def.excl_token().is_some(); 453 let is_negative = impl_def.excl_token().is_some();
454 454
455 // We cannot use `assoc_items()` here as that does not include macro calls. 455 // We cannot use `assoc_items()` here as that does not include macro calls.
@@ -648,10 +648,10 @@ impl Ctx {
648 self.data().vis.alloc(vis) 648 self.data().vis.alloc(vis)
649 } 649 }
650 650
651 fn lower_type_ref(&self, type_ref: &ast::TypeRef) -> TypeRef { 651 fn lower_type_ref(&self, type_ref: &ast::Type) -> TypeRef {
652 TypeRef::from_ast(&self.body_ctx, type_ref.clone()) 652 TypeRef::from_ast(&self.body_ctx, type_ref.clone())
653 } 653 }
654 fn lower_type_ref_opt(&self, type_ref: Option<ast::TypeRef>) -> TypeRef { 654 fn lower_type_ref_opt(&self, type_ref: Option<ast::Type>) -> TypeRef {
655 type_ref.map(|ty| self.lower_type_ref(&ty)).unwrap_or(TypeRef::Error) 655 type_ref.map(|ty| self.lower_type_ref(&ty)).unwrap_or(TypeRef::Error)
656 } 656 }
657 657
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 07d17916a..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.type_ref());
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.type_ref().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_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs
index a5dc10eac..6f7884ffe 100644
--- a/crates/ra_hir_def/src/type_ref.rs
+++ b/crates/ra_hir_def/src/type_ref.rs
@@ -1,6 +1,5 @@
1//! HIR for references to types. Paths in these are not yet resolved. They can 1//! HIR for references to types. Paths in these are not yet resolved. They can
2//! be directly created from an ast::TypeRef, without further queries. 2//! be directly created from an ast::TypeRef, without further queries.
3
4use ra_syntax::ast::{self}; 3use ra_syntax::ast::{self};
5 4
6use crate::{body::LowerCtx, path::Path}; 5use crate::{body::LowerCtx, path::Path};
@@ -80,14 +79,14 @@ pub enum TypeBound {
80 79
81impl TypeRef { 80impl TypeRef {
82 /// Converts an `ast::TypeRef` to a `hir::TypeRef`. 81 /// Converts an `ast::TypeRef` to a `hir::TypeRef`.
83 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self { 82 pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::Type) -> Self {
84 match node { 83 match node {
85 ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), 84 ast::Type::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
86 ast::TypeRef::TupleType(inner) => { 85 ast::Type::TupleType(inner) => {
87 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) 86 TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect())
88 } 87 }
89 ast::TypeRef::NeverType(..) => TypeRef::Never, 88 ast::Type::NeverType(..) => TypeRef::Never,
90 ast::TypeRef::PathType(inner) => { 89 ast::Type::PathType(inner) => {
91 // FIXME: Use `Path::from_src` 90 // FIXME: Use `Path::from_src`
92 inner 91 inner
93 .path() 92 .path()
@@ -95,24 +94,24 @@ impl TypeRef {
95 .map(TypeRef::Path) 94 .map(TypeRef::Path)
96 .unwrap_or(TypeRef::Error) 95 .unwrap_or(TypeRef::Error)
97 } 96 }
98 ast::TypeRef::PointerType(inner) => { 97 ast::Type::PtrType(inner) => {
99 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); 98 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
100 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 99 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
101 TypeRef::RawPtr(Box::new(inner_ty), mutability) 100 TypeRef::RawPtr(Box::new(inner_ty), mutability)
102 } 101 }
103 ast::TypeRef::ArrayType(inner) => { 102 ast::Type::ArrayType(inner) => {
104 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) 103 TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
105 } 104 }
106 ast::TypeRef::SliceType(inner) => { 105 ast::Type::SliceType(inner) => {
107 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) 106 TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty())))
108 } 107 }
109 ast::TypeRef::ReferenceType(inner) => { 108 ast::Type::RefType(inner) => {
110 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); 109 let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty());
111 let mutability = Mutability::from_mutable(inner.mut_token().is_some()); 110 let mutability = Mutability::from_mutable(inner.mut_token().is_some());
112 TypeRef::Reference(Box::new(inner_ty), mutability) 111 TypeRef::Reference(Box::new(inner_ty), mutability)
113 } 112 }
114 ast::TypeRef::PlaceholderType(_inner) => TypeRef::Placeholder, 113 ast::Type::InferType(_inner) => TypeRef::Placeholder,
115 ast::TypeRef::FnPointerType(inner) => { 114 ast::Type::FnPtrType(inner) => {
116 let ret_ty = inner 115 let ret_ty = inner
117 .ret_type() 116 .ret_type()
118 .and_then(|rt| rt.ty()) 117 .and_then(|rt| rt.ty())
@@ -132,17 +131,17 @@ impl TypeRef {
132 TypeRef::Fn(params, is_varargs) 131 TypeRef::Fn(params, is_varargs)
133 } 132 }
134 // for types are close enough for our purposes to the inner type for now... 133 // for types are close enough for our purposes to the inner type for now...
135 ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), 134 ast::Type::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()),
136 ast::TypeRef::ImplTraitType(inner) => { 135 ast::Type::ImplTraitType(inner) => {
137 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) 136 TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
138 } 137 }
139 ast::TypeRef::DynTraitType(inner) => { 138 ast::Type::DynTraitType(inner) => {
140 TypeRef::DynTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) 139 TypeRef::DynTrait(type_bounds_from_ast(ctx, inner.type_bound_list()))
141 } 140 }
142 } 141 }
143 } 142 }
144 143
145 pub(crate) fn from_ast_opt(ctx: &LowerCtx, node: Option<ast::TypeRef>) -> Self { 144 pub(crate) fn from_ast_opt(ctx: &LowerCtx, node: Option<ast::Type>) -> Self {
146 if let Some(node) = node { 145 if let Some(node) = node {
147 TypeRef::from_ast(ctx, node) 146 TypeRef::from_ast(ctx, node)
148 } else { 147 } else {
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index 41df66696..f3b7cd492 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -379,7 +379,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
379 379
380 FOR_EXPR => FragmentKind::Expr, 380 FOR_EXPR => FragmentKind::Expr,
381 PATH_EXPR => FragmentKind::Expr, 381 PATH_EXPR => FragmentKind::Expr,
382 LAMBDA_EXPR => FragmentKind::Expr, 382 CLOSURE_EXPR => FragmentKind::Expr,
383 CONDITION => FragmentKind::Expr, 383 CONDITION => FragmentKind::Expr,
384 BREAK_EXPR => FragmentKind::Expr, 384 BREAK_EXPR => FragmentKind::Expr,
385 RETURN_EXPR => FragmentKind::Expr, 385 RETURN_EXPR => FragmentKind::Expr,
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs
index f210c305a..977c0525b 100644
--- a/crates/ra_hir_ty/src/diagnostics.rs
+++ b/crates/ra_hir_ty/src/diagnostics.rs
@@ -92,7 +92,7 @@ impl AstDiagnostic for MissingFields {
92#[derive(Debug)] 92#[derive(Debug)]
93pub struct MissingPatFields { 93pub struct MissingPatFields {
94 pub file: HirFileId, 94 pub file: HirFileId,
95 pub field_list: AstPtr<ast::RecordFieldPatList>, 95 pub field_list: AstPtr<ast::RecordPatFieldList>,
96 pub missed_fields: Vec<Name>, 96 pub missed_fields: Vec<Name>,
97} 97}
98 98
diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/ra_hir_ty/src/diagnostics/expr.rs
index f0e0f2988..95bbf2d95 100644
--- a/crates/ra_hir_ty/src/diagnostics/expr.rs
+++ b/crates/ra_hir_ty/src/diagnostics/expr.rs
@@ -131,7 +131,7 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
131 if let Some(expr) = source_ptr.value.as_ref().left() { 131 if let Some(expr) = source_ptr.value.as_ref().left() {
132 let root = source_ptr.file_syntax(db.upcast()); 132 let root = source_ptr.file_syntax(db.upcast());
133 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) { 133 if let ast::Pat::RecordPat(record_pat) = expr.to_node(&root) {
134 if let Some(field_list) = record_pat.record_field_pat_list() { 134 if let Some(field_list) = record_pat.record_pat_field_list() {
135 let variant_data = variant_data(db.upcast(), variant_def); 135 let variant_data = variant_data(db.upcast(), variant_def);
136 let missed_fields = missed_fields 136 let missed_fields = missed_fields
137 .into_iter() 137 .into_iter()
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 2113abbb2..6b03b30bb 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -265,7 +265,7 @@ impl<'a> CompletionContext<'a> {
265 return; 265 return;
266 } 266 }
267 // FIXME: remove this (V) duplication and make the check more precise 267 // FIXME: remove this (V) duplication and make the check more precise
268 if name_ref.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 268 if name_ref.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
269 self.record_pat_syntax = 269 self.record_pat_syntax =
270 self.sema.find_node_at_offset_with_macros(&original_file, offset); 270 self.sema.find_node_at_offset_with_macros(&original_file, offset);
271 } 271 }
@@ -275,7 +275,7 @@ impl<'a> CompletionContext<'a> {
275 // Otherwise, see if this is a declaration. We can use heuristics to 275 // Otherwise, see if this is a declaration. We can use heuristics to
276 // suggest declaration names, see `CompletionKind::Magic`. 276 // suggest declaration names, see `CompletionKind::Magic`.
277 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { 277 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) {
278 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { 278 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::IdentPat::cast) {
279 self.is_pat_binding_or_const = true; 279 self.is_pat_binding_or_const = true;
280 if bind_pat.at_token().is_some() 280 if bind_pat.at_token().is_some()
281 || bind_pat.ref_token().is_some() 281 || bind_pat.ref_token().is_some()
@@ -283,7 +283,7 @@ impl<'a> CompletionContext<'a> {
283 { 283 {
284 self.is_pat_binding_or_const = false; 284 self.is_pat_binding_or_const = false;
285 } 285 }
286 if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { 286 if bind_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast).is_some() {
287 self.is_pat_binding_or_const = false; 287 self.is_pat_binding_or_const = false;
288 } 288 }
289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { 289 if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) {
@@ -300,7 +300,7 @@ impl<'a> CompletionContext<'a> {
300 return; 300 return;
301 } 301 }
302 // FIXME: remove this (^) duplication and make the check more precise 302 // FIXME: remove this (^) duplication and make the check more precise
303 if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { 303 if name.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() {
304 self.record_pat_syntax = 304 self.record_pat_syntax =
305 self.sema.find_node_at_offset_with_macros(&original_file, offset); 305 self.sema.find_node_at_offset_with_macros(&original_file, offset);
306 } 306 }
@@ -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/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index a68861e1c..7c4feff6d 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -44,7 +44,7 @@ fn test_has_block_expr_parent() {
44} 44}
45 45
46pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { 46pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool {
47 element.ancestors().find(|it| it.kind() == BIND_PAT).is_some() 47 element.ancestors().find(|it| it.kind() == IDENT_PAT).is_some()
48} 48}
49#[test] 49#[test]
50fn test_has_bind_pat_parent() { 50fn test_has_bind_pat_parent() {
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool {
134 NodeOrToken::Token(token) => token.parent(), 134 NodeOrToken::Token(token) => token.parent(),
135 }; 135 };
136 for node in leaf.ancestors() { 136 for node in leaf.ancestors() {
137 if node.kind() == FN || node.kind() == LAMBDA_EXPR { 137 if node.kind() == FN || node.kind() == CLOSURE_EXPR {
138 break; 138 break;
139 } 139 }
140 let loop_body = match_ast! { 140 let loop_body = match_ast! {
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 45fbc86ef..fdbf75abd 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -7,7 +7,7 @@ use ra_ide_db::{defs::Definition, RootDatabase};
7use ra_syntax::{ 7use ra_syntax::{
8 ast::{self, DocCommentsOwner, NameOwner}, 8 ast::{self, DocCommentsOwner, NameOwner},
9 match_ast, AstNode, SmolStr, 9 match_ast, AstNode, SmolStr,
10 SyntaxKind::{self, BIND_PAT, TYPE_PARAM}, 10 SyntaxKind::{self, IDENT_PAT, TYPE_PARAM},
11 TextRange, 11 TextRange,
12}; 12};
13 13
@@ -253,7 +253,7 @@ impl ToNav for hir::ImplDef {
253 let focus_range = if derive_attr.is_some() { 253 let focus_range = if derive_attr.is_some() {
254 None 254 None
255 } else { 255 } else {
256 src.value.target_type().map(|ty| original_range(db, src.with_value(ty.syntax())).range) 256 src.value.self_ty().map(|ty| original_range(db, src.with_value(ty.syntax())).range)
257 }; 257 };
258 258
259 NavigationTarget::from_syntax( 259 NavigationTarget::from_syntax(
@@ -339,7 +339,7 @@ impl ToNav for hir::Local {
339 NavigationTarget { 339 NavigationTarget {
340 file_id: full_range.file_id, 340 file_id: full_range.file_id,
341 name, 341 name,
342 kind: BIND_PAT, 342 kind: IDENT_PAT,
343 full_range: full_range.range, 343 full_range: full_range.range,
344 focus_range: None, 344 focus_range: None,
345 container_name: None, 345 container_name: None,
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index bddf1bd47..0fdf8e9a5 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -77,7 +77,7 @@ impl ShortLabel for ast::Variant {
77 } 77 }
78} 78}
79 79
80fn short_label_from_ty<T>(node: &T, ty: Option<ast::TypeRef>, prefix: &str) -> Option<String> 80fn short_label_from_ty<T>(node: &T, ty: Option<ast::Type>, prefix: &str) -> Option<String>
81where 81where
82 T: NameOwner + VisibilityOwner, 82 T: NameOwner + VisibilityOwner,
83{ 83{
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index fc81b48cc..7230a0ff9 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -37,7 +37,7 @@ fn try_extend_selection(
37 37
38 let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; 38 let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING];
39 let list_kinds = [ 39 let list_kinds = [
40 RECORD_FIELD_PAT_LIST, 40 RECORD_PAT_FIELD_LIST,
41 MATCH_ARM_LIST, 41 MATCH_ARM_LIST,
42 RECORD_FIELD_LIST, 42 RECORD_FIELD_LIST,
43 TUPLE_FIELD_LIST, 43 TUPLE_FIELD_LIST,
@@ -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_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index 91765140a..87cab4503 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -57,7 +57,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
57 57
58 fn decl_with_type_ref<N: NameOwner + AttrsOwner>( 58 fn decl_with_type_ref<N: NameOwner + AttrsOwner>(
59 node: &N, 59 node: &N,
60 type_ref: Option<ast::TypeRef>, 60 type_ref: Option<ast::Type>,
61 ) -> Option<StructureNode> { 61 ) -> Option<StructureNode> {
62 let detail = type_ref.map(|type_ref| { 62 let detail = type_ref.map(|type_ref| {
63 let mut detail = String::new(); 63 let mut detail = String::new();
@@ -130,8 +130,8 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
130 ast::Const(it) => decl_with_type_ref(&it, it.ty()), 130 ast::Const(it) => decl_with_type_ref(&it, it.ty()),
131 ast::Static(it) => decl_with_type_ref(&it, it.ty()), 131 ast::Static(it) => decl_with_type_ref(&it, it.ty()),
132 ast::Impl(it) => { 132 ast::Impl(it) => {
133 let target_type = it.target_type()?; 133 let target_type = it.self_ty()?;
134 let target_trait = it.target_trait(); 134 let target_trait = it.trait_();
135 let label = match target_trait { 135 let label = match target_trait {
136 None => format!("impl {}", target_type.syntax().text()), 136 None => format!("impl {}", target_type.syntax().text()),
137 Some(t) => { 137 Some(t) => {
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs
index 5a6e17936..903c34996 100644
--- a/crates/ra_ide/src/folding_ranges.rs
+++ b/crates/ra_ide/src/folding_ranges.rs
@@ -86,7 +86,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
86 USE => Some(FoldKind::Imports), 86 USE => Some(FoldKind::Imports),
87 ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), 87 ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
88 RECORD_FIELD_LIST 88 RECORD_FIELD_LIST
89 | RECORD_FIELD_PAT_LIST 89 | RECORD_PAT_FIELD_LIST
90 | RECORD_EXPR_FIELD_LIST 90 | RECORD_EXPR_FIELD_LIST
91 | ITEM_LIST 91 | ITEM_LIST
92 | EXTERN_ITEM_LIST 92 | EXTERN_ITEM_LIST
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 4bbbcd258..1bacead63 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -78,7 +78,7 @@ pub(crate) fn inlay_hints(
78 match node { 78 match node {
79 ast::CallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, 79 ast::CallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); },
80 ast::MethodCallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, 80 ast::MethodCallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); },
81 ast::BindPat(it) => { get_bind_pat_hints(&mut res, &sema, config, it); }, 81 ast::IdentPat(it) => { get_bind_pat_hints(&mut res, &sema, config, it); },
82 _ => (), 82 _ => (),
83 } 83 }
84 } 84 }
@@ -161,7 +161,7 @@ fn get_param_name_hints(
161 Either::Left(self_param) => Some((self_param.to_string(), arg)), 161 Either::Left(self_param) => Some((self_param.to_string(), arg)),
162 Either::Right(pat) => { 162 Either::Right(pat) => {
163 let param_name = match pat { 163 let param_name = match pat {
164 ast::Pat::BindPat(it) => it.name()?.to_string(), 164 ast::Pat::IdentPat(it) => it.name()?.to_string(),
165 it => it.to_string(), 165 it => it.to_string(),
166 }; 166 };
167 Some((param_name, arg)) 167 Some((param_name, arg))
@@ -182,7 +182,7 @@ fn get_bind_pat_hints(
182 acc: &mut Vec<InlayHint>, 182 acc: &mut Vec<InlayHint>,
183 sema: &Semantics<RootDatabase>, 183 sema: &Semantics<RootDatabase>,
184 config: &InlayHintsConfig, 184 config: &InlayHintsConfig,
185 pat: ast::BindPat, 185 pat: ast::IdentPat,
186) -> Option<()> { 186) -> Option<()> {
187 if !config.type_hints { 187 if !config.type_hints {
188 return None; 188 return None;
@@ -202,7 +202,7 @@ fn get_bind_pat_hints(
202 Some(()) 202 Some(())
203} 203}
204 204
205fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type) -> bool { 205fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::IdentPat, pat_ty: &Type) -> bool {
206 if let Some(Adt::Enum(enum_data)) = pat_ty.as_adt() { 206 if let Some(Adt::Enum(enum_data)) = pat_ty.as_adt() {
207 let pat_text = bind_pat.to_string(); 207 let pat_text = bind_pat.to_string();
208 enum_data 208 enum_data
@@ -215,7 +215,11 @@ fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type
215 } 215 }
216} 216}
217 217
218fn should_not_display_type_hint(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type) -> bool { 218fn should_not_display_type_hint(
219 db: &RootDatabase,
220 bind_pat: &ast::IdentPat,
221 pat_ty: &Type,
222) -> bool {
219 if pat_ty.is_unknown() { 223 if pat_ty.is_unknown() {
220 return true; 224 return true;
221 } 225 }
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 519e4bf1a..cf456630a 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -150,7 +150,7 @@ fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Optio
150 let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?; 150 let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?;
151 if stmt.initializer().is_some() { 151 if stmt.initializer().is_some() {
152 let pat = stmt.pat()?; 152 let pat = stmt.pat()?;
153 if let ast::Pat::BindPat(it) = pat { 153 if let ast::Pat::IdentPat(it) = pat {
154 if it.mut_token().is_some() { 154 if it.mut_token().is_some() {
155 return Some(ReferenceAccess::Write); 155 return Some(ReferenceAccess::Write);
156 } 156 }
@@ -290,7 +290,7 @@ fn main() {
290 ); 290 );
291 check_result( 291 check_result(
292 refs, 292 refs,
293 "i BIND_PAT FileId(1) 24..25 Other Write", 293 "i IDENT_PAT FileId(1) 24..25 Other Write",
294 &[ 294 &[
295 "FileId(1) 50..51 Other Write", 295 "FileId(1) 50..51 Other Write",
296 "FileId(1) 54..55 Other Read", 296 "FileId(1) 54..55 Other Read",
@@ -316,7 +316,7 @@ fn bar() {
316 ); 316 );
317 check_result( 317 check_result(
318 refs, 318 refs,
319 "spam BIND_PAT FileId(1) 19..23 Other", 319 "spam IDENT_PAT FileId(1) 19..23 Other",
320 &["FileId(1) 34..38 Other Read", "FileId(1) 41..45 Other Read"], 320 &["FileId(1) 34..38 Other Read", "FileId(1) 41..45 Other Read"],
321 ); 321 );
322 } 322 }
@@ -330,7 +330,7 @@ fn foo(i : u32) -> u32 {
330} 330}
331"#, 331"#,
332 ); 332 );
333 check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); 333 check_result(refs, "i IDENT_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]);
334 } 334 }
335 335
336 #[test] 336 #[test]
@@ -342,7 +342,7 @@ fn foo(i<|> : u32) -> u32 {
342} 342}
343"#, 343"#,
344 ); 344 );
345 check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); 345 check_result(refs, "i IDENT_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]);
346 } 346 }
347 347
348 #[test] 348 #[test]
@@ -559,7 +559,7 @@ fn foo() {
559 ); 559 );
560 check_result( 560 check_result(
561 refs, 561 refs,
562 "i BIND_PAT FileId(1) 23..24 Other Write", 562 "i IDENT_PAT FileId(1) 23..24 Other Write",
563 &["FileId(1) 34..35 Other Write", "FileId(1) 38..39 Other Read"], 563 &["FileId(1) 34..35 Other Write", "FileId(1) 38..39 Other Read"],
564 ); 564 );
565 } 565 }
@@ -595,7 +595,7 @@ fn foo() {
595} 595}
596"#, 596"#,
597 ); 597 );
598 check_result(refs, "i BIND_PAT FileId(1) 19..20 Other", &["FileId(1) 26..27 Other Write"]); 598 check_result(refs, "i IDENT_PAT FileId(1) 19..20 Other", &["FileId(1) 26..27 Other Write"]);
599 } 599 }
600 600
601 #[test] 601 #[test]
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 31654bf79..c8d80fcf7 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -157,7 +157,7 @@ fn rename_to_self(
157 } 157 }
158 let first_param = params.params().next()?; 158 let first_param = params.params().next()?;
159 let mutable = match first_param.ty() { 159 let mutable = match first_param.ty() {
160 Some(ast::TypeRef::ReferenceType(rt)) => rt.mut_token().is_some(), 160 Some(ast::Type::RefType(rt)) => rt.mut_token().is_some(),
161 _ => return None, // not renaming other types 161 _ => return None, // not renaming other types
162 }; 162 };
163 163
@@ -194,7 +194,7 @@ fn text_edit_from_self_param(
194 new_name: &str, 194 new_name: &str,
195) -> Option<TextEdit> { 195) -> Option<TextEdit> {
196 fn target_type_name(impl_def: &ast::Impl) -> Option<String> { 196 fn target_type_name(impl_def: &ast::Impl) -> Option<String> {
197 if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { 197 if let Some(ast::Type::PathType(p)) = impl_def.self_ty() {
198 return Some(p.path()?.segment()?.name_ref()?.text().to_string()); 198 return Some(p.path()?.segment()?.name_ref()?.text().to_string());
199 } 199 }
200 None 200 None
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index e3a96f9d5..a32ae0165 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -546,7 +546,7 @@ fn highlight_element(
546 T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { 546 T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => {
547 HighlightTag::Macro.into() 547 HighlightTag::Macro.into()
548 } 548 }
549 T![*] if element.parent().and_then(ast::PointerType::cast).is_some() => { 549 T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => {
550 HighlightTag::Keyword.into() 550 HighlightTag::Keyword.into()
551 } 551 }
552 T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { 552 T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => {
@@ -577,7 +577,7 @@ fn highlight_element(
577 _ if element.parent().and_then(ast::RangePat::cast).is_some() => { 577 _ if element.parent().and_then(ast::RangePat::cast).is_some() => {
578 HighlightTag::Operator.into() 578 HighlightTag::Operator.into()
579 } 579 }
580 _ if element.parent().and_then(ast::DotDotPat::cast).is_some() => { 580 _ if element.parent().and_then(ast::RestPat::cast).is_some() => {
581 HighlightTag::Operator.into() 581 HighlightTag::Operator.into()
582 } 582 }
583 _ if element.parent().and_then(ast::Attr::cast).is_some() => { 583 _ if element.parent().and_then(ast::Attr::cast).is_some() => {
@@ -717,7 +717,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
717 CONST => HighlightTag::Constant, 717 CONST => HighlightTag::Constant,
718 STATIC => HighlightTag::Static, 718 STATIC => HighlightTag::Static,
719 VARIANT => HighlightTag::EnumVariant, 719 VARIANT => HighlightTag::EnumVariant,
720 BIND_PAT => HighlightTag::Local, 720 IDENT_PAT => HighlightTag::Local,
721 _ => default, 721 _ => default,
722 }; 722 };
723 723
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index df56f2d9e..66c048714 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -111,7 +111,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
111 111
112 let parent = name.syntax().parent()?; 112 let parent = name.syntax().parent()?;
113 113
114 if let Some(bind_pat) = ast::BindPat::cast(parent.clone()) { 114 if let Some(bind_pat) = ast::IdentPat::cast(parent.clone()) {
115 if let Some(def) = sema.resolve_bind_pat_to_const(&bind_pat) { 115 if let Some(def) = sema.resolve_bind_pat_to_const(&bind_pat) {
116 return Some(NameClass::ConstReference(Definition::ModuleDef(def))); 116 return Some(NameClass::ConstReference(Definition::ModuleDef(def)));
117 } 117 }
@@ -128,10 +128,10 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
128 128
129 Some(NameClass::Definition(name_ref_class.definition())) 129 Some(NameClass::Definition(name_ref_class.definition()))
130 }, 130 },
131 ast::BindPat(it) => { 131 ast::IdentPat(it) => {
132 let local = sema.to_def(&it)?; 132 let local = sema.to_def(&it)?;
133 133
134 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordFieldPat::cast) { 134 if let Some(record_field_pat) = it.syntax().parent().and_then(ast::RecordPatField::cast) {
135 if record_field_pat.name_ref().is_none() { 135 if record_field_pat.name_ref().is_none() {
136 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { 136 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
137 let field = Definition::Field(field); 137 let field = Definition::Field(field);
@@ -247,7 +247,7 @@ pub fn classify_name_ref(
247 } 247 }
248 } 248 }
249 249
250 if let Some(record_field_pat) = ast::RecordFieldPat::cast(parent.clone()) { 250 if let Some(record_field_pat) = ast::RecordPatField::cast(parent.clone()) {
251 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) { 251 if let Some(field) = sema.resolve_record_field_pat(&record_field_pat) {
252 let field = Definition::Field(field); 252 let field = Definition::Field(field);
253 return Some(NameRefClass::Definition(field)); 253 return Some(NameRefClass::Definition(field));
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index 707e84f42..286983d60 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -625,7 +625,7 @@ fn test_tt_to_stmts() {
625 r#"[email protected] 625 r#"[email protected]
626 [email protected] 626 [email protected]
627 [email protected] "let" 627 [email protected] "let"
628 BIN[email protected] 628 IDENT[email protected]
629 [email protected] 629 [email protected]
630 [email protected] "a" 630 [email protected] "a"
631 [email protected] "=" 631 [email protected] "="
@@ -1116,7 +1116,7 @@ fn test_vec() {
1116 [email protected] "{" 1116 [email protected] "{"
1117 [email protected] 1117 [email protected]
1118 [email protected] "let" 1118 [email protected] "let"
1119 BIN[email protected] 1119 IDENT[email protected]
1120 [email protected] "mut" 1120 [email protected] "mut"
1121 [email protected] 1121 [email protected]
1122 [email protected] "v" 1122 [email protected] "v"
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index 706a2f796..0b01d3bc6 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -250,7 +250,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker {
250 p.error("expected expression"); 250 p.error("expected expression");
251 } 251 }
252 } 252 }
253 m.complete(p, LAMBDA_EXPR) 253 m.complete(p, CLOSURE_EXPR)
254} 254}
255 255
256// test if_expr 256// test if_expr
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs
index 427c0eb49..716bdc978 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/ra_parser/src/grammar/patterns.rs
@@ -192,7 +192,7 @@ fn record_field_pat_list(p: &mut Parser) {
192 p.bump(T!['{']); 192 p.bump(T!['{']);
193 while !p.at(EOF) && !p.at(T!['}']) { 193 while !p.at(EOF) && !p.at(T!['}']) {
194 match p.current() { 194 match p.current() {
195 // A trailing `..` is *not* treated as a DOT_DOT_PAT. 195 // A trailing `..` is *not* treated as a REST_PAT.
196 T![.] if p.at(T![..]) => p.bump(T![..]), 196 T![.] if p.at(T![..]) => p.bump(T![..]),
197 T!['{'] => error_block(p, "expected ident"), 197 T!['{'] => error_block(p, "expected ident"),
198 198
@@ -217,7 +217,7 @@ fn record_field_pat_list(p: &mut Parser) {
217 bind_pat(p, false); 217 bind_pat(p, false);
218 } 218 }
219 } 219 }
220 m.complete(p, RECORD_FIELD_PAT); 220 m.complete(p, RECORD_PAT_FIELD);
221 } 221 }
222 } 222 }
223 if !p.at(T!['}']) { 223 if !p.at(T!['}']) {
@@ -225,7 +225,7 @@ fn record_field_pat_list(p: &mut Parser) {
225 } 225 }
226 } 226 }
227 p.expect(T!['}']); 227 p.expect(T!['}']);
228 m.complete(p, RECORD_FIELD_PAT_LIST); 228 m.complete(p, RECORD_PAT_FIELD_LIST);
229} 229}
230 230
231// test placeholder_pat 231// test placeholder_pat
@@ -234,7 +234,7 @@ fn placeholder_pat(p: &mut Parser) -> CompletedMarker {
234 assert!(p.at(T![_])); 234 assert!(p.at(T![_]));
235 let m = p.start(); 235 let m = p.start();
236 p.bump(T![_]); 236 p.bump(T![_]);
237 m.complete(p, PLACEHOLDER_PAT) 237 m.complete(p, WILDCARD_PAT)
238} 238}
239 239
240// test dot_dot_pat 240// test dot_dot_pat
@@ -267,7 +267,7 @@ fn dot_dot_pat(p: &mut Parser) -> CompletedMarker {
267 assert!(p.at(T![..])); 267 assert!(p.at(T![..]));
268 let m = p.start(); 268 let m = p.start();
269 p.bump(T![..]); 269 p.bump(T![..]);
270 m.complete(p, DOT_DOT_PAT) 270 m.complete(p, REST_PAT)
271} 271}
272 272
273// test ref_pat 273// test ref_pat
@@ -361,7 +361,7 @@ fn bind_pat(p: &mut Parser, with_at: bool) -> CompletedMarker {
361 if with_at && p.eat(T![@]) { 361 if with_at && p.eat(T![@]) {
362 pattern_single(p); 362 pattern_single(p);
363 } 363 }
364 m.complete(p, BIND_PAT) 364 m.complete(p, IDENT_PAT)
365} 365}
366 366
367// test box_pat 367// test box_pat
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/grammar/types.rs b/crates/ra_parser/src/grammar/types.rs
index 9e8e3bd97..0aa173a52 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/ra_parser/src/grammar/types.rs
@@ -117,7 +117,7 @@ fn pointer_type(p: &mut Parser) {
117 }; 117 };
118 118
119 type_no_bounds(p); 119 type_no_bounds(p);
120 m.complete(p, POINTER_TYPE); 120 m.complete(p, PTR_TYPE);
121} 121}
122 122
123fn array_or_slice_type(p: &mut Parser) { 123fn array_or_slice_type(p: &mut Parser) {
@@ -163,7 +163,7 @@ fn reference_type(p: &mut Parser) {
163 p.eat(LIFETIME); 163 p.eat(LIFETIME);
164 p.eat(T![mut]); 164 p.eat(T![mut]);
165 type_no_bounds(p); 165 type_no_bounds(p);
166 m.complete(p, REFERENCE_TYPE); 166 m.complete(p, REF_TYPE);
167} 167}
168 168
169// test placeholder_type 169// test placeholder_type
@@ -172,7 +172,7 @@ fn placeholder_type(p: &mut Parser) {
172 assert!(p.at(T![_])); 172 assert!(p.at(T![_]));
173 let m = p.start(); 173 let m = p.start();
174 p.bump(T![_]); 174 p.bump(T![_]);
175 m.complete(p, PLACEHOLDER_TYPE); 175 m.complete(p, INFER_TYPE);
176} 176}
177 177
178// test fn_pointer_type 178// test fn_pointer_type
@@ -201,7 +201,7 @@ fn fn_pointer_type(p: &mut Parser) {
201 // test fn_pointer_type_with_ret 201 // test fn_pointer_type_with_ret
202 // type F = fn() -> (); 202 // type F = fn() -> ();
203 opt_fn_ret_type(p); 203 opt_fn_ret_type(p);
204 m.complete(p, FN_POINTER_TYPE); 204 m.complete(p, FN_PTR_TYPE);
205} 205}
206 206
207pub(super) fn for_binder(p: &mut Parser) { 207pub(super) fn for_binder(p: &mut Parser) {
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index be4da67bc..192ecd864 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -143,12 +143,12 @@ pub enum SyntaxKind {
143 TUPLE_TYPE, 143 TUPLE_TYPE,
144 NEVER_TYPE, 144 NEVER_TYPE,
145 PATH_TYPE, 145 PATH_TYPE,
146 POINTER_TYPE, 146 PTR_TYPE,
147 ARRAY_TYPE, 147 ARRAY_TYPE,
148 SLICE_TYPE, 148 SLICE_TYPE,
149 REFERENCE_TYPE, 149 REF_TYPE,
150 PLACEHOLDER_TYPE, 150 INFER_TYPE,
151 FN_POINTER_TYPE, 151 FN_PTR_TYPE,
152 FOR_TYPE, 152 FOR_TYPE,
153 IMPL_TRAIT_TYPE, 153 IMPL_TRAIT_TYPE,
154 DYN_TRAIT_TYPE, 154 DYN_TRAIT_TYPE,
@@ -156,13 +156,13 @@ pub enum SyntaxKind {
156 PAREN_PAT, 156 PAREN_PAT,
157 REF_PAT, 157 REF_PAT,
158 BOX_PAT, 158 BOX_PAT,
159 BIND_PAT, 159 IDENT_PAT,
160 PLACEHOLDER_PAT, 160 WILDCARD_PAT,
161 DOT_DOT_PAT, 161 REST_PAT,
162 PATH_PAT, 162 PATH_PAT,
163 RECORD_PAT, 163 RECORD_PAT,
164 RECORD_FIELD_PAT_LIST, 164 RECORD_PAT_FIELD_LIST,
165 RECORD_FIELD_PAT, 165 RECORD_PAT_FIELD,
166 TUPLE_STRUCT_PAT, 166 TUPLE_STRUCT_PAT,
167 TUPLE_PAT, 167 TUPLE_PAT,
168 SLICE_PAT, 168 SLICE_PAT,
@@ -173,7 +173,7 @@ pub enum SyntaxKind {
173 ARRAY_EXPR, 173 ARRAY_EXPR,
174 PAREN_EXPR, 174 PAREN_EXPR,
175 PATH_EXPR, 175 PATH_EXPR,
176 LAMBDA_EXPR, 176 CLOSURE_EXPR,
177 IF_EXPR, 177 IF_EXPR,
178 WHILE_EXPR, 178 WHILE_EXPR,
179 CONDITION, 179 CONDITION,
@@ -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/parsing.rs b/crates/ra_ssr/src/parsing.rs
index 78e03f394..f455eb5b7 100644
--- a/crates/ra_ssr/src/parsing.rs
+++ b/crates/ra_ssr/src/parsing.rs
@@ -70,7 +70,7 @@ impl ParsedRule {
70 rules: Vec::new(), 70 rules: Vec::new(),
71 }; 71 };
72 builder.try_add(ast::Expr::parse(&raw_pattern), raw_template.map(ast::Expr::parse)); 72 builder.try_add(ast::Expr::parse(&raw_pattern), raw_template.map(ast::Expr::parse));
73 builder.try_add(ast::TypeRef::parse(&raw_pattern), raw_template.map(ast::TypeRef::parse)); 73 builder.try_add(ast::Type::parse(&raw_pattern), raw_template.map(ast::Type::parse));
74 builder.try_add(ast::Item::parse(&raw_pattern), raw_template.map(ast::Item::parse)); 74 builder.try_add(ast::Item::parse(&raw_pattern), raw_template.map(ast::Item::parse));
75 builder.try_add(ast::Path::parse(&raw_pattern), raw_template.map(ast::Path::parse)); 75 builder.try_add(ast::Path::parse(&raw_pattern), raw_template.map(ast::Path::parse));
76 builder.try_add(ast::Pat::parse(&raw_pattern), raw_template.map(ast::Pat::parse)); 76 builder.try_add(ast::Pat::parse(&raw_pattern), raw_template.map(ast::Pat::parse));
@@ -109,7 +109,7 @@ impl RuleBuilder {
109 // path refers to semantically the same thing, whereas the non-path-based rules could match 109 // path refers to semantically the same thing, whereas the non-path-based rules could match
110 // anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the 110 // anything. Specifically, if we have a rule like `foo ==>> bar` we only want to match the
111 // `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a 111 // `foo` that is in the current scope, not any `foo`. However "foo" can be parsed as a
112 // pattern (BIND_PAT -> NAME -> IDENT). Allowing such a rule through would result in 112 // pattern (IDENT_PAT -> NAME -> IDENT). Allowing such a rule through would result in
113 // renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd 113 // renaming everything called `foo` to `bar`. It'd also be slow, since without a path, we'd
114 // have to use the slow-scan search mechanism. 114 // have to use the slow-scan search mechanism.
115 if self.rules.iter().any(|rule| contains_path(&rule.pattern)) { 115 if self.rules.iter().any(|rule| contains_path(&rule.pattern)) {
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs
index 78d456546..6f62000f4 100644
--- a/crates/ra_ssr/src/resolving.rs
+++ b/crates/ra_ssr/src/resolving.rs
@@ -198,7 +198,7 @@ fn pick_node_for_resolution(node: SyntaxNode) -> SyntaxNode {
198 return n; 198 return n;
199 } 199 }
200 } 200 }
201 SyntaxKind::LET_STMT | SyntaxKind::BIND_PAT => { 201 SyntaxKind::LET_STMT | SyntaxKind::IDENT_PAT => {
202 if let Some(next) = node.next_sibling() { 202 if let Some(next) = node.next_sibling() {
203 return pick_node_for_resolution(next); 203 return pick_node_for_resolution(next);
204 } 204 }
@@ -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_ssr/src/tests.rs b/crates/ra_ssr/src/tests.rs
index a4fa2cb44..2ae03c64c 100644
--- a/crates/ra_ssr/src/tests.rs
+++ b/crates/ra_ssr/src/tests.rs
@@ -924,7 +924,7 @@ fn ufcs_matches_method_call() {
924fn pattern_is_a_single_segment_path() { 924fn pattern_is_a_single_segment_path() {
925 mark::check!(pattern_is_a_single_segment_path); 925 mark::check!(pattern_is_a_single_segment_path);
926 // The first function should not be altered because the `foo` in scope at the cursor position is 926 // The first function should not be altered because the `foo` in scope at the cursor position is
927 // a different `foo`. This case is special because "foo" can be parsed as a pattern (BIND_PAT -> 927 // a different `foo`. This case is special because "foo" can be parsed as a pattern (IDENT_PAT ->
928 // NAME -> IDENT), which contains no path. If we're not careful we'll end up matching the `foo` 928 // NAME -> IDENT), which contains no path. If we're not careful we'll end up matching the `foo`
929 // in `let foo` from the first function. Whether we should match the `let foo` in the second 929 // in `let foo` from the first function. Whether we should match the `let foo` in the second
930 // function is less clear. At the moment, we don't. Doing so sounds like a rename operation, 930 // function is less clear. At the moment, we don't. Doing so sounds like a rename operation,
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index fd426ece9..d536bb1e7 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -17,7 +17,7 @@ use crate::{
17 17
18pub use self::{ 18pub use self::{
19 expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp}, 19 expr_ext::{ArrayExprKind, BinOp, Effect, ElseBranch, LiteralKind, PrefixOp, RangeOp},
20 generated::{nodes::*, tokens::*}, 20 generated::*,
21 node_ext::{ 21 node_ext::{
22 AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents, 22 AttrKind, FieldKind, NameOrNameRef, PathSegmentKind, SelfParamKind, SlicePatComponents,
23 StructKind, TypeBoundKind, VisibilityKind, 23 StructKind, TypeBoundKind, VisibilityKind,
@@ -287,7 +287,7 @@ where
287 287
288 assert!(pred.for_token().is_none()); 288 assert!(pred.for_token().is_none());
289 assert!(pred.generic_param_list().is_none()); 289 assert!(pred.generic_param_list().is_none());
290 assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); 290 assert_eq!("T", pred.ty().unwrap().syntax().text().to_string());
291 assert_bound("Clone", bounds.next()); 291 assert_bound("Clone", bounds.next());
292 assert_bound("Copy", bounds.next()); 292 assert_bound("Copy", bounds.next());
293 assert_bound("Debug", bounds.next()); 293 assert_bound("Debug", bounds.next());
@@ -304,20 +304,20 @@ where
304 let pred = predicates.next().unwrap(); 304 let pred = predicates.next().unwrap();
305 let mut bounds = pred.type_bound_list().unwrap().bounds(); 305 let mut bounds = pred.type_bound_list().unwrap().bounds();
306 306
307 assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string()); 307 assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string());
308 assert_bound("'a", bounds.next()); 308 assert_bound("'a", bounds.next());
309 309
310 let pred = predicates.next().unwrap(); 310 let pred = predicates.next().unwrap();
311 let mut bounds = pred.type_bound_list().unwrap().bounds(); 311 let mut bounds = pred.type_bound_list().unwrap().bounds();
312 312
313 assert_eq!("Iterator::Item", pred.type_ref().unwrap().syntax().text().to_string()); 313 assert_eq!("Iterator::Item", pred.ty().unwrap().syntax().text().to_string());
314 assert_bound("Debug", bounds.next()); 314 assert_bound("Debug", bounds.next());
315 assert_bound("'a", bounds.next()); 315 assert_bound("'a", bounds.next());
316 316
317 let pred = predicates.next().unwrap(); 317 let pred = predicates.next().unwrap();
318 let mut bounds = pred.type_bound_list().unwrap().bounds(); 318 let mut bounds = pred.type_bound_list().unwrap().bounds();
319 319
320 assert_eq!("<T as Iterator>::Item", pred.type_ref().unwrap().syntax().text().to_string()); 320 assert_eq!("<T as Iterator>::Item", pred.ty().unwrap().syntax().text().to_string());
321 assert_bound("Debug", bounds.next()); 321 assert_bound("Debug", bounds.next());
322 assert_bound("'a", bounds.next()); 322 assert_bound("'a", bounds.next());
323 323
@@ -326,6 +326,6 @@ where
326 326
327 assert!(pred.for_token().is_some()); 327 assert!(pred.for_token().is_some());
328 assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string()); 328 assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string());
329 assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); 329 assert_eq!("F", pred.ty().unwrap().syntax().text().to_string());
330 assert_bound("Fn(&'a str)", bounds.next()); 330 assert_bound("Fn(&'a str)", bounds.next());
331} 331}
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index 8d3e42f25..667a9294f 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()),
@@ -390,7 +390,7 @@ impl ast::MatchArmList {
390 #[must_use] 390 #[must_use]
391 pub fn remove_placeholder(&self) -> ast::MatchArmList { 391 pub fn remove_placeholder(&self) -> ast::MatchArmList {
392 let placeholder = 392 let placeholder =
393 self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::PlaceholderPat(_)))); 393 self.arms().find(|arm| matches!(arm.pat(), Some(ast::Pat::WildcardPat(_))));
394 if let Some(placeholder) = placeholder { 394 if let Some(placeholder) = placeholder {
395 self.remove_arm(&placeholder) 395 self.remove_arm(&placeholder)
396 } else { 396 } else {
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index f5199e09f..4a6f41ee7 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1,6 +1,41 @@
1//! This file is actually hand-written, but the submodules are indeed generated. 1//! This file is actually hand-written, but the submodules are indeed generated.
2
3#[rustfmt::skip] 2#[rustfmt::skip]
4pub(super) mod nodes; 3mod nodes;
5#[rustfmt::skip] 4#[rustfmt::skip]
6pub(super) mod tokens; 5mod tokens;
6
7use crate::{
8 AstNode,
9 SyntaxKind::{self, *},
10 SyntaxNode,
11};
12
13pub use {nodes::*, tokens::*};
14
15// Stmt is the only nested enum, so it's easier to just hand-write it
16impl AstNode for Stmt {
17 fn can_cast(kind: SyntaxKind) -> bool {
18 match kind {
19 LET_STMT | EXPR_STMT => true,
20 _ => Item::can_cast(kind),
21 }
22 }
23 fn cast(syntax: SyntaxNode) -> Option<Self> {
24 let res = match syntax.kind() {
25 LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
26 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
27 _ => {
28 let item = Item::cast(syntax)?;
29 Stmt::Item(item)
30 }
31 };
32 Some(res)
33 }
34 fn syntax(&self) -> &SyntaxNode {
35 match self {
36 Stmt::LetStmt(it) => &it.syntax,
37 Stmt::ExprStmt(it) => &it.syntax,
38 Stmt::Item(it) => it.syntax(),
39 }
40 }
41}
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 4306efe13..3d49309d1 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -6,13 +6,133 @@ 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 SourceFile { 9pub struct Name {
10 pub(crate) syntax: SyntaxNode, 10 pub(crate) syntax: SyntaxNode,
11} 11}
12impl ast::AttrsOwner for SourceFile {} 12impl Name {
13impl ast::ModuleItemOwner for SourceFile {} 13 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
14impl SourceFile { 14}
15 pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } 15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
16pub struct NameRef {
17 pub(crate) syntax: SyntaxNode,
18}
19impl NameRef {
20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
21}
22#[derive(Debug, Clone, PartialEq, Eq, Hash)]
23pub struct Path {
24 pub(crate) syntax: SyntaxNode,
25}
26impl Path {
27 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
28 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
29 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
30}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32pub struct PathSegment {
33 pub(crate) syntax: SyntaxNode,
34}
35impl PathSegment {
36 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
37 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
38 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
39 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
40 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
41 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
42 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
43 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
44 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
45 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
46 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
47 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
48}
49#[derive(Debug, Clone, PartialEq, Eq, Hash)]
50pub struct GenericArgList {
51 pub(crate) syntax: SyntaxNode,
52}
53impl GenericArgList {
54 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
55 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
56 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
57 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
58}
59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
60pub struct ParamList {
61 pub(crate) syntax: SyntaxNode,
62}
63impl ParamList {
64 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
65 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
66 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
67 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
68 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
69}
70#[derive(Debug, Clone, PartialEq, Eq, Hash)]
71pub struct RetType {
72 pub(crate) syntax: SyntaxNode,
73}
74impl RetType {
75 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
76 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
77}
78#[derive(Debug, Clone, PartialEq, Eq, Hash)]
79pub struct PathType {
80 pub(crate) syntax: SyntaxNode,
81}
82impl PathType {
83 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
84}
85#[derive(Debug, Clone, PartialEq, Eq, Hash)]
86pub struct TypeArg {
87 pub(crate) syntax: SyntaxNode,
88}
89impl TypeArg {
90 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
91}
92#[derive(Debug, Clone, PartialEq, Eq, Hash)]
93pub struct AssocTypeArg {
94 pub(crate) syntax: SyntaxNode,
95}
96impl ast::TypeBoundsOwner for AssocTypeArg {}
97impl AssocTypeArg {
98 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
99 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
100 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
101}
102#[derive(Debug, Clone, PartialEq, Eq, Hash)]
103pub struct LifetimeArg {
104 pub(crate) syntax: SyntaxNode,
105}
106impl LifetimeArg {
107 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
108 support::token(&self.syntax, T![lifetime])
109 }
110}
111#[derive(Debug, Clone, PartialEq, Eq, Hash)]
112pub struct ConstArg {
113 pub(crate) syntax: SyntaxNode,
114}
115impl ConstArg {
116 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
117}
118#[derive(Debug, Clone, PartialEq, Eq, Hash)]
119pub struct TypeBoundList {
120 pub(crate) syntax: SyntaxNode,
121}
122impl TypeBoundList {
123 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
124}
125#[derive(Debug, Clone, PartialEq, Eq, Hash)]
126pub struct MacroCall {
127 pub(crate) syntax: SyntaxNode,
128}
129impl ast::AttrsOwner for MacroCall {}
130impl ast::NameOwner for MacroCall {}
131impl MacroCall {
132 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
133 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
134 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
135 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
16} 136}
17#[derive(Debug, Clone, PartialEq, Eq, Hash)] 137#[derive(Debug, Clone, PartialEq, Eq, Hash)]
18pub struct Attr { 138pub struct Attr {
@@ -29,6 +149,41 @@ impl Attr {
29 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 149 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
30} 150}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)] 151#[derive(Debug, Clone, PartialEq, Eq, Hash)]
152pub struct TokenTree {
153 pub(crate) syntax: SyntaxNode,
154}
155impl TokenTree {
156 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
157 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
158 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
159 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
160 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
161 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
162}
163#[derive(Debug, Clone, PartialEq, Eq, Hash)]
164pub struct MacroItems {
165 pub(crate) syntax: SyntaxNode,
166}
167impl ast::ModuleItemOwner for MacroItems {}
168impl MacroItems {}
169#[derive(Debug, Clone, PartialEq, Eq, Hash)]
170pub struct MacroStmts {
171 pub(crate) syntax: SyntaxNode,
172}
173impl MacroStmts {
174 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
175 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
176}
177#[derive(Debug, Clone, PartialEq, Eq, Hash)]
178pub struct SourceFile {
179 pub(crate) syntax: SyntaxNode,
180}
181impl ast::AttrsOwner for SourceFile {}
182impl ast::ModuleItemOwner for SourceFile {}
183impl SourceFile {
184 pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) }
185}
186#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32pub struct Const { 187pub struct Const {
33 pub(crate) syntax: SyntaxNode, 188 pub(crate) syntax: SyntaxNode,
34} 189}
@@ -40,7 +195,7 @@ impl Const {
40 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 195 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
41 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 196 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
42 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 197 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
43 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 198 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
44 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 199 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
45 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 200 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
46 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 201 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
@@ -112,24 +267,11 @@ impl Impl {
112 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 267 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
113 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } 268 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
114 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 269 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
115 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
116 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 270 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
117 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 271 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
118 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } 272 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
119} 273}
120#[derive(Debug, Clone, PartialEq, Eq, Hash)] 274#[derive(Debug, Clone, PartialEq, Eq, Hash)]
121pub struct MacroCall {
122 pub(crate) syntax: SyntaxNode,
123}
124impl ast::AttrsOwner for MacroCall {}
125impl ast::NameOwner for MacroCall {}
126impl MacroCall {
127 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
128 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
129 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
130 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
131}
132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
133pub struct Module { 275pub struct Module {
134 pub(crate) syntax: SyntaxNode, 276 pub(crate) syntax: SyntaxNode,
135} 277}
@@ -152,7 +294,7 @@ impl Static {
152 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 294 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
153 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 295 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
154 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 296 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
155 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 297 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
156 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 298 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
157 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 299 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
158 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 300 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
@@ -198,7 +340,7 @@ impl TypeAlias {
198 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 340 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
199 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } 341 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
200 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 342 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
201 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 343 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
202 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 344 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
203} 345}
204#[derive(Debug, Clone, PartialEq, Eq, Hash)] 346#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -239,13 +381,6 @@ impl Visibility {
239 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 381 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
240} 382}
241#[derive(Debug, Clone, PartialEq, Eq, Hash)] 383#[derive(Debug, Clone, PartialEq, Eq, Hash)]
242pub struct Name {
243 pub(crate) syntax: SyntaxNode,
244}
245impl Name {
246 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
247}
248#[derive(Debug, Clone, PartialEq, Eq, Hash)]
249pub struct ItemList { 384pub struct ItemList {
250 pub(crate) syntax: SyntaxNode, 385 pub(crate) syntax: SyntaxNode,
251} 386}
@@ -256,13 +391,6 @@ impl ItemList {
256 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 391 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
257} 392}
258#[derive(Debug, Clone, PartialEq, Eq, Hash)] 393#[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 { 394pub struct Rename {
267 pub(crate) syntax: SyntaxNode, 395 pub(crate) syntax: SyntaxNode,
268} 396}
@@ -283,15 +411,6 @@ impl UseTree {
283 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } 411 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
284} 412}
285#[derive(Debug, Clone, PartialEq, Eq, Hash)] 413#[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 { 414pub struct UseTreeList {
296 pub(crate) syntax: SyntaxNode, 415 pub(crate) syntax: SyntaxNode,
297} 416}
@@ -317,25 +436,6 @@ impl GenericParamList {
317 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } 436 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
318} 437}
319#[derive(Debug, Clone, PartialEq, Eq, Hash)] 438#[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<TypeRef> { support::child(&self.syntax) }
337}
338#[derive(Debug, Clone, PartialEq, Eq, Hash)]
339pub struct WhereClause { 439pub struct WhereClause {
340 pub(crate) syntax: SyntaxNode, 440 pub(crate) syntax: SyntaxNode,
341} 441}
@@ -348,9 +448,7 @@ pub struct BlockExpr {
348 pub(crate) syntax: SyntaxNode, 448 pub(crate) syntax: SyntaxNode,
349} 449}
350impl ast::AttrsOwner for BlockExpr {} 450impl ast::AttrsOwner for BlockExpr {}
351impl ast::ModuleItemOwner for BlockExpr {}
352impl BlockExpr { 451impl BlockExpr {
353 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
354 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 452 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
355 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 453 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
356 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 454 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
@@ -369,7 +467,7 @@ impl SelfParam {
369 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 467 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
370 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 468 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
371 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 469 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
372 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 470 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
373} 471}
374#[derive(Debug, Clone, PartialEq, Eq, Hash)] 472#[derive(Debug, Clone, PartialEq, Eq, Hash)]
375pub struct Param { 473pub struct Param {
@@ -379,17 +477,10 @@ impl ast::AttrsOwner for Param {}
379impl Param { 477impl Param {
380 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 478 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
381 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 479 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
382 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 480 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
383 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } 481 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
384} 482}
385#[derive(Debug, Clone, PartialEq, Eq, Hash)] 483#[derive(Debug, Clone, PartialEq, Eq, Hash)]
386pub struct TypeBoundList {
387 pub(crate) syntax: SyntaxNode,
388}
389impl TypeBoundList {
390 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
391}
392#[derive(Debug, Clone, PartialEq, Eq, Hash)]
393pub struct RecordFieldList { 484pub struct RecordFieldList {
394 pub(crate) syntax: SyntaxNode, 485 pub(crate) syntax: SyntaxNode,
395} 486}
@@ -416,7 +507,7 @@ impl ast::NameOwner for RecordField {}
416impl ast::VisibilityOwner for RecordField {} 507impl ast::VisibilityOwner for RecordField {}
417impl RecordField { 508impl RecordField {
418 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 509 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
419 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 510 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
420} 511}
421#[derive(Debug, Clone, PartialEq, Eq, Hash)] 512#[derive(Debug, Clone, PartialEq, Eq, Hash)]
422pub struct TupleField { 513pub struct TupleField {
@@ -425,7 +516,7 @@ pub struct TupleField {
425impl ast::AttrsOwner for TupleField {} 516impl ast::AttrsOwner for TupleField {}
426impl ast::VisibilityOwner for TupleField {} 517impl ast::VisibilityOwner for TupleField {}
427impl TupleField { 518impl TupleField {
428 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 519 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
429} 520}
430#[derive(Debug, Clone, PartialEq, Eq, Hash)] 521#[derive(Debug, Clone, PartialEq, Eq, Hash)]
431pub struct VariantList { 522pub struct VariantList {
@@ -469,10 +560,24 @@ impl ExternItemList {
469 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 560 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
470} 561}
471#[derive(Debug, Clone, PartialEq, Eq, Hash)] 562#[derive(Debug, Clone, PartialEq, Eq, Hash)]
563pub struct ConstParam {
564 pub(crate) syntax: SyntaxNode,
565}
566impl ast::AttrsOwner for ConstParam {}
567impl ast::NameOwner for ConstParam {}
568impl ConstParam {
569 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
570 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
571 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
572 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
573 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
574}
575#[derive(Debug, Clone, PartialEq, Eq, Hash)]
472pub struct LifetimeParam { 576pub struct LifetimeParam {
473 pub(crate) syntax: SyntaxNode, 577 pub(crate) syntax: SyntaxNode,
474} 578}
475impl ast::AttrsOwner for LifetimeParam {} 579impl ast::AttrsOwner for LifetimeParam {}
580impl ast::TypeBoundsOwner for LifetimeParam {}
476impl LifetimeParam { 581impl LifetimeParam {
477 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 582 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
478 support::token(&self.syntax, T![lifetime]) 583 support::token(&self.syntax, T![lifetime])
@@ -487,200 +592,124 @@ impl ast::NameOwner for TypeParam {}
487impl ast::TypeBoundsOwner for TypeParam {} 592impl ast::TypeBoundsOwner for TypeParam {}
488impl TypeParam { 593impl TypeParam {
489 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 594 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
490 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } 595 pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) }
491} 596}
492#[derive(Debug, Clone, PartialEq, Eq, Hash)] 597#[derive(Debug, Clone, PartialEq, Eq, Hash)]
493pub struct ConstParam { 598pub struct WherePred {
494 pub(crate) syntax: SyntaxNode, 599 pub(crate) syntax: SyntaxNode,
495} 600}
496impl ast::AttrsOwner for ConstParam {} 601impl ast::TypeBoundsOwner for WherePred {}
497impl ast::NameOwner for ConstParam {} 602impl WherePred {
498impl ConstParam { 603 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
499 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 604 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
500 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 605 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
501 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 606 support::token(&self.syntax, T![lifetime])
502 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 607 }
503 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } 608 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
504} 609}
505#[derive(Debug, Clone, PartialEq, Eq, Hash)] 610#[derive(Debug, Clone, PartialEq, Eq, Hash)]
506pub struct Literal { 611pub struct Literal {
507 pub(crate) syntax: SyntaxNode, 612 pub(crate) syntax: SyntaxNode,
508} 613}
614impl ast::AttrsOwner for Literal {}
509impl Literal {} 615impl Literal {}
510#[derive(Debug, Clone, PartialEq, Eq, Hash)] 616#[derive(Debug, Clone, PartialEq, Eq, Hash)]
511pub struct TokenTree { 617pub struct ExprStmt {
512 pub(crate) syntax: SyntaxNode,
513}
514impl TokenTree {
515 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
516 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
517 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
518 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
519 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
520 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
521}
522#[derive(Debug, Clone, PartialEq, Eq, Hash)]
523pub struct ParenType {
524 pub(crate) syntax: SyntaxNode, 618 pub(crate) syntax: SyntaxNode,
525} 619}
526impl ParenType { 620impl ast::AttrsOwner for ExprStmt {}
527 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 621impl ExprStmt {
528 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 622 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
529 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 623 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
530} 624}
531#[derive(Debug, Clone, PartialEq, Eq, Hash)] 625#[derive(Debug, Clone, PartialEq, Eq, Hash)]
532pub struct TupleType { 626pub struct LetStmt {
533 pub(crate) syntax: SyntaxNode, 627 pub(crate) syntax: SyntaxNode,
534} 628}
535impl TupleType { 629impl ast::AttrsOwner for LetStmt {}
536 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 630impl LetStmt {
537 pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } 631 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
538 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 632 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
633 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
634 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
635 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
636 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
637 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
539} 638}
540#[derive(Debug, Clone, PartialEq, Eq, Hash)] 639#[derive(Debug, Clone, PartialEq, Eq, Hash)]
541pub struct NeverType { 640pub struct ArrayExpr {
542 pub(crate) syntax: SyntaxNode, 641 pub(crate) syntax: SyntaxNode,
543} 642}
544impl NeverType { 643impl ast::AttrsOwner for ArrayExpr {}
545 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 644impl ArrayExpr {
645 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
646 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
647 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
648 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
649 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
546} 650}
547#[derive(Debug, Clone, PartialEq, Eq, Hash)] 651#[derive(Debug, Clone, PartialEq, Eq, Hash)]
548pub struct PathType { 652pub struct AwaitExpr {
549 pub(crate) syntax: SyntaxNode, 653 pub(crate) syntax: SyntaxNode,
550} 654}
551impl PathType { 655impl ast::AttrsOwner for AwaitExpr {}
552 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 656impl AwaitExpr {
657 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
658 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
659 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
553} 660}
554#[derive(Debug, Clone, PartialEq, Eq, Hash)] 661#[derive(Debug, Clone, PartialEq, Eq, Hash)]
555pub struct PointerType { 662pub struct BinExpr {
556 pub(crate) syntax: SyntaxNode, 663 pub(crate) syntax: SyntaxNode,
557} 664}
558impl PointerType { 665impl ast::AttrsOwner for BinExpr {}
559 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } 666impl BinExpr {}
560 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
561 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
562 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
563}
564#[derive(Debug, Clone, PartialEq, Eq, Hash)] 667#[derive(Debug, Clone, PartialEq, Eq, Hash)]
565pub struct ArrayType { 668pub struct BoxExpr {
566 pub(crate) syntax: SyntaxNode, 669 pub(crate) syntax: SyntaxNode,
567} 670}
568impl ArrayType { 671impl ast::AttrsOwner for BoxExpr {}
569 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 672impl BoxExpr {
570 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 673 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
571 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
572 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 674 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
573 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
574} 675}
575#[derive(Debug, Clone, PartialEq, Eq, Hash)] 676#[derive(Debug, Clone, PartialEq, Eq, Hash)]
576pub struct SliceType { 677pub struct BreakExpr {
577 pub(crate) syntax: SyntaxNode,
578}
579impl SliceType {
580 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
581 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
582 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
583}
584#[derive(Debug, Clone, PartialEq, Eq, Hash)]
585pub struct ReferenceType {
586 pub(crate) syntax: SyntaxNode, 678 pub(crate) syntax: SyntaxNode,
587} 679}
588impl ReferenceType { 680impl ast::AttrsOwner for BreakExpr {}
589 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 681impl BreakExpr {
682 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
590 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 683 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
591 support::token(&self.syntax, T![lifetime]) 684 support::token(&self.syntax, T![lifetime])
592 } 685 }
593 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
594 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
595}
596#[derive(Debug, Clone, PartialEq, Eq, Hash)]
597pub struct PlaceholderType {
598 pub(crate) syntax: SyntaxNode,
599}
600impl PlaceholderType {
601 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
602}
603#[derive(Debug, Clone, PartialEq, Eq, Hash)]
604pub struct FnPointerType {
605 pub(crate) syntax: SyntaxNode,
606}
607impl FnPointerType {
608 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
609 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
610 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
611 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
612 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
613}
614#[derive(Debug, Clone, PartialEq, Eq, Hash)]
615pub struct ForType {
616 pub(crate) syntax: SyntaxNode,
617}
618impl ForType {
619 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
620 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
621 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
622}
623#[derive(Debug, Clone, PartialEq, Eq, Hash)]
624pub struct ImplTraitType {
625 pub(crate) syntax: SyntaxNode,
626}
627impl ImplTraitType {
628 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
629 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
630}
631#[derive(Debug, Clone, PartialEq, Eq, Hash)]
632pub struct DynTraitType {
633 pub(crate) syntax: SyntaxNode,
634}
635impl DynTraitType {
636 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
637 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
638}
639#[derive(Debug, Clone, PartialEq, Eq, Hash)]
640pub struct TupleExpr {
641 pub(crate) syntax: SyntaxNode,
642}
643impl ast::AttrsOwner for TupleExpr {}
644impl TupleExpr {
645 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
646 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
647 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
648}
649#[derive(Debug, Clone, PartialEq, Eq, Hash)]
650pub struct ArrayExpr {
651 pub(crate) syntax: SyntaxNode,
652}
653impl ast::AttrsOwner for ArrayExpr {}
654impl ArrayExpr {
655 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
656 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
657 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 686 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
658 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
659 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
660} 687}
661#[derive(Debug, Clone, PartialEq, Eq, Hash)] 688#[derive(Debug, Clone, PartialEq, Eq, Hash)]
662pub struct ParenExpr { 689pub struct CallExpr {
663 pub(crate) syntax: SyntaxNode, 690 pub(crate) syntax: SyntaxNode,
664} 691}
665impl ast::AttrsOwner for ParenExpr {} 692impl ast::AttrsOwner for CallExpr {}
666impl ParenExpr { 693impl ast::ArgListOwner for CallExpr {}
667 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 694impl CallExpr {
668 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 695 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
669 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
670} 696}
671#[derive(Debug, Clone, PartialEq, Eq, Hash)] 697#[derive(Debug, Clone, PartialEq, Eq, Hash)]
672pub struct PathExpr { 698pub struct CastExpr {
673 pub(crate) syntax: SyntaxNode, 699 pub(crate) syntax: SyntaxNode,
674} 700}
675impl PathExpr { 701impl ast::AttrsOwner for CastExpr {}
676 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 702impl CastExpr {
703 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
704 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
705 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
677} 706}
678#[derive(Debug, Clone, PartialEq, Eq, Hash)] 707#[derive(Debug, Clone, PartialEq, Eq, Hash)]
679pub struct LambdaExpr { 708pub struct ClosureExpr {
680 pub(crate) syntax: SyntaxNode, 709 pub(crate) syntax: SyntaxNode,
681} 710}
682impl ast::AttrsOwner for LambdaExpr {} 711impl ast::AttrsOwner for ClosureExpr {}
683impl LambdaExpr { 712impl ClosureExpr {
684 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 713 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
685 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 714 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
686 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } 715 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
@@ -689,23 +718,17 @@ impl LambdaExpr {
689 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 718 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
690} 719}
691#[derive(Debug, Clone, PartialEq, Eq, Hash)] 720#[derive(Debug, Clone, PartialEq, Eq, Hash)]
692pub struct IfExpr { 721pub struct ContinueExpr {
693 pub(crate) syntax: SyntaxNode,
694}
695impl ast::AttrsOwner for IfExpr {}
696impl IfExpr {
697 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
698 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
699}
700#[derive(Debug, Clone, PartialEq, Eq, Hash)]
701pub struct Condition {
702 pub(crate) syntax: SyntaxNode, 722 pub(crate) syntax: SyntaxNode,
703} 723}
704impl Condition { 724impl ast::AttrsOwner for ContinueExpr {}
705 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 725impl ContinueExpr {
706 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 726 pub fn continue_token(&self) -> Option<SyntaxToken> {
707 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 727 support::token(&self.syntax, T![continue])
708 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 728 }
729 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
730 support::token(&self.syntax, T![lifetime])
731 }
709} 732}
710#[derive(Debug, Clone, PartialEq, Eq, Hash)] 733#[derive(Debug, Clone, PartialEq, Eq, Hash)]
711pub struct EffectExpr { 734pub struct EffectExpr {
@@ -720,22 +743,14 @@ impl EffectExpr {
720 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 743 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
721} 744}
722#[derive(Debug, Clone, PartialEq, Eq, Hash)] 745#[derive(Debug, Clone, PartialEq, Eq, Hash)]
723pub struct Label { 746pub struct FieldExpr {
724 pub(crate) syntax: SyntaxNode,
725}
726impl Label {
727 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
728 support::token(&self.syntax, T![lifetime])
729 }
730}
731#[derive(Debug, Clone, PartialEq, Eq, Hash)]
732pub struct LoopExpr {
733 pub(crate) syntax: SyntaxNode, 747 pub(crate) syntax: SyntaxNode,
734} 748}
735impl ast::AttrsOwner for LoopExpr {} 749impl ast::AttrsOwner for FieldExpr {}
736impl ast::LoopBodyOwner for LoopExpr {} 750impl FieldExpr {
737impl LoopExpr { 751 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
738 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } 752 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
753 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
739} 754}
740#[derive(Debug, Clone, PartialEq, Eq, Hash)] 755#[derive(Debug, Clone, PartialEq, Eq, Hash)]
741pub struct ForExpr { 756pub struct ForExpr {
@@ -750,120 +765,117 @@ impl ForExpr {
750 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } 765 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
751} 766}
752#[derive(Debug, Clone, PartialEq, Eq, Hash)] 767#[derive(Debug, Clone, PartialEq, Eq, Hash)]
753pub struct WhileExpr { 768pub struct IfExpr {
754 pub(crate) syntax: SyntaxNode, 769 pub(crate) syntax: SyntaxNode,
755} 770}
756impl ast::AttrsOwner for WhileExpr {} 771impl ast::AttrsOwner for IfExpr {}
757impl ast::LoopBodyOwner for WhileExpr {} 772impl IfExpr {
758impl WhileExpr { 773 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
759 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
760 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 774 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
775 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) }
761} 776}
762#[derive(Debug, Clone, PartialEq, Eq, Hash)] 777#[derive(Debug, Clone, PartialEq, Eq, Hash)]
763pub struct ContinueExpr { 778pub struct IndexExpr {
764 pub(crate) syntax: SyntaxNode, 779 pub(crate) syntax: SyntaxNode,
765} 780}
766impl ast::AttrsOwner for ContinueExpr {} 781impl ast::AttrsOwner for IndexExpr {}
767impl ContinueExpr { 782impl IndexExpr {
768 pub fn continue_token(&self) -> Option<SyntaxToken> { 783 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
769 support::token(&self.syntax, T![continue]) 784 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
770 }
771 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
772 support::token(&self.syntax, T![lifetime])
773 }
774} 785}
775#[derive(Debug, Clone, PartialEq, Eq, Hash)] 786#[derive(Debug, Clone, PartialEq, Eq, Hash)]
776pub struct BreakExpr { 787pub struct LoopExpr {
777 pub(crate) syntax: SyntaxNode, 788 pub(crate) syntax: SyntaxNode,
778} 789}
779impl ast::AttrsOwner for BreakExpr {} 790impl ast::AttrsOwner for LoopExpr {}
780impl BreakExpr { 791impl ast::LoopBodyOwner for LoopExpr {}
781 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } 792impl LoopExpr {
782 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 793 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
783 support::token(&self.syntax, T![lifetime])
784 }
785 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
786} 794}
787#[derive(Debug, Clone, PartialEq, Eq, Hash)] 795#[derive(Debug, Clone, PartialEq, Eq, Hash)]
788pub struct ReturnExpr { 796pub struct MatchExpr {
789 pub(crate) syntax: SyntaxNode, 797 pub(crate) syntax: SyntaxNode,
790} 798}
791impl ast::AttrsOwner for ReturnExpr {} 799impl ast::AttrsOwner for MatchExpr {}
792impl ReturnExpr { 800impl MatchExpr {
793 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } 801 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
794 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 802 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
803 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
795} 804}
796#[derive(Debug, Clone, PartialEq, Eq, Hash)] 805#[derive(Debug, Clone, PartialEq, Eq, Hash)]
797pub struct CallExpr { 806pub struct MethodCallExpr {
798 pub(crate) syntax: SyntaxNode, 807 pub(crate) syntax: SyntaxNode,
799} 808}
800impl ast::AttrsOwner for CallExpr {} 809impl ast::AttrsOwner for MethodCallExpr {}
801impl ast::ArgListOwner for CallExpr {} 810impl ast::ArgListOwner for MethodCallExpr {}
802impl CallExpr { 811impl MethodCallExpr {
803 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 812 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
813 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
814 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
815 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
804} 816}
805#[derive(Debug, Clone, PartialEq, Eq, Hash)] 817#[derive(Debug, Clone, PartialEq, Eq, Hash)]
806pub struct ArgList { 818pub struct ParenExpr {
807 pub(crate) syntax: SyntaxNode, 819 pub(crate) syntax: SyntaxNode,
808} 820}
809impl ArgList { 821impl ast::AttrsOwner for ParenExpr {}
822impl ParenExpr {
810 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 823 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
811 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 824 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
812 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 825 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
813} 826}
814#[derive(Debug, Clone, PartialEq, Eq, Hash)] 827#[derive(Debug, Clone, PartialEq, Eq, Hash)]
815pub struct MethodCallExpr { 828pub struct PathExpr {
816 pub(crate) syntax: SyntaxNode, 829 pub(crate) syntax: SyntaxNode,
817} 830}
818impl ast::AttrsOwner for MethodCallExpr {} 831impl ast::AttrsOwner for PathExpr {}
819impl ast::ArgListOwner for MethodCallExpr {} 832impl PathExpr {
820impl MethodCallExpr { 833 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
821 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
822 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
823 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
824 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
825} 834}
826#[derive(Debug, Clone, PartialEq, Eq, Hash)] 835#[derive(Debug, Clone, PartialEq, Eq, Hash)]
827pub struct TypeArgList { 836pub struct PrefixExpr {
828 pub(crate) syntax: SyntaxNode, 837 pub(crate) syntax: SyntaxNode,
829} 838}
830impl TypeArgList { 839impl ast::AttrsOwner for PrefixExpr {}
831 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } 840impl PrefixExpr {
832 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } 841 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
833 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
834 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
835 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
836 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
837 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
838} 842}
839#[derive(Debug, Clone, PartialEq, Eq, Hash)] 843#[derive(Debug, Clone, PartialEq, Eq, Hash)]
840pub struct FieldExpr { 844pub struct RangeExpr {
841 pub(crate) syntax: SyntaxNode, 845 pub(crate) syntax: SyntaxNode,
842} 846}
843impl ast::AttrsOwner for FieldExpr {} 847impl ast::AttrsOwner for RangeExpr {}
844impl FieldExpr { 848impl RangeExpr {}
845 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 849#[derive(Debug, Clone, PartialEq, Eq, Hash)]
846 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 850pub struct RecordExpr {
847 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 851 pub(crate) syntax: SyntaxNode,
852}
853impl RecordExpr {
854 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
855 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> {
856 support::child(&self.syntax)
857 }
848} 858}
849#[derive(Debug, Clone, PartialEq, Eq, Hash)] 859#[derive(Debug, Clone, PartialEq, Eq, Hash)]
850pub struct IndexExpr { 860pub struct RefExpr {
851 pub(crate) syntax: SyntaxNode, 861 pub(crate) syntax: SyntaxNode,
852} 862}
853impl ast::AttrsOwner for IndexExpr {} 863impl ast::AttrsOwner for RefExpr {}
854impl IndexExpr { 864impl RefExpr {
855 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 865 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
856 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 866 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
867 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
868 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
869 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
857} 870}
858#[derive(Debug, Clone, PartialEq, Eq, Hash)] 871#[derive(Debug, Clone, PartialEq, Eq, Hash)]
859pub struct AwaitExpr { 872pub struct ReturnExpr {
860 pub(crate) syntax: SyntaxNode, 873 pub(crate) syntax: SyntaxNode,
861} 874}
862impl ast::AttrsOwner for AwaitExpr {} 875impl ast::AttrsOwner for ReturnExpr {}
863impl AwaitExpr { 876impl ReturnExpr {
877 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) }
864 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 878 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
865 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
866 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
867} 879}
868#[derive(Debug, Clone, PartialEq, Eq, Hash)] 880#[derive(Debug, Clone, PartialEq, Eq, Hash)]
869pub struct TryExpr { 881pub struct TryExpr {
@@ -875,70 +887,80 @@ impl TryExpr {
875 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } 887 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
876} 888}
877#[derive(Debug, Clone, PartialEq, Eq, Hash)] 889#[derive(Debug, Clone, PartialEq, Eq, Hash)]
878pub struct CastExpr { 890pub struct TupleExpr {
879 pub(crate) syntax: SyntaxNode, 891 pub(crate) syntax: SyntaxNode,
880} 892}
881impl ast::AttrsOwner for CastExpr {} 893impl ast::AttrsOwner for TupleExpr {}
882impl CastExpr { 894impl TupleExpr {
883 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 895 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
884 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } 896 pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
885 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } 897 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
886} 898}
887#[derive(Debug, Clone, PartialEq, Eq, Hash)] 899#[derive(Debug, Clone, PartialEq, Eq, Hash)]
888pub struct RefExpr { 900pub struct WhileExpr {
889 pub(crate) syntax: SyntaxNode, 901 pub(crate) syntax: SyntaxNode,
890} 902}
891impl ast::AttrsOwner for RefExpr {} 903impl ast::AttrsOwner for WhileExpr {}
892impl RefExpr { 904impl ast::LoopBodyOwner for WhileExpr {}
893 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 905impl WhileExpr {
894 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } 906 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
895 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 907 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
896 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
897 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
898} 908}
899#[derive(Debug, Clone, PartialEq, Eq, Hash)] 909#[derive(Debug, Clone, PartialEq, Eq, Hash)]
900pub struct PrefixExpr { 910pub struct Label {
901 pub(crate) syntax: SyntaxNode, 911 pub(crate) syntax: SyntaxNode,
902} 912}
903impl ast::AttrsOwner for PrefixExpr {} 913impl Label {
904impl PrefixExpr { 914 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
905 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 915 support::token(&self.syntax, T![lifetime])
916 }
906} 917}
907#[derive(Debug, Clone, PartialEq, Eq, Hash)] 918#[derive(Debug, Clone, PartialEq, Eq, Hash)]
908pub struct BoxExpr { 919pub struct RecordExprFieldList {
909 pub(crate) syntax: SyntaxNode, 920 pub(crate) syntax: SyntaxNode,
910} 921}
911impl ast::AttrsOwner for BoxExpr {} 922impl ast::AttrsOwner for RecordExprFieldList {}
912impl BoxExpr { 923impl RecordExprFieldList {
913 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } 924 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
914 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 925 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) }
926 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
927 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
928 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
915} 929}
916#[derive(Debug, Clone, PartialEq, Eq, Hash)] 930#[derive(Debug, Clone, PartialEq, Eq, Hash)]
917pub struct RangeExpr { 931pub struct RecordExprField {
918 pub(crate) syntax: SyntaxNode, 932 pub(crate) syntax: SyntaxNode,
919} 933}
920impl ast::AttrsOwner for RangeExpr {} 934impl ast::AttrsOwner for RecordExprField {}
921impl RangeExpr {} 935impl RecordExprField {
936 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
937 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
938 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
939}
922#[derive(Debug, Clone, PartialEq, Eq, Hash)] 940#[derive(Debug, Clone, PartialEq, Eq, Hash)]
923pub struct BinExpr { 941pub struct ArgList {
924 pub(crate) syntax: SyntaxNode, 942 pub(crate) syntax: SyntaxNode,
925} 943}
926impl ast::AttrsOwner for BinExpr {} 944impl ArgList {
927impl BinExpr {} 945 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
946 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
947 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
948}
928#[derive(Debug, Clone, PartialEq, Eq, Hash)] 949#[derive(Debug, Clone, PartialEq, Eq, Hash)]
929pub struct MatchExpr { 950pub struct Condition {
930 pub(crate) syntax: SyntaxNode, 951 pub(crate) syntax: SyntaxNode,
931} 952}
932impl ast::AttrsOwner for MatchExpr {} 953impl Condition {
933impl MatchExpr { 954 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
934 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } 955 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
956 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
935 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 957 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
936 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
937} 958}
938#[derive(Debug, Clone, PartialEq, Eq, Hash)] 959#[derive(Debug, Clone, PartialEq, Eq, Hash)]
939pub struct MatchArmList { 960pub struct MatchArmList {
940 pub(crate) syntax: SyntaxNode, 961 pub(crate) syntax: SyntaxNode,
941} 962}
963impl ast::AttrsOwner for MatchArmList {}
942impl MatchArmList { 964impl MatchArmList {
943 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 965 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
944 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } 966 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
@@ -954,6 +976,7 @@ impl MatchArm {
954 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } 976 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
955 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } 977 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
956 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 978 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
979 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
957} 980}
958#[derive(Debug, Clone, PartialEq, Eq, Hash)] 981#[derive(Debug, Clone, PartialEq, Eq, Hash)]
959pub struct MatchGuard { 982pub struct MatchGuard {
@@ -964,304 +987,326 @@ impl MatchGuard {
964 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 987 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
965} 988}
966#[derive(Debug, Clone, PartialEq, Eq, Hash)] 989#[derive(Debug, Clone, PartialEq, Eq, Hash)]
967pub struct RecordExpr { 990pub struct ArrayType {
968 pub(crate) syntax: SyntaxNode,
969}
970impl RecordExpr {
971 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
972 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> {
973 support::child(&self.syntax)
974 }
975}
976#[derive(Debug, Clone, PartialEq, Eq, Hash)]
977pub struct RecordExprFieldList {
978 pub(crate) syntax: SyntaxNode, 991 pub(crate) syntax: SyntaxNode,
979} 992}
980impl RecordExprFieldList { 993impl ArrayType {
981 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 994 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
982 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } 995 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
983 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 996 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
984 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } 997 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
985 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 998 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
986} 999}
987#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1000#[derive(Debug, Clone, PartialEq, Eq, Hash)]
988pub struct RecordExprField { 1001pub struct DynTraitType {
989 pub(crate) syntax: SyntaxNode, 1002 pub(crate) syntax: SyntaxNode,
990} 1003}
991impl ast::AttrsOwner for RecordExprField {} 1004impl DynTraitType {
992impl RecordExprField { 1005 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
993 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1006 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
994 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
995 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
996} 1007}
997#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1008#[derive(Debug, Clone, PartialEq, Eq, Hash)]
998pub struct OrPat { 1009pub struct FnPtrType {
999 pub(crate) syntax: SyntaxNode, 1010 pub(crate) syntax: SyntaxNode,
1000} 1011}
1001impl OrPat { 1012impl FnPtrType {
1002 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1013 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1014 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
1015 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
1016 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
1017 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
1018 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1019 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1003} 1020}
1004#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1021#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1005pub struct ParenPat { 1022pub struct ForType {
1006 pub(crate) syntax: SyntaxNode, 1023 pub(crate) syntax: SyntaxNode,
1007} 1024}
1008impl ParenPat { 1025impl ForType {
1009 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 1026 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
1010 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1027 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
1011 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1028 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1012} 1029}
1013#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1030#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1014pub struct RefPat { 1031pub struct ImplTraitType {
1015 pub(crate) syntax: SyntaxNode, 1032 pub(crate) syntax: SyntaxNode,
1016} 1033}
1017impl RefPat { 1034impl ImplTraitType {
1018 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 1035 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
1019 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 1036 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
1020 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1021} 1037}
1022#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1038#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1023pub struct BoxPat { 1039pub struct InferType {
1024 pub(crate) syntax: SyntaxNode, 1040 pub(crate) syntax: SyntaxNode,
1025} 1041}
1026impl BoxPat { 1042impl InferType {
1027 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } 1043 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1028 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1029} 1044}
1030#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1045#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1031pub struct BindPat { 1046pub struct NeverType {
1032 pub(crate) syntax: SyntaxNode, 1047 pub(crate) syntax: SyntaxNode,
1033} 1048}
1034impl ast::AttrsOwner for BindPat {} 1049impl NeverType {
1035impl ast::NameOwner for BindPat {} 1050 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1036impl BindPat {
1037 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1038 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1039 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1040 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1041} 1051}
1042#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1052#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1043pub struct PlaceholderPat { 1053pub struct ParenType {
1044 pub(crate) syntax: SyntaxNode, 1054 pub(crate) syntax: SyntaxNode,
1045} 1055}
1046impl PlaceholderPat { 1056impl ParenType {
1047 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 1057 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1058 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1059 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1048} 1060}
1049#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1061#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1050pub struct DotDotPat { 1062pub struct PtrType {
1051 pub(crate) syntax: SyntaxNode, 1063 pub(crate) syntax: SyntaxNode,
1052} 1064}
1053impl DotDotPat { 1065impl PtrType {
1054 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1066 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
1067 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1068 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1069 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1055} 1070}
1056#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1071#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1057pub struct PathPat { 1072pub struct RefType {
1058 pub(crate) syntax: SyntaxNode, 1073 pub(crate) syntax: SyntaxNode,
1059} 1074}
1060impl PathPat { 1075impl RefType {
1061 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1076 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1077 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1078 support::token(&self.syntax, T![lifetime])
1079 }
1080 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1081 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1062} 1082}
1063#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1083#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1064pub struct SlicePat { 1084pub struct SliceType {
1065 pub(crate) syntax: SyntaxNode, 1085 pub(crate) syntax: SyntaxNode,
1066} 1086}
1067impl SlicePat { 1087impl SliceType {
1068 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 1088 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1069 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 1089 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1070 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 1090 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1071} 1091}
1072#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1092#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1073pub struct RangePat { 1093pub struct TupleType {
1074 pub(crate) syntax: SyntaxNode, 1094 pub(crate) syntax: SyntaxNode,
1075} 1095}
1076impl RangePat { 1096impl TupleType {
1077 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1097 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1078 pub fn dotdoteq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..=]) } 1098 pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) }
1099 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1079} 1100}
1080#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1101#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1081pub struct LiteralPat { 1102pub struct TypeBound {
1082 pub(crate) syntax: SyntaxNode, 1103 pub(crate) syntax: SyntaxNode,
1083} 1104}
1084impl LiteralPat { 1105impl TypeBound {
1085 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 1106 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1107 support::token(&self.syntax, T![lifetime])
1108 }
1109 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1110 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1086} 1111}
1087#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1112#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1088pub struct MacroPat { 1113pub struct IdentPat {
1089 pub(crate) syntax: SyntaxNode, 1114 pub(crate) syntax: SyntaxNode,
1090} 1115}
1091impl MacroPat { 1116impl ast::AttrsOwner for IdentPat {}
1092 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } 1117impl ast::NameOwner for IdentPat {}
1118impl IdentPat {
1119 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1120 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1121 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1122 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1093} 1123}
1094#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1124#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1095pub struct RecordPat { 1125pub struct BoxPat {
1096 pub(crate) syntax: SyntaxNode, 1126 pub(crate) syntax: SyntaxNode,
1097} 1127}
1098impl RecordPat { 1128impl BoxPat {
1099 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1129 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1100 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { 1130 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1101 support::child(&self.syntax)
1102 }
1103} 1131}
1104#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1105pub struct RecordFieldPatList { 1133pub struct RestPat {
1106 pub(crate) syntax: SyntaxNode, 1134 pub(crate) syntax: SyntaxNode,
1107} 1135}
1108impl RecordFieldPatList { 1136impl RestPat {
1109 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1110 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
1111 support::children(&self.syntax)
1112 }
1113 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1114 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1137 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1115 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1116} 1138}
1117#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1139#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1118pub struct RecordFieldPat { 1140pub struct LiteralPat {
1119 pub(crate) syntax: SyntaxNode, 1141 pub(crate) syntax: SyntaxNode,
1120} 1142}
1121impl ast::AttrsOwner for RecordFieldPat {} 1143impl LiteralPat {
1122impl RecordFieldPat { 1144 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1123 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1124 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1125 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1126} 1145}
1127#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1146#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1128pub struct TupleStructPat { 1147pub struct MacroPat {
1129 pub(crate) syntax: SyntaxNode, 1148 pub(crate) syntax: SyntaxNode,
1130} 1149}
1131impl TupleStructPat { 1150impl MacroPat {
1132 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1151 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
1133 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1134 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1135 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1136} 1152}
1137#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1153#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1138pub struct TuplePat { 1154pub struct OrPat {
1139 pub(crate) syntax: SyntaxNode, 1155 pub(crate) syntax: SyntaxNode,
1140} 1156}
1141impl TuplePat { 1157impl OrPat {
1142 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 1158 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1143 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1144 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1145} 1159}
1146#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1160#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1147pub struct MacroDef { 1161pub struct ParenPat {
1148 pub(crate) syntax: SyntaxNode, 1162 pub(crate) syntax: SyntaxNode,
1149} 1163}
1150impl ast::NameOwner for MacroDef {} 1164impl ParenPat {
1151impl MacroDef { 1165 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1152 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } 1166 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1167 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1153} 1168}
1154#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1169#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1155pub struct MacroItems { 1170pub struct PathPat {
1156 pub(crate) syntax: SyntaxNode, 1171 pub(crate) syntax: SyntaxNode,
1157} 1172}
1158impl ast::ModuleItemOwner for MacroItems {} 1173impl PathPat {
1159impl MacroItems {} 1174 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1175}
1160#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1176#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1161pub struct MacroStmts { 1177pub struct WildcardPat {
1162 pub(crate) syntax: SyntaxNode, 1178 pub(crate) syntax: SyntaxNode,
1163} 1179}
1164impl MacroStmts { 1180impl WildcardPat {
1165 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 1181 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1166 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1167} 1182}
1168#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1183#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1169pub struct TypeBound { 1184pub struct RangePat {
1170 pub(crate) syntax: SyntaxNode, 1185 pub(crate) syntax: SyntaxNode,
1171} 1186}
1172impl TypeBound { 1187impl RangePat {}
1173 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1174 support::token(&self.syntax, T![lifetime])
1175 }
1176 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1177 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1178}
1179#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1188#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1180pub struct WherePred { 1189pub struct RecordPat {
1181 pub(crate) syntax: SyntaxNode, 1190 pub(crate) syntax: SyntaxNode,
1182} 1191}
1183impl ast::TypeBoundsOwner for WherePred {} 1192impl RecordPat {
1184impl WherePred { 1193 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1185 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 1194 pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> {
1186 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } 1195 support::child(&self.syntax)
1187 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1188 support::token(&self.syntax, T![lifetime])
1189 } 1196 }
1190 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1191} 1197}
1192#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1198#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1193pub struct ExprStmt { 1199pub struct RefPat {
1194 pub(crate) syntax: SyntaxNode, 1200 pub(crate) syntax: SyntaxNode,
1195} 1201}
1196impl ast::AttrsOwner for ExprStmt {} 1202impl RefPat {
1197impl ExprStmt { 1203 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1198 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1204 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1199 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 1205 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1200} 1206}
1201#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1207#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1202pub struct LetStmt { 1208pub struct SlicePat {
1203 pub(crate) syntax: SyntaxNode, 1209 pub(crate) syntax: SyntaxNode,
1204} 1210}
1205impl ast::AttrsOwner for LetStmt {} 1211impl SlicePat {
1206impl LetStmt { 1212 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1207 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 1213 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1208 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1214 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1209 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1210 pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1211 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1212 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
1213 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1214} 1215}
1215#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1216#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1216pub struct PathSegment { 1217pub struct TuplePat {
1217 pub(crate) syntax: SyntaxNode, 1218 pub(crate) syntax: SyntaxNode,
1218} 1219}
1219impl PathSegment { 1220impl TuplePat {
1220 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } 1221 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1221 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } 1222 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1222 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 1223 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1223 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
1224 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
1225 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1226 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1227 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1228 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1229 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
1230 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
1231} 1224}
1232#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1225#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1233pub struct TypeArg { 1226pub struct TupleStructPat {
1234 pub(crate) syntax: SyntaxNode, 1227 pub(crate) syntax: SyntaxNode,
1235} 1228}
1236impl TypeArg { 1229impl TupleStructPat {
1237 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1230 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1231 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1232 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1233 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1238} 1234}
1239#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1235#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1240pub struct LifetimeArg { 1236pub struct RecordPatFieldList {
1241 pub(crate) syntax: SyntaxNode, 1237 pub(crate) syntax: SyntaxNode,
1242} 1238}
1243impl LifetimeArg { 1239impl RecordPatFieldList {
1244 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1240 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1245 support::token(&self.syntax, T![lifetime]) 1241 pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) }
1246 } 1242 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1243 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1247} 1244}
1248#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1245#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1249pub struct AssocTypeArg { 1246pub struct RecordPatField {
1250 pub(crate) syntax: SyntaxNode, 1247 pub(crate) syntax: SyntaxNode,
1251} 1248}
1252impl ast::TypeBoundsOwner for AssocTypeArg {} 1249impl ast::AttrsOwner for RecordPatField {}
1253impl AssocTypeArg { 1250impl RecordPatField {
1254 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1251 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1255 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1252 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1256 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1253 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1257} 1254}
1258#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1255#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1259pub struct ConstArg { 1256pub enum GenericArg {
1260 pub(crate) syntax: SyntaxNode, 1257 TypeArg(TypeArg),
1258 AssocTypeArg(AssocTypeArg),
1259 LifetimeArg(LifetimeArg),
1260 ConstArg(ConstArg),
1261} 1261}
1262impl ConstArg { 1262#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1263 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 1263pub enum Type {
1264 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 1264 ArrayType(ArrayType),
1265 DynTraitType(DynTraitType),
1266 FnPtrType(FnPtrType),
1267 ForType(ForType),
1268 ImplTraitType(ImplTraitType),
1269 InferType(InferType),
1270 NeverType(NeverType),
1271 ParenType(ParenType),
1272 PathType(PathType),
1273 PtrType(PtrType),
1274 RefType(RefType),
1275 SliceType(SliceType),
1276 TupleType(TupleType),
1277}
1278#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1279pub enum Expr {
1280 ArrayExpr(ArrayExpr),
1281 AwaitExpr(AwaitExpr),
1282 BinExpr(BinExpr),
1283 BlockExpr(BlockExpr),
1284 BoxExpr(BoxExpr),
1285 BreakExpr(BreakExpr),
1286 CallExpr(CallExpr),
1287 CastExpr(CastExpr),
1288 ClosureExpr(ClosureExpr),
1289 ContinueExpr(ContinueExpr),
1290 EffectExpr(EffectExpr),
1291 FieldExpr(FieldExpr),
1292 ForExpr(ForExpr),
1293 IfExpr(IfExpr),
1294 IndexExpr(IndexExpr),
1295 Literal(Literal),
1296 LoopExpr(LoopExpr),
1297 MacroCall(MacroCall),
1298 MatchExpr(MatchExpr),
1299 MethodCallExpr(MethodCallExpr),
1300 ParenExpr(ParenExpr),
1301 PathExpr(PathExpr),
1302 PrefixExpr(PrefixExpr),
1303 RangeExpr(RangeExpr),
1304 RecordExpr(RecordExpr),
1305 RefExpr(RefExpr),
1306 ReturnExpr(ReturnExpr),
1307 TryExpr(TryExpr),
1308 TupleExpr(TupleExpr),
1309 WhileExpr(WhileExpr),
1265} 1310}
1266#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1311#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1267pub enum Item { 1312pub enum Item {
@@ -1282,38 +1327,28 @@ pub enum Item {
1282} 1327}
1283impl ast::AttrsOwner for Item {} 1328impl ast::AttrsOwner for Item {}
1284#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1329#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1285pub enum TypeRef { 1330pub enum Stmt {
1286 ParenType(ParenType), 1331 ExprStmt(ExprStmt),
1287 TupleType(TupleType), 1332 Item(Item),
1288 NeverType(NeverType), 1333 LetStmt(LetStmt),
1289 PathType(PathType),
1290 PointerType(PointerType),
1291 ArrayType(ArrayType),
1292 SliceType(SliceType),
1293 ReferenceType(ReferenceType),
1294 PlaceholderType(PlaceholderType),
1295 FnPointerType(FnPointerType),
1296 ForType(ForType),
1297 ImplTraitType(ImplTraitType),
1298 DynTraitType(DynTraitType),
1299} 1334}
1300#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1335#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1301pub enum Pat { 1336pub enum Pat {
1337 IdentPat(IdentPat),
1338 BoxPat(BoxPat),
1339 RestPat(RestPat),
1340 LiteralPat(LiteralPat),
1341 MacroPat(MacroPat),
1302 OrPat(OrPat), 1342 OrPat(OrPat),
1303 ParenPat(ParenPat), 1343 ParenPat(ParenPat),
1304 RefPat(RefPat),
1305 BoxPat(BoxPat),
1306 BindPat(BindPat),
1307 PlaceholderPat(PlaceholderPat),
1308 DotDotPat(DotDotPat),
1309 PathPat(PathPat), 1344 PathPat(PathPat),
1345 WildcardPat(WildcardPat),
1346 RangePat(RangePat),
1310 RecordPat(RecordPat), 1347 RecordPat(RecordPat),
1311 TupleStructPat(TupleStructPat), 1348 RefPat(RefPat),
1312 TuplePat(TuplePat),
1313 SlicePat(SlicePat), 1349 SlicePat(SlicePat),
1314 RangePat(RangePat), 1350 TuplePat(TuplePat),
1315 LiteralPat(LiteralPat), 1351 TupleStructPat(TupleStructPat),
1316 MacroPat(MacroPat),
1317} 1352}
1318#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1353#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1319pub enum FieldList { 1354pub enum FieldList {
@@ -1321,81 +1356,52 @@ pub enum FieldList {
1321 TupleFieldList(TupleFieldList), 1356 TupleFieldList(TupleFieldList),
1322} 1357}
1323#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1358#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1324pub enum Expr { 1359pub enum AdtDef {
1325 TupleExpr(TupleExpr), 1360 Enum(Enum),
1326 ArrayExpr(ArrayExpr), 1361 Struct(Struct),
1327 ParenExpr(ParenExpr), 1362 Union(Union),
1328 PathExpr(PathExpr),
1329 LambdaExpr(LambdaExpr),
1330 IfExpr(IfExpr),
1331 LoopExpr(LoopExpr),
1332 ForExpr(ForExpr),
1333 WhileExpr(WhileExpr),
1334 ContinueExpr(ContinueExpr),
1335 BreakExpr(BreakExpr),
1336 Label(Label),
1337 BlockExpr(BlockExpr),
1338 ReturnExpr(ReturnExpr),
1339 MatchExpr(MatchExpr),
1340 RecordExpr(RecordExpr),
1341 CallExpr(CallExpr),
1342 IndexExpr(IndexExpr),
1343 MethodCallExpr(MethodCallExpr),
1344 FieldExpr(FieldExpr),
1345 AwaitExpr(AwaitExpr),
1346 TryExpr(TryExpr),
1347 EffectExpr(EffectExpr),
1348 CastExpr(CastExpr),
1349 RefExpr(RefExpr),
1350 PrefixExpr(PrefixExpr),
1351 RangeExpr(RangeExpr),
1352 BinExpr(BinExpr),
1353 Literal(Literal),
1354 MacroCall(MacroCall),
1355 BoxExpr(BoxExpr),
1356} 1363}
1364impl ast::AttrsOwner for AdtDef {}
1365impl ast::GenericParamsOwner for AdtDef {}
1366impl ast::NameOwner for AdtDef {}
1367impl ast::VisibilityOwner for AdtDef {}
1357#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1368#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1358pub enum AssocItem { 1369pub enum AssocItem {
1359 Fn(Fn),
1360 TypeAlias(TypeAlias),
1361 Const(Const), 1370 Const(Const),
1371 Fn(Fn),
1362 MacroCall(MacroCall), 1372 MacroCall(MacroCall),
1373 TypeAlias(TypeAlias),
1363} 1374}
1364impl ast::AttrsOwner for AssocItem {} 1375impl ast::AttrsOwner for AssocItem {}
1365impl ast::NameOwner for AssocItem {} 1376impl ast::NameOwner for AssocItem {}
1366#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1377#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1367pub enum ExternItem { 1378pub enum ExternItem {
1368 Fn(Fn), 1379 Fn(Fn),
1369 Static(Static),
1370 MacroCall(MacroCall), 1380 MacroCall(MacroCall),
1381 Static(Static),
1371} 1382}
1372impl ast::AttrsOwner for ExternItem {} 1383impl ast::AttrsOwner for ExternItem {}
1373impl ast::NameOwner for ExternItem {} 1384impl ast::NameOwner for ExternItem {}
1374#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1385#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1375pub enum GenericParam { 1386pub enum GenericParam {
1387 ConstParam(ConstParam),
1376 LifetimeParam(LifetimeParam), 1388 LifetimeParam(LifetimeParam),
1377 TypeParam(TypeParam), 1389 TypeParam(TypeParam),
1378 ConstParam(ConstParam),
1379} 1390}
1380impl ast::AttrsOwner for GenericParam {} 1391impl ast::AttrsOwner for GenericParam {}
1381#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1392impl AstNode for Name {
1382pub enum Stmt { 1393 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
1383 LetStmt(LetStmt), 1394 fn cast(syntax: SyntaxNode) -> Option<Self> {
1384 ExprStmt(ExprStmt), 1395 if Self::can_cast(syntax.kind()) {
1385} 1396 Some(Self { syntax })
1386impl ast::AttrsOwner for Stmt {} 1397 } else {
1387#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1398 None
1388pub enum AdtDef { 1399 }
1389 Struct(Struct), 1400 }
1390 Enum(Enum), 1401 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1391 Union(Union),
1392} 1402}
1393impl ast::AttrsOwner for AdtDef {} 1403impl AstNode for NameRef {
1394impl ast::GenericParamsOwner for AdtDef {} 1404 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
1395impl ast::NameOwner for AdtDef {}
1396impl ast::VisibilityOwner for AdtDef {}
1397impl AstNode for SourceFile {
1398 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
1399 fn cast(syntax: SyntaxNode) -> Option<Self> { 1405 fn cast(syntax: SyntaxNode) -> Option<Self> {
1400 if Self::can_cast(syntax.kind()) { 1406 if Self::can_cast(syntax.kind()) {
1401 Some(Self { syntax }) 1407 Some(Self { syntax })
@@ -1405,8 +1411,8 @@ impl AstNode for SourceFile {
1405 } 1411 }
1406 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1412 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1407} 1413}
1408impl AstNode for Attr { 1414impl AstNode for Path {
1409 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } 1415 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
1410 fn cast(syntax: SyntaxNode) -> Option<Self> { 1416 fn cast(syntax: SyntaxNode) -> Option<Self> {
1411 if Self::can_cast(syntax.kind()) { 1417 if Self::can_cast(syntax.kind()) {
1412 Some(Self { syntax }) 1418 Some(Self { syntax })
@@ -1416,8 +1422,8 @@ impl AstNode for Attr {
1416 } 1422 }
1417 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1423 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1418} 1424}
1419impl AstNode for Const { 1425impl AstNode for PathSegment {
1420 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } 1426 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
1421 fn cast(syntax: SyntaxNode) -> Option<Self> { 1427 fn cast(syntax: SyntaxNode) -> Option<Self> {
1422 if Self::can_cast(syntax.kind()) { 1428 if Self::can_cast(syntax.kind()) {
1423 Some(Self { syntax }) 1429 Some(Self { syntax })
@@ -1427,8 +1433,8 @@ impl AstNode for Const {
1427 } 1433 }
1428 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1434 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1429} 1435}
1430impl AstNode for Enum { 1436impl AstNode for GenericArgList {
1431 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } 1437 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST }
1432 fn cast(syntax: SyntaxNode) -> Option<Self> { 1438 fn cast(syntax: SyntaxNode) -> Option<Self> {
1433 if Self::can_cast(syntax.kind()) { 1439 if Self::can_cast(syntax.kind()) {
1434 Some(Self { syntax }) 1440 Some(Self { syntax })
@@ -1438,8 +1444,8 @@ impl AstNode for Enum {
1438 } 1444 }
1439 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1445 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1440} 1446}
1441impl AstNode for ExternBlock { 1447impl AstNode for ParamList {
1442 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } 1448 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
1443 fn cast(syntax: SyntaxNode) -> Option<Self> { 1449 fn cast(syntax: SyntaxNode) -> Option<Self> {
1444 if Self::can_cast(syntax.kind()) { 1450 if Self::can_cast(syntax.kind()) {
1445 Some(Self { syntax }) 1451 Some(Self { syntax })
@@ -1449,8 +1455,8 @@ impl AstNode for ExternBlock {
1449 } 1455 }
1450 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1456 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1451} 1457}
1452impl AstNode for ExternCrate { 1458impl AstNode for RetType {
1453 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } 1459 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
1454 fn cast(syntax: SyntaxNode) -> Option<Self> { 1460 fn cast(syntax: SyntaxNode) -> Option<Self> {
1455 if Self::can_cast(syntax.kind()) { 1461 if Self::can_cast(syntax.kind()) {
1456 Some(Self { syntax }) 1462 Some(Self { syntax })
@@ -1460,8 +1466,8 @@ impl AstNode for ExternCrate {
1460 } 1466 }
1461 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1467 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1462} 1468}
1463impl AstNode for Fn { 1469impl AstNode for PathType {
1464 fn can_cast(kind: SyntaxKind) -> bool { kind == FN } 1470 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
1465 fn cast(syntax: SyntaxNode) -> Option<Self> { 1471 fn cast(syntax: SyntaxNode) -> Option<Self> {
1466 if Self::can_cast(syntax.kind()) { 1472 if Self::can_cast(syntax.kind()) {
1467 Some(Self { syntax }) 1473 Some(Self { syntax })
@@ -1471,8 +1477,8 @@ impl AstNode for Fn {
1471 } 1477 }
1472 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1478 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1473} 1479}
1474impl AstNode for Impl { 1480impl AstNode for TypeArg {
1475 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } 1481 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
1476 fn cast(syntax: SyntaxNode) -> Option<Self> { 1482 fn cast(syntax: SyntaxNode) -> Option<Self> {
1477 if Self::can_cast(syntax.kind()) { 1483 if Self::can_cast(syntax.kind()) {
1478 Some(Self { syntax }) 1484 Some(Self { syntax })
@@ -1482,8 +1488,8 @@ impl AstNode for Impl {
1482 } 1488 }
1483 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1489 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1484} 1490}
1485impl AstNode for MacroCall { 1491impl AstNode for AssocTypeArg {
1486 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } 1492 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
1487 fn cast(syntax: SyntaxNode) -> Option<Self> { 1493 fn cast(syntax: SyntaxNode) -> Option<Self> {
1488 if Self::can_cast(syntax.kind()) { 1494 if Self::can_cast(syntax.kind()) {
1489 Some(Self { syntax }) 1495 Some(Self { syntax })
@@ -1493,8 +1499,8 @@ impl AstNode for MacroCall {
1493 } 1499 }
1494 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1500 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1495} 1501}
1496impl AstNode for Module { 1502impl AstNode for LifetimeArg {
1497 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } 1503 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
1498 fn cast(syntax: SyntaxNode) -> Option<Self> { 1504 fn cast(syntax: SyntaxNode) -> Option<Self> {
1499 if Self::can_cast(syntax.kind()) { 1505 if Self::can_cast(syntax.kind()) {
1500 Some(Self { syntax }) 1506 Some(Self { syntax })
@@ -1504,8 +1510,8 @@ impl AstNode for Module {
1504 } 1510 }
1505 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1511 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1506} 1512}
1507impl AstNode for Static { 1513impl AstNode for ConstArg {
1508 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } 1514 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
1509 fn cast(syntax: SyntaxNode) -> Option<Self> { 1515 fn cast(syntax: SyntaxNode) -> Option<Self> {
1510 if Self::can_cast(syntax.kind()) { 1516 if Self::can_cast(syntax.kind()) {
1511 Some(Self { syntax }) 1517 Some(Self { syntax })
@@ -1515,8 +1521,8 @@ impl AstNode for Static {
1515 } 1521 }
1516 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1522 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1517} 1523}
1518impl AstNode for Struct { 1524impl AstNode for TypeBoundList {
1519 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } 1525 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
1520 fn cast(syntax: SyntaxNode) -> Option<Self> { 1526 fn cast(syntax: SyntaxNode) -> Option<Self> {
1521 if Self::can_cast(syntax.kind()) { 1527 if Self::can_cast(syntax.kind()) {
1522 Some(Self { syntax }) 1528 Some(Self { syntax })
@@ -1526,8 +1532,8 @@ impl AstNode for Struct {
1526 } 1532 }
1527 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1533 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1528} 1534}
1529impl AstNode for Trait { 1535impl AstNode for MacroCall {
1530 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } 1536 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
1531 fn cast(syntax: SyntaxNode) -> Option<Self> { 1537 fn cast(syntax: SyntaxNode) -> Option<Self> {
1532 if Self::can_cast(syntax.kind()) { 1538 if Self::can_cast(syntax.kind()) {
1533 Some(Self { syntax }) 1539 Some(Self { syntax })
@@ -1537,8 +1543,8 @@ impl AstNode for Trait {
1537 } 1543 }
1538 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1544 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1539} 1545}
1540impl AstNode for TypeAlias { 1546impl AstNode for Attr {
1541 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } 1547 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
1542 fn cast(syntax: SyntaxNode) -> Option<Self> { 1548 fn cast(syntax: SyntaxNode) -> Option<Self> {
1543 if Self::can_cast(syntax.kind()) { 1549 if Self::can_cast(syntax.kind()) {
1544 Some(Self { syntax }) 1550 Some(Self { syntax })
@@ -1548,8 +1554,8 @@ impl AstNode for TypeAlias {
1548 } 1554 }
1549 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1555 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1550} 1556}
1551impl AstNode for Union { 1557impl AstNode for TokenTree {
1552 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } 1558 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
1553 fn cast(syntax: SyntaxNode) -> Option<Self> { 1559 fn cast(syntax: SyntaxNode) -> Option<Self> {
1554 if Self::can_cast(syntax.kind()) { 1560 if Self::can_cast(syntax.kind()) {
1555 Some(Self { syntax }) 1561 Some(Self { syntax })
@@ -1559,8 +1565,8 @@ impl AstNode for Union {
1559 } 1565 }
1560 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1566 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1561} 1567}
1562impl AstNode for Use { 1568impl AstNode for MacroItems {
1563 fn can_cast(kind: SyntaxKind) -> bool { kind == USE } 1569 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
1564 fn cast(syntax: SyntaxNode) -> Option<Self> { 1570 fn cast(syntax: SyntaxNode) -> Option<Self> {
1565 if Self::can_cast(syntax.kind()) { 1571 if Self::can_cast(syntax.kind()) {
1566 Some(Self { syntax }) 1572 Some(Self { syntax })
@@ -1570,8 +1576,8 @@ impl AstNode for Use {
1570 } 1576 }
1571 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1577 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1572} 1578}
1573impl AstNode for Visibility { 1579impl AstNode for MacroStmts {
1574 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } 1580 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS }
1575 fn cast(syntax: SyntaxNode) -> Option<Self> { 1581 fn cast(syntax: SyntaxNode) -> Option<Self> {
1576 if Self::can_cast(syntax.kind()) { 1582 if Self::can_cast(syntax.kind()) {
1577 Some(Self { syntax }) 1583 Some(Self { syntax })
@@ -1581,8 +1587,8 @@ impl AstNode for Visibility {
1581 } 1587 }
1582 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1588 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1583} 1589}
1584impl AstNode for Name { 1590impl AstNode for SourceFile {
1585 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } 1591 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
1586 fn cast(syntax: SyntaxNode) -> Option<Self> { 1592 fn cast(syntax: SyntaxNode) -> Option<Self> {
1587 if Self::can_cast(syntax.kind()) { 1593 if Self::can_cast(syntax.kind()) {
1588 Some(Self { syntax }) 1594 Some(Self { syntax })
@@ -1592,8 +1598,8 @@ impl AstNode for Name {
1592 } 1598 }
1593 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1599 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1594} 1600}
1595impl AstNode for ItemList { 1601impl AstNode for Const {
1596 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } 1602 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST }
1597 fn cast(syntax: SyntaxNode) -> Option<Self> { 1603 fn cast(syntax: SyntaxNode) -> Option<Self> {
1598 if Self::can_cast(syntax.kind()) { 1604 if Self::can_cast(syntax.kind()) {
1599 Some(Self { syntax }) 1605 Some(Self { syntax })
@@ -1603,8 +1609,8 @@ impl AstNode for ItemList {
1603 } 1609 }
1604 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1610 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1605} 1611}
1606impl AstNode for NameRef { 1612impl AstNode for Enum {
1607 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } 1613 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM }
1608 fn cast(syntax: SyntaxNode) -> Option<Self> { 1614 fn cast(syntax: SyntaxNode) -> Option<Self> {
1609 if Self::can_cast(syntax.kind()) { 1615 if Self::can_cast(syntax.kind()) {
1610 Some(Self { syntax }) 1616 Some(Self { syntax })
@@ -1614,8 +1620,8 @@ impl AstNode for NameRef {
1614 } 1620 }
1615 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1621 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1616} 1622}
1617impl AstNode for Rename { 1623impl AstNode for ExternBlock {
1618 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } 1624 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
1619 fn cast(syntax: SyntaxNode) -> Option<Self> { 1625 fn cast(syntax: SyntaxNode) -> Option<Self> {
1620 if Self::can_cast(syntax.kind()) { 1626 if Self::can_cast(syntax.kind()) {
1621 Some(Self { syntax }) 1627 Some(Self { syntax })
@@ -1625,8 +1631,8 @@ impl AstNode for Rename {
1625 } 1631 }
1626 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1632 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1627} 1633}
1628impl AstNode for UseTree { 1634impl AstNode for ExternCrate {
1629 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } 1635 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE }
1630 fn cast(syntax: SyntaxNode) -> Option<Self> { 1636 fn cast(syntax: SyntaxNode) -> Option<Self> {
1631 if Self::can_cast(syntax.kind()) { 1637 if Self::can_cast(syntax.kind()) {
1632 Some(Self { syntax }) 1638 Some(Self { syntax })
@@ -1636,8 +1642,8 @@ impl AstNode for UseTree {
1636 } 1642 }
1637 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1643 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1638} 1644}
1639impl AstNode for Path { 1645impl AstNode for Fn {
1640 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } 1646 fn can_cast(kind: SyntaxKind) -> bool { kind == FN }
1641 fn cast(syntax: SyntaxNode) -> Option<Self> { 1647 fn cast(syntax: SyntaxNode) -> Option<Self> {
1642 if Self::can_cast(syntax.kind()) { 1648 if Self::can_cast(syntax.kind()) {
1643 Some(Self { syntax }) 1649 Some(Self { syntax })
@@ -1647,8 +1653,8 @@ impl AstNode for Path {
1647 } 1653 }
1648 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1654 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1649} 1655}
1650impl AstNode for UseTreeList { 1656impl AstNode for Impl {
1651 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } 1657 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL }
1652 fn cast(syntax: SyntaxNode) -> Option<Self> { 1658 fn cast(syntax: SyntaxNode) -> Option<Self> {
1653 if Self::can_cast(syntax.kind()) { 1659 if Self::can_cast(syntax.kind()) {
1654 Some(Self { syntax }) 1660 Some(Self { syntax })
@@ -1658,8 +1664,8 @@ impl AstNode for UseTreeList {
1658 } 1664 }
1659 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1665 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1660} 1666}
1661impl AstNode for Abi { 1667impl AstNode for Module {
1662 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } 1668 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
1663 fn cast(syntax: SyntaxNode) -> Option<Self> { 1669 fn cast(syntax: SyntaxNode) -> Option<Self> {
1664 if Self::can_cast(syntax.kind()) { 1670 if Self::can_cast(syntax.kind()) {
1665 Some(Self { syntax }) 1671 Some(Self { syntax })
@@ -1669,8 +1675,8 @@ impl AstNode for Abi {
1669 } 1675 }
1670 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1676 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1671} 1677}
1672impl AstNode for GenericParamList { 1678impl AstNode for Static {
1673 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } 1679 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC }
1674 fn cast(syntax: SyntaxNode) -> Option<Self> { 1680 fn cast(syntax: SyntaxNode) -> Option<Self> {
1675 if Self::can_cast(syntax.kind()) { 1681 if Self::can_cast(syntax.kind()) {
1676 Some(Self { syntax }) 1682 Some(Self { syntax })
@@ -1680,8 +1686,8 @@ impl AstNode for GenericParamList {
1680 } 1686 }
1681 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1687 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1682} 1688}
1683impl AstNode for ParamList { 1689impl AstNode for Struct {
1684 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } 1690 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT }
1685 fn cast(syntax: SyntaxNode) -> Option<Self> { 1691 fn cast(syntax: SyntaxNode) -> Option<Self> {
1686 if Self::can_cast(syntax.kind()) { 1692 if Self::can_cast(syntax.kind()) {
1687 Some(Self { syntax }) 1693 Some(Self { syntax })
@@ -1691,8 +1697,8 @@ impl AstNode for ParamList {
1691 } 1697 }
1692 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1698 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1693} 1699}
1694impl AstNode for RetType { 1700impl AstNode for Trait {
1695 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } 1701 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT }
1696 fn cast(syntax: SyntaxNode) -> Option<Self> { 1702 fn cast(syntax: SyntaxNode) -> Option<Self> {
1697 if Self::can_cast(syntax.kind()) { 1703 if Self::can_cast(syntax.kind()) {
1698 Some(Self { syntax }) 1704 Some(Self { syntax })
@@ -1702,8 +1708,8 @@ impl AstNode for RetType {
1702 } 1708 }
1703 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1709 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1704} 1710}
1705impl AstNode for WhereClause { 1711impl AstNode for TypeAlias {
1706 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } 1712 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS }
1707 fn cast(syntax: SyntaxNode) -> Option<Self> { 1713 fn cast(syntax: SyntaxNode) -> Option<Self> {
1708 if Self::can_cast(syntax.kind()) { 1714 if Self::can_cast(syntax.kind()) {
1709 Some(Self { syntax }) 1715 Some(Self { syntax })
@@ -1713,8 +1719,8 @@ impl AstNode for WhereClause {
1713 } 1719 }
1714 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1720 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1715} 1721}
1716impl AstNode for BlockExpr { 1722impl AstNode for Union {
1717 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } 1723 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION }
1718 fn cast(syntax: SyntaxNode) -> Option<Self> { 1724 fn cast(syntax: SyntaxNode) -> Option<Self> {
1719 if Self::can_cast(syntax.kind()) { 1725 if Self::can_cast(syntax.kind()) {
1720 Some(Self { syntax }) 1726 Some(Self { syntax })
@@ -1724,8 +1730,8 @@ impl AstNode for BlockExpr {
1724 } 1730 }
1725 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1731 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1726} 1732}
1727impl AstNode for SelfParam { 1733impl AstNode for Use {
1728 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } 1734 fn can_cast(kind: SyntaxKind) -> bool { kind == USE }
1729 fn cast(syntax: SyntaxNode) -> Option<Self> { 1735 fn cast(syntax: SyntaxNode) -> Option<Self> {
1730 if Self::can_cast(syntax.kind()) { 1736 if Self::can_cast(syntax.kind()) {
1731 Some(Self { syntax }) 1737 Some(Self { syntax })
@@ -1735,8 +1741,8 @@ impl AstNode for SelfParam {
1735 } 1741 }
1736 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1742 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1737} 1743}
1738impl AstNode for Param { 1744impl AstNode for Visibility {
1739 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } 1745 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
1740 fn cast(syntax: SyntaxNode) -> Option<Self> { 1746 fn cast(syntax: SyntaxNode) -> Option<Self> {
1741 if Self::can_cast(syntax.kind()) { 1747 if Self::can_cast(syntax.kind()) {
1742 Some(Self { syntax }) 1748 Some(Self { syntax })
@@ -1746,8 +1752,8 @@ impl AstNode for Param {
1746 } 1752 }
1747 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1753 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1748} 1754}
1749impl AstNode for TypeBoundList { 1755impl AstNode for ItemList {
1750 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } 1756 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
1751 fn cast(syntax: SyntaxNode) -> Option<Self> { 1757 fn cast(syntax: SyntaxNode) -> Option<Self> {
1752 if Self::can_cast(syntax.kind()) { 1758 if Self::can_cast(syntax.kind()) {
1753 Some(Self { syntax }) 1759 Some(Self { syntax })
@@ -1757,8 +1763,8 @@ impl AstNode for TypeBoundList {
1757 } 1763 }
1758 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1764 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1759} 1765}
1760impl AstNode for RecordFieldList { 1766impl AstNode for Rename {
1761 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } 1767 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME }
1762 fn cast(syntax: SyntaxNode) -> Option<Self> { 1768 fn cast(syntax: SyntaxNode) -> Option<Self> {
1763 if Self::can_cast(syntax.kind()) { 1769 if Self::can_cast(syntax.kind()) {
1764 Some(Self { syntax }) 1770 Some(Self { syntax })
@@ -1768,8 +1774,8 @@ impl AstNode for RecordFieldList {
1768 } 1774 }
1769 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1775 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1770} 1776}
1771impl AstNode for TupleFieldList { 1777impl AstNode for UseTree {
1772 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } 1778 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
1773 fn cast(syntax: SyntaxNode) -> Option<Self> { 1779 fn cast(syntax: SyntaxNode) -> Option<Self> {
1774 if Self::can_cast(syntax.kind()) { 1780 if Self::can_cast(syntax.kind()) {
1775 Some(Self { syntax }) 1781 Some(Self { syntax })
@@ -1779,8 +1785,8 @@ impl AstNode for TupleFieldList {
1779 } 1785 }
1780 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1786 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1781} 1787}
1782impl AstNode for RecordField { 1788impl AstNode for UseTreeList {
1783 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } 1789 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
1784 fn cast(syntax: SyntaxNode) -> Option<Self> { 1790 fn cast(syntax: SyntaxNode) -> Option<Self> {
1785 if Self::can_cast(syntax.kind()) { 1791 if Self::can_cast(syntax.kind()) {
1786 Some(Self { syntax }) 1792 Some(Self { syntax })
@@ -1790,8 +1796,8 @@ impl AstNode for RecordField {
1790 } 1796 }
1791 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1797 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1792} 1798}
1793impl AstNode for TupleField { 1799impl AstNode for Abi {
1794 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } 1800 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
1795 fn cast(syntax: SyntaxNode) -> Option<Self> { 1801 fn cast(syntax: SyntaxNode) -> Option<Self> {
1796 if Self::can_cast(syntax.kind()) { 1802 if Self::can_cast(syntax.kind()) {
1797 Some(Self { syntax }) 1803 Some(Self { syntax })
@@ -1801,8 +1807,8 @@ impl AstNode for TupleField {
1801 } 1807 }
1802 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1808 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1803} 1809}
1804impl AstNode for VariantList { 1810impl AstNode for GenericParamList {
1805 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } 1811 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST }
1806 fn cast(syntax: SyntaxNode) -> Option<Self> { 1812 fn cast(syntax: SyntaxNode) -> Option<Self> {
1807 if Self::can_cast(syntax.kind()) { 1813 if Self::can_cast(syntax.kind()) {
1808 Some(Self { syntax }) 1814 Some(Self { syntax })
@@ -1812,8 +1818,8 @@ impl AstNode for VariantList {
1812 } 1818 }
1813 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1819 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1814} 1820}
1815impl AstNode for Variant { 1821impl AstNode for WhereClause {
1816 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } 1822 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
1817 fn cast(syntax: SyntaxNode) -> Option<Self> { 1823 fn cast(syntax: SyntaxNode) -> Option<Self> {
1818 if Self::can_cast(syntax.kind()) { 1824 if Self::can_cast(syntax.kind()) {
1819 Some(Self { syntax }) 1825 Some(Self { syntax })
@@ -1823,8 +1829,8 @@ impl AstNode for Variant {
1823 } 1829 }
1824 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1830 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1825} 1831}
1826impl AstNode for AssocItemList { 1832impl AstNode for BlockExpr {
1827 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } 1833 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
1828 fn cast(syntax: SyntaxNode) -> Option<Self> { 1834 fn cast(syntax: SyntaxNode) -> Option<Self> {
1829 if Self::can_cast(syntax.kind()) { 1835 if Self::can_cast(syntax.kind()) {
1830 Some(Self { syntax }) 1836 Some(Self { syntax })
@@ -1834,8 +1840,8 @@ impl AstNode for AssocItemList {
1834 } 1840 }
1835 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1841 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1836} 1842}
1837impl AstNode for ExternItemList { 1843impl AstNode for SelfParam {
1838 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } 1844 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
1839 fn cast(syntax: SyntaxNode) -> Option<Self> { 1845 fn cast(syntax: SyntaxNode) -> Option<Self> {
1840 if Self::can_cast(syntax.kind()) { 1846 if Self::can_cast(syntax.kind()) {
1841 Some(Self { syntax }) 1847 Some(Self { syntax })
@@ -1845,8 +1851,8 @@ impl AstNode for ExternItemList {
1845 } 1851 }
1846 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1852 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1847} 1853}
1848impl AstNode for LifetimeParam { 1854impl AstNode for Param {
1849 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } 1855 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
1850 fn cast(syntax: SyntaxNode) -> Option<Self> { 1856 fn cast(syntax: SyntaxNode) -> Option<Self> {
1851 if Self::can_cast(syntax.kind()) { 1857 if Self::can_cast(syntax.kind()) {
1852 Some(Self { syntax }) 1858 Some(Self { syntax })
@@ -1856,8 +1862,8 @@ impl AstNode for LifetimeParam {
1856 } 1862 }
1857 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1863 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1858} 1864}
1859impl AstNode for TypeParam { 1865impl AstNode for RecordFieldList {
1860 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } 1866 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
1861 fn cast(syntax: SyntaxNode) -> Option<Self> { 1867 fn cast(syntax: SyntaxNode) -> Option<Self> {
1862 if Self::can_cast(syntax.kind()) { 1868 if Self::can_cast(syntax.kind()) {
1863 Some(Self { syntax }) 1869 Some(Self { syntax })
@@ -1867,8 +1873,8 @@ impl AstNode for TypeParam {
1867 } 1873 }
1868 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1874 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1869} 1875}
1870impl AstNode for ConstParam { 1876impl AstNode for TupleFieldList {
1871 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } 1877 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST }
1872 fn cast(syntax: SyntaxNode) -> Option<Self> { 1878 fn cast(syntax: SyntaxNode) -> Option<Self> {
1873 if Self::can_cast(syntax.kind()) { 1879 if Self::can_cast(syntax.kind()) {
1874 Some(Self { syntax }) 1880 Some(Self { syntax })
@@ -1878,8 +1884,8 @@ impl AstNode for ConstParam {
1878 } 1884 }
1879 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1885 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1880} 1886}
1881impl AstNode for Literal { 1887impl AstNode for RecordField {
1882 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } 1888 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
1883 fn cast(syntax: SyntaxNode) -> Option<Self> { 1889 fn cast(syntax: SyntaxNode) -> Option<Self> {
1884 if Self::can_cast(syntax.kind()) { 1890 if Self::can_cast(syntax.kind()) {
1885 Some(Self { syntax }) 1891 Some(Self { syntax })
@@ -1889,8 +1895,8 @@ impl AstNode for Literal {
1889 } 1895 }
1890 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1896 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1891} 1897}
1892impl AstNode for TokenTree { 1898impl AstNode for TupleField {
1893 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } 1899 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD }
1894 fn cast(syntax: SyntaxNode) -> Option<Self> { 1900 fn cast(syntax: SyntaxNode) -> Option<Self> {
1895 if Self::can_cast(syntax.kind()) { 1901 if Self::can_cast(syntax.kind()) {
1896 Some(Self { syntax }) 1902 Some(Self { syntax })
@@ -1900,8 +1906,8 @@ impl AstNode for TokenTree {
1900 } 1906 }
1901 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1907 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1902} 1908}
1903impl AstNode for ParenType { 1909impl AstNode for VariantList {
1904 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } 1910 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
1905 fn cast(syntax: SyntaxNode) -> Option<Self> { 1911 fn cast(syntax: SyntaxNode) -> Option<Self> {
1906 if Self::can_cast(syntax.kind()) { 1912 if Self::can_cast(syntax.kind()) {
1907 Some(Self { syntax }) 1913 Some(Self { syntax })
@@ -1911,8 +1917,8 @@ impl AstNode for ParenType {
1911 } 1917 }
1912 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1918 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1913} 1919}
1914impl AstNode for TupleType { 1920impl AstNode for Variant {
1915 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } 1921 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
1916 fn cast(syntax: SyntaxNode) -> Option<Self> { 1922 fn cast(syntax: SyntaxNode) -> Option<Self> {
1917 if Self::can_cast(syntax.kind()) { 1923 if Self::can_cast(syntax.kind()) {
1918 Some(Self { syntax }) 1924 Some(Self { syntax })
@@ -1922,8 +1928,8 @@ impl AstNode for TupleType {
1922 } 1928 }
1923 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1929 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1924} 1930}
1925impl AstNode for NeverType { 1931impl AstNode for AssocItemList {
1926 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } 1932 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
1927 fn cast(syntax: SyntaxNode) -> Option<Self> { 1933 fn cast(syntax: SyntaxNode) -> Option<Self> {
1928 if Self::can_cast(syntax.kind()) { 1934 if Self::can_cast(syntax.kind()) {
1929 Some(Self { syntax }) 1935 Some(Self { syntax })
@@ -1933,8 +1939,8 @@ impl AstNode for NeverType {
1933 } 1939 }
1934 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1940 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1935} 1941}
1936impl AstNode for PathType { 1942impl AstNode for ExternItemList {
1937 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } 1943 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
1938 fn cast(syntax: SyntaxNode) -> Option<Self> { 1944 fn cast(syntax: SyntaxNode) -> Option<Self> {
1939 if Self::can_cast(syntax.kind()) { 1945 if Self::can_cast(syntax.kind()) {
1940 Some(Self { syntax }) 1946 Some(Self { syntax })
@@ -1944,8 +1950,8 @@ impl AstNode for PathType {
1944 } 1950 }
1945 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1951 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1946} 1952}
1947impl AstNode for PointerType { 1953impl AstNode for ConstParam {
1948 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } 1954 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
1949 fn cast(syntax: SyntaxNode) -> Option<Self> { 1955 fn cast(syntax: SyntaxNode) -> Option<Self> {
1950 if Self::can_cast(syntax.kind()) { 1956 if Self::can_cast(syntax.kind()) {
1951 Some(Self { syntax }) 1957 Some(Self { syntax })
@@ -1955,8 +1961,8 @@ impl AstNode for PointerType {
1955 } 1961 }
1956 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1962 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1957} 1963}
1958impl AstNode for ArrayType { 1964impl AstNode for LifetimeParam {
1959 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } 1965 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
1960 fn cast(syntax: SyntaxNode) -> Option<Self> { 1966 fn cast(syntax: SyntaxNode) -> Option<Self> {
1961 if Self::can_cast(syntax.kind()) { 1967 if Self::can_cast(syntax.kind()) {
1962 Some(Self { syntax }) 1968 Some(Self { syntax })
@@ -1966,8 +1972,8 @@ impl AstNode for ArrayType {
1966 } 1972 }
1967 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1973 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1968} 1974}
1969impl AstNode for SliceType { 1975impl AstNode for TypeParam {
1970 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } 1976 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
1971 fn cast(syntax: SyntaxNode) -> Option<Self> { 1977 fn cast(syntax: SyntaxNode) -> Option<Self> {
1972 if Self::can_cast(syntax.kind()) { 1978 if Self::can_cast(syntax.kind()) {
1973 Some(Self { syntax }) 1979 Some(Self { syntax })
@@ -1977,8 +1983,8 @@ impl AstNode for SliceType {
1977 } 1983 }
1978 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1984 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1979} 1985}
1980impl AstNode for ReferenceType { 1986impl AstNode for WherePred {
1981 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } 1987 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
1982 fn cast(syntax: SyntaxNode) -> Option<Self> { 1988 fn cast(syntax: SyntaxNode) -> Option<Self> {
1983 if Self::can_cast(syntax.kind()) { 1989 if Self::can_cast(syntax.kind()) {
1984 Some(Self { syntax }) 1990 Some(Self { syntax })
@@ -1988,8 +1994,8 @@ impl AstNode for ReferenceType {
1988 } 1994 }
1989 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1995 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1990} 1996}
1991impl AstNode for PlaceholderType { 1997impl AstNode for Literal {
1992 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } 1998 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
1993 fn cast(syntax: SyntaxNode) -> Option<Self> { 1999 fn cast(syntax: SyntaxNode) -> Option<Self> {
1994 if Self::can_cast(syntax.kind()) { 2000 if Self::can_cast(syntax.kind()) {
1995 Some(Self { syntax }) 2001 Some(Self { syntax })
@@ -1999,8 +2005,8 @@ impl AstNode for PlaceholderType {
1999 } 2005 }
2000 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2006 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2001} 2007}
2002impl AstNode for FnPointerType { 2008impl AstNode for ExprStmt {
2003 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } 2009 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
2004 fn cast(syntax: SyntaxNode) -> Option<Self> { 2010 fn cast(syntax: SyntaxNode) -> Option<Self> {
2005 if Self::can_cast(syntax.kind()) { 2011 if Self::can_cast(syntax.kind()) {
2006 Some(Self { syntax }) 2012 Some(Self { syntax })
@@ -2010,8 +2016,8 @@ impl AstNode for FnPointerType {
2010 } 2016 }
2011 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2017 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2012} 2018}
2013impl AstNode for ForType { 2019impl AstNode for LetStmt {
2014 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } 2020 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
2015 fn cast(syntax: SyntaxNode) -> Option<Self> { 2021 fn cast(syntax: SyntaxNode) -> Option<Self> {
2016 if Self::can_cast(syntax.kind()) { 2022 if Self::can_cast(syntax.kind()) {
2017 Some(Self { syntax }) 2023 Some(Self { syntax })
@@ -2021,8 +2027,8 @@ impl AstNode for ForType {
2021 } 2027 }
2022 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2028 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2023} 2029}
2024impl AstNode for ImplTraitType { 2030impl AstNode for ArrayExpr {
2025 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } 2031 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
2026 fn cast(syntax: SyntaxNode) -> Option<Self> { 2032 fn cast(syntax: SyntaxNode) -> Option<Self> {
2027 if Self::can_cast(syntax.kind()) { 2033 if Self::can_cast(syntax.kind()) {
2028 Some(Self { syntax }) 2034 Some(Self { syntax })
@@ -2032,8 +2038,8 @@ impl AstNode for ImplTraitType {
2032 } 2038 }
2033 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2039 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2034} 2040}
2035impl AstNode for DynTraitType { 2041impl AstNode for AwaitExpr {
2036 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } 2042 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
2037 fn cast(syntax: SyntaxNode) -> Option<Self> { 2043 fn cast(syntax: SyntaxNode) -> Option<Self> {
2038 if Self::can_cast(syntax.kind()) { 2044 if Self::can_cast(syntax.kind()) {
2039 Some(Self { syntax }) 2045 Some(Self { syntax })
@@ -2043,8 +2049,8 @@ impl AstNode for DynTraitType {
2043 } 2049 }
2044 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2050 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2045} 2051}
2046impl AstNode for TupleExpr { 2052impl AstNode for BinExpr {
2047 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } 2053 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
2048 fn cast(syntax: SyntaxNode) -> Option<Self> { 2054 fn cast(syntax: SyntaxNode) -> Option<Self> {
2049 if Self::can_cast(syntax.kind()) { 2055 if Self::can_cast(syntax.kind()) {
2050 Some(Self { syntax }) 2056 Some(Self { syntax })
@@ -2054,8 +2060,8 @@ impl AstNode for TupleExpr {
2054 } 2060 }
2055 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2061 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2056} 2062}
2057impl AstNode for ArrayExpr { 2063impl AstNode for BoxExpr {
2058 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } 2064 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
2059 fn cast(syntax: SyntaxNode) -> Option<Self> { 2065 fn cast(syntax: SyntaxNode) -> Option<Self> {
2060 if Self::can_cast(syntax.kind()) { 2066 if Self::can_cast(syntax.kind()) {
2061 Some(Self { syntax }) 2067 Some(Self { syntax })
@@ -2065,8 +2071,8 @@ impl AstNode for ArrayExpr {
2065 } 2071 }
2066 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2072 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2067} 2073}
2068impl AstNode for ParenExpr { 2074impl AstNode for BreakExpr {
2069 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } 2075 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
2070 fn cast(syntax: SyntaxNode) -> Option<Self> { 2076 fn cast(syntax: SyntaxNode) -> Option<Self> {
2071 if Self::can_cast(syntax.kind()) { 2077 if Self::can_cast(syntax.kind()) {
2072 Some(Self { syntax }) 2078 Some(Self { syntax })
@@ -2076,8 +2082,8 @@ impl AstNode for ParenExpr {
2076 } 2082 }
2077 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2083 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2078} 2084}
2079impl AstNode for PathExpr { 2085impl AstNode for CallExpr {
2080 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } 2086 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
2081 fn cast(syntax: SyntaxNode) -> Option<Self> { 2087 fn cast(syntax: SyntaxNode) -> Option<Self> {
2082 if Self::can_cast(syntax.kind()) { 2088 if Self::can_cast(syntax.kind()) {
2083 Some(Self { syntax }) 2089 Some(Self { syntax })
@@ -2087,8 +2093,8 @@ impl AstNode for PathExpr {
2087 } 2093 }
2088 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2094 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2089} 2095}
2090impl AstNode for LambdaExpr { 2096impl AstNode for CastExpr {
2091 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } 2097 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
2092 fn cast(syntax: SyntaxNode) -> Option<Self> { 2098 fn cast(syntax: SyntaxNode) -> Option<Self> {
2093 if Self::can_cast(syntax.kind()) { 2099 if Self::can_cast(syntax.kind()) {
2094 Some(Self { syntax }) 2100 Some(Self { syntax })
@@ -2098,8 +2104,8 @@ impl AstNode for LambdaExpr {
2098 } 2104 }
2099 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2105 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2100} 2106}
2101impl AstNode for IfExpr { 2107impl AstNode for ClosureExpr {
2102 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } 2108 fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR }
2103 fn cast(syntax: SyntaxNode) -> Option<Self> { 2109 fn cast(syntax: SyntaxNode) -> Option<Self> {
2104 if Self::can_cast(syntax.kind()) { 2110 if Self::can_cast(syntax.kind()) {
2105 Some(Self { syntax }) 2111 Some(Self { syntax })
@@ -2109,8 +2115,8 @@ impl AstNode for IfExpr {
2109 } 2115 }
2110 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2116 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2111} 2117}
2112impl AstNode for Condition { 2118impl AstNode for ContinueExpr {
2113 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } 2119 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
2114 fn cast(syntax: SyntaxNode) -> Option<Self> { 2120 fn cast(syntax: SyntaxNode) -> Option<Self> {
2115 if Self::can_cast(syntax.kind()) { 2121 if Self::can_cast(syntax.kind()) {
2116 Some(Self { syntax }) 2122 Some(Self { syntax })
@@ -2131,8 +2137,8 @@ impl AstNode for EffectExpr {
2131 } 2137 }
2132 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2138 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2133} 2139}
2134impl AstNode for Label { 2140impl AstNode for FieldExpr {
2135 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } 2141 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
2136 fn cast(syntax: SyntaxNode) -> Option<Self> { 2142 fn cast(syntax: SyntaxNode) -> Option<Self> {
2137 if Self::can_cast(syntax.kind()) { 2143 if Self::can_cast(syntax.kind()) {
2138 Some(Self { syntax }) 2144 Some(Self { syntax })
@@ -2142,8 +2148,8 @@ impl AstNode for Label {
2142 } 2148 }
2143 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2149 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2144} 2150}
2145impl AstNode for LoopExpr { 2151impl AstNode for ForExpr {
2146 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } 2152 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
2147 fn cast(syntax: SyntaxNode) -> Option<Self> { 2153 fn cast(syntax: SyntaxNode) -> Option<Self> {
2148 if Self::can_cast(syntax.kind()) { 2154 if Self::can_cast(syntax.kind()) {
2149 Some(Self { syntax }) 2155 Some(Self { syntax })
@@ -2153,8 +2159,8 @@ impl AstNode for LoopExpr {
2153 } 2159 }
2154 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2160 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2155} 2161}
2156impl AstNode for ForExpr { 2162impl AstNode for IfExpr {
2157 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } 2163 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
2158 fn cast(syntax: SyntaxNode) -> Option<Self> { 2164 fn cast(syntax: SyntaxNode) -> Option<Self> {
2159 if Self::can_cast(syntax.kind()) { 2165 if Self::can_cast(syntax.kind()) {
2160 Some(Self { syntax }) 2166 Some(Self { syntax })
@@ -2164,8 +2170,8 @@ impl AstNode for ForExpr {
2164 } 2170 }
2165 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2171 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2166} 2172}
2167impl AstNode for WhileExpr { 2173impl AstNode for IndexExpr {
2168 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } 2174 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
2169 fn cast(syntax: SyntaxNode) -> Option<Self> { 2175 fn cast(syntax: SyntaxNode) -> Option<Self> {
2170 if Self::can_cast(syntax.kind()) { 2176 if Self::can_cast(syntax.kind()) {
2171 Some(Self { syntax }) 2177 Some(Self { syntax })
@@ -2175,8 +2181,8 @@ impl AstNode for WhileExpr {
2175 } 2181 }
2176 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2182 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2177} 2183}
2178impl AstNode for ContinueExpr { 2184impl AstNode for LoopExpr {
2179 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } 2185 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
2180 fn cast(syntax: SyntaxNode) -> Option<Self> { 2186 fn cast(syntax: SyntaxNode) -> Option<Self> {
2181 if Self::can_cast(syntax.kind()) { 2187 if Self::can_cast(syntax.kind()) {
2182 Some(Self { syntax }) 2188 Some(Self { syntax })
@@ -2186,8 +2192,8 @@ impl AstNode for ContinueExpr {
2186 } 2192 }
2187 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2193 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2188} 2194}
2189impl AstNode for BreakExpr { 2195impl AstNode for MatchExpr {
2190 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } 2196 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
2191 fn cast(syntax: SyntaxNode) -> Option<Self> { 2197 fn cast(syntax: SyntaxNode) -> Option<Self> {
2192 if Self::can_cast(syntax.kind()) { 2198 if Self::can_cast(syntax.kind()) {
2193 Some(Self { syntax }) 2199 Some(Self { syntax })
@@ -2197,8 +2203,8 @@ impl AstNode for BreakExpr {
2197 } 2203 }
2198 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2204 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2199} 2205}
2200impl AstNode for ReturnExpr { 2206impl AstNode for MethodCallExpr {
2201 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } 2207 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
2202 fn cast(syntax: SyntaxNode) -> Option<Self> { 2208 fn cast(syntax: SyntaxNode) -> Option<Self> {
2203 if Self::can_cast(syntax.kind()) { 2209 if Self::can_cast(syntax.kind()) {
2204 Some(Self { syntax }) 2210 Some(Self { syntax })
@@ -2208,8 +2214,8 @@ impl AstNode for ReturnExpr {
2208 } 2214 }
2209 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2215 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2210} 2216}
2211impl AstNode for CallExpr { 2217impl AstNode for ParenExpr {
2212 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } 2218 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
2213 fn cast(syntax: SyntaxNode) -> Option<Self> { 2219 fn cast(syntax: SyntaxNode) -> Option<Self> {
2214 if Self::can_cast(syntax.kind()) { 2220 if Self::can_cast(syntax.kind()) {
2215 Some(Self { syntax })