aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-31 16:09:31 +0100
committerGitHub <[email protected]>2020-07-31 16:09:31 +0100
commit7325283c6977e078513b5b21aa173775e2b22e12 (patch)
tree7be8b4fbc2e7470bf7891d81b3812eb572bb0d1c
parentad239f6197bda31f7a9b904b5ccb25c93cbc701a (diff)
parent633aace41108b74fe6c93c5ab04272067db033f9 (diff)
Merge #5624
5624: Finalize expressions grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_assists/src/handlers/extract_variable.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs24
-rw-r--r--crates/ra_hir_expand/src/db.rs2
-rw-r--r--crates/ra_ide/src/completion/patterns.rs2
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs1325
-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.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast14
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast2
-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/ok/0035_weird_exprs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast2
-rw-r--r--xtask/src/ast_src.rs2
-rw-r--r--xtask/src/codegen/gen_syntax.rs15
-rw-r--r--xtask/src/codegen/rust.ungram332
19 files changed, 894 insertions, 848 deletions
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_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 5816bf566..99d723402 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -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) => {
@@ -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() {
@@ -618,8 +631,7 @@ impl ExprCollector<'_> {
618 }) 631 })
619 .collect(); 632 .collect();
620 let tail = block.expr().map(|e| self.collect_expr(e)); 633 let tail = block.expr().map(|e| self.collect_expr(e));
621 let label = block.label().and_then(|l| l.lifetime_token()).map(|t| Name::new_lifetime(&t)); 634 self.alloc_expr(Expr::Block { statements, tail, label: None }, syntax_node_ptr)
622 self.alloc_expr(Expr::Block { statements, tail, label }, syntax_node_ptr)
623 } 635 }
624 636
625 fn collect_block_items(&mut self, block: &ast::BlockExpr) { 637 fn collect_block_items(&mut self, block: &ast::BlockExpr) {
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_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index a68861e1c..9e654b373 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -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_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/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 64ab18217..2830c0d74 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -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,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 763fd20f4..158544fa2 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -349,7 +349,6 @@ pub struct BlockExpr {
349} 349}
350impl ast::AttrsOwner for BlockExpr {} 350impl ast::AttrsOwner for BlockExpr {}
351impl BlockExpr { 351impl BlockExpr {
352 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
353 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 352 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
354 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 353 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
355 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 354 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
@@ -468,6 +467,19 @@ impl ExternItemList {
468 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 467 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
469} 468}
470#[derive(Debug, Clone, PartialEq, Eq, Hash)] 469#[derive(Debug, Clone, PartialEq, Eq, Hash)]
470pub struct ConstParam {
471 pub(crate) syntax: SyntaxNode,
472}
473impl ast::AttrsOwner for ConstParam {}
474impl ast::NameOwner for ConstParam {}
475impl ConstParam {
476 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
477 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
478 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
479 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
480 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
481}
482#[derive(Debug, Clone, PartialEq, Eq, Hash)]
471pub struct LifetimeParam { 483pub struct LifetimeParam {
472 pub(crate) syntax: SyntaxNode, 484 pub(crate) syntax: SyntaxNode,
473} 485}
@@ -490,19 +502,6 @@ impl TypeParam {
490 pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } 502 pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) }
491} 503}
492#[derive(Debug, Clone, PartialEq, Eq, Hash)] 504#[derive(Debug, Clone, PartialEq, Eq, Hash)]
493pub struct ConstParam {
494 pub(crate) syntax: SyntaxNode,
495}
496impl ast::AttrsOwner for ConstParam {}
497impl ast::NameOwner for ConstParam {}
498impl ConstParam {
499 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
500 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
501 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
502 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
503 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
504}
505#[derive(Debug, Clone, PartialEq, Eq, Hash)]
506pub struct WherePred { 505pub struct WherePred {
507 pub(crate) syntax: SyntaxNode, 506 pub(crate) syntax: SyntaxNode,
508} 507}
@@ -519,6 +518,7 @@ impl WherePred {
519pub struct Literal { 518pub struct Literal {
520 pub(crate) syntax: SyntaxNode, 519 pub(crate) syntax: SyntaxNode,
521} 520}
521impl ast::AttrsOwner for Literal {}
522impl Literal {} 522impl Literal {}
523#[derive(Debug, Clone, PartialEq, Eq, Hash)] 523#[derive(Debug, Clone, PartialEq, Eq, Hash)]
524pub struct TokenTree { 524pub struct TokenTree {
@@ -533,6 +533,15 @@ impl TokenTree {
533 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 533 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
534} 534}
535#[derive(Debug, Clone, PartialEq, Eq, Hash)] 535#[derive(Debug, Clone, PartialEq, Eq, Hash)]
536pub struct ExprStmt {
537 pub(crate) syntax: SyntaxNode,
538}
539impl ast::AttrsOwner for ExprStmt {}
540impl ExprStmt {
541 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
542 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
543}
544#[derive(Debug, Clone, PartialEq, Eq, Hash)]
536pub struct LetStmt { 545pub struct LetStmt {
537 pub(crate) syntax: SyntaxNode, 546 pub(crate) syntax: SyntaxNode,
538} 547}
@@ -547,165 +556,191 @@ impl LetStmt {
547 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 556 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
548} 557}
549#[derive(Debug, Clone, PartialEq, Eq, Hash)] 558#[derive(Debug, Clone, PartialEq, Eq, Hash)]
550pub struct ExprStmt { 559pub struct ArrayExpr {
551 pub(crate) syntax: SyntaxNode, 560 pub(crate) syntax: SyntaxNode,
552} 561}
553impl ast::AttrsOwner for ExprStmt {} 562impl ast::AttrsOwner for ArrayExpr {}
554impl ExprStmt { 563impl ArrayExpr {
564 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
565 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
555 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 566 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
556 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 567 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
568 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
557} 569}
558#[derive(Debug, Clone, PartialEq, Eq, Hash)] 570#[derive(Debug, Clone, PartialEq, Eq, Hash)]
559pub struct ParenType { 571pub struct AwaitExpr {
560 pub(crate) syntax: SyntaxNode,
561}
562impl ParenType {
563 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
564 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
565 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
566}
567#[derive(Debug, Clone, PartialEq, Eq, Hash)]
568pub struct TupleType {
569 pub(crate) syntax: SyntaxNode, 572 pub(crate) syntax: SyntaxNode,
570} 573}
571impl TupleType { 574impl ast::AttrsOwner for AwaitExpr {}
572 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 575impl AwaitExpr {
573 pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) } 576 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
574 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 577 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
578 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
575} 579}
576#[derive(Debug, Clone, PartialEq, Eq, Hash)] 580#[derive(Debug, Clone, PartialEq, Eq, Hash)]
577pub struct NeverType { 581pub struct BinExpr {
578 pub(crate) syntax: SyntaxNode, 582 pub(crate) syntax: SyntaxNode,
579} 583}
580impl NeverType { 584impl ast::AttrsOwner for BinExpr {}
581 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 585impl BinExpr {}
582}
583#[derive(Debug, Clone, PartialEq, Eq, Hash)] 586#[derive(Debug, Clone, PartialEq, Eq, Hash)]
584pub struct PathType { 587pub struct BoxExpr {
585 pub(crate) syntax: SyntaxNode, 588 pub(crate) syntax: SyntaxNode,
586} 589}
587impl PathType { 590impl ast::AttrsOwner for BoxExpr {}
588 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 591impl BoxExpr {
592 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
593 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
589} 594}
590#[derive(Debug, Clone, PartialEq, Eq, Hash)] 595#[derive(Debug, Clone, PartialEq, Eq, Hash)]
591pub struct PointerType { 596pub struct BreakExpr {
592 pub(crate) syntax: SyntaxNode, 597 pub(crate) syntax: SyntaxNode,
593} 598}
594impl PointerType { 599impl ast::AttrsOwner for BreakExpr {}
595 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } 600impl BreakExpr {
596 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 601 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
597 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 602 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
598 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 603 support::token(&self.syntax, T![lifetime])
604 }
605 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
599} 606}
600#[derive(Debug, Clone, PartialEq, Eq, Hash)] 607#[derive(Debug, Clone, PartialEq, Eq, Hash)]
601pub struct ArrayType { 608pub struct CallExpr {
602 pub(crate) syntax: SyntaxNode, 609 pub(crate) syntax: SyntaxNode,
603} 610}
604impl ArrayType { 611impl ast::AttrsOwner for CallExpr {}
605 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 612impl ast::ArgListOwner for CallExpr {}
606 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 613impl CallExpr {
607 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
608 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 614 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
609 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
610} 615}
611#[derive(Debug, Clone, PartialEq, Eq, Hash)] 616#[derive(Debug, Clone, PartialEq, Eq, Hash)]
612pub struct SliceType { 617pub struct CastExpr {
613 pub(crate) syntax: SyntaxNode, 618 pub(crate) syntax: SyntaxNode,
614} 619}
615impl SliceType { 620impl ast::AttrsOwner for CastExpr {}
616 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 621impl CastExpr {
622 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
623 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
617 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 624 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
618 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
619} 625}
620#[derive(Debug, Clone, PartialEq, Eq, Hash)] 626#[derive(Debug, Clone, PartialEq, Eq, Hash)]
621pub struct ReferenceType { 627pub struct ContinueExpr {
622 pub(crate) syntax: SyntaxNode, 628 pub(crate) syntax: SyntaxNode,
623} 629}
624impl ReferenceType { 630impl ast::AttrsOwner for ContinueExpr {}
625 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 631impl ContinueExpr {
632 pub fn continue_token(&self) -> Option<SyntaxToken> {
633 support::token(&self.syntax, T![continue])
634 }
626 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 635 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
627 support::token(&self.syntax, T![lifetime]) 636 support::token(&self.syntax, T![lifetime])
628 } 637 }
629 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
630 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
631} 638}
632#[derive(Debug, Clone, PartialEq, Eq, Hash)] 639#[derive(Debug, Clone, PartialEq, Eq, Hash)]
633pub struct InferType { 640pub struct EffectExpr {
634 pub(crate) syntax: SyntaxNode, 641 pub(crate) syntax: SyntaxNode,
635} 642}
636impl InferType { 643impl ast::AttrsOwner for EffectExpr {}
637 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 644impl EffectExpr {
645 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
646 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
647 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
648 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
649 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
638} 650}
639#[derive(Debug, Clone, PartialEq, Eq, Hash)] 651#[derive(Debug, Clone, PartialEq, Eq, Hash)]
640pub struct FnPointerType { 652pub struct FieldExpr {
641 pub(crate) syntax: SyntaxNode, 653 pub(crate) syntax: SyntaxNode,
642} 654}
643impl FnPointerType { 655impl ast::AttrsOwner for FieldExpr {}
644 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 656impl FieldExpr {
645 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 657 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
646 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 658 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
647 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 659 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
648 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
649 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
650 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
651} 660}
652#[derive(Debug, Clone, PartialEq, Eq, Hash)] 661#[derive(Debug, Clone, PartialEq, Eq, Hash)]
653pub struct ForType { 662pub struct ForExpr {
654 pub(crate) syntax: SyntaxNode, 663 pub(crate) syntax: SyntaxNode,
655} 664}
656impl ForType { 665impl ast::AttrsOwner for ForExpr {}
666impl ast::LoopBodyOwner for ForExpr {}
667impl ForExpr {
657 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 668 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
658 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } 669 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
659 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 670 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
671 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
660} 672}
661#[derive(Debug, Clone, PartialEq, Eq, Hash)] 673#[derive(Debug, Clone, PartialEq, Eq, Hash)]
662pub struct ImplTraitType { 674pub struct IfExpr {
663 pub(crate) syntax: SyntaxNode, 675 pub(crate) syntax: SyntaxNode,
664} 676}
665impl ImplTraitType { 677impl ast::AttrsOwner for IfExpr {}
666 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } 678impl IfExpr {
667 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } 679 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
680 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
681 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) }
668} 682}
669#[derive(Debug, Clone, PartialEq, Eq, Hash)] 683#[derive(Debug, Clone, PartialEq, Eq, Hash)]
670pub struct DynTraitType { 684pub struct IndexExpr {
671 pub(crate) syntax: SyntaxNode, 685 pub(crate) syntax: SyntaxNode,
672} 686}
673impl DynTraitType { 687impl ast::AttrsOwner for IndexExpr {}
674 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } 688impl IndexExpr {
675 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } 689 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
690 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
676} 691}
677#[derive(Debug, Clone, PartialEq, Eq, Hash)] 692#[derive(Debug, Clone, PartialEq, Eq, Hash)]
678pub struct TypeBound { 693pub struct Label {
679 pub(crate) syntax: SyntaxNode, 694 pub(crate) syntax: SyntaxNode,
680} 695}
681impl TypeBound { 696impl Label {
682 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 697 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
683 support::token(&self.syntax, T![lifetime]) 698 support::token(&self.syntax, T![lifetime])
684 } 699 }
685 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
686 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
687} 700}
688#[derive(Debug, Clone, PartialEq, Eq, Hash)] 701#[derive(Debug, Clone, PartialEq, Eq, Hash)]
689pub struct TupleExpr { 702pub struct ClosureExpr {
690 pub(crate) syntax: SyntaxNode, 703 pub(crate) syntax: SyntaxNode,
691} 704}
692impl ast::AttrsOwner for TupleExpr {} 705impl ast::AttrsOwner for ClosureExpr {}
693impl TupleExpr { 706impl ClosureExpr {
694 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 707 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
695 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 708 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
696 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 709 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
710 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
711 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
712 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
697} 713}
698#[derive(Debug, Clone, PartialEq, Eq, Hash)] 714#[derive(Debug, Clone, PartialEq, Eq, Hash)]
699pub struct ArrayExpr { 715pub struct LoopExpr {
700 pub(crate) syntax: SyntaxNode, 716 pub(crate) syntax: SyntaxNode,
701} 717}
702impl ast::AttrsOwner for ArrayExpr {} 718impl ast::AttrsOwner for LoopExpr {}
703impl ArrayExpr { 719impl ast::LoopBodyOwner for LoopExpr {}
704 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 720impl LoopExpr {
705 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 721 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
722}
723#[derive(Debug, Clone, PartialEq, Eq, Hash)]
724pub struct MatchExpr {
725 pub(crate) syntax: SyntaxNode,
726}
727impl ast::AttrsOwner for MatchExpr {}
728impl MatchExpr {
729 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
706 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 730 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
707 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 731 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
708 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 732}
733#[derive(Debug, Clone, PartialEq, Eq, Hash)]
734pub struct MethodCallExpr {
735 pub(crate) syntax: SyntaxNode,
736}
737impl ast::AttrsOwner for MethodCallExpr {}
738impl ast::ArgListOwner for MethodCallExpr {}
739impl MethodCallExpr {
740 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
741 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
742 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
743 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
709} 744}
710#[derive(Debug, Clone, PartialEq, Eq, Hash)] 745#[derive(Debug, Clone, PartialEq, Eq, Hash)]
711pub struct ParenExpr { 746pub struct ParenExpr {
@@ -721,82 +756,73 @@ impl ParenExpr {
721pub struct PathExpr { 756pub struct PathExpr {
722 pub(crate) syntax: SyntaxNode, 757 pub(crate) syntax: SyntaxNode,
723} 758}
759impl ast::AttrsOwner for PathExpr {}
724impl PathExpr { 760impl PathExpr {
725 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 761 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
726} 762}
727#[derive(Debug, Clone, PartialEq, Eq, Hash)] 763#[derive(Debug, Clone, PartialEq, Eq, Hash)]
728pub struct LambdaExpr { 764pub struct PrefixExpr {
729 pub(crate) syntax: SyntaxNode, 765 pub(crate) syntax: SyntaxNode,
730} 766}
731impl ast::AttrsOwner for LambdaExpr {} 767impl ast::AttrsOwner for PrefixExpr {}
732impl LambdaExpr { 768impl PrefixExpr {
733 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 769 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
734 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
735 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
736 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
737 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
738 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
739} 770}
740#[derive(Debug, Clone, PartialEq, Eq, Hash)] 771#[derive(Debug, Clone, PartialEq, Eq, Hash)]
741pub struct IfExpr { 772pub struct RangeExpr {
742 pub(crate) syntax: SyntaxNode, 773 pub(crate) syntax: SyntaxNode,
743} 774}
744impl ast::AttrsOwner for IfExpr {} 775impl ast::AttrsOwner for RangeExpr {}
745impl IfExpr { 776impl RangeExpr {}
746 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
747 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
748}
749#[derive(Debug, Clone, PartialEq, Eq, Hash)] 777#[derive(Debug, Clone, PartialEq, Eq, Hash)]
750pub struct Condition { 778pub struct RecordExpr {
751 pub(crate) syntax: SyntaxNode, 779 pub(crate) syntax: SyntaxNode,
752} 780}
753impl Condition { 781impl RecordExpr {
754 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 782 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
755 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 783 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> {
756 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 784 support::child(&self.syntax)
757 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 785 }
758} 786}
759#[derive(Debug, Clone, PartialEq, Eq, Hash)] 787#[derive(Debug, Clone, PartialEq, Eq, Hash)]
760pub struct EffectExpr { 788pub struct RefExpr {
761 pub(crate) syntax: SyntaxNode, 789 pub(crate) syntax: SyntaxNode,
762} 790}
763impl ast::AttrsOwner for EffectExpr {} 791impl ast::AttrsOwner for RefExpr {}
764impl EffectExpr { 792impl RefExpr {
765 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } 793 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
766 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } 794 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
767 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 795 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
768 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 796 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
769 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 797 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
770} 798}
771#[derive(Debug, Clone, PartialEq, Eq, Hash)] 799#[derive(Debug, Clone, PartialEq, Eq, Hash)]
772pub struct Label { 800pub struct ReturnExpr {
773 pub(crate) syntax: SyntaxNode, 801 pub(crate) syntax: SyntaxNode,
774} 802}
775impl Label { 803impl ast::AttrsOwner for ReturnExpr {}
776 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 804impl ReturnExpr {
777 support::token(&self.syntax, T![lifetime]) 805 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) }
778 } 806 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
779} 807}
780#[derive(Debug, Clone, PartialEq, Eq, Hash)] 808#[derive(Debug, Clone, PartialEq, Eq, Hash)]
781pub struct LoopExpr { 809pub struct TryExpr {
782 pub(crate) syntax: SyntaxNode, 810 pub(crate) syntax: SyntaxNode,
783} 811}
784impl ast::AttrsOwner for LoopExpr {} 812impl ast::AttrsOwner for TryExpr {}
785impl ast::LoopBodyOwner for LoopExpr {} 813impl TryExpr {
786impl LoopExpr { 814 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
787 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } 815 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
788} 816}
789#[derive(Debug, Clone, PartialEq, Eq, Hash)] 817#[derive(Debug, Clone, PartialEq, Eq, Hash)]
790pub struct ForExpr { 818pub struct TupleExpr {
791 pub(crate) syntax: SyntaxNode, 819 pub(crate) syntax: SyntaxNode,
792} 820}
793impl ast::AttrsOwner for ForExpr {} 821impl ast::AttrsOwner for TupleExpr {}
794impl ast::LoopBodyOwner for ForExpr {} 822impl TupleExpr {
795impl ForExpr { 823 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
796 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 824 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
797 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 825 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
798 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
799 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
800} 826}
801#[derive(Debug, Clone, PartialEq, Eq, Hash)] 827#[derive(Debug, Clone, PartialEq, Eq, Hash)]
802pub struct WhileExpr { 828pub struct WhileExpr {
@@ -809,46 +835,25 @@ impl WhileExpr {
809 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 835 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
810} 836}
811#[derive(Debug, Clone, PartialEq, Eq, Hash)] 837#[derive(Debug, Clone, PartialEq, Eq, Hash)]
812pub struct ContinueExpr { 838pub struct RecordExprFieldList {
813 pub(crate) syntax: SyntaxNode,
814}
815impl ast::AttrsOwner for ContinueExpr {}
816impl ContinueExpr {
817 pub fn continue_token(&self) -> Option<SyntaxToken> {
818 support::token(&self.syntax, T![continue])
819 }
820 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
821 support::token(&self.syntax, T![lifetime])
822 }
823}
824#[derive(Debug, Clone, PartialEq, Eq, Hash)]
825pub struct BreakExpr {
826 pub(crate) syntax: SyntaxNode,
827}
828impl ast::AttrsOwner for BreakExpr {}
829impl BreakExpr {
830 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
831 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
832 support::token(&self.syntax, T![lifetime])
833 }
834 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
835}
836#[derive(Debug, Clone, PartialEq, Eq, Hash)]
837pub struct ReturnExpr {
838 pub(crate) syntax: SyntaxNode, 839 pub(crate) syntax: SyntaxNode,
839} 840}
840impl ast::AttrsOwner for ReturnExpr {} 841impl ast::AttrsOwner for RecordExprFieldList {}
841impl ReturnExpr { 842impl RecordExprFieldList {
842 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } 843 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
843 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 844 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) }
845 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
846 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
847 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
844} 848}
845#[derive(Debug, Clone, PartialEq, Eq, Hash)] 849#[derive(Debug, Clone, PartialEq, Eq, Hash)]
846pub struct CallExpr { 850pub struct RecordExprField {
847 pub(crate) syntax: SyntaxNode, 851 pub(crate) syntax: SyntaxNode,
848} 852}
849impl ast::AttrsOwner for CallExpr {} 853impl ast::AttrsOwner for RecordExprField {}
850impl ast::ArgListOwner for CallExpr {} 854impl RecordExprField {
851impl CallExpr { 855 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
856 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
852 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 857 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
853} 858}
854#[derive(Debug, Clone, PartialEq, Eq, Hash)] 859#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -861,18 +866,6 @@ impl ArgList {
861 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 866 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
862} 867}
863#[derive(Debug, Clone, PartialEq, Eq, Hash)] 868#[derive(Debug, Clone, PartialEq, Eq, Hash)]
864pub struct MethodCallExpr {
865 pub(crate) syntax: SyntaxNode,
866}
867impl ast::AttrsOwner for MethodCallExpr {}
868impl ast::ArgListOwner for MethodCallExpr {}
869impl MethodCallExpr {
870 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
871 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
872 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
873 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
874}
875#[derive(Debug, Clone, PartialEq, Eq, Hash)]
876pub struct TypeArgList { 869pub struct TypeArgList {
877 pub(crate) syntax: SyntaxNode, 870 pub(crate) syntax: SyntaxNode,
878} 871}
@@ -886,162 +879,174 @@ impl TypeArgList {
886 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } 879 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
887} 880}
888#[derive(Debug, Clone, PartialEq, Eq, Hash)] 881#[derive(Debug, Clone, PartialEq, Eq, Hash)]
889pub struct FieldExpr { 882pub struct Condition {
890 pub(crate) syntax: SyntaxNode, 883 pub(crate) syntax: SyntaxNode,
891} 884}
892impl ast::AttrsOwner for FieldExpr {} 885impl Condition {
893impl FieldExpr { 886 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
887 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
888 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
894 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 889 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
895 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
896 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
897} 890}
898#[derive(Debug, Clone, PartialEq, Eq, Hash)] 891#[derive(Debug, Clone, PartialEq, Eq, Hash)]
899pub struct IndexExpr { 892pub struct MatchArmList {
900 pub(crate) syntax: SyntaxNode, 893 pub(crate) syntax: SyntaxNode,
901} 894}
902impl ast::AttrsOwner for IndexExpr {} 895impl ast::AttrsOwner for MatchArmList {}
903impl IndexExpr { 896impl MatchArmList {
904 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 897 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
905 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 898 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
899 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
906} 900}
907#[derive(Debug, Clone, PartialEq, Eq, Hash)] 901#[derive(Debug, Clone, PartialEq, Eq, Hash)]
908pub struct AwaitExpr { 902pub struct MatchArm {
909 pub(crate) syntax: SyntaxNode, 903 pub(crate) syntax: SyntaxNode,
910} 904}
911impl ast::AttrsOwner for AwaitExpr {} 905impl ast::AttrsOwner for MatchArm {}
912impl AwaitExpr { 906impl MatchArm {
907 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
908 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
909 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
913 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 910 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
914 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 911 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
915 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
916} 912}
917#[derive(Debug, Clone, PartialEq, Eq, Hash)] 913#[derive(Debug, Clone, PartialEq, Eq, Hash)]
918pub struct TryExpr { 914pub struct MatchGuard {
919 pub(crate) syntax: SyntaxNode, 915 pub(crate) syntax: SyntaxNode,
920} 916}
921impl ast::AttrsOwner for TryExpr {} 917impl MatchGuard {
922impl TryExpr { 918 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
923 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 919 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
924 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
925} 920}
926#[derive(Debug, Clone, PartialEq, Eq, Hash)] 921#[derive(Debug, Clone, PartialEq, Eq, Hash)]
927pub struct CastExpr { 922pub struct ArrayType {
928 pub(crate) syntax: SyntaxNode, 923 pub(crate) syntax: SyntaxNode,
929} 924}
930impl ast::AttrsOwner for CastExpr {} 925impl ArrayType {
931impl CastExpr { 926 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
932 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
933 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
934 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } 927 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
928 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
929 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
930 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
935} 931}
936#[derive(Debug, Clone, PartialEq, Eq, Hash)] 932#[derive(Debug, Clone, PartialEq, Eq, Hash)]
937pub struct RefExpr { 933pub struct DynTraitType {
938 pub(crate) syntax: SyntaxNode, 934 pub(crate) syntax: SyntaxNode,
939} 935}
940impl ast::AttrsOwner for RefExpr {} 936impl DynTraitType {
941impl RefExpr { 937 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
942 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 938 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
943 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
944 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
945 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
946 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
947} 939}
948#[derive(Debug, Clone, PartialEq, Eq, Hash)] 940#[derive(Debug, Clone, PartialEq, Eq, Hash)]
949pub struct PrefixExpr { 941pub struct FnPointerType {
950 pub(crate) syntax: SyntaxNode, 942 pub(crate) syntax: SyntaxNode,
951} 943}
952impl ast::AttrsOwner for PrefixExpr {} 944impl FnPointerType {
953impl PrefixExpr { 945 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
954 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 946 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
947 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
948 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
949 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
950 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
951 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
955} 952}
956#[derive(Debug, Clone, PartialEq, Eq, Hash)] 953#[derive(Debug, Clone, PartialEq, Eq, Hash)]
957pub struct BoxExpr { 954pub struct ForType {
958 pub(crate) syntax: SyntaxNode, 955 pub(crate) syntax: SyntaxNode,
959} 956}
960impl ast::AttrsOwner for BoxExpr {} 957impl ForType {
961impl BoxExpr { 958 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
962 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } 959 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
963 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 960 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
964} 961}
965#[derive(Debug, Clone, PartialEq, Eq, Hash)] 962#[derive(Debug, Clone, PartialEq, Eq, Hash)]
966pub struct RangeExpr { 963pub struct ImplTraitType {
967 pub(crate) syntax: SyntaxNode, 964 pub(crate) syntax: SyntaxNode,
968} 965}
969impl ast::AttrsOwner for RangeExpr {} 966impl ImplTraitType {
970impl RangeExpr {} 967 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
968 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
969}
971#[derive(Debug, Clone, PartialEq, Eq, Hash)] 970#[derive(Debug, Clone, PartialEq, Eq, Hash)]
972pub struct BinExpr { 971pub struct InferType {
973 pub(crate) syntax: SyntaxNode, 972 pub(crate) syntax: SyntaxNode,
974} 973}
975impl ast::AttrsOwner for BinExpr {} 974impl InferType {
976impl BinExpr {} 975 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
976}
977#[derive(Debug, Clone, PartialEq, Eq, Hash)] 977#[derive(Debug, Clone, PartialEq, Eq, Hash)]
978pub struct MatchExpr { 978pub struct NeverType {
979 pub(crate) syntax: SyntaxNode, 979 pub(crate) syntax: SyntaxNode,
980} 980}
981impl ast::AttrsOwner for MatchExpr {} 981impl NeverType {
982impl MatchExpr { 982 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
983 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
984 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
985 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
986} 983}
987#[derive(Debug, Clone, PartialEq, Eq, Hash)] 984#[derive(Debug, Clone, PartialEq, Eq, Hash)]
988pub struct MatchArmList { 985pub struct ParenType {
989 pub(crate) syntax: SyntaxNode, 986 pub(crate) syntax: SyntaxNode,
990} 987}
991impl MatchArmList { 988impl ParenType {
992 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 989 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
993 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } 990 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
994 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 991 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
995} 992}
996#[derive(Debug, Clone, PartialEq, Eq, Hash)] 993#[derive(Debug, Clone, PartialEq, Eq, Hash)]
997pub struct MatchArm { 994pub struct PathType {
998 pub(crate) syntax: SyntaxNode, 995 pub(crate) syntax: SyntaxNode,
999} 996}
1000impl ast::AttrsOwner for MatchArm {} 997impl PathType {
1001impl MatchArm { 998 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1002 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1003 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
1004 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
1005 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1006} 999}
1007#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1000#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1008pub struct MatchGuard { 1001pub struct PointerType {
1009 pub(crate) syntax: SyntaxNode, 1002 pub(crate) syntax: SyntaxNode,
1010} 1003}
1011impl MatchGuard { 1004impl PointerType {
1012 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } 1005 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
1013 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1006 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1007 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1008 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1014} 1009}
1015#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1010#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1016pub struct RecordExpr { 1011pub struct ReferenceType {
1017 pub(crate) syntax: SyntaxNode, 1012 pub(crate) syntax: SyntaxNode,
1018} 1013}
1019impl RecordExpr { 1014impl ReferenceType {
1020 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1015 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1021 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { 1016 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1022 support::child(&self.syntax) 1017 support::token(&self.syntax, T![lifetime])
1023 } 1018 }
1019 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1020 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1024} 1021}
1025#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1022#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1026pub struct RecordExprFieldList { 1023pub struct SliceType {
1027 pub(crate) syntax: SyntaxNode, 1024 pub(crate) syntax: SyntaxNode,
1028} 1025}
1029impl RecordExprFieldList { 1026impl SliceType {
1030 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 1027 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1031 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } 1028 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1032 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 1029 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1033 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1034 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1035} 1030}
1036#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1031#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1037pub struct RecordExprField { 1032pub struct TupleType {
1038 pub(crate) syntax: SyntaxNode, 1033 pub(crate) syntax: SyntaxNode,
1039} 1034}
1040impl ast::AttrsOwner for RecordExprField {} 1035impl TupleType {
1041impl RecordExprField { 1036 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1042 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1037 pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) }
1043 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 1038 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1044 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1039}
1040#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1041pub struct TypeBound {
1042 pub(crate) syntax: SyntaxNode,
1043}
1044impl TypeBound {
1045 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1046 support::token(&self.syntax, T![lifetime])
1047 }
1048 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1049 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1045} 1050}
1046#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1051#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1047pub struct OrPat { 1052pub struct OrPat {
@@ -1285,19 +1290,19 @@ pub enum Item {
1285impl ast::AttrsOwner for Item {} 1290impl ast::AttrsOwner for Item {}
1286#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1291#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1287pub enum Type { 1292pub enum Type {
1288 ParenType(ParenType),
1289 TupleType(TupleType),
1290 NeverType(NeverType),
1291 PathType(PathType),
1292 PointerType(PointerType),
1293 ArrayType(ArrayType), 1293 ArrayType(ArrayType),
1294 SliceType(SliceType), 1294 DynTraitType(DynTraitType),
1295 ReferenceType(ReferenceType),
1296 InferType(InferType),
1297 FnPointerType(FnPointerType), 1295 FnPointerType(FnPointerType),
1298 ForType(ForType), 1296 ForType(ForType),
1299 ImplTraitType(ImplTraitType), 1297 ImplTraitType(ImplTraitType),
1300 DynTraitType(DynTraitType), 1298 InferType(InferType),
1299 NeverType(NeverType),
1300 ParenType(ParenType),
1301 PathType(PathType),
1302 PointerType(PointerType),
1303 ReferenceType(ReferenceType),
1304 SliceType(SliceType),
1305 TupleType(TupleType),
1301} 1306}
1302#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1307#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1303pub enum Pat { 1308pub enum Pat {
@@ -1324,42 +1329,42 @@ pub enum FieldList {
1324} 1329}
1325#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1326pub enum Expr { 1331pub enum Expr {
1327 TupleExpr(TupleExpr),
1328 ArrayExpr(ArrayExpr), 1332 ArrayExpr(ArrayExpr),
1329 ParenExpr(ParenExpr), 1333 AwaitExpr(AwaitExpr),
1330 PathExpr(PathExpr), 1334 BinExpr(BinExpr),
1331 LambdaExpr(LambdaExpr),
1332 IfExpr(IfExpr),
1333 LoopExpr(LoopExpr),
1334 ForExpr(ForExpr),
1335 WhileExpr(WhileExpr),
1336 ContinueExpr(ContinueExpr),
1337 BreakExpr(BreakExpr),
1338 Label(Label),
1339 BlockExpr(BlockExpr), 1335 BlockExpr(BlockExpr),
1340 ReturnExpr(ReturnExpr), 1336 BoxExpr(BoxExpr),
1341 MatchExpr(MatchExpr), 1337 BreakExpr(BreakExpr),
1342 RecordExpr(RecordExpr),
1343 CallExpr(CallExpr), 1338 CallExpr(CallExpr),
1339 CastExpr(CastExpr),
1340 ContinueExpr(ContinueExpr),
1341 EffectExpr(EffectExpr),
1342 FieldExpr(FieldExpr),
1343 ForExpr(ForExpr),
1344 IfExpr(IfExpr),
1344 IndexExpr(IndexExpr), 1345 IndexExpr(IndexExpr),
1346 Label(Label),
1347 ClosureExpr(ClosureExpr),
1348 Literal(Literal),
1349 LoopExpr(LoopExpr),
1350 MacroCall(MacroCall),
1351 MatchExpr(MatchExpr),
1345 MethodCallExpr(MethodCallExpr), 1352 MethodCallExpr(MethodCallExpr),
1346 FieldExpr(FieldExpr), 1353 ParenExpr(ParenExpr),
1347 AwaitExpr(AwaitExpr), 1354 PathExpr(PathExpr),
1348 TryExpr(TryExpr),
1349 EffectExpr(EffectExpr),
1350 CastExpr(CastExpr),
1351 RefExpr(RefExpr),
1352 PrefixExpr(PrefixExpr), 1355 PrefixExpr(PrefixExpr),
1353 RangeExpr(RangeExpr), 1356 RangeExpr(RangeExpr),
1354 BinExpr(BinExpr), 1357 RecordExpr(RecordExpr),
1355 Literal(Literal), 1358 RefExpr(RefExpr),
1356 MacroCall(MacroCall), 1359 ReturnExpr(ReturnExpr),
1357 BoxExpr(BoxExpr), 1360 TryExpr(TryExpr),
1361 TupleExpr(TupleExpr),
1362 WhileExpr(WhileExpr),
1358} 1363}
1359#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1364#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1360pub enum AdtDef { 1365pub enum AdtDef {
1361 Struct(Struct),
1362 Enum(Enum), 1366 Enum(Enum),
1367 Struct(Struct),
1363 Union(Union), 1368 Union(Union),
1364} 1369}
1365impl ast::AttrsOwner for AdtDef {} 1370impl ast::AttrsOwner for AdtDef {}
@@ -1368,10 +1373,10 @@ impl ast::NameOwner for AdtDef {}
1368impl ast::VisibilityOwner for AdtDef {} 1373impl ast::VisibilityOwner for AdtDef {}
1369#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1374#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1370pub enum AssocItem { 1375pub enum AssocItem {
1371 Fn(Fn),
1372 TypeAlias(TypeAlias),
1373 Const(Const), 1376 Const(Const),
1377 Fn(Fn),
1374 MacroCall(MacroCall), 1378 MacroCall(MacroCall),
1379 TypeAlias(TypeAlias),
1375} 1380}
1376impl ast::AttrsOwner for AssocItem {} 1381impl ast::AttrsOwner for AssocItem {}
1377impl ast::NameOwner for AssocItem {} 1382impl ast::NameOwner for AssocItem {}
@@ -1385,16 +1390,16 @@ impl ast::AttrsOwner for ExternItem {}
1385impl ast::NameOwner for ExternItem {} 1390impl ast::NameOwner for ExternItem {}
1386#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1391#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1387pub enum GenericParam { 1392pub enum GenericParam {
1393 ConstParam(ConstParam),
1388 LifetimeParam(LifetimeParam), 1394 LifetimeParam(LifetimeParam),
1389 TypeParam(TypeParam), 1395 TypeParam(TypeParam),
1390 ConstParam(ConstParam),
1391} 1396}
1392impl ast::AttrsOwner for GenericParam {} 1397impl ast::AttrsOwner for GenericParam {}
1393#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1398#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1394pub enum Stmt { 1399pub enum Stmt {
1395 LetStmt(LetStmt),
1396 ExprStmt(ExprStmt), 1400 ExprStmt(ExprStmt),
1397 Item(Item), 1401 Item(Item),
1402 LetStmt(LetStmt),
1398} 1403}
1399impl AstNode for SourceFile { 1404impl AstNode for SourceFile {
1400 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } 1405 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
@@ -1847,8 +1852,8 @@ impl AstNode for ExternItemList {
1847 } 1852 }
1848 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1853 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1849} 1854}
1850impl AstNode for LifetimeParam { 1855impl AstNode for ConstParam {
1851 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } 1856 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
1852 fn cast(syntax: SyntaxNode) -> Option<Self> { 1857 fn cast(syntax: SyntaxNode) -> Option<Self> {
1853 if Self::can_cast(syntax.kind()) { 1858 if Self::can_cast(syntax.kind()) {
1854 Some(Self { syntax }) 1859 Some(Self { syntax })
@@ -1858,8 +1863,8 @@ impl AstNode for LifetimeParam {
1858 } 1863 }
1859 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1864 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1860} 1865}
1861impl AstNode for TypeParam { 1866impl AstNode for LifetimeParam {
1862 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } 1867 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
1863 fn cast(syntax: SyntaxNode) -> Option<Self> { 1868 fn cast(syntax: SyntaxNode) -> Option<Self> {
1864 if Self::can_cast(syntax.kind()) { 1869 if Self::can_cast(syntax.kind()) {
1865 Some(Self { syntax }) 1870 Some(Self { syntax })
@@ -1869,8 +1874,8 @@ impl AstNode for TypeParam {
1869 } 1874 }
1870 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1875 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1871} 1876}
1872impl AstNode for ConstParam { 1877impl AstNode for TypeParam {
1873 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } 1878 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
1874 fn cast(syntax: SyntaxNode) -> Option<Self> { 1879 fn cast(syntax: SyntaxNode) -> Option<Self> {
1875 if Self::can_cast(syntax.kind()) { 1880 if Self::can_cast(syntax.kind()) {
1876 Some(Self { syntax }) 1881 Some(Self { syntax })
@@ -1913,8 +1918,8 @@ impl AstNode for TokenTree {
1913 } 1918 }
1914 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1919 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1915} 1920}
1916impl AstNode for LetStmt { 1921impl AstNode for ExprStmt {
1917 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } 1922 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
1918 fn cast(syntax: SyntaxNode) -> Option<Self> { 1923 fn cast(syntax: SyntaxNode) -> Option<Self> {
1919 if Self::can_cast(syntax.kind()) { 1924 if Self::can_cast(syntax.kind()) {
1920 Some(Self { syntax }) 1925 Some(Self { syntax })
@@ -1924,8 +1929,8 @@ impl AstNode for LetStmt {
1924 } 1929 }
1925 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1930 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1926} 1931}
1927impl AstNode for ExprStmt { 1932impl AstNode for LetStmt {
1928 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } 1933 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
1929 fn cast(syntax: SyntaxNode) -> Option<Self> { 1934 fn cast(syntax: SyntaxNode) -> Option<Self> {
1930 if Self::can_cast(syntax.kind()) { 1935 if Self::can_cast(syntax.kind()) {
1931 Some(Self { syntax }) 1936 Some(Self { syntax })
@@ -1935,8 +1940,8 @@ impl AstNode for ExprStmt {
1935 } 1940 }
1936 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1941 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1937} 1942}
1938impl AstNode for ParenType { 1943impl AstNode for ArrayExpr {
1939 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } 1944 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
1940 fn cast(syntax: SyntaxNode) -> Option<Self> { 1945 fn cast(syntax: SyntaxNode) -> Option<Self> {
1941 if Self::can_cast(syntax.kind()) { 1946 if Self::can_cast(syntax.kind()) {
1942 Some(Self { syntax }) 1947 Some(Self { syntax })
@@ -1946,8 +1951,8 @@ impl AstNode for ParenType {
1946 } 1951 }
1947 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1952 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1948} 1953}
1949impl AstNode for TupleType { 1954impl AstNode for AwaitExpr {
1950 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } 1955 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
1951 fn cast(syntax: SyntaxNode) -> Option<Self> { 1956 fn cast(syntax: SyntaxNode) -> Option<Self> {
1952 if Self::can_cast(syntax.kind()) { 1957 if Self::can_cast(syntax.kind()) {
1953 Some(Self { syntax }) 1958 Some(Self { syntax })
@@ -1957,8 +1962,8 @@ impl AstNode for TupleType {
1957 } 1962 }
1958 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1963 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1959} 1964}
1960impl AstNode for NeverType { 1965impl AstNode for BinExpr {
1961 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } 1966 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
1962 fn cast(syntax: SyntaxNode) -> Option<Self> { 1967 fn cast(syntax: SyntaxNode) -> Option<Self> {
1963 if Self::can_cast(syntax.kind()) { 1968 if Self::can_cast(syntax.kind()) {
1964 Some(Self { syntax }) 1969 Some(Self { syntax })
@@ -1968,8 +1973,8 @@ impl AstNode for NeverType {
1968 } 1973 }
1969 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1974 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1970} 1975}
1971impl AstNode for PathType { 1976impl AstNode for BoxExpr {
1972 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } 1977 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
1973 fn cast(syntax: SyntaxNode) -> Option<Self> { 1978 fn cast(syntax: SyntaxNode) -> Option<Self> {
1974 if Self::can_cast(syntax.kind()) { 1979 if Self::can_cast(syntax.kind()) {
1975 Some(Self { syntax }) 1980 Some(Self { syntax })
@@ -1979,8 +1984,8 @@ impl AstNode for PathType {
1979 } 1984 }
1980 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1985 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1981} 1986}
1982impl AstNode for PointerType { 1987impl AstNode for BreakExpr {
1983 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } 1988 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
1984 fn cast(syntax: SyntaxNode) -> Option<Self> { 1989 fn cast(syntax: SyntaxNode) -> Option<Self> {
1985 if Self::can_cast(syntax.kind()) { 1990 if Self::can_cast(syntax.kind()) {
1986 Some(Self { syntax }) 1991 Some(Self { syntax })
@@ -1990,8 +1995,8 @@ impl AstNode for PointerType {
1990 } 1995 }
1991 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1996 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1992} 1997}
1993impl AstNode for ArrayType { 1998impl AstNode for CallExpr {
1994 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } 1999 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
1995 fn cast(syntax: SyntaxNode) -> Option<Self> { 2000 fn cast(syntax: SyntaxNode) -> Option<Self> {
1996 if Self::can_cast(syntax.kind()) { 2001 if Self::can_cast(syntax.kind()) {
1997 Some(Self { syntax }) 2002 Some(Self { syntax })
@@ -2001,8 +2006,8 @@ impl AstNode for ArrayType {
2001 } 2006 }
2002 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2007 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2003} 2008}
2004impl AstNode for SliceType { 2009impl AstNode for CastExpr {
2005 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } 2010 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
2006 fn cast(syntax: SyntaxNode) -> Option<Self> { 2011 fn cast(syntax: SyntaxNode) -> Option<Self> {
2007 if Self::can_cast(syntax.kind()) { 2012 if Self::can_cast(syntax.kind()) {
2008 Some(Self { syntax }) 2013 Some(Self { syntax })
@@ -2012,8 +2017,8 @@ impl AstNode for SliceType {
2012 } 2017 }
2013 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2018 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2014} 2019}
2015impl AstNode for ReferenceType { 2020impl AstNode for ContinueExpr {
2016 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } 2021 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
2017 fn cast(syntax: SyntaxNode) -> Option<Self> { 2022 fn cast(syntax: SyntaxNode) -> Option<Self> {
2018 if Self::can_cast(syntax.kind()) { 2023 if Self::can_cast(syntax.kind()) {
2019 Some(Self { syntax }) 2024 Some(Self { syntax })
@@ -2023,8 +2028,8 @@ impl AstNode for ReferenceType {
2023 } 2028 }
2024 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2029 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2025} 2030}
2026impl AstNode for InferType { 2031impl AstNode for EffectExpr {
2027 fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } 2032 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
2028 fn cast(syntax: SyntaxNode) -> Option<Self> { 2033 fn cast(syntax: SyntaxNode) -> Option<Self> {
2029 if Self::can_cast(syntax.kind()) { 2034 if Self::can_cast(syntax.kind()) {
2030 Some(Self { syntax }) 2035 Some(Self { syntax })
@@ -2034,8 +2039,8 @@ impl AstNode for InferType {
2034 } 2039 }
2035 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2040 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2036} 2041}
2037impl AstNode for FnPointerType { 2042impl AstNode for FieldExpr {
2038 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } 2043 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
2039 fn cast(syntax: SyntaxNode) -> Option<Self> { 2044 fn cast(syntax: SyntaxNode) -> Option<Self> {
2040 if Self::can_cast(syntax.kind()) { 2045 if Self::can_cast(syntax.kind()) {
2041 Some(Self { syntax }) 2046 Some(Self { syntax })
@@ -2045,8 +2050,8 @@ impl AstNode for FnPointerType {
2045 } 2050 }
2046 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2051 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2047} 2052}
2048impl AstNode for ForType { 2053impl AstNode for ForExpr {
2049 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } 2054 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
2050 fn cast(syntax: SyntaxNode) -> Option<Self> { 2055 fn cast(syntax: SyntaxNode) -> Option<Self> {
2051 if Self::can_cast(syntax.kind()) { 2056 if Self::can_cast(syntax.kind()) {
2052 Some(Self { syntax }) 2057 Some(Self { syntax })
@@ -2056,8 +2061,8 @@ impl AstNode for ForType {
2056 } 2061 }
2057 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2062 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2058} 2063}
2059impl AstNode for ImplTraitType { 2064impl AstNode for IfExpr {
2060 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } 2065 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
2061 fn cast(syntax: SyntaxNode) -> Option<Self> { 2066 fn cast(syntax: SyntaxNode) -> Option<Self> {
2062 if Self::can_cast(syntax.kind()) { 2067 if Self::can_cast(syntax.kind()) {
2063 Some(Self { syntax }) 2068 Some(Self { syntax })
@@ -2067,8 +2072,8 @@ impl AstNode for ImplTraitType {
2067 } 2072 }
2068 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2073 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2069} 2074}
2070impl AstNode for DynTraitType { 2075impl AstNode for IndexExpr {
2071 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } 2076 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
2072 fn cast(syntax: SyntaxNode) -> Option<Self> { 2077 fn cast(syntax: SyntaxNode) -> Option<Self> {
2073 if Self::can_cast(syntax.kind()) { 2078 if Self::can_cast(syntax.kind()) {
2074 Some(Self { syntax }) 2079 Some(Self { syntax })
@@ -2078,8 +2083,8 @@ impl AstNode for DynTraitType {
2078 } 2083 }
2079 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2084 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2080} 2085}
2081impl AstNode for TypeBound { 2086impl AstNode for Label {
2082 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } 2087 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
2083 fn cast(syntax: SyntaxNode) -> Option<Self> { 2088 fn cast(syntax: SyntaxNode) -> Option<Self> {
2084 if Self::can_cast(syntax.kind()) { 2089 if Self::can_cast(syntax.kind()) {
2085 Some(Self { syntax }) 2090 Some(Self { syntax })
@@ -2089,8 +2094,8 @@ impl AstNode for TypeBound {
2089 } 2094 }
2090 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2095 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2091} 2096}
2092impl AstNode for TupleExpr { 2097impl AstNode for ClosureExpr {
2093 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } 2098 fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR }
2094 fn cast(syntax: SyntaxNode) -> Option<Self> { 2099 fn cast(syntax: SyntaxNode) -> Option<Self> {
2095 if Self::can_cast(syntax.kind()) { 2100 if Self::can_cast(syntax.kind()) {
2096 Some(Self { syntax }) 2101 Some(Self { syntax })
@@ -2100,8 +2105,8 @@ impl AstNode for TupleExpr {
2100 } 2105 }
2101 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2106 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2102} 2107}
2103impl AstNode for ArrayExpr { 2108impl AstNode for LoopExpr {
2104 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } 2109 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
2105 fn cast(syntax: SyntaxNode) -> Option<Self> { 2110 fn cast(syntax: SyntaxNode) -> Option<Self> {
2106 if Self::can_cast(syntax.kind()) { 2111 if Self::can_cast(syntax.kind()) {
2107 Some(Self { syntax }) 2112 Some(Self { syntax })
@@ -2111,8 +2116,8 @@ impl AstNode for ArrayExpr {
2111 } 2116 }
2112 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2117 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2113} 2118}
2114impl AstNode for ParenExpr { 2119impl AstNode for MatchExpr {
2115 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } 2120 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
2116 fn cast(syntax: SyntaxNode) -> Option<Self> { 2121 fn cast(syntax: SyntaxNode) -> Option<Self> {
2117 if Self::can_cast(syntax.kind()) { 2122 if Self::can_cast(syntax.kind()) {
2118 Some(Self { syntax }) 2123 Some(Self { syntax })
@@ -2122,8 +2127,8 @@ impl AstNode for ParenExpr {
2122 } 2127 }
2123 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2128 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2124} 2129}
2125impl AstNode for PathExpr { 2130impl AstNode for MethodCallExpr {
2126 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } 2131 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
2127 fn cast(syntax: SyntaxNode) -> Option<Self> { 2132 fn cast(syntax: SyntaxNode) -> Option<Self> {
2128 if Self::can_cast(syntax.kind()) { 2133 if Self::can_cast(syntax.kind()) {
2129 Some(Self { syntax }) 2134 Some(Self { syntax })
@@ -2133,8 +2138,8 @@ impl AstNode for PathExpr {
2133 } 2138 }
2134 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2139 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2135} 2140}
2136impl AstNode for LambdaExpr { 2141impl AstNode for ParenExpr {
2137 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } 2142 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
2138 fn cast(syntax: SyntaxNode) -> Option<Self> { 2143 fn cast(syntax: SyntaxNode) -> Option<Self> {
2139 if Self::can_cast(syntax.kind()) { 2144 if Self::can_cast(syntax.kind()) {
2140 Some(Self { syntax }) 2145 Some(Self { syntax })
@@ -2144,8 +2149,8 @@ impl AstNode for LambdaExpr {
2144 } 2149 }
2145 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2150 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2146} 2151}
2147impl AstNode for IfExpr { 2152impl AstNode for PathExpr {
2148 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } 2153 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
2149 fn cast(syntax: SyntaxNode) -> Option<Self> { 2154 fn cast(syntax: SyntaxNode) -> Option<Self> {
2150 if Self::can_cast(syntax.kind()) { 2155 if Self::can_cast(syntax.kind()) {
2151 Some(Self { syntax }) 2156 Some(Self { syntax })
@@ -2155,8 +2160,8 @@ impl AstNode for IfExpr {
2155 } 2160 }
2156 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2161 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2157} 2162}
2158impl AstNode for Condition { 2163impl AstNode for PrefixExpr {
2159 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } 2164 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
2160 fn cast(syntax: SyntaxNode) -> Option<Self> { 2165 fn cast(syntax: SyntaxNode) -> Option<Self> {
2161 if Self::can_cast(syntax.kind()) { 2166 if Self::can_cast(syntax.kind()) {
2162 Some(Self { syntax }) 2167 Some(Self { syntax })
@@ -2166,8 +2171,8 @@ impl AstNode for Condition {
2166 } 2171 }
2167 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2172 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2168} 2173}
2169impl AstNode for EffectExpr { 2174impl AstNode for RangeExpr {
2170 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } 2175 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
2171 fn cast(syntax: SyntaxNode) -> Option<Self> { 2176 fn cast(syntax: SyntaxNode) -> Option<Self> {
2172 if Self::can_cast(syntax.kind()) { 2177 if Self::can_cast(syntax.kind()) {
2173 Some(Self { syntax }) 2178 Some(Self { syntax })
@@ -2177,8 +2182,8 @@ impl AstNode for EffectExpr {
2177 } 2182 }
2178 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2183 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2179} 2184}
2180impl AstNode for Label { 2185impl AstNode for RecordExpr {
2181 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } 2186 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR }
2182 fn cast(syntax: SyntaxNode) -> Option<Self> { 2187 fn cast(syntax: SyntaxNode) -> Option<Self> {
2183 if Self::can_cast(syntax.kind()) { 2188 if Self::can_cast(syntax.kind()) {
2184 Some(Self { syntax }) 2189 Some(Self { syntax })
@@ -2188,8 +2193,8 @@ impl AstNode for Label {
2188 } 2193 }
2189 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2194 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2190} 2195}
2191impl AstNode for LoopExpr { 2196impl AstNode for RefExpr {
2192 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } 2197 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
2193 fn cast(syntax: SyntaxNode) -> Option<Self> { 2198 fn cast(syntax: SyntaxNode) -> Option<Self> {
2194 if Self::can_cast(syntax.kind()) { 2199 if Self::can_cast(syntax.kind()) {
2195 Some(Self { syntax }) 2200 Some(Self { syntax })
@@ -2199,8 +2204,8 @@ impl AstNode for LoopExpr {
2199 } 2204 }
2200 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2205 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2201} 2206}
2202impl AstNode for ForExpr { 2207impl AstNode for ReturnExpr {
2203 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } 2208 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
2204 fn cast(syntax: SyntaxNode) -> Option<Self> { 2209 fn cast(syntax: SyntaxNode) -> Option<Self> {
2205 if Self::can_cast(syntax.kind()) { 2210 if Self::can_cast(syntax.kind()) {
2206 Some(Self { syntax }) 2211 Some(Self { syntax })
@@ -2210,8 +2215,8 @@ impl AstNode for ForExpr {
2210 } 2215 }
2211 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2216 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2212} 2217}
2213impl AstNode for WhileExpr { 2218impl AstNode for TryExpr {
2214 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } 2219 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
2215 fn cast(syntax: SyntaxNode) -> Option<Self> { 2220 fn cast(syntax: SyntaxNode) -> Option<Self> {
2216 if Self::can_cast(syntax.kind()) { 2221 if Self::can_cast(syntax.kind()) {
2217 Some(Self { syntax }) 2222 Some(Self { syntax })
@@ -2221,8 +2226,8 @@ impl AstNode for WhileExpr {
2221 } 2226 }
2222 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2227 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2223} 2228}
2224impl AstNode for ContinueExpr { 2229impl AstNode for TupleExpr {
2225 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } 2230 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
2226 fn cast(syntax: SyntaxNode) -> Option<Self> { 2231 fn cast(syntax: SyntaxNode) -> Option<Self> {
2227 if Self::can_cast(syntax.kind()) { 2232 if Self::can_cast(syntax.kind()) {
2228 Some(Self { syntax }) 2233 Some(Self { syntax })
@@ -2232,8 +2237,8 @@ impl AstNode for ContinueExpr {
2232 } 2237 }
2233 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2238 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2234} 2239}
2235impl AstNode for BreakExpr { 2240impl AstNode for WhileExpr {
2236 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } 2241 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
2237 fn cast(syntax: SyntaxNode) -> Option<Self> { 2242 fn cast(syntax: SyntaxNode) -> Option<Self> {
2238 if Self::can_cast(syntax.kind()) { 2243 if Self::can_cast(syntax.kind()) {
2239 Some(Self { syntax }) 2244 Some(Self { syntax })
@@ -2243,8 +2248,8 @@ impl AstNode for BreakExpr {
2243 } 2248 }
2244 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2249 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2245} 2250}
2246impl AstNode for ReturnExpr { 2251impl AstNode for RecordExprFieldList {
2247 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } 2252 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST }
2248 fn cast(syntax: SyntaxNode) -> Option<Self> { 2253 fn cast(syntax: SyntaxNode) -> Option<Self> {
2249 if Self::can_cast(syntax.kind()) { 2254 if Self::can_cast(syntax.kind()) {
2250 Some(Self { syntax }) 2255 Some(Self { syntax })
@@ -2254,8 +2259,8 @@ impl AstNode for ReturnExpr {
2254 } 2259 }
2255 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2260 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2256} 2261}
2257impl AstNode for CallExpr { 2262impl AstNode for RecordExprField {
2258 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } 2263 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD }
2259 fn cast(syntax: SyntaxNode) -> Option<Self> { 2264 fn cast(syntax: SyntaxNode) -> Option<Self> {
2260 if Self::can_cast(syntax.kind()) { 2265 if Self::can_cast(syntax.kind()) {
2261 Some(Self { syntax }) 2266 Some(Self { syntax })
@@ -2276,8 +2281,8 @@ impl AstNode for ArgList {
2276 } 2281 }
2277 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2282 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2278} 2283}
2279impl AstNode for MethodCallExpr { 2284impl AstNode for TypeArgList {
2280 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } 2285 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST }
2281 fn cast(syntax: SyntaxNode) -> Option<Self> { 2286 fn cast(syntax: SyntaxNode) -> Option<Self> {
2282 if Self::can_cast(syntax.kind()) { 2287 if Self::can_cast(syntax.kind()) {
2283 Some(Self { syntax }) 2288 Some(Self { syntax })
@@ -2287,8 +2292,8 @@ impl AstNode for MethodCallExpr {
2287 } 2292 }
2288 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2293 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2289} 2294}
2290impl AstNode for TypeArgList { 2295impl AstNode for Condition {
2291 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } 2296 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
2292 fn cast(syntax: SyntaxNode) -> Option<Self> { 2297 fn cast(syntax: SyntaxNode) -> Option<Self> {
2293 if Self::can_cast(syntax.kind()) { 2298 if Self::can_cast(syntax.kind()) {
2294 Some(Self { syntax }) 2299 Some(Self { syntax })
@@ -2298,8 +2303,8 @@ impl AstNode for TypeArgList {
2298 } 2303 }
2299 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2304 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2300} 2305}
2301impl AstNode for FieldExpr { 2306impl AstNode for MatchArmList {
2302 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } 2307 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
2303 fn cast(syntax: SyntaxNode) -> Option<Self> { 2308 fn cast(syntax: SyntaxNode) -> Option<Self> {
2304 if Self::can_cast(syntax.kind()) { 2309 if Self::can_cast(syntax.kind()) {
2305 Some(Self { syntax }) 2310 Some(Self { syntax })
@@ -2309,8 +2314,8 @@ impl AstNode for FieldExpr {
2309 } 2314 }
2310 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2315 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2311} 2316}
2312impl AstNode for IndexExpr { 2317impl AstNode for MatchArm {
2313 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } 2318 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
2314 fn cast(syntax: SyntaxNode) -> Option<Self> { 2319 fn cast(syntax: SyntaxNode) -> Option<Self> {
2315 if Self::can_cast(syntax.kind()) { 2320 if Self::can_cast(syntax.kind()) {
2316 Some(Self { syntax }) 2321 Some(Self { syntax })
@@ -2320,8 +2325,8 @@ impl AstNode for IndexExpr {
2320 } 2325 }
2321 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2326 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2322} 2327}
2323impl AstNode for AwaitExpr { 2328impl AstNode for MatchGuard {
2324 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } 2329 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
2325 fn cast(syntax: SyntaxNode) -> Option<Self> { 2330 fn cast(syntax: SyntaxNode) -> Option<Self> {
2326 if Self::can_cast(syntax.kind()) { 2331 if Self::can_cast(syntax.kind()) {
2327 Some(Self { syntax }) 2332 Some(Self { syntax })
@@ -2331,8 +2336,8 @@ impl AstNode for AwaitExpr {
2331 } 2336 }
2332 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2337 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2333} 2338}
2334impl AstNode for TryExpr { 2339impl AstNode for ArrayType {
2335 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } 2340 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
2336 fn cast(syntax: SyntaxNode) -> Option<Self> { 2341 fn cast(syntax: SyntaxNode) -> Option<Self> {
2337 if Self::can_cast(syntax.kind()) { 2342 if Self::can_cast(syntax.kind()) {
2338 Some(Self { syntax }) 2343 Some(Self { syntax })
@@ -2342,8 +2347,8 @@ impl AstNode for TryExpr {
2342 } 2347 }
2343 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2348 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2344} 2349}
2345impl AstNode for CastExpr { 2350impl AstNode for DynTraitType {
2346 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } 2351 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
2347 fn cast(syntax: SyntaxNode) -> Option<Self> { 2352 fn cast(syntax: SyntaxNode) -> Option<Self> {
2348 if Self::can_cast(syntax.kind()) { 2353 if Self::can_cast(syntax.kind()) {
2349 Some(Self { syntax }) 2354 Some(Self { syntax })
@@ -2353,8 +2358,8 @@ impl AstNode for CastExpr {
2353 } 2358 }
2354 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2359 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2355} 2360}
2356impl AstNode for RefExpr { 2361impl AstNode for FnPointerType {
2357 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } 2362 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE }
2358 fn cast(syntax: SyntaxNode) -> Option<Self> { 2363 fn cast(syntax: SyntaxNode) -> Option<Self> {
2359 if Self::can_cast(syntax.kind()) { 2364 if Self::can_cast(syntax.kind()) {
2360 Some(Self { syntax }) 2365 Some(Self { syntax })
@@ -2364,8 +2369,8 @@ impl AstNode for RefExpr {
2364 } 2369 }
2365 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2370 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2366} 2371}
2367impl AstNode for PrefixExpr { 2372impl AstNode for ForType {
2368 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } 2373 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
2369 fn cast(syntax: SyntaxNode) -> Option<Self> { 2374 fn cast(syntax: SyntaxNode) -> Option<Self> {
2370 if Self::can_cast(syntax.kind()) { 2375 if Self::can_cast(syntax.kind()) {
2371 Some(Self { syntax }) 2376 Some(Self { syntax })
@@ -2375,8 +2380,8 @@ impl AstNode for PrefixExpr {
2375 } 2380 }
2376 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2381 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2377} 2382}
2378impl AstNode for BoxExpr { 2383impl AstNode for ImplTraitType {
2379 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } 2384 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
2380 fn cast(syntax: SyntaxNode) -> Option<Self> { 2385 fn cast(syntax: SyntaxNode) -> Option<Self> {
2381 if Self::can_cast(syntax.kind()) { 2386 if Self::can_cast(syntax.kind()) {
2382 Some(Self { syntax }) 2387 Some(Self { syntax })
@@ -2386,8 +2391,8 @@ impl AstNode for BoxExpr {
2386 } 2391 }
2387 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2392 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2388} 2393}
2389impl AstNode for RangeExpr { 2394impl AstNode for InferType {
2390 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } 2395 fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE }
2391 fn cast(syntax: SyntaxNode) -> Option<Self> { 2396 fn cast(syntax: SyntaxNode) -> Option<Self> {
2392 if Self::can_cast(syntax.kind()) { 2397 if Self::can_cast(syntax.kind()) {
2393 Some(Self { syntax }) 2398 Some(Self { syntax })
@@ -2397,8 +2402,8 @@ impl AstNode for RangeExpr {
2397 } 2402 }
2398 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2403 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2399} 2404}
2400impl AstNode for BinExpr { 2405impl AstNode for NeverType {
2401 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } 2406 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
2402 fn cast(syntax: SyntaxNode) -> Option<Self> { 2407 fn cast(syntax: SyntaxNode) -> Option<Self> {
2403 if Self::can_cast(syntax.kind()) { 2408 if Self::can_cast(syntax.kind()) {
2404 Some(Self { syntax }) 2409 Some(Self { syntax })
@@ -2408,8 +2413,8 @@ impl AstNode for BinExpr {
2408 } 2413 }
2409 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2414 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2410} 2415}
2411impl AstNode for MatchExpr { 2416impl AstNode for ParenType {
2412 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } 2417 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
2413 fn cast(syntax: SyntaxNode) -> Option<Self> { 2418 fn cast(syntax: SyntaxNode) -> Option<Self> {
2414 if Self::can_cast(syntax.kind()) { 2419 if Self::can_cast(syntax.kind()) {
2415 Some(Self { syntax }) 2420 Some(Self { syntax })
@@ -2419,8 +2424,8 @@ impl AstNode for MatchExpr {
2419 } 2424 }
2420 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2425 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2421} 2426}
2422impl AstNode for MatchArmList { 2427impl AstNode for PathType {
2423 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } 2428 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
2424 fn cast(syntax: SyntaxNode) -> Option<Self> { 2429 fn cast(syntax: SyntaxNode) -> Option<Self> {
2425 if Self::can_cast(syntax.kind()) { 2430 if Self::can_cast(syntax.kind()) {
2426 Some(Self { syntax }) 2431 Some(Self { syntax })
@@ -2430,8 +2435,8 @@ impl AstNode for MatchArmList {
2430 } 2435 }
2431 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2436 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2432} 2437}
2433impl AstNode for MatchArm { 2438impl AstNode for PointerType {
2434 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } 2439 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE }
2435 fn cast(syntax: SyntaxNode) -> Option<Self> { 2440 fn cast(syntax: SyntaxNode) -> Option<Self> {
2436 if Self::can_cast(syntax.kind()) { 2441 if Self::can_cast(syntax.kind()) {
2437 Some(Self { syntax }) 2442 Some(Self { syntax })
@@ -2441,8 +2446,8 @@ impl AstNode for MatchArm {
2441 } 2446 }
2442 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2447 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2443} 2448}
2444impl AstNode for MatchGuard { 2449impl AstNode for ReferenceType {
2445 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } 2450 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE }
2446 fn cast(syntax: SyntaxNode) -> Option<Self> { 2451 fn cast(syntax: SyntaxNode) -> Option<Self> {
2447 if Self::can_cast(syntax.kind()) { 2452 if Self::can_cast(syntax.kind()) {
2448 Some(Self { syntax }) 2453 Some(Self { syntax })
@@ -2452,8 +2457,8 @@ impl AstNode for MatchGuard {
2452 } 2457 }
2453 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2458 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2454} 2459}
2455impl AstNode for RecordExpr { 2460impl AstNode for SliceType {
2456 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } 2461 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
2457 fn cast(syntax: SyntaxNode) -> Option<Self> { 2462 fn cast(syntax: SyntaxNode) -> Option<Self> {
2458 if Self::can_cast(syntax.kind()) { 2463 if Self::can_cast(syntax.kind()) {
2459 Some(Self { syntax }) 2464 Some(Self { syntax })
@@ -2463,8 +2468,8 @@ impl AstNode for RecordExpr {
2463 } 2468 }
2464 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2469 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2465} 2470}
2466impl AstNode for RecordExprFieldList { 2471impl AstNode for TupleType {
2467 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } 2472 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
2468 fn cast(syntax: SyntaxNode) -> Option<Self> { 2473 fn cast(syntax: SyntaxNode) -> Option<Self> {
2469 if Self::can_cast(syntax.kind()) { 2474 if Self::can_cast(syntax.kind()) {
2470 Some(Self { syntax }) 2475 Some(Self { syntax })
@@ -2474,8 +2479,8 @@ impl AstNode for RecordExprFieldList {
2474 } 2479 }
2475 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2480 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2476} 2481}
2477impl AstNode for RecordExprField { 2482impl AstNode for TypeBound {
2478 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } 2483 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
2479 fn cast(syntax: SyntaxNode) -> Option<Self> { 2484 fn cast(syntax: SyntaxNode) -> Option<Self> {
2480 if Self::can_cast(syntax.kind()) { 2485 if Self::can_cast(syntax.kind()) {
2481 Some(Self { syntax }) 2486 Some(Self { syntax })
@@ -2849,88 +2854,88 @@ impl AstNode for Item {
2849 } 2854 }
2850 } 2855 }
2851} 2856}
2852impl From<ParenType> for Type { 2857impl From<ArrayType> for Type {
2853 fn from(node: ParenType) -> Type { Type::ParenType(node) } 2858 fn from(node: ArrayType) -> Type { Type::ArrayType(node) }
2854} 2859}
2855impl From<TupleType> for Type { 2860impl From<DynTraitType> for Type {
2856 fn from(node: TupleType) -> Type { Type::TupleType(node) } 2861 fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) }
2862}
2863impl From<FnPointerType> for Type {
2864 fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) }
2865}
2866impl From<ForType> for Type {
2867 fn from(node: ForType) -> Type { Type::ForType(node) }
2868}
2869impl From<ImplTraitType> for Type {
2870 fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) }
2871}
2872impl From<InferType> for Type {
2873 fn from(node: InferType) -> Type { Type::InferType(node) }
2857} 2874}
2858impl From<NeverType> for Type { 2875impl From<NeverType> for Type {
2859 fn from(node: NeverType) -> Type { Type::NeverType(node) } 2876 fn from(node: NeverType) -> Type { Type::NeverType(node) }
2860} 2877}
2878impl From<ParenType> for Type {
2879 fn from(node: ParenType) -> Type { Type::ParenType(node) }
2880}
2861impl From<PathType> for Type { 2881impl From<PathType> for Type {
2862 fn from(node: PathType) -> Type { Type::PathType(node) } 2882 fn from(node: PathType) -> Type { Type::PathType(node) }
2863} 2883}
2864impl From<PointerType> for Type { 2884impl From<PointerType> for Type {
2865 fn from(node: PointerType) -> Type { Type::PointerType(node) } 2885 fn from(node: PointerType) -> Type { Type::PointerType(node) }
2866} 2886}
2867impl From<ArrayType> for Type {
2868 fn from(node: ArrayType) -> Type { Type::ArrayType(node) }
2869}
2870impl From<SliceType> for Type {
2871 fn from(node: SliceType) -> Type { Type::SliceType(node) }
2872}
2873impl From<ReferenceType> for Type { 2887impl From<ReferenceType> for Type {
2874 fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } 2888 fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) }
2875} 2889}
2876impl From<InferType> for Type { 2890impl From<SliceType> for Type {
2877 fn from(node: InferType) -> Type { Type::InferType(node) } 2891 fn from(node: SliceType) -> Type { Type::SliceType(node) }
2878}
2879impl From<FnPointerType> for Type {
2880 fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) }
2881}
2882impl From<ForType> for Type {
2883 fn from(node: ForType) -> Type { Type::ForType(node) }
2884}
2885impl From<ImplTraitType> for Type {
2886 fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) }
2887} 2892}
2888impl From<DynTraitType> for Type { 2893impl From<TupleType> for Type {
2889 fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } 2894 fn from(node: TupleType) -> Type { Type::TupleType(node) }
2890} 2895}
2891impl AstNode for Type { 2896impl AstNode for Type {
2892 fn can_cast(kind: SyntaxKind) -> bool { 2897 fn can_cast(kind: SyntaxKind) -> bool {
2893 match kind { 2898 match kind {
2894 PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE 2899 ARRAY_TYPE | DYN_TRAIT_TYPE | FN_POINTER_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE
2895 | SLICE_TYPE | REFERENCE_TYPE | INFER_TYPE | FN_POINTER_TYPE | FOR_TYPE 2900 | INFER_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | POINTER_TYPE | REFERENCE_TYPE
2896 | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true, 2901 | SLICE_TYPE | TUPLE_TYPE => true,
2897 _ => false, 2902 _ => false,
2898 } 2903 }
2899 } 2904 }
2900 fn cast(syntax: SyntaxNode) -> Option<Self> { 2905 fn cast(syntax: SyntaxNode) -> Option<Self> {
2901 let res = match syntax.kind() { 2906 let res = match syntax.kind() {
2902 PAREN_TYPE => Type::ParenType(ParenType { syntax }),
2903 TUPLE_TYPE => Type::TupleType(TupleType { syntax }),
2904 NEVER_TYPE => Type::NeverType(NeverType { syntax }),
2905 PATH_TYPE => Type::PathType(PathType { syntax }),
2906 POINTER_TYPE => Type::PointerType(PointerType { syntax }),
2907 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), 2907 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }),
2908 SLICE_TYPE => Type::SliceType(SliceType { syntax }), 2908 DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }),
2909 REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }),
2910 INFER_TYPE => Type::InferType(InferType { syntax }),
2911 FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), 2909 FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }),
2912 FOR_TYPE => Type::ForType(ForType { syntax }), 2910 FOR_TYPE => Type::ForType(ForType { syntax }),
2913 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), 2911 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }),
2914 DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), 2912 INFER_TYPE => Type::InferType(InferType { syntax }),
2913 NEVER_TYPE => Type::NeverType(NeverType { syntax }),
2914 PAREN_TYPE => Type::ParenType(ParenType { syntax }),
2915 PATH_TYPE => Type::PathType(PathType { syntax }),
2916 POINTER_TYPE => Type::PointerType(PointerType { syntax }),
2917 REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }),
2918 SLICE_TYPE => Type::SliceType(SliceType { syntax }),
2919 TUPLE_TYPE => Type::TupleType(TupleType { syntax }),
2915 _ => return None, 2920 _ => return None,
2916 }; 2921 };
2917 Some(res) 2922 Some(res)
2918 } 2923 }
2919 fn syntax(&self) -> &SyntaxNode { 2924 fn syntax(&self) -> &SyntaxNode {
2920 match self { 2925 match self {
2921 Type::ParenType(it) => &it.syntax,
2922 Type::TupleType(it) => &it.syntax,
2923 Type::NeverType(it) => &it.syntax,
2924 Type::PathType(it) => &it.syntax,
2925 Type::PointerType(it) => &it.syntax,
2926 Type::ArrayType(it) => &it.syntax, 2926 Type::ArrayType(it) => &it.syntax,
2927 Type::SliceType(it) => &it.syntax, 2927 Type::DynTraitType(it) => &it.syntax,
2928 Type::ReferenceType(it) => &it.syntax,
2929 Type::InferType(it) => &it.syntax,
2930 Type::FnPointerType(it) => &it.syntax, 2928 Type::FnPointerType(it) => &it.syntax,
2931 Type::ForType(it) => &it.syntax, 2929 Type::ForType(it) => &it.syntax,
2932 Type::ImplTraitType(it) => &it.syntax, 2930 Type::ImplTraitType(it) => &it.syntax,
2933 Type::DynTraitType(it) => &it.syntax, 2931 Type::InferType(it) => &it.syntax,
2932 Type::NeverType(it) => &it.syntax,
2933 Type::ParenType(it) => &it.syntax,
2934 Type::PathType(it) => &it.syntax,
2935 Type::PointerType(it) => &it.syntax,
2936 Type::ReferenceType(it) => &it.syntax,
2937 Type::SliceType(it) => &it.syntax,
2938 Type::TupleType(it) => &it.syntax,
2934 } 2939 }
2935 } 2940 }
2936} 2941}
@@ -3057,80 +3062,74 @@ impl AstNode for FieldList {
3057 } 3062 }
3058 } 3063 }
3059} 3064}
3060impl From<TupleExpr> for Expr {
3061 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
3062}
3063impl From<ArrayExpr> for Expr { 3065impl From<ArrayExpr> for Expr {
3064 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } 3066 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
3065} 3067}
3066impl From<ParenExpr> for Expr { 3068impl From<AwaitExpr> for Expr {
3067 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) } 3069 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
3068} 3070}
3069impl From<PathExpr> for Expr { 3071impl From<BinExpr> for Expr {
3070 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) } 3072 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) }
3071} 3073}
3072impl From<LambdaExpr> for Expr { 3074impl From<BlockExpr> for Expr {
3073 fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) } 3075 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
3074} 3076}
3075impl From<IfExpr> for Expr { 3077impl From<BoxExpr> for Expr {
3076 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) } 3078 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) }
3077} 3079}
3078impl From<LoopExpr> for Expr { 3080impl From<BreakExpr> for Expr {
3079 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) } 3081 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) }
3080} 3082}
3081impl From<ForExpr> for Expr { 3083impl From<CallExpr> for Expr {
3082 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) } 3084 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
3083} 3085}
3084impl From<WhileExpr> for Expr { 3086impl From<CastExpr> for Expr {
3085 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } 3087 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
3086} 3088}
3087impl From<ContinueExpr> for Expr { 3089impl From<ContinueExpr> for Expr {
3088 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } 3090 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
3089} 3091}
3090impl From<BreakExpr> for Expr { 3092impl From<EffectExpr> for Expr {
3091 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) } 3093 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
3092}
3093impl From<Label> for Expr {
3094 fn from(node: Label) -> Expr { Expr::Label(node) }
3095}
3096impl From<BlockExpr> for Expr {
3097 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
3098}
3099impl From<ReturnExpr> for Expr {
3100 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
3101} 3094}
3102impl From<MatchExpr> for Expr { 3095impl From<FieldExpr> for Expr {
3103 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } 3096 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) }
3104} 3097}
3105impl From<RecordExpr> for Expr { 3098impl From<ForExpr> for Expr {
3106 fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } 3099 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) }
3107} 3100}
3108impl From<CallExpr> for Expr { 3101impl From<IfExpr> for Expr {
3109 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } 3102 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
3110} 3103}
3111impl From<IndexExpr> for Expr { 3104impl From<IndexExpr> for Expr {
3112 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } 3105 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
3113} 3106}
3114impl From<MethodCallExpr> for Expr { 3107impl From<Label> for Expr {
3115 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) } 3108 fn from(node: Label) -> Expr { Expr::Label(node) }
3116} 3109}
3117impl From<FieldExpr> for Expr { 3110impl From<ClosureExpr> for Expr {
3118 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) } 3111 fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) }
3119} 3112}
3120impl From<AwaitExpr> for Expr { 3113impl From<Literal> for Expr {
3121 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) } 3114 fn from(node: Literal) -> Expr { Expr::Literal(node) }
3122} 3115}
3123impl From<TryExpr> for Expr { 3116impl From<LoopExpr> for Expr {
3124 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } 3117 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) }
3125} 3118}
3126impl From<EffectExpr> for Expr { 3119impl From<MacroCall> for Expr {
3127 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } 3120 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) }
3128} 3121}
3129impl From<CastExpr> for Expr { 3122impl From<MatchExpr> for Expr {
3130 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } 3123 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) }
3131} 3124}
3132impl From<RefExpr> for Expr { 3125impl From<MethodCallExpr> for Expr {
3133 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) } 3126 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) }
3127}
3128impl From<ParenExpr> for Expr {
3129 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) }
3130}
3131impl From<PathExpr> for Expr {
3132 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) }
3134} 3133}
3135impl From<PrefixExpr> for Expr { 3134impl From<PrefixExpr> for Expr {
3136 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) } 3135 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) }
@@ -3138,124 +3137,128 @@ impl From<PrefixExpr> for Expr {
3138impl From<RangeExpr> for Expr { 3137impl From<RangeExpr> for Expr {
3139 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) } 3138 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) }
3140} 3139}
3141impl From<BinExpr> for Expr { 3140impl From<RecordExpr> for Expr {
3142 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } 3141 fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) }
3143} 3142}
3144impl From<Literal> for Expr { 3143impl From<RefExpr> for Expr {
3145 fn from(node: Literal) -> Expr { Expr::Literal(node) } 3144 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) }
3146} 3145}
3147impl From<MacroCall> for Expr { 3146impl From<ReturnExpr> for Expr {
3148 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) } 3147 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
3149} 3148}
3150impl From<BoxExpr> for Expr { 3149impl From<TryExpr> for Expr {
3151 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) } 3150 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
3151}
3152impl From<TupleExpr> for Expr {
3153 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
3154}
3155impl From<WhileExpr> for Expr {
3156 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) }
3152} 3157}
3153impl AstNode for Expr { 3158impl AstNode for Expr {
3154 fn can_cast(kind: SyntaxKind) -> bool { 3159 fn can_cast(kind: SyntaxKind) -> bool {
3155 match kind { 3160 match kind {
3156 TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR 3161 ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR
3157 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL 3162 | CAST_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | IF_EXPR
3158 | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_EXPR | CALL_EXPR | INDEX_EXPR 3163 | INDEX_EXPR | LABEL | CLOSURE_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR
3159 | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR 3164 | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR
3160 | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { 3165 | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true,
3161 true
3162 }
3163 _ => false, 3166 _ => false,
3164 } 3167 }
3165 } 3168 }
3166 fn cast(syntax: SyntaxNode) -> Option<Self> { 3169 fn cast(syntax: SyntaxNode) -> Option<Self> {
3167 let res = match syntax.kind() { 3170 let res = match syntax.kind() {
3168 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
3169 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), 3171 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
3170 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }), 3172 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
3171 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }), 3173 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
3172 LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }),
3173 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
3174 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
3175 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
3176 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
3177 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
3178 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
3179 LABEL => Expr::Label(Label { syntax }),
3180 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), 3174 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
3181 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), 3175 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
3182 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), 3176 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
3183 RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }),
3184 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), 3177 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
3178 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
3179 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
3180 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
3181 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
3182 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
3183 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
3185 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), 3184 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
3185 LABEL => Expr::Label(Label { syntax }),
3186 CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }),
3187 LITERAL => Expr::Literal(Literal { syntax }),
3188 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
3189 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
3190 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
3186 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), 3191 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
3187 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), 3192 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
3188 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), 3193 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
3189 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
3190 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
3191 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
3192 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
3193 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), 3194 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
3194 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }), 3195 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
3195 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), 3196 RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }),
3196 LITERAL => Expr::Literal(Literal { syntax }), 3197 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
3197 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), 3198 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
3198 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }), 3199 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
3200 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
3201 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
3199 _ => return None, 3202 _ => return None,
3200 }; 3203 };
3201 Some(res) 3204 Some(res)
3202 } 3205 }
3203 fn syntax(&self) -> &SyntaxNode { 3206 fn syntax(&self) -> &SyntaxNode {
3204 match self { 3207 match self {
3205 Expr::TupleExpr(it) => &it.syntax,
3206 Expr::ArrayExpr(it) => &it.syntax, 3208 Expr::ArrayExpr(it) => &it.syntax,
3207 Expr::ParenExpr(it) => &it.syntax, 3209 Expr::AwaitExpr(it) => &it.syntax,
3208 Expr::PathExpr(it) => &it.syntax, 3210 Expr::BinExpr(it) => &it.syntax,
3209 Expr::LambdaExpr(it) => &it.syntax,
3210 Expr::IfExpr(it) => &it.syntax,
3211 Expr::LoopExpr(it) => &it.syntax,
3212 Expr::ForExpr(it) => &it.syntax,
3213 Expr::WhileExpr(it) => &it.syntax,
3214 Expr::ContinueExpr(it) => &it.syntax,
3215 Expr::BreakExpr(it) => &it.syntax,
3216 Expr::Label(it) => &it.syntax,
3217 Expr::BlockExpr(it) => &it.syntax, 3211 Expr::BlockExpr(it) => &it.syntax,
3218 Expr::ReturnExpr(it) => &it.syntax, 3212 Expr::BoxExpr(it) => &it.syntax,
3219 Expr::MatchExpr(it) => &it.syntax, 3213 Expr::BreakExpr(it) => &it.syntax,
3220 Expr::RecordExpr(it) => &it.syntax,
3221 Expr::CallExpr(it) => &it.syntax, 3214 Expr::CallExpr(it) => &it.syntax,
3215 Expr::CastExpr(it) => &it.syntax,
3216 Expr::ContinueExpr(it) => &it.syntax,
3217 Expr::EffectExpr(it) => &it.syntax,
3218 Expr::FieldExpr(it) => &it.syntax,
3219 Expr::ForExpr(it) => &it.syntax,
3220 Expr::IfExpr(it) => &it.syntax,
3222 Expr::IndexExpr(it) => &it.syntax, 3221 Expr::IndexExpr(it) => &it.syntax,
3222 Expr::Label(it) => &it.syntax,
3223 Expr::ClosureExpr(it) => &it.syntax,
3224 Expr::Literal(it) => &it.syntax,
3225 Expr::LoopExpr(it) => &it.syntax,
3226 Expr::MacroCall(it) => &it.syntax,
3227 Expr::MatchExpr(it) => &it.syntax,
3223 Expr::MethodCallExpr(it) => &it.syntax, 3228 Expr::MethodCallExpr(it) => &it.syntax,
3224 Expr::FieldExpr(it) => &it.syntax, 3229 Expr::ParenExpr(it) => &it.syntax,
3225 Expr::AwaitExpr(it) => &it.syntax, 3230 Expr::PathExpr(it) => &it.syntax,
3226 Expr::TryExpr(it) => &it.syntax,
3227 Expr::EffectExpr(it) => &it.syntax,
3228 Expr::CastExpr(it) => &it.syntax,
3229 Expr::RefExpr(it) => &it.syntax,
3230 Expr::PrefixExpr(it) => &it.syntax, 3231 Expr::PrefixExpr(it) => &it.syntax,
3231 Expr::RangeExpr(it) => &it.syntax, 3232 Expr::RangeExpr(it) => &it.syntax,
3232 Expr::BinExpr(it) => &it.syntax, 3233 Expr::RecordExpr(it) => &it.syntax,
3233 Expr::Literal(it) => &it.syntax, 3234 Expr::RefExpr(it) => &it.syntax,
3234 Expr::MacroCall(it) => &it.syntax, 3235 Expr::ReturnExpr(it) => &it.syntax,
3235 Expr::BoxExpr(it) => &it.syntax, 3236 Expr::TryExpr(it) => &it.syntax,
3237 Expr::TupleExpr(it) => &it.syntax,
3238 Expr::WhileExpr(it) => &it.syntax,
3236 } 3239 }
3237 } 3240 }
3238} 3241}
3239impl From<Struct> for AdtDef {
3240 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
3241}
3242impl From<Enum> for AdtDef { 3242impl From<Enum> for AdtDef {
3243 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } 3243 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) }
3244} 3244}
3245impl From<Struct> for AdtDef {
3246 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
3247}
3245impl From<Union> for AdtDef { 3248impl From<Union> for AdtDef {
3246 fn from(node: Union) -> AdtDef { AdtDef::Union(node) } 3249 fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
3247} 3250}
3248impl AstNode for AdtDef { 3251impl AstNode for AdtDef {
3249 fn can_cast(kind: SyntaxKind) -> bool { 3252 fn can_cast(kind: SyntaxKind) -> bool {
3250 match kind { 3253 match kind {
3251 STRUCT | ENUM | UNION => true, 3254 ENUM | STRUCT | UNION => true,
3252 _ => false, 3255 _ => false,
3253 } 3256 }
3254 } 3257 }
3255 fn cast(syntax: SyntaxNode) -> Option<Self> { 3258 fn cast(syntax: SyntaxNode) -> Option<Self> {
3256 let res = match syntax.kind() { 3259 let res = match syntax.kind() {
3257 STRUCT => AdtDef::Struct(Struct { syntax }),
3258 ENUM => AdtDef::Enum(Enum { syntax }), 3260 ENUM => AdtDef::Enum(Enum { syntax }),
3261 STRUCT => AdtDef::Struct(Struct { syntax }),
3259 UNION => AdtDef::Union(Union { syntax }), 3262 UNION => AdtDef::Union(Union { syntax }),
3260 _ => return None, 3263 _ => return None,
3261 }; 3264 };
@@ -3263,47 +3266,47 @@ impl AstNode for AdtDef {
3263 } 3266 }
3264 fn syntax(&self) -> &SyntaxNode { 3267 fn syntax(&self) -> &SyntaxNode {
3265 match self { 3268 match self {
3266 AdtDef::Struct(it) => &it.syntax,
3267 AdtDef::Enum(it) => &it.syntax, 3269 AdtDef::Enum(it) => &it.syntax,
3270 AdtDef::Struct(it) => &it.syntax,
3268 AdtDef::Union(it) => &it.syntax, 3271 AdtDef::Union(it) => &it.syntax,
3269 } 3272 }
3270 } 3273 }
3271} 3274}
3272impl From<Fn> for AssocItem {
3273 fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
3274}
3275impl From<TypeAlias> for AssocItem {
3276 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
3277}
3278impl From<Const> for AssocItem { 3275impl From<Const> for AssocItem {
3279 fn from(node: Const) -> AssocItem { AssocItem::Const(node) } 3276 fn from(node: Const) -> AssocItem { AssocItem::Const(node) }
3280} 3277}
3278impl From<Fn> for AssocItem {
3279 fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
3280}
3281impl From<MacroCall> for AssocItem { 3281impl From<MacroCall> for AssocItem {
3282 fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } 3282 fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) }
3283} 3283}
3284impl From<TypeAlias> for AssocItem {
3285 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
3286}
3284impl AstNode for AssocItem { 3287impl AstNode for AssocItem {
3285 fn can_cast(kind: SyntaxKind) -> bool { 3288 fn can_cast(kind: SyntaxKind) -> bool {
3286 match kind { 3289 match kind {
3287 FN | TYPE_ALIAS | CONST | MACRO_CALL => true, 3290 CONST | FN | MACRO_CALL | TYPE_ALIAS => true,
3288 _ => false, 3291 _ => false,
3289 } 3292 }
3290 } 3293 }
3291 fn cast(syntax: SyntaxNode) -> Option<Self> { 3294 fn cast(syntax: SyntaxNode) -> Option<Self> {
3292 let res = match syntax.kind() { 3295 let res = match syntax.kind() {
3293 FN => AssocItem::Fn(Fn { syntax }),
3294 TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
3295 CONST => AssocItem::Const(Const { syntax }), 3296 CONST => AssocItem::Const(Const { syntax }),
3297 FN => AssocItem::Fn(Fn { syntax }),
3296 MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), 3298 MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
3299 TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
3297 _ => return None, 3300 _ => return None,
3298 }; 3301 };
3299 Some(res) 3302 Some(res)
3300 } 3303 }
3301 fn syntax(&self) -> &SyntaxNode { 3304 fn syntax(&self) -> &SyntaxNode {
3302 match self { 3305 match self {
3303 AssocItem::Fn(it) => &it.syntax,
3304 AssocItem::TypeAlias(it) => &it.syntax,
3305 AssocItem::Const(it) => &it.syntax, 3306 AssocItem::Const(it) => &it.syntax,
3307 AssocItem::Fn(it) => &it.syntax,
3306 AssocItem::MacroCall(it) => &it.syntax, 3308 AssocItem::MacroCall(it) => &it.syntax,
3309 AssocItem::TypeAlias(it) => &it.syntax,
3307 } 3310 }
3308 } 3311 }
3309} 3312}
@@ -3340,48 +3343,48 @@ impl AstNode for ExternItem {
3340 } 3343 }
3341 } 3344 }
3342} 3345}
3346impl From<ConstParam> for GenericParam {
3347 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
3348}
3343impl From<LifetimeParam> for GenericParam { 3349impl From<LifetimeParam> for GenericParam {
3344 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } 3350 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
3345} 3351}
3346impl From<TypeParam> for GenericParam { 3352impl From<TypeParam> for GenericParam {
3347 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } 3353 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
3348} 3354}
3349impl From<ConstParam> for GenericParam {
3350 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
3351}
3352impl AstNode for GenericParam { 3355impl AstNode for GenericParam {
3353 fn can_cast(kind: SyntaxKind) -> bool { 3356 fn can_cast(kind: SyntaxKind) -> bool {
3354 match kind { 3357 match kind {
3355 LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true, 3358 CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM => true,
3356 _ => false, 3359 _ => false,
3357 } 3360 }
3358 } 3361 }
3359 fn cast(syntax: SyntaxNode) -> Option<Self> { 3362 fn cast(syntax: SyntaxNode) -> Option<Self> {
3360 let res = match syntax.kind() { 3363 let res = match syntax.kind() {
3364 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
3361 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), 3365 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
3362 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), 3366 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
3363 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
3364 _ => return None, 3367 _ => return None,
3365 }; 3368 };
3366 Some(res) 3369 Some(res)
3367 } 3370 }
3368 fn syntax(&self) -> &SyntaxNode { 3371 fn syntax(&self) -> &SyntaxNode {
3369 match self { 3372 match self {
3373 GenericParam::ConstParam(it) => &it.syntax,
3370 GenericParam::LifetimeParam(it) => &it.syntax, 3374 GenericParam::LifetimeParam(it) => &it.syntax,
3371 GenericParam::TypeParam(it) => &it.syntax, 3375 GenericParam::TypeParam(it) => &it.syntax,
3372 GenericParam::ConstParam(it) => &it.syntax,
3373 } 3376 }
3374 } 3377 }
3375} 3378}
3376impl From<LetStmt> for Stmt {
3377 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3378}
3379impl From<ExprStmt> for Stmt { 3379impl From<ExprStmt> for Stmt {
3380 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } 3380 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
3381} 3381}
3382impl From<Item> for Stmt { 3382impl From<Item> for Stmt {
3383 fn from(node: Item) -> Stmt { Stmt::Item(node) } 3383 fn from(node: Item) -> Stmt { Stmt::Item(node) }
3384} 3384}
3385impl From<LetStmt> for Stmt {
3386 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3387}
3385impl std::fmt::Display for Item { 3388impl std::fmt::Display for Item {
3386 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3389 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3387 std::fmt::Display::fmt(self.syntax(), f) 3390 std::fmt::Display::fmt(self.syntax(), f)
@@ -3637,17 +3640,17 @@ impl std::fmt::Display for ExternItemList {
3637 std::fmt::Display::fmt(self.syntax(), f) 3640 std::fmt::Display::fmt(self.syntax(), f)
3638 } 3641 }
3639} 3642}
3640impl std::fmt::Display for LifetimeParam { 3643impl std::fmt::Display for ConstParam {
3641 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3642 std::fmt::Display::fmt(self.syntax(), f) 3645 std::fmt::Display::fmt(self.syntax(), f)
3643 } 3646 }
3644} 3647}
3645impl std::fmt::Display for TypeParam { 3648impl std::fmt::Display for LifetimeParam {
3646 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3647 std::fmt::Display::fmt(self.syntax(), f) 3650 std::fmt::Display::fmt(self.syntax(), f)
3648 } 3651 }
3649} 3652}
3650impl std::fmt::Display for ConstParam { 3653impl std::fmt::Display for TypeParam {
3651 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3654 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3652 std::fmt::Display::fmt(self.syntax(), f) 3655 std::fmt::Display::fmt(self.syntax(), f)
3653 } 3656 }
@@ -3667,162 +3670,162 @@ impl std::fmt::Display for TokenTree {
3667 std::fmt::Display::fmt(self.syntax(), f) 3670 std::fmt::Display::fmt(self.syntax(), f)
3668 } 3671 }
3669} 3672}
3670impl std::fmt::Display for LetStmt { 3673impl std::fmt::Display for ExprStmt {
3671 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3674 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3672 std::fmt::Display::fmt(self.syntax(), f) 3675 std::fmt::Display::fmt(self.syntax(), f)
3673 } 3676 }
3674} 3677}
3675impl std::fmt::Display for ExprStmt { 3678impl std::fmt::Display for LetStmt {
3676 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3679 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3677 std::fmt::Display::fmt(self.syntax(), f) 3680 std::fmt::Display::fmt(self.syntax(), f)
3678 } 3681 }
3679} 3682}
3680impl std::fmt::Display for ParenType { 3683impl std::fmt::Display for ArrayExpr {
3681 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3684 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3682 std::fmt::Display::fmt(self.syntax(), f) 3685 std::fmt::Display::fmt(self.syntax(), f)
3683 } 3686 }
3684} 3687}
3685impl std::fmt::Display for TupleType { 3688impl std::fmt::Display for AwaitExpr {
3686 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3689 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3687 std::fmt::Display::fmt(self.syntax(), f) 3690 std::fmt::Display::fmt(self.syntax(), f)
3688 } 3691 }
3689} 3692}
3690impl std::fmt::Display for NeverType { 3693impl std::fmt::Display for BinExpr {
3691 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3694 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3692 std::fmt::Display::fmt(self.syntax(), f) 3695 std::fmt::Display::fmt(self.syntax(), f)
3693 } 3696 }
3694} 3697}
3695impl std::fmt::Display for PathType { 3698impl std::fmt::Display for BoxExpr {
3696 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3699 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3697 std::fmt::Display::fmt(self.syntax(), f) 3700 std::fmt::Display::fmt(self.syntax(), f)
3698 } 3701 }
3699} 3702}
3700impl std::fmt::Display for PointerType { 3703impl std::fmt::Display for BreakExpr {
3701 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3704 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3702 std::fmt::Display::fmt(self.syntax(), f) 3705 std::fmt::Display::fmt(self.syntax(), f)
3703 } 3706 }
3704} 3707}
3705impl std::fmt::Display for ArrayType { 3708impl std::fmt::Display for CallExpr {
3706 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3709 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3707 std::fmt::Display::fmt(self.syntax(), f) 3710 std::fmt::Display::fmt(self.syntax(), f)
3708 } 3711 }
3709} 3712}
3710impl std::fmt::Display for SliceType { 3713impl std::fmt::Display for CastExpr {
3711 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3712 std::fmt::Display::fmt(self.syntax(), f) 3715 std::fmt::Display::fmt(self.syntax(), f)
3713 } 3716 }
3714} 3717}
3715impl std::fmt::Display for ReferenceType { 3718impl std::fmt::Display for ContinueExpr {
3716 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3719 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3717 std::fmt::Display::fmt(self.syntax(), f) 3720 std::fmt::Display::fmt(self.syntax(), f)
3718 } 3721 }
3719} 3722}
3720impl std::fmt::Display for InferType { 3723impl std::fmt::Display for EffectExpr {
3721 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3724 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3722 std::fmt::Display::fmt(self.syntax(), f) 3725 std::fmt::Display::fmt(self.syntax(), f)
3723 } 3726 }
3724} 3727}
3725impl std::fmt::Display for FnPointerType { 3728impl std::fmt::Display for FieldExpr {
3726 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3729 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3727 std::fmt::Display::fmt(self.syntax(), f) 3730 std::fmt::Display::fmt(self.syntax(), f)
3728 } 3731 }
3729} 3732}
3730impl std::fmt::Display for ForType { 3733impl std::fmt::Display for ForExpr {
3731 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3734 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3732 std::fmt::Display::fmt(self.syntax(), f) 3735 std::fmt::Display::fmt(self.syntax(), f)
3733 } 3736 }
3734} 3737}
3735impl std::fmt::Display for ImplTraitType { 3738impl std::fmt::Display for IfExpr {
3736 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3739 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3737 std::fmt::Display::fmt(self.syntax(), f) 3740 std::fmt::Display::fmt(self.syntax(), f)
3738 } 3741 }
3739} 3742}
3740impl std::fmt::Display for DynTraitType { 3743impl std::fmt::Display for IndexExpr {
3741 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3744 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3742 std::fmt::Display::fmt(self.syntax(), f) 3745 std::fmt::Display::fmt(self.syntax(), f)
3743 } 3746 }
3744} 3747}
3745impl std::fmt::Display for TypeBound { 3748impl std::fmt::Display for Label {
3746 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3749 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3747 std::fmt::Display::fmt(self.syntax(), f) 3750 std::fmt::Display::fmt(self.syntax(), f)
3748 } 3751 }
3749} 3752}
3750impl std::fmt::Display for TupleExpr { 3753impl std::fmt::Display for ClosureExpr {
3751 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3754 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3752 std::fmt::Display::fmt(self.syntax(), f) 3755 std::fmt::Display::fmt(self.syntax(), f)
3753 } 3756 }
3754} 3757}
3755impl std::fmt::Display for ArrayExpr { 3758impl std::fmt::Display for LoopExpr {
3756 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3759 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3757 std::fmt::Display::fmt(self.syntax(), f) 3760 std::fmt::Display::fmt(self.syntax(), f)
3758 } 3761 }
3759} 3762}
3760impl std::fmt::Display for ParenExpr { 3763impl std::fmt::Display for MatchExpr {
3761 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3764 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3762 std::fmt::Display::fmt(self.syntax(), f) 3765 std::fmt::Display::fmt(self.syntax(), f)
3763 } 3766 }
3764} 3767}
3765impl std::fmt::Display for PathExpr { 3768impl std::fmt::Display for MethodCallExpr {
3766 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3769 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3767 std::fmt::Display::fmt(self.syntax(), f) 3770 std::fmt::Display::fmt(self.syntax(), f)
3768 } 3771 }
3769} 3772}
3770impl std::fmt::Display for LambdaExpr { 3773impl std::fmt::Display for ParenExpr {
3771 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3774 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3772 std::fmt::Display::fmt(self.syntax(), f) 3775 std::fmt::Display::fmt(self.syntax(), f)
3773 } 3776 }
3774} 3777}
3775impl std::fmt::Display for IfExpr { 3778impl std::fmt::Display for PathExpr {
3776 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3779 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3777 std::fmt::Display::fmt(self.syntax(), f) 3780 std::fmt::Display::fmt(self.syntax(), f)
3778 } 3781 }
3779} 3782}
3780impl std::fmt::Display for Condition { 3783impl std::fmt::Display for PrefixExpr {
3781 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3784 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3782 std::fmt::Display::fmt(self.syntax(), f) 3785 std::fmt::Display::fmt(self.syntax(), f)
3783 } 3786 }
3784} 3787}
3785impl std::fmt::Display for EffectExpr { 3788impl std::fmt::Display for RangeExpr {
3786 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3789 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3787 std::fmt::Display::fmt(self.syntax(), f) 3790 std::fmt::Display::fmt(self.syntax(), f)
3788 } 3791 }
3789} 3792}
3790impl std::fmt::Display for Label { 3793impl std::fmt::Display for RecordExpr {
3791 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3794 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3792 std::fmt::Display::fmt(self.syntax(), f) 3795 std::fmt::Display::fmt(self.syntax(), f)
3793 } 3796 }
3794} 3797}
3795impl std::fmt::Display for LoopExpr { 3798impl std::fmt::Display for RefExpr {
3796 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3799 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3797 std::fmt::Display::fmt(self.syntax(), f) 3800 std::fmt::Display::fmt(self.syntax(), f)
3798 } 3801 }
3799} 3802}
3800impl std::fmt::Display for ForExpr { 3803impl std::fmt::Display for ReturnExpr {
3801 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3804 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3802 std::fmt::Display::fmt(self.syntax(), f) 3805 std::fmt::Display::fmt(self.syntax(), f)
3803 } 3806 }
3804} 3807}
3805impl std::fmt::Display for WhileExpr { 3808impl std::fmt::Display for TryExpr {
3806 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3809 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3807 std::fmt::Display::fmt(self.syntax(), f) 3810 std::fmt::Display::fmt(self.syntax(), f)
3808 } 3811 }
3809} 3812}
3810impl std::fmt::Display for ContinueExpr { 3813impl std::fmt::Display for TupleExpr {
3811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3814 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3812 std::fmt::Display::fmt(self.syntax(), f) 3815 std::fmt::Display::fmt(self.syntax(), f)
3813 } 3816 }
3814} 3817}
3815impl std::fmt::Display for BreakExpr { 3818impl std::fmt::Display for WhileExpr {
3816 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3819 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3817 std::fmt::Display::fmt(self.syntax(), f) 3820 std::fmt::Display::fmt(self.syntax(), f)
3818 } 3821 }
3819} 3822}
3820impl std::fmt::Display for ReturnExpr { 3823impl std::fmt::Display for RecordExprFieldList {
3821 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3824 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3822 std::fmt::Display::fmt(self.syntax(), f) 3825 std::fmt::Display::fmt(self.syntax(), f)
3823 } 3826 }
3824} 3827}
3825impl std::fmt::Display for CallExpr { 3828impl std::fmt::Display for RecordExprField {
3826 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3829 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3827 std::fmt::Display::fmt(self.syntax(), f) 3830 std::fmt::Display::fmt(self.syntax(), f)
3828 } 3831 }
@@ -3832,97 +3835,97 @@ impl std::fmt::Display for ArgList {
3832 std::fmt::Display::fmt(self.syntax(), f) 3835 std::fmt::Display::fmt(self.syntax(), f)
3833 } 3836 }
3834} 3837}
3835impl std::fmt::Display for MethodCallExpr { 3838impl std::fmt::Display for TypeArgList {
3836 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3839 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3837 std::fmt::Display::fmt(self.syntax(), f) 3840 std::fmt::Display::fmt(self.syntax(), f)
3838 } 3841 }
3839} 3842}
3840impl std::fmt::Display for TypeArgList { 3843impl std::fmt::Display for Condition {
3841 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3844 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3842 std::fmt::Display::fmt(self.syntax(), f) 3845 std::fmt::Display::fmt(self.syntax(), f)
3843 } 3846 }
3844} 3847}
3845impl std::fmt::Display for FieldExpr { 3848impl std::fmt::Display for MatchArmList {
3846 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3849 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3847 std::fmt::Display::fmt(self.syntax(), f) 3850 std::fmt::Display::fmt(self.syntax(), f)
3848 } 3851 }
3849} 3852}
3850impl std::fmt::Display for IndexExpr { 3853impl std::fmt::Display for MatchArm {
3851 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3852 std::fmt::Display::fmt(self.syntax(), f) 3855 std::fmt::Display::fmt(self.syntax(), f)
3853 } 3856 }
3854} 3857}
3855impl std::fmt::Display for AwaitExpr { 3858impl std::fmt::Display for MatchGuard {
3856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3859 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3857 std::fmt::Display::fmt(self.syntax(), f) 3860 std::fmt::Display::fmt(self.syntax(), f)
3858 } 3861 }
3859} 3862}
3860impl std::fmt::Display for TryExpr { 3863impl std::fmt::Display for ArrayType {
3861 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3864 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3862 std::fmt::Display::fmt(self.syntax(), f) 3865 std::fmt::Display::fmt(self.syntax(), f)
3863 } 3866 }
3864} 3867}
3865impl std::fmt::Display for CastExpr { 3868impl std::fmt::Display for DynTraitType {
3866 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3869 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3867 std::fmt::Display::fmt(self.syntax(), f) 3870 std::fmt::Display::fmt(self.syntax(), f)
3868 } 3871 }
3869} 3872}
3870impl std::fmt::Display for RefExpr { 3873impl std::fmt::Display for FnPointerType {
3871 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3874 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3872 std::fmt::Display::fmt(self.syntax(), f) 3875 std::fmt::Display::fmt(self.syntax(), f)
3873 } 3876 }
3874} 3877}
3875impl std::fmt::Display for PrefixExpr { 3878impl std::fmt::Display for ForType {
3876 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3879 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3877 std::fmt::Display::fmt(self.syntax(), f) 3880 std::fmt::Display::fmt(self.syntax(), f)
3878 } 3881 }
3879} 3882}
3880impl std::fmt::Display for BoxExpr { 3883impl std::fmt::Display for ImplTraitType {
3881 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3882 std::fmt::Display::fmt(self.syntax(), f) 3885 std::fmt::Display::fmt(self.syntax(), f)
3883 } 3886 }
3884} 3887}
3885impl std::fmt::Display for RangeExpr { 3888impl std::fmt::Display for InferType {
3886 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3887 std::fmt::Display::fmt(self.syntax(), f) 3890 std::fmt::Display::fmt(self.syntax(), f)
3888 } 3891 }
3889} 3892}
3890impl std::fmt::Display for BinExpr { 3893impl std::fmt::Display for NeverType {
3891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3894 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3892 std::fmt::Display::fmt(self.syntax(), f) 3895 std::fmt::Display::fmt(self.syntax(), f)
3893 } 3896 }
3894} 3897}
3895impl std::fmt::Display for MatchExpr { 3898impl std::fmt::Display for ParenType {
3896 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3899 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3897 std::fmt::Display::fmt(self.syntax(), f) 3900 std::fmt::Display::fmt(self.syntax(), f)
3898 } 3901 }
3899} 3902}
3900impl std::fmt::Display for MatchArmList { 3903impl std::fmt::Display for PathType {
3901 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3904 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3902 std::fmt::Display::fmt(self.syntax(), f) 3905 std::fmt::Display::fmt(self.syntax(), f)
3903 } 3906 }
3904} 3907}
3905impl std::fmt::Display for MatchArm { 3908impl std::fmt::Display for PointerType {
3906 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3909 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3907 std::fmt::Display::fmt(self.syntax(), f) 3910 std::fmt::Display::fmt(self.syntax(), f)
3908 } 3911 }
3909} 3912}
3910impl std::fmt::Display for MatchGuard { 3913impl std::fmt::Display for ReferenceType {
3911 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3912 std::fmt::Display::fmt(self.syntax(), f) 3915 std::fmt::Display::fmt(self.syntax(), f)
3913 } 3916 }
3914} 3917}
3915impl std::fmt::Display for RecordExpr { 3918impl std::fmt::Display for SliceType {
3916 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3919 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3917 std::fmt::Display::fmt(self.syntax(), f) 3920 std::fmt::Display::fmt(self.syntax(), f)
3918 } 3921 }
3919} 3922}
3920impl std::fmt::Display for RecordExprFieldList { 3923impl std::fmt::Display for TupleType {
3921 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3924 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3922 std::fmt::Display::fmt(self.syntax(), f) 3925 std::fmt::Display::fmt(self.syntax(), f)
3923 } 3926 }
3924} 3927}
3925impl std::fmt::Display for RecordExprField { 3928impl std::fmt::Display for TypeBound {
3926 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3929 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3927 std::fmt::Display::fmt(self.syntax(), f) 3930 std::fmt::Display::fmt(self.syntax(), f)
3928 } 3931 }
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
index 1c3e0f65b..e0f1d0c27 100644
--- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
+++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] "{" 12 [email protected] "{"
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 LAMBDA[email protected] 15 CLOSURE[email protected]
16 [email protected] 16 [email protected]
17 [email protected] "|" 17 [email protected] "|"
18 [email protected] "|" 18 [email protected] "|"
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
index d62906b99..0afa24b77 100644
--- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
+++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast
@@ -117,7 +117,7 @@ [email protected]
117 [email protected] 117 [email protected]
118 [email protected] 118 [email protected]
119 [email protected] 119 [email protected]
120 LAMBDA[email protected] 120 CLOSURE[email protected]
121 [email protected] 121 [email protected]
122 [email protected] 122 [email protected]
123 [email protected] 123 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
index a98c31b0c..0678d4278 100644
--- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast
@@ -49,7 +49,7 @@ [email protected]
49 [email protected] "map" 49 [email protected] "map"
50 [email protected] 50 [email protected]
51 [email protected] "(" 51 [email protected] "("
52 LAMBDA[email protected] 52 CLOSURE[email protected]
53 [email protected] 53 [email protected]
54 [email protected] "|" 54 [email protected] "|"
55 [email protected] 55 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
index 51a6c5170..a80d79563 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] "{" 12 [email protected] "{"
13 [email protected] "\n " 13 [email protected] "\n "
14 [email protected] 14 [email protected]
15 LAMBDA[email protected] 15 CLOSURE[email protected]
16 [email protected] 16 [email protected]
17 [email protected] "|" 17 [email protected] "|"
18 [email protected] "|" 18 [email protected] "|"
@@ -23,7 +23,7 @@ [email protected]
23 [email protected] ";" 23 [email protected] ";"
24 [email protected] "\n " 24 [email protected] "\n "
25 [email protected] 25 [email protected]
26 LAMBDA[email protected] 26 CLOSURE[email protected]
27 [email protected] 27 [email protected]
28 [email protected] "|" 28 [email protected] "|"
29 [email protected] "|" 29 [email protected] "|"
@@ -47,7 +47,7 @@ [email protected]
47 [email protected] ";" 47 [email protected] ";"
48 [email protected] "\n " 48 [email protected] "\n "
49 [email protected] 49 [email protected]
50 LAMBDA[email protected] 50 CLOSURE[email protected]
51 [email protected] 51 [email protected]
52 [email protected] "|" 52 [email protected] "|"
53 [email protected] 53 [email protected]
@@ -64,7 +64,7 @@ [email protected]
64 [email protected] ";" 64 [email protected] ";"
65 [email protected] "\n " 65 [email protected] "\n "
66 [email protected] 66 [email protected]
67 LAMBDA[email protected] 67 CLOSURE[email protected]
68 [email protected] "move" 68 [email protected] "move"
69 [email protected] " " 69 [email protected] " "
70 [email protected] 70 [email protected]
@@ -91,7 +91,7 @@ [email protected]
91 [email protected] ";" 91 [email protected] ";"
92 [email protected] "\n " 92 [email protected] "\n "
93 [email protected] 93 [email protected]
94 LAMBDA[email protected] 94 CLOSURE[email protected]
95 [email protected] "async" 95 [email protected] "async"
96 [email protected] " " 96 [email protected] " "
97 [email protected] 97 [email protected]
@@ -104,7 +104,7 @@ [email protected]
104 [email protected] ";" 104 [email protected] ";"
105 [email protected] "\n " 105 [email protected] "\n "
106 [email protected] 106 [email protected]
107 LAMBDA[email protected] 107 CLOSURE[email protected]
108 [email protected] "move" 108 [email protected] "move"
109 [email protected] " " 109 [email protected] " "
110 [email protected] 110 [email protected]
@@ -117,7 +117,7 @@ [email protected]
117 [email protected] ";" 117 [email protected] ";"
118 [email protected] "\n " 118 [email protected] "\n "
119 [email protected] 119 [email protected]
120 LAMBDA[email protected] 120 CLOSURE[email protected]
121 [email protected] "async" 121 [email protected] "async"
122 [email protected] " " 122 [email protected] " "
123 [email protected] "move" 123 [email protected] "move"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
index 931e81f27..d2fd6e567 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast
@@ -105,7 +105,7 @@ [email protected]
105 [email protected] " " 105 [email protected] " "
106 [email protected] "=" 106 [email protected] "="
107 [email protected] " " 107 [email protected] " "
108 LAMBDA[email protected] 108 CLOSURE[email protected]
109 [email protected] 109 [email protected]
110 [email protected] "#" 110 [email protected] "#"
111 [email protected] "[" 111 [email protected] "["
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
index c63a55a56..0a9f7c137 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] " " 20 [email protected] " "
21 [email protected] "=" 21 [email protected] "="
22 [email protected] " " 22 [email protected] " "
23 LAMBDA[email protected] 23 CLOSURE[email protected]
24 [email protected] 24 [email protected]
25 [email protected] "|" 25 [email protected] "|"
26 [email protected] 26 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
index 9c071ec2e..aa4099a92 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast
@@ -13,7 +13,7 @@ [email protected]
13 [email protected] " " 13 [email protected] " "
14 [email protected] 14 [email protected]
15 [email protected] 15 [email protected]
16 LAMBDA[email protected] 16 CLOSURE[email protected]
17 [email protected] 17 [email protected]
18 [email protected] "|" 18 [email protected] "|"
19 [email protected] "|" 19 [email protected] "|"
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
index 66cd5727a..1d75ed08f 100644
--- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast
@@ -351,7 +351,7 @@ [email protected]
351 [email protected] " " 351 [email protected] " "
352 [email protected] 352 [email protected]
353 [email protected] "{" 353 [email protected] "{"
354 LAMBDA[email protected] 354 CLOSURE[email protected]
355 [email protected] 355 [email protected]
356 [email protected] "|" 356 [email protected] "|"
357 [email protected] "|" 357 [email protected] "|"
@@ -1628,7 +1628,7 @@ [email protected]
1628 [email protected] 1628 [email protected]
1629 [email protected] 1629 [email protected]
1630 [email protected] "(" 1630 [email protected] "("
1631 LAMBDA[email protected] 1631 CLOSURE[email protected]
1632 [email protected] 1632 [email protected]
1633 [email protected] "|" 1633 [email protected] "|"
1634 [email protected] 1634 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
index c9e6d88eb..650f4e310 100644
--- a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] "catch_unwind" 52 [email protected] "catch_unwind"
53 [email protected] 53 [email protected]
54 [email protected] "(" 54 [email protected] "("
55 LAMBDA[email protected] 55 CLOSURE[email protected]
56 [email protected] "move" 56 [email protected] "move"
57 [email protected] " " 57 [email protected] " "
58 [email protected] 58 [email protected]
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index 38b60b2a5..427406249 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -144,7 +144,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
144 "ARRAY_EXPR", 144 "ARRAY_EXPR",
145 "PAREN_EXPR", 145 "PAREN_EXPR",
146 "PATH_EXPR", 146 "PATH_EXPR",
147 "LAMBDA_EXPR", 147 "CLOSURE_EXPR",
148 "IF_EXPR", 148 "IF_EXPR",
149 "WHILE_EXPR", 149 "WHILE_EXPR",
150 "CONDITION", 150 "CONDITION",
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs
index d9f358513..059538696 100644
--- a/xtask/src/codegen/gen_syntax.rs
+++ b/xtask/src/codegen/gen_syntax.rs
@@ -579,6 +579,21 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, r
579 } 579 }
580 Rule::Labeled { label: l, rule } => { 580 Rule::Labeled { label: l, rule } => {
581 assert!(label.is_none()); 581 assert!(label.is_none());
582 let manually_implemented = matches!(
583 l.as_str(),
584 "lhs"
585 | "rhs"
586 | "then_branch"
587 | "else_branch"
588 | "start"
589 | "end"
590 | "op"
591 | "index"
592 | "base"
593 );
594 if manually_implemented {
595 return;
596 }
582 lower_rule(acc, grammar, Some(l), rule); 597 lower_rule(acc, grammar, Some(l), rule);
583 } 598 }
584 Rule::Seq(rules) | Rule::Alt(rules) => { 599 Rule::Seq(rules) | Rule::Alt(rules) => {
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index 17de36d7a..aef07cb1e 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -115,8 +115,8 @@ Union =
115 RecordFieldList 115 RecordFieldList
116 116
117AdtDef = 117AdtDef =
118 Struct 118 Enum
119| Enum 119| Struct
120| Union 120| Union
121 121
122Const = 122Const =
@@ -136,10 +136,10 @@ AssocItemList =
136 '{' Attr* AssocItem* '}' 136 '{' Attr* AssocItem* '}'
137 137
138AssocItem = 138AssocItem =
139 Fn 139 Const
140| TypeAlias 140| Fn
141| Const
142| MacroCall 141| MacroCall
142| TypeAlias
143 143
144Impl = 144Impl =
145 Attr* Visibility? 145 Attr* Visibility?
@@ -162,9 +162,9 @@ GenericParamList =
162 '<' (GenericParam (',' GenericParam)* ','?)? '>' 162 '<' (GenericParam (',' GenericParam)* ','?)? '>'
163 163
164GenericParam = 164GenericParam =
165 LifetimeParam 165 ConstParam
166| LifetimeParam
166| TypeParam 167| TypeParam
167| ConstParam
168 168
169TypeParam = 169TypeParam =
170 Attr* Name (':' TypeBoundList?)? 170 Attr* Name (':' TypeBoundList?)?
@@ -195,9 +195,9 @@ Attr =
195 '#' '!'? '[' Path ('=' Literal | TokenTree)? ']' 195 '#' '!'? '[' Path ('=' Literal | TokenTree)? ']'
196 196
197Stmt = 197Stmt =
198 LetStmt 198 ExprStmt
199| ExprStmt
200| Item 199| Item
200| LetStmt
201 201
202LetStmt = 202LetStmt =
203 Attr* 'let' Pat (':' Type)? 203 Attr* 'let' Pat (':' Type)?
@@ -206,189 +206,238 @@ LetStmt =
206ExprStmt = 206ExprStmt =
207 Attr* Expr ';'? 207 Attr* Expr ';'?
208 208
209Type = 209Expr =
210 ParenType 210 ArrayExpr
211| TupleType 211| AwaitExpr
212| NeverType 212| BinExpr
213| PathType 213| BlockExpr
214| PointerType 214| BoxExpr
215| ArrayType 215| BreakExpr
216| SliceType 216| CallExpr
217| ReferenceType 217| CastExpr
218| InferType 218| ContinueExpr
219| FnPointerType 219| EffectExpr
220| ForType 220| FieldExpr
221| ImplTraitType 221| ForExpr
222| DynTraitType 222| IfExpr
223| IndexExpr
224| Label
225| ClosureExpr
226| Literal
227| LoopExpr
228| MacroCall
229| MatchExpr
230| MethodCallExpr
231| ParenExpr
232| PathExpr
233| PrefixExpr
234| RangeExpr
235| RecordExpr
236| RefExpr
237| ReturnExpr
238| TryExpr
239| TupleExpr
240| WhileExpr
223 241
224ParenType = 242Literal =
225 '(' Type ')' 243 Attr* 'int_number'
226 244
227NeverType = 245PathExpr =
228 '!' 246 Attr* Path
229 247
230PathType = 248BlockExpr =
231 Path 249 '{'
250 Attr*
251 statements:Stmt*
252 Expr?
253 '}'
232 254
233TupleType = 255RefExpr =
234 '(' fields:(Type (',' Type)* ','?)? ')' 256 Attr* '&' ('raw' |'mut' | 'const') Expr
235 257
236PointerType = 258TryExpr =
237 '*' ('const' | 'mut') Type 259 Attr* Expr '?'
238 260
239ReferenceType = 261EffectExpr =
240 '&' 'lifetime'? 'mut'? Type 262 Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
241 263
242ArrayType = 264PrefixExpr =
243 '[' Type ';' Expr ']' 265 Attr* op:('-' | '!' | '*') Expr
244 266
245SliceType = 267BinExpr =
246 '[' Type ']' 268 Attr*
269 lhs:Expr
270 op:(
271 '||' | '&&'
272 | '==' | '!=' | '<=' | '>=' | '<' | '>'
273 | '+' | '*' | '-' | '/' | '%' | '<<' | '>>' | '^' | '|' | '&'
274 | '=' | '+=' | '/=' | '*=' | '%=' | '>>=' | '<<=' | '-=' | '|=' | '&=' | '^='
275 )
276 rhs:Expr
247 277
248InferType = 278CastExpr =
249 '_' 279 Attr* Expr 'as' Type
250 280
251FnPointerType = 281ParenExpr =
252 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType? 282 Attr* '(' Attr* Expr ')'
253 283
254ForType = 284ArrayExpr =
255 'for' GenericParamList Type 285 Attr* '[' Attr* (
286 (Expr (',' Expr)* ','?)?
287 | Expr ';' Expr
288 ) ']'
256 289
257ImplTraitType = 290IndexExpr =
258 'impl' TypeBoundList 291 Attr* base:Expr '[' index:Expr ']'
259 292
260DynTraitType = 293TupleExpr =
261 'dyn' TypeBoundList 294 Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')'
262 295
263TypeBoundList = 296RecordExpr =
264 bounds:(TypeBound ('+' TypeBound)* '+'?) 297 Path RecordExprFieldList
265 298
266TypeBound = 299RecordExprFieldList =
267 'lifetime' 300 '{'
268| '?'? Type 301 Attr*
302 fields:(RecordExprField (',' RecordExprField)* ','?)
303 ('..' spread:Expr)?
304 '}'
269 305
270TupleExpr = 306RecordExprField =
271 Attr* '(' Expr* ')' 307 Attr* NameRef (':' Expr)?
272 308
273ArrayExpr = 309CallExpr =
274 Attr* '[' (Expr* | Expr ';' Expr) ']' 310 Attr* Expr ArgList
275 311
276ParenExpr = 312ArgList =
277 Attr* '(' Expr ')' 313 '(' args:(Expr (',' Expr)* ','?)? ')'
278 314
279PathExpr = 315MethodCallExpr =
280 Path 316 Attr* Expr '.' NameRef TypeArgList? ArgList
317
318FieldExpr =
319 Attr* Expr '.' NameRef
281 320
282LambdaExpr = 321ClosureExpr =
283 Attr* 'static'? 'async'? 'move'? ParamList RetType? 322 Attr* 'static'? 'async'? 'move'? ParamList RetType?
284 body:Expr 323 body:Expr
285 324
286IfExpr = 325IfExpr =
287 Attr* 'if' Condition 326 Attr* 'if' Condition then_branch:BlockExpr
327 ('else' else_branch:(IfExpr | BlockExpr))?
288 328
289Condition = 329Condition =
290 'let' Pat '=' Expr 330 'let' Pat '=' Expr
291| Expr 331| Expr
292 332
293EffectExpr =
294 Attr* Label? ('try' | 'unsafe' | 'async') BlockExpr
295
296LoopExpr = 333LoopExpr =
297 Attr* Label? 'loop' 334 Attr* Label? 'loop'
298 loop_body:BlockExpr? 335 loop_body:BlockExpr
299 336
300ForExpr = 337ForExpr =
301 Attr* Label? 'for' Pat 'in' iterable:Expr 338 Attr* Label? 'for' Pat 'in' iterable:Expr
302 loop_body:BlockExpr? 339 loop_body:BlockExpr
303 340
304WhileExpr = 341WhileExpr =
305 Attr* Label? 'while' Condition 342 Attr* Label? 'while' Condition
306 loop_body:BlockExpr? 343 loop_body:BlockExpr?
307 344
308ContinueExpr = 345Label =
309 Attr* 'continue' 'lifetime'? 346 'lifetime'
310 347
311BreakExpr = 348BreakExpr =
312 Attr* 'break' 'lifetime'? Expr? 349 Attr* 'break' 'lifetime'? Expr?
313 350
314Label = 351ContinueExpr =
315 'lifetime' 352 Attr* 'continue' 'lifetime'?
316
317BlockExpr =
318 Attr* Label
319 '{'
320 statements:Stmt*
321 Expr?
322 '}'
323 353
324ReturnExpr = 354RangeExpr =
325 Attr* 'return' Expr 355 Attr* start:Expr? op:('..' | '..=') end:Expr?
326 356
327CallExpr = 357MatchExpr =
328 Attr* Expr ArgList 358 Attr* 'match' Expr MatchArmList
329 359
330MethodCallExpr = 360MatchArmList =
331 Attr* Expr '.' NameRef TypeArgList? ArgList 361 '{'
362 Attr*
363 arms:MatchArm*
364 '}'
332 365
333ArgList = 366MatchArm =
334 '(' args:Expr* ')' 367 Attr* Pat guard:MatchGuard? '=>' Expr ','?
335 368
336FieldExpr = 369MatchGuard =
337 Attr* Expr '.' NameRef 370 'if' Expr
338 371
339IndexExpr = 372ReturnExpr =
340 Attr* '[' ']' 373 Attr* 'return' Expr?
341 374
342AwaitExpr = 375AwaitExpr =
343 Attr* Expr '.' 'await' 376 Attr* Expr '.' 'await'
344 377
345TryExpr = 378BoxExpr =
346 Attr* Expr '?' 379 Attr* 'box' Expr
347 380
348CastExpr = 381Type =
349 Attr* Expr 'as' Type 382 ArrayType
383| DynTraitType
384| FnPointerType
385| ForType
386| ImplTraitType
387| InferType
388| NeverType
389| ParenType
390| PathType
391| PointerType
392| ReferenceType
393| SliceType
394| TupleType
350 395
351RefExpr = 396ParenType =
352 Attr* '&' ('raw' | 'mut' | 'const') Expr 397 '(' Type ')'
353 398
354PrefixExpr = 399NeverType =
355 Attr* Expr 400 '!'
356 401
357BoxExpr = 402PathType =
358 Attr* 'box' Expr 403 Path
359 404
360RangeExpr = 405TupleType =
361 Attr* 406 '(' fields:(Type (',' Type)* ','?)? ')'
362 407
363BinExpr = 408PointerType =
364 Attr* 409 '*' ('const' | 'mut') Type
365 410
366Literal = 411ReferenceType =
367 'int_number' 412 '&' 'lifetime'? 'mut'? Type
368 413
369MatchExpr = 414ArrayType =
370 Attr* 'match' Expr MatchArmList 415 '[' Type ';' Expr ']'
371 416
372MatchArmList = 417SliceType =
373 '{' arms:MatchArm* '}' 418 '[' Type ']'
374 419
375MatchArm = 420InferType =
376 Attr* Pat guard:MatchGuard? '=>' Expr 421 '_'
377 422
378MatchGuard = 423FnPointerType =
379 'if' Expr 424 'const'? 'async'? 'unsafe'? Abi? 'fn' ParamList RetType?
380 425
381RecordExpr = 426ForType =
382 Path RecordExprFieldList 427 'for' GenericParamList Type
383 428
384RecordExprFieldList = 429ImplTraitType =
385 '{' 430 'impl' TypeBoundList
386 fields:RecordExprField*
387 ('..' spread:Expr)?
388 '}'
389 431
390RecordExprField = 432DynTraitType =
391 Attr* NameRef (':' Expr)? 433 'dyn' TypeBoundList
434
435TypeBoundList =
436 bounds:(TypeBound ('+' TypeBound)* '+'?)
437
438TypeBound =
439 'lifetime'
440| '?'? Type
392 441
393OrPat = 442OrPat =
394 Pat* 443 Pat*
@@ -510,36 +559,3 @@ Pat =
510| RangePat 559| RangePat
511| LiteralPat 560| LiteralPat
512| MacroPat 561| MacroPat
513
514Expr =
515 TupleExpr
516| ArrayExpr
517| ParenExpr
518| PathExpr
519| LambdaExpr
520| IfExpr
521| LoopExpr
522| ForExpr
523| WhileExpr
524| ContinueExpr
525| BreakExpr
526| Label
527| BlockExpr
528| ReturnExpr
529| MatchExpr
530| RecordExpr
531| CallExpr
532| IndexExpr
533| MethodCallExpr
534| FieldExpr
535| AwaitExpr
536| TryExpr
537| EffectExpr
538| CastExpr
539| RefExpr
540| PrefixExpr
541| RangeExpr
542| BinExpr
543| Literal
544| MacroCall
545| BoxExpr