]> git.lizzy.rs Git - rust.git/blob - crates/ra_syntax/src/ast/generated.rs
fill struct fields diagnostic
[rust.git] / crates / ra_syntax / src / ast / generated.rs
1 // This file is automatically generated based on the file `./generated.rs.tera` when `cargo gen-syntax` is run
2 // Do not edit manually
3
4 //! This module contains auto-generated Rust AST. Like `SyntaxNode`s, AST nodes
5 //! are generic over ownership: `X<'a>` things are `Copy` references, `XNode`
6 //! are Arc-based. You can switch between the two variants using `.owned` and
7 //! `.borrowed` functions. Most of the code works with borowed mode, and only
8 //! this mode has all AST accessors.
9
10 #![cfg_attr(rustfmt, rustfmt_skip)]
11
12 use rowan::TransparentNewType;
13
14 use crate::{
15     SyntaxNode, SyntaxKind::*,
16     syntax_node::{TreeArc},
17     ast::{self, AstNode},
18 };
19
20 // Alias
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 #[repr(transparent)]
23 pub struct Alias {
24     pub(crate) syntax: SyntaxNode,
25 }
26 unsafe impl TransparentNewType for Alias {
27     type Repr = rowan::SyntaxNode;
28 }
29
30 impl AstNode for Alias {
31     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
32         match syntax.kind() {
33             ALIAS => Some(Alias::from_repr(syntax.into_repr())),
34             _ => None,
35         }
36     }
37     fn syntax(&self) -> &SyntaxNode { &self.syntax }
38 }
39
40 impl ToOwned for Alias {
41     type Owned = TreeArc<Alias>;
42     fn to_owned(&self) -> TreeArc<Alias> { TreeArc::cast(self.syntax.to_owned()) }
43 }
44
45
46 impl ast::NameOwner for Alias {}
47 impl Alias {}
48
49 // ArgList
50 #[derive(Debug, PartialEq, Eq, Hash)]
51 #[repr(transparent)]
52 pub struct ArgList {
53     pub(crate) syntax: SyntaxNode,
54 }
55 unsafe impl TransparentNewType for ArgList {
56     type Repr = rowan::SyntaxNode;
57 }
58
59 impl AstNode for ArgList {
60     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
61         match syntax.kind() {
62             ARG_LIST => Some(ArgList::from_repr(syntax.into_repr())),
63             _ => None,
64         }
65     }
66     fn syntax(&self) -> &SyntaxNode { &self.syntax }
67 }
68
69 impl ToOwned for ArgList {
70     type Owned = TreeArc<ArgList>;
71     fn to_owned(&self) -> TreeArc<ArgList> { TreeArc::cast(self.syntax.to_owned()) }
72 }
73
74
75 impl ArgList {
76     pub fn args(&self) -> impl Iterator<Item = &Expr> {
77         super::children(self)
78     }
79 }
80
81 // ArrayExpr
82 #[derive(Debug, PartialEq, Eq, Hash)]
83 #[repr(transparent)]
84 pub struct ArrayExpr {
85     pub(crate) syntax: SyntaxNode,
86 }
87 unsafe impl TransparentNewType for ArrayExpr {
88     type Repr = rowan::SyntaxNode;
89 }
90
91 impl AstNode for ArrayExpr {
92     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
93         match syntax.kind() {
94             ARRAY_EXPR => Some(ArrayExpr::from_repr(syntax.into_repr())),
95             _ => None,
96         }
97     }
98     fn syntax(&self) -> &SyntaxNode { &self.syntax }
99 }
100
101 impl ToOwned for ArrayExpr {
102     type Owned = TreeArc<ArrayExpr>;
103     fn to_owned(&self) -> TreeArc<ArrayExpr> { TreeArc::cast(self.syntax.to_owned()) }
104 }
105
106
107 impl ArrayExpr {
108     pub fn exprs(&self) -> impl Iterator<Item = &Expr> {
109         super::children(self)
110     }
111 }
112
113 // ArrayType
114 #[derive(Debug, PartialEq, Eq, Hash)]
115 #[repr(transparent)]
116 pub struct ArrayType {
117     pub(crate) syntax: SyntaxNode,
118 }
119 unsafe impl TransparentNewType for ArrayType {
120     type Repr = rowan::SyntaxNode;
121 }
122
123 impl AstNode for ArrayType {
124     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
125         match syntax.kind() {
126             ARRAY_TYPE => Some(ArrayType::from_repr(syntax.into_repr())),
127             _ => None,
128         }
129     }
130     fn syntax(&self) -> &SyntaxNode { &self.syntax }
131 }
132
133 impl ToOwned for ArrayType {
134     type Owned = TreeArc<ArrayType>;
135     fn to_owned(&self) -> TreeArc<ArrayType> { TreeArc::cast(self.syntax.to_owned()) }
136 }
137
138
139 impl ArrayType {
140     pub fn type_ref(&self) -> Option<&TypeRef> {
141         super::child_opt(self)
142     }
143
144     pub fn expr(&self) -> Option<&Expr> {
145         super::child_opt(self)
146     }
147 }
148
149 // AssocTypeArg
150 #[derive(Debug, PartialEq, Eq, Hash)]
151 #[repr(transparent)]
152 pub struct AssocTypeArg {
153     pub(crate) syntax: SyntaxNode,
154 }
155 unsafe impl TransparentNewType for AssocTypeArg {
156     type Repr = rowan::SyntaxNode;
157 }
158
159 impl AstNode for AssocTypeArg {
160     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
161         match syntax.kind() {
162             ASSOC_TYPE_ARG => Some(AssocTypeArg::from_repr(syntax.into_repr())),
163             _ => None,
164         }
165     }
166     fn syntax(&self) -> &SyntaxNode { &self.syntax }
167 }
168
169 impl ToOwned for AssocTypeArg {
170     type Owned = TreeArc<AssocTypeArg>;
171     fn to_owned(&self) -> TreeArc<AssocTypeArg> { TreeArc::cast(self.syntax.to_owned()) }
172 }
173
174
175 impl AssocTypeArg {
176     pub fn name_ref(&self) -> Option<&NameRef> {
177         super::child_opt(self)
178     }
179
180     pub fn type_ref(&self) -> Option<&TypeRef> {
181         super::child_opt(self)
182     }
183 }
184
185 // Attr
186 #[derive(Debug, PartialEq, Eq, Hash)]
187 #[repr(transparent)]
188 pub struct Attr {
189     pub(crate) syntax: SyntaxNode,
190 }
191 unsafe impl TransparentNewType for Attr {
192     type Repr = rowan::SyntaxNode;
193 }
194
195 impl AstNode for Attr {
196     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
197         match syntax.kind() {
198             ATTR => Some(Attr::from_repr(syntax.into_repr())),
199             _ => None,
200         }
201     }
202     fn syntax(&self) -> &SyntaxNode { &self.syntax }
203 }
204
205 impl ToOwned for Attr {
206     type Owned = TreeArc<Attr>;
207     fn to_owned(&self) -> TreeArc<Attr> { TreeArc::cast(self.syntax.to_owned()) }
208 }
209
210
211 impl Attr {
212     pub fn value(&self) -> Option<&TokenTree> {
213         super::child_opt(self)
214     }
215 }
216
217 // BinExpr
218 #[derive(Debug, PartialEq, Eq, Hash)]
219 #[repr(transparent)]
220 pub struct BinExpr {
221     pub(crate) syntax: SyntaxNode,
222 }
223 unsafe impl TransparentNewType for BinExpr {
224     type Repr = rowan::SyntaxNode;
225 }
226
227 impl AstNode for BinExpr {
228     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
229         match syntax.kind() {
230             BIN_EXPR => Some(BinExpr::from_repr(syntax.into_repr())),
231             _ => None,
232         }
233     }
234     fn syntax(&self) -> &SyntaxNode { &self.syntax }
235 }
236
237 impl ToOwned for BinExpr {
238     type Owned = TreeArc<BinExpr>;
239     fn to_owned(&self) -> TreeArc<BinExpr> { TreeArc::cast(self.syntax.to_owned()) }
240 }
241
242
243 impl BinExpr {}
244
245 // BindPat
246 #[derive(Debug, PartialEq, Eq, Hash)]
247 #[repr(transparent)]
248 pub struct BindPat {
249     pub(crate) syntax: SyntaxNode,
250 }
251 unsafe impl TransparentNewType for BindPat {
252     type Repr = rowan::SyntaxNode;
253 }
254
255 impl AstNode for BindPat {
256     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
257         match syntax.kind() {
258             BIND_PAT => Some(BindPat::from_repr(syntax.into_repr())),
259             _ => None,
260         }
261     }
262     fn syntax(&self) -> &SyntaxNode { &self.syntax }
263 }
264
265 impl ToOwned for BindPat {
266     type Owned = TreeArc<BindPat>;
267     fn to_owned(&self) -> TreeArc<BindPat> { TreeArc::cast(self.syntax.to_owned()) }
268 }
269
270
271 impl ast::NameOwner for BindPat {}
272 impl BindPat {
273     pub fn pat(&self) -> Option<&Pat> {
274         super::child_opt(self)
275     }
276 }
277
278 // Block
279 #[derive(Debug, PartialEq, Eq, Hash)]
280 #[repr(transparent)]
281 pub struct Block {
282     pub(crate) syntax: SyntaxNode,
283 }
284 unsafe impl TransparentNewType for Block {
285     type Repr = rowan::SyntaxNode;
286 }
287
288 impl AstNode for Block {
289     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
290         match syntax.kind() {
291             BLOCK => Some(Block::from_repr(syntax.into_repr())),
292             _ => None,
293         }
294     }
295     fn syntax(&self) -> &SyntaxNode { &self.syntax }
296 }
297
298 impl ToOwned for Block {
299     type Owned = TreeArc<Block>;
300     fn to_owned(&self) -> TreeArc<Block> { TreeArc::cast(self.syntax.to_owned()) }
301 }
302
303
304 impl ast::AttrsOwner for Block {}
305 impl Block {
306     pub fn statements(&self) -> impl Iterator<Item = &Stmt> {
307         super::children(self)
308     }
309
310     pub fn expr(&self) -> Option<&Expr> {
311         super::child_opt(self)
312     }
313 }
314
315 // BlockExpr
316 #[derive(Debug, PartialEq, Eq, Hash)]
317 #[repr(transparent)]
318 pub struct BlockExpr {
319     pub(crate) syntax: SyntaxNode,
320 }
321 unsafe impl TransparentNewType for BlockExpr {
322     type Repr = rowan::SyntaxNode;
323 }
324
325 impl AstNode for BlockExpr {
326     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
327         match syntax.kind() {
328             BLOCK_EXPR => Some(BlockExpr::from_repr(syntax.into_repr())),
329             _ => None,
330         }
331     }
332     fn syntax(&self) -> &SyntaxNode { &self.syntax }
333 }
334
335 impl ToOwned for BlockExpr {
336     type Owned = TreeArc<BlockExpr>;
337     fn to_owned(&self) -> TreeArc<BlockExpr> { TreeArc::cast(self.syntax.to_owned()) }
338 }
339
340
341 impl BlockExpr {
342     pub fn block(&self) -> Option<&Block> {
343         super::child_opt(self)
344     }
345 }
346
347 // BreakExpr
348 #[derive(Debug, PartialEq, Eq, Hash)]
349 #[repr(transparent)]
350 pub struct BreakExpr {
351     pub(crate) syntax: SyntaxNode,
352 }
353 unsafe impl TransparentNewType for BreakExpr {
354     type Repr = rowan::SyntaxNode;
355 }
356
357 impl AstNode for BreakExpr {
358     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
359         match syntax.kind() {
360             BREAK_EXPR => Some(BreakExpr::from_repr(syntax.into_repr())),
361             _ => None,
362         }
363     }
364     fn syntax(&self) -> &SyntaxNode { &self.syntax }
365 }
366
367 impl ToOwned for BreakExpr {
368     type Owned = TreeArc<BreakExpr>;
369     fn to_owned(&self) -> TreeArc<BreakExpr> { TreeArc::cast(self.syntax.to_owned()) }
370 }
371
372
373 impl BreakExpr {
374     pub fn expr(&self) -> Option<&Expr> {
375         super::child_opt(self)
376     }
377 }
378
379 // CallExpr
380 #[derive(Debug, PartialEq, Eq, Hash)]
381 #[repr(transparent)]
382 pub struct CallExpr {
383     pub(crate) syntax: SyntaxNode,
384 }
385 unsafe impl TransparentNewType for CallExpr {
386     type Repr = rowan::SyntaxNode;
387 }
388
389 impl AstNode for CallExpr {
390     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
391         match syntax.kind() {
392             CALL_EXPR => Some(CallExpr::from_repr(syntax.into_repr())),
393             _ => None,
394         }
395     }
396     fn syntax(&self) -> &SyntaxNode { &self.syntax }
397 }
398
399 impl ToOwned for CallExpr {
400     type Owned = TreeArc<CallExpr>;
401     fn to_owned(&self) -> TreeArc<CallExpr> { TreeArc::cast(self.syntax.to_owned()) }
402 }
403
404
405 impl ast::ArgListOwner for CallExpr {}
406 impl CallExpr {
407     pub fn expr(&self) -> Option<&Expr> {
408         super::child_opt(self)
409     }
410 }
411
412 // CastExpr
413 #[derive(Debug, PartialEq, Eq, Hash)]
414 #[repr(transparent)]
415 pub struct CastExpr {
416     pub(crate) syntax: SyntaxNode,
417 }
418 unsafe impl TransparentNewType for CastExpr {
419     type Repr = rowan::SyntaxNode;
420 }
421
422 impl AstNode for CastExpr {
423     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
424         match syntax.kind() {
425             CAST_EXPR => Some(CastExpr::from_repr(syntax.into_repr())),
426             _ => None,
427         }
428     }
429     fn syntax(&self) -> &SyntaxNode { &self.syntax }
430 }
431
432 impl ToOwned for CastExpr {
433     type Owned = TreeArc<CastExpr>;
434     fn to_owned(&self) -> TreeArc<CastExpr> { TreeArc::cast(self.syntax.to_owned()) }
435 }
436
437
438 impl CastExpr {
439     pub fn expr(&self) -> Option<&Expr> {
440         super::child_opt(self)
441     }
442
443     pub fn type_ref(&self) -> Option<&TypeRef> {
444         super::child_opt(self)
445     }
446 }
447
448 // Condition
449 #[derive(Debug, PartialEq, Eq, Hash)]
450 #[repr(transparent)]
451 pub struct Condition {
452     pub(crate) syntax: SyntaxNode,
453 }
454 unsafe impl TransparentNewType for Condition {
455     type Repr = rowan::SyntaxNode;
456 }
457
458 impl AstNode for Condition {
459     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
460         match syntax.kind() {
461             CONDITION => Some(Condition::from_repr(syntax.into_repr())),
462             _ => None,
463         }
464     }
465     fn syntax(&self) -> &SyntaxNode { &self.syntax }
466 }
467
468 impl ToOwned for Condition {
469     type Owned = TreeArc<Condition>;
470     fn to_owned(&self) -> TreeArc<Condition> { TreeArc::cast(self.syntax.to_owned()) }
471 }
472
473
474 impl Condition {
475     pub fn pat(&self) -> Option<&Pat> {
476         super::child_opt(self)
477     }
478
479     pub fn expr(&self) -> Option<&Expr> {
480         super::child_opt(self)
481     }
482 }
483
484 // ConstDef
485 #[derive(Debug, PartialEq, Eq, Hash)]
486 #[repr(transparent)]
487 pub struct ConstDef {
488     pub(crate) syntax: SyntaxNode,
489 }
490 unsafe impl TransparentNewType for ConstDef {
491     type Repr = rowan::SyntaxNode;
492 }
493
494 impl AstNode for ConstDef {
495     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
496         match syntax.kind() {
497             CONST_DEF => Some(ConstDef::from_repr(syntax.into_repr())),
498             _ => None,
499         }
500     }
501     fn syntax(&self) -> &SyntaxNode { &self.syntax }
502 }
503
504 impl ToOwned for ConstDef {
505     type Owned = TreeArc<ConstDef>;
506     fn to_owned(&self) -> TreeArc<ConstDef> { TreeArc::cast(self.syntax.to_owned()) }
507 }
508
509
510 impl ast::VisibilityOwner for ConstDef {}
511 impl ast::NameOwner for ConstDef {}
512 impl ast::TypeParamsOwner for ConstDef {}
513 impl ast::AttrsOwner for ConstDef {}
514 impl ast::DocCommentsOwner for ConstDef {}
515 impl ast::TypeAscriptionOwner for ConstDef {}
516 impl ConstDef {
517     pub fn body(&self) -> Option<&Expr> {
518         super::child_opt(self)
519     }
520 }
521
522 // ContinueExpr
523 #[derive(Debug, PartialEq, Eq, Hash)]
524 #[repr(transparent)]
525 pub struct ContinueExpr {
526     pub(crate) syntax: SyntaxNode,
527 }
528 unsafe impl TransparentNewType for ContinueExpr {
529     type Repr = rowan::SyntaxNode;
530 }
531
532 impl AstNode for ContinueExpr {
533     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
534         match syntax.kind() {
535             CONTINUE_EXPR => Some(ContinueExpr::from_repr(syntax.into_repr())),
536             _ => None,
537         }
538     }
539     fn syntax(&self) -> &SyntaxNode { &self.syntax }
540 }
541
542 impl ToOwned for ContinueExpr {
543     type Owned = TreeArc<ContinueExpr>;
544     fn to_owned(&self) -> TreeArc<ContinueExpr> { TreeArc::cast(self.syntax.to_owned()) }
545 }
546
547
548 impl ContinueExpr {}
549
550 // DynTraitType
551 #[derive(Debug, PartialEq, Eq, Hash)]
552 #[repr(transparent)]
553 pub struct DynTraitType {
554     pub(crate) syntax: SyntaxNode,
555 }
556 unsafe impl TransparentNewType for DynTraitType {
557     type Repr = rowan::SyntaxNode;
558 }
559
560 impl AstNode for DynTraitType {
561     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
562         match syntax.kind() {
563             DYN_TRAIT_TYPE => Some(DynTraitType::from_repr(syntax.into_repr())),
564             _ => None,
565         }
566     }
567     fn syntax(&self) -> &SyntaxNode { &self.syntax }
568 }
569
570 impl ToOwned for DynTraitType {
571     type Owned = TreeArc<DynTraitType>;
572     fn to_owned(&self) -> TreeArc<DynTraitType> { TreeArc::cast(self.syntax.to_owned()) }
573 }
574
575
576 impl ast::TypeBoundsOwner for DynTraitType {}
577 impl DynTraitType {}
578
579 // EnumDef
580 #[derive(Debug, PartialEq, Eq, Hash)]
581 #[repr(transparent)]
582 pub struct EnumDef {
583     pub(crate) syntax: SyntaxNode,
584 }
585 unsafe impl TransparentNewType for EnumDef {
586     type Repr = rowan::SyntaxNode;
587 }
588
589 impl AstNode for EnumDef {
590     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
591         match syntax.kind() {
592             ENUM_DEF => Some(EnumDef::from_repr(syntax.into_repr())),
593             _ => None,
594         }
595     }
596     fn syntax(&self) -> &SyntaxNode { &self.syntax }
597 }
598
599 impl ToOwned for EnumDef {
600     type Owned = TreeArc<EnumDef>;
601     fn to_owned(&self) -> TreeArc<EnumDef> { TreeArc::cast(self.syntax.to_owned()) }
602 }
603
604
605 impl ast::VisibilityOwner for EnumDef {}
606 impl ast::NameOwner for EnumDef {}
607 impl ast::TypeParamsOwner for EnumDef {}
608 impl ast::AttrsOwner for EnumDef {}
609 impl ast::DocCommentsOwner for EnumDef {}
610 impl EnumDef {
611     pub fn variant_list(&self) -> Option<&EnumVariantList> {
612         super::child_opt(self)
613     }
614 }
615
616 // EnumVariant
617 #[derive(Debug, PartialEq, Eq, Hash)]
618 #[repr(transparent)]
619 pub struct EnumVariant {
620     pub(crate) syntax: SyntaxNode,
621 }
622 unsafe impl TransparentNewType for EnumVariant {
623     type Repr = rowan::SyntaxNode;
624 }
625
626 impl AstNode for EnumVariant {
627     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
628         match syntax.kind() {
629             ENUM_VARIANT => Some(EnumVariant::from_repr(syntax.into_repr())),
630             _ => None,
631         }
632     }
633     fn syntax(&self) -> &SyntaxNode { &self.syntax }
634 }
635
636 impl ToOwned for EnumVariant {
637     type Owned = TreeArc<EnumVariant>;
638     fn to_owned(&self) -> TreeArc<EnumVariant> { TreeArc::cast(self.syntax.to_owned()) }
639 }
640
641
642 impl ast::NameOwner for EnumVariant {}
643 impl ast::DocCommentsOwner for EnumVariant {}
644 impl ast::AttrsOwner for EnumVariant {}
645 impl EnumVariant {
646     pub fn expr(&self) -> Option<&Expr> {
647         super::child_opt(self)
648     }
649 }
650
651 // EnumVariantList
652 #[derive(Debug, PartialEq, Eq, Hash)]
653 #[repr(transparent)]
654 pub struct EnumVariantList {
655     pub(crate) syntax: SyntaxNode,
656 }
657 unsafe impl TransparentNewType for EnumVariantList {
658     type Repr = rowan::SyntaxNode;
659 }
660
661 impl AstNode for EnumVariantList {
662     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
663         match syntax.kind() {
664             ENUM_VARIANT_LIST => Some(EnumVariantList::from_repr(syntax.into_repr())),
665             _ => None,
666         }
667     }
668     fn syntax(&self) -> &SyntaxNode { &self.syntax }
669 }
670
671 impl ToOwned for EnumVariantList {
672     type Owned = TreeArc<EnumVariantList>;
673     fn to_owned(&self) -> TreeArc<EnumVariantList> { TreeArc::cast(self.syntax.to_owned()) }
674 }
675
676
677 impl EnumVariantList {
678     pub fn variants(&self) -> impl Iterator<Item = &EnumVariant> {
679         super::children(self)
680     }
681 }
682
683 // Expr
684 #[derive(Debug, PartialEq, Eq, Hash)]
685 #[repr(transparent)]
686 pub struct Expr {
687     pub(crate) syntax: SyntaxNode,
688 }
689 unsafe impl TransparentNewType for Expr {
690     type Repr = rowan::SyntaxNode;
691 }
692
693 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
694 pub enum ExprKind<'a> {
695     TupleExpr(&'a TupleExpr),
696     ArrayExpr(&'a ArrayExpr),
697     ParenExpr(&'a ParenExpr),
698     PathExpr(&'a PathExpr),
699     LambdaExpr(&'a LambdaExpr),
700     IfExpr(&'a IfExpr),
701     LoopExpr(&'a LoopExpr),
702     ForExpr(&'a ForExpr),
703     WhileExpr(&'a WhileExpr),
704     ContinueExpr(&'a ContinueExpr),
705     BreakExpr(&'a BreakExpr),
706     Label(&'a Label),
707     BlockExpr(&'a BlockExpr),
708     ReturnExpr(&'a ReturnExpr),
709     MatchExpr(&'a MatchExpr),
710     StructLit(&'a StructLit),
711     CallExpr(&'a CallExpr),
712     IndexExpr(&'a IndexExpr),
713     MethodCallExpr(&'a MethodCallExpr),
714     FieldExpr(&'a FieldExpr),
715     TryExpr(&'a TryExpr),
716     CastExpr(&'a CastExpr),
717     RefExpr(&'a RefExpr),
718     PrefixExpr(&'a PrefixExpr),
719     RangeExpr(&'a RangeExpr),
720     BinExpr(&'a BinExpr),
721     Literal(&'a Literal),
722     MacroCall(&'a MacroCall),
723 }
724 impl<'a> From<&'a TupleExpr> for &'a Expr {
725     fn from(n: &'a TupleExpr) -> &'a Expr {
726         Expr::cast(&n.syntax).unwrap()
727     }
728 }
729 impl<'a> From<&'a ArrayExpr> for &'a Expr {
730     fn from(n: &'a ArrayExpr) -> &'a Expr {
731         Expr::cast(&n.syntax).unwrap()
732     }
733 }
734 impl<'a> From<&'a ParenExpr> for &'a Expr {
735     fn from(n: &'a ParenExpr) -> &'a Expr {
736         Expr::cast(&n.syntax).unwrap()
737     }
738 }
739 impl<'a> From<&'a PathExpr> for &'a Expr {
740     fn from(n: &'a PathExpr) -> &'a Expr {
741         Expr::cast(&n.syntax).unwrap()
742     }
743 }
744 impl<'a> From<&'a LambdaExpr> for &'a Expr {
745     fn from(n: &'a LambdaExpr) -> &'a Expr {
746         Expr::cast(&n.syntax).unwrap()
747     }
748 }
749 impl<'a> From<&'a IfExpr> for &'a Expr {
750     fn from(n: &'a IfExpr) -> &'a Expr {
751         Expr::cast(&n.syntax).unwrap()
752     }
753 }
754 impl<'a> From<&'a LoopExpr> for &'a Expr {
755     fn from(n: &'a LoopExpr) -> &'a Expr {
756         Expr::cast(&n.syntax).unwrap()
757     }
758 }
759 impl<'a> From<&'a ForExpr> for &'a Expr {
760     fn from(n: &'a ForExpr) -> &'a Expr {
761         Expr::cast(&n.syntax).unwrap()
762     }
763 }
764 impl<'a> From<&'a WhileExpr> for &'a Expr {
765     fn from(n: &'a WhileExpr) -> &'a Expr {
766         Expr::cast(&n.syntax).unwrap()
767     }
768 }
769 impl<'a> From<&'a ContinueExpr> for &'a Expr {
770     fn from(n: &'a ContinueExpr) -> &'a Expr {
771         Expr::cast(&n.syntax).unwrap()
772     }
773 }
774 impl<'a> From<&'a BreakExpr> for &'a Expr {
775     fn from(n: &'a BreakExpr) -> &'a Expr {
776         Expr::cast(&n.syntax).unwrap()
777     }
778 }
779 impl<'a> From<&'a Label> for &'a Expr {
780     fn from(n: &'a Label) -> &'a Expr {
781         Expr::cast(&n.syntax).unwrap()
782     }
783 }
784 impl<'a> From<&'a BlockExpr> for &'a Expr {
785     fn from(n: &'a BlockExpr) -> &'a Expr {
786         Expr::cast(&n.syntax).unwrap()
787     }
788 }
789 impl<'a> From<&'a ReturnExpr> for &'a Expr {
790     fn from(n: &'a ReturnExpr) -> &'a Expr {
791         Expr::cast(&n.syntax).unwrap()
792     }
793 }
794 impl<'a> From<&'a MatchExpr> for &'a Expr {
795     fn from(n: &'a MatchExpr) -> &'a Expr {
796         Expr::cast(&n.syntax).unwrap()
797     }
798 }
799 impl<'a> From<&'a StructLit> for &'a Expr {
800     fn from(n: &'a StructLit) -> &'a Expr {
801         Expr::cast(&n.syntax).unwrap()
802     }
803 }
804 impl<'a> From<&'a CallExpr> for &'a Expr {
805     fn from(n: &'a CallExpr) -> &'a Expr {
806         Expr::cast(&n.syntax).unwrap()
807     }
808 }
809 impl<'a> From<&'a IndexExpr> for &'a Expr {
810     fn from(n: &'a IndexExpr) -> &'a Expr {
811         Expr::cast(&n.syntax).unwrap()
812     }
813 }
814 impl<'a> From<&'a MethodCallExpr> for &'a Expr {
815     fn from(n: &'a MethodCallExpr) -> &'a Expr {
816         Expr::cast(&n.syntax).unwrap()
817     }
818 }
819 impl<'a> From<&'a FieldExpr> for &'a Expr {
820     fn from(n: &'a FieldExpr) -> &'a Expr {
821         Expr::cast(&n.syntax).unwrap()
822     }
823 }
824 impl<'a> From<&'a TryExpr> for &'a Expr {
825     fn from(n: &'a TryExpr) -> &'a Expr {
826         Expr::cast(&n.syntax).unwrap()
827     }
828 }
829 impl<'a> From<&'a CastExpr> for &'a Expr {
830     fn from(n: &'a CastExpr) -> &'a Expr {
831         Expr::cast(&n.syntax).unwrap()
832     }
833 }
834 impl<'a> From<&'a RefExpr> for &'a Expr {
835     fn from(n: &'a RefExpr) -> &'a Expr {
836         Expr::cast(&n.syntax).unwrap()
837     }
838 }
839 impl<'a> From<&'a PrefixExpr> for &'a Expr {
840     fn from(n: &'a PrefixExpr) -> &'a Expr {
841         Expr::cast(&n.syntax).unwrap()
842     }
843 }
844 impl<'a> From<&'a RangeExpr> for &'a Expr {
845     fn from(n: &'a RangeExpr) -> &'a Expr {
846         Expr::cast(&n.syntax).unwrap()
847     }
848 }
849 impl<'a> From<&'a BinExpr> for &'a Expr {
850     fn from(n: &'a BinExpr) -> &'a Expr {
851         Expr::cast(&n.syntax).unwrap()
852     }
853 }
854 impl<'a> From<&'a Literal> for &'a Expr {
855     fn from(n: &'a Literal) -> &'a Expr {
856         Expr::cast(&n.syntax).unwrap()
857     }
858 }
859 impl<'a> From<&'a MacroCall> for &'a Expr {
860     fn from(n: &'a MacroCall) -> &'a Expr {
861         Expr::cast(&n.syntax).unwrap()
862     }
863 }
864
865
866 impl AstNode for Expr {
867     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
868         match syntax.kind() {
869             | TUPLE_EXPR
870             | ARRAY_EXPR
871             | PAREN_EXPR
872             | PATH_EXPR
873             | LAMBDA_EXPR
874             | IF_EXPR
875             | LOOP_EXPR
876             | FOR_EXPR
877             | WHILE_EXPR
878             | CONTINUE_EXPR
879             | BREAK_EXPR
880             | LABEL
881             | BLOCK_EXPR
882             | RETURN_EXPR
883             | MATCH_EXPR
884             | STRUCT_LIT
885             | CALL_EXPR
886             | INDEX_EXPR
887             | METHOD_CALL_EXPR
888             | FIELD_EXPR
889             | TRY_EXPR
890             | CAST_EXPR
891             | REF_EXPR
892             | PREFIX_EXPR
893             | RANGE_EXPR
894             | BIN_EXPR
895             | LITERAL
896             | MACRO_CALL => Some(Expr::from_repr(syntax.into_repr())),
897             _ => None,
898         }
899     }
900     fn syntax(&self) -> &SyntaxNode { &self.syntax }
901 }
902
903 impl ToOwned for Expr {
904     type Owned = TreeArc<Expr>;
905     fn to_owned(&self) -> TreeArc<Expr> { TreeArc::cast(self.syntax.to_owned()) }
906 }
907
908 impl Expr {
909     pub fn kind(&self) -> ExprKind {
910         match self.syntax.kind() {
911             TUPLE_EXPR => ExprKind::TupleExpr(TupleExpr::cast(&self.syntax).unwrap()),
912             ARRAY_EXPR => ExprKind::ArrayExpr(ArrayExpr::cast(&self.syntax).unwrap()),
913             PAREN_EXPR => ExprKind::ParenExpr(ParenExpr::cast(&self.syntax).unwrap()),
914             PATH_EXPR => ExprKind::PathExpr(PathExpr::cast(&self.syntax).unwrap()),
915             LAMBDA_EXPR => ExprKind::LambdaExpr(LambdaExpr::cast(&self.syntax).unwrap()),
916             IF_EXPR => ExprKind::IfExpr(IfExpr::cast(&self.syntax).unwrap()),
917             LOOP_EXPR => ExprKind::LoopExpr(LoopExpr::cast(&self.syntax).unwrap()),
918             FOR_EXPR => ExprKind::ForExpr(ForExpr::cast(&self.syntax).unwrap()),
919             WHILE_EXPR => ExprKind::WhileExpr(WhileExpr::cast(&self.syntax).unwrap()),
920             CONTINUE_EXPR => ExprKind::ContinueExpr(ContinueExpr::cast(&self.syntax).unwrap()),
921             BREAK_EXPR => ExprKind::BreakExpr(BreakExpr::cast(&self.syntax).unwrap()),
922             LABEL => ExprKind::Label(Label::cast(&self.syntax).unwrap()),
923             BLOCK_EXPR => ExprKind::BlockExpr(BlockExpr::cast(&self.syntax).unwrap()),
924             RETURN_EXPR => ExprKind::ReturnExpr(ReturnExpr::cast(&self.syntax).unwrap()),
925             MATCH_EXPR => ExprKind::MatchExpr(MatchExpr::cast(&self.syntax).unwrap()),
926             STRUCT_LIT => ExprKind::StructLit(StructLit::cast(&self.syntax).unwrap()),
927             CALL_EXPR => ExprKind::CallExpr(CallExpr::cast(&self.syntax).unwrap()),
928             INDEX_EXPR => ExprKind::IndexExpr(IndexExpr::cast(&self.syntax).unwrap()),
929             METHOD_CALL_EXPR => ExprKind::MethodCallExpr(MethodCallExpr::cast(&self.syntax).unwrap()),
930             FIELD_EXPR => ExprKind::FieldExpr(FieldExpr::cast(&self.syntax).unwrap()),
931             TRY_EXPR => ExprKind::TryExpr(TryExpr::cast(&self.syntax).unwrap()),
932             CAST_EXPR => ExprKind::CastExpr(CastExpr::cast(&self.syntax).unwrap()),
933             REF_EXPR => ExprKind::RefExpr(RefExpr::cast(&self.syntax).unwrap()),
934             PREFIX_EXPR => ExprKind::PrefixExpr(PrefixExpr::cast(&self.syntax).unwrap()),
935             RANGE_EXPR => ExprKind::RangeExpr(RangeExpr::cast(&self.syntax).unwrap()),
936             BIN_EXPR => ExprKind::BinExpr(BinExpr::cast(&self.syntax).unwrap()),
937             LITERAL => ExprKind::Literal(Literal::cast(&self.syntax).unwrap()),
938             MACRO_CALL => ExprKind::MacroCall(MacroCall::cast(&self.syntax).unwrap()),
939             _ => unreachable!(),
940         }
941     }
942 }
943
944 impl Expr {}
945
946 // ExprStmt
947 #[derive(Debug, PartialEq, Eq, Hash)]
948 #[repr(transparent)]
949 pub struct ExprStmt {
950     pub(crate) syntax: SyntaxNode,
951 }
952 unsafe impl TransparentNewType for ExprStmt {
953     type Repr = rowan::SyntaxNode;
954 }
955
956 impl AstNode for ExprStmt {
957     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
958         match syntax.kind() {
959             EXPR_STMT => Some(ExprStmt::from_repr(syntax.into_repr())),
960             _ => None,
961         }
962     }
963     fn syntax(&self) -> &SyntaxNode { &self.syntax }
964 }
965
966 impl ToOwned for ExprStmt {
967     type Owned = TreeArc<ExprStmt>;
968     fn to_owned(&self) -> TreeArc<ExprStmt> { TreeArc::cast(self.syntax.to_owned()) }
969 }
970
971
972 impl ExprStmt {
973     pub fn expr(&self) -> Option<&Expr> {
974         super::child_opt(self)
975     }
976 }
977
978 // ExternCrateItem
979 #[derive(Debug, PartialEq, Eq, Hash)]
980 #[repr(transparent)]
981 pub struct ExternCrateItem {
982     pub(crate) syntax: SyntaxNode,
983 }
984 unsafe impl TransparentNewType for ExternCrateItem {
985     type Repr = rowan::SyntaxNode;
986 }
987
988 impl AstNode for ExternCrateItem {
989     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
990         match syntax.kind() {
991             EXTERN_CRATE_ITEM => Some(ExternCrateItem::from_repr(syntax.into_repr())),
992             _ => None,
993         }
994     }
995     fn syntax(&self) -> &SyntaxNode { &self.syntax }
996 }
997
998 impl ToOwned for ExternCrateItem {
999     type Owned = TreeArc<ExternCrateItem>;
1000     fn to_owned(&self) -> TreeArc<ExternCrateItem> { TreeArc::cast(self.syntax.to_owned()) }
1001 }
1002
1003
1004 impl ExternCrateItem {
1005     pub fn name_ref(&self) -> Option<&NameRef> {
1006         super::child_opt(self)
1007     }
1008
1009     pub fn alias(&self) -> Option<&Alias> {
1010         super::child_opt(self)
1011     }
1012 }
1013
1014 // FieldExpr
1015 #[derive(Debug, PartialEq, Eq, Hash)]
1016 #[repr(transparent)]
1017 pub struct FieldExpr {
1018     pub(crate) syntax: SyntaxNode,
1019 }
1020 unsafe impl TransparentNewType for FieldExpr {
1021     type Repr = rowan::SyntaxNode;
1022 }
1023
1024 impl AstNode for FieldExpr {
1025     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1026         match syntax.kind() {
1027             FIELD_EXPR => Some(FieldExpr::from_repr(syntax.into_repr())),
1028             _ => None,
1029         }
1030     }
1031     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1032 }
1033
1034 impl ToOwned for FieldExpr {
1035     type Owned = TreeArc<FieldExpr>;
1036     fn to_owned(&self) -> TreeArc<FieldExpr> { TreeArc::cast(self.syntax.to_owned()) }
1037 }
1038
1039
1040 impl FieldExpr {
1041     pub fn expr(&self) -> Option<&Expr> {
1042         super::child_opt(self)
1043     }
1044
1045     pub fn name_ref(&self) -> Option<&NameRef> {
1046         super::child_opt(self)
1047     }
1048 }
1049
1050 // FieldPat
1051 #[derive(Debug, PartialEq, Eq, Hash)]
1052 #[repr(transparent)]
1053 pub struct FieldPat {
1054     pub(crate) syntax: SyntaxNode,
1055 }
1056 unsafe impl TransparentNewType for FieldPat {
1057     type Repr = rowan::SyntaxNode;
1058 }
1059
1060 impl AstNode for FieldPat {
1061     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1062         match syntax.kind() {
1063             FIELD_PAT => Some(FieldPat::from_repr(syntax.into_repr())),
1064             _ => None,
1065         }
1066     }
1067     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1068 }
1069
1070 impl ToOwned for FieldPat {
1071     type Owned = TreeArc<FieldPat>;
1072     fn to_owned(&self) -> TreeArc<FieldPat> { TreeArc::cast(self.syntax.to_owned()) }
1073 }
1074
1075
1076 impl ast::NameOwner for FieldPat {}
1077 impl FieldPat {
1078     pub fn pat(&self) -> Option<&Pat> {
1079         super::child_opt(self)
1080     }
1081 }
1082
1083 // FieldPatList
1084 #[derive(Debug, PartialEq, Eq, Hash)]
1085 #[repr(transparent)]
1086 pub struct FieldPatList {
1087     pub(crate) syntax: SyntaxNode,
1088 }
1089 unsafe impl TransparentNewType for FieldPatList {
1090     type Repr = rowan::SyntaxNode;
1091 }
1092
1093 impl AstNode for FieldPatList {
1094     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1095         match syntax.kind() {
1096             FIELD_PAT_LIST => Some(FieldPatList::from_repr(syntax.into_repr())),
1097             _ => None,
1098         }
1099     }
1100     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1101 }
1102
1103 impl ToOwned for FieldPatList {
1104     type Owned = TreeArc<FieldPatList>;
1105     fn to_owned(&self) -> TreeArc<FieldPatList> { TreeArc::cast(self.syntax.to_owned()) }
1106 }
1107
1108
1109 impl FieldPatList {
1110     pub fn field_pats(&self) -> impl Iterator<Item = &FieldPat> {
1111         super::children(self)
1112     }
1113
1114     pub fn bind_pats(&self) -> impl Iterator<Item = &BindPat> {
1115         super::children(self)
1116     }
1117 }
1118
1119 // FnDef
1120 #[derive(Debug, PartialEq, Eq, Hash)]
1121 #[repr(transparent)]
1122 pub struct FnDef {
1123     pub(crate) syntax: SyntaxNode,
1124 }
1125 unsafe impl TransparentNewType for FnDef {
1126     type Repr = rowan::SyntaxNode;
1127 }
1128
1129 impl AstNode for FnDef {
1130     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1131         match syntax.kind() {
1132             FN_DEF => Some(FnDef::from_repr(syntax.into_repr())),
1133             _ => None,
1134         }
1135     }
1136     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1137 }
1138
1139 impl ToOwned for FnDef {
1140     type Owned = TreeArc<FnDef>;
1141     fn to_owned(&self) -> TreeArc<FnDef> { TreeArc::cast(self.syntax.to_owned()) }
1142 }
1143
1144
1145 impl ast::VisibilityOwner for FnDef {}
1146 impl ast::NameOwner for FnDef {}
1147 impl ast::TypeParamsOwner for FnDef {}
1148 impl ast::AttrsOwner for FnDef {}
1149 impl ast::DocCommentsOwner for FnDef {}
1150 impl FnDef {
1151     pub fn param_list(&self) -> Option<&ParamList> {
1152         super::child_opt(self)
1153     }
1154
1155     pub fn body(&self) -> Option<&Block> {
1156         super::child_opt(self)
1157     }
1158
1159     pub fn ret_type(&self) -> Option<&RetType> {
1160         super::child_opt(self)
1161     }
1162 }
1163
1164 // FnPointerType
1165 #[derive(Debug, PartialEq, Eq, Hash)]
1166 #[repr(transparent)]
1167 pub struct FnPointerType {
1168     pub(crate) syntax: SyntaxNode,
1169 }
1170 unsafe impl TransparentNewType for FnPointerType {
1171     type Repr = rowan::SyntaxNode;
1172 }
1173
1174 impl AstNode for FnPointerType {
1175     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1176         match syntax.kind() {
1177             FN_POINTER_TYPE => Some(FnPointerType::from_repr(syntax.into_repr())),
1178             _ => None,
1179         }
1180     }
1181     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1182 }
1183
1184 impl ToOwned for FnPointerType {
1185     type Owned = TreeArc<FnPointerType>;
1186     fn to_owned(&self) -> TreeArc<FnPointerType> { TreeArc::cast(self.syntax.to_owned()) }
1187 }
1188
1189
1190 impl FnPointerType {
1191     pub fn param_list(&self) -> Option<&ParamList> {
1192         super::child_opt(self)
1193     }
1194
1195     pub fn ret_type(&self) -> Option<&RetType> {
1196         super::child_opt(self)
1197     }
1198 }
1199
1200 // ForExpr
1201 #[derive(Debug, PartialEq, Eq, Hash)]
1202 #[repr(transparent)]
1203 pub struct ForExpr {
1204     pub(crate) syntax: SyntaxNode,
1205 }
1206 unsafe impl TransparentNewType for ForExpr {
1207     type Repr = rowan::SyntaxNode;
1208 }
1209
1210 impl AstNode for ForExpr {
1211     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1212         match syntax.kind() {
1213             FOR_EXPR => Some(ForExpr::from_repr(syntax.into_repr())),
1214             _ => None,
1215         }
1216     }
1217     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1218 }
1219
1220 impl ToOwned for ForExpr {
1221     type Owned = TreeArc<ForExpr>;
1222     fn to_owned(&self) -> TreeArc<ForExpr> { TreeArc::cast(self.syntax.to_owned()) }
1223 }
1224
1225
1226 impl ast::LoopBodyOwner for ForExpr {}
1227 impl ForExpr {
1228     pub fn pat(&self) -> Option<&Pat> {
1229         super::child_opt(self)
1230     }
1231
1232     pub fn iterable(&self) -> Option<&Expr> {
1233         super::child_opt(self)
1234     }
1235 }
1236
1237 // ForType
1238 #[derive(Debug, PartialEq, Eq, Hash)]
1239 #[repr(transparent)]
1240 pub struct ForType {
1241     pub(crate) syntax: SyntaxNode,
1242 }
1243 unsafe impl TransparentNewType for ForType {
1244     type Repr = rowan::SyntaxNode;
1245 }
1246
1247 impl AstNode for ForType {
1248     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1249         match syntax.kind() {
1250             FOR_TYPE => Some(ForType::from_repr(syntax.into_repr())),
1251             _ => None,
1252         }
1253     }
1254     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1255 }
1256
1257 impl ToOwned for ForType {
1258     type Owned = TreeArc<ForType>;
1259     fn to_owned(&self) -> TreeArc<ForType> { TreeArc::cast(self.syntax.to_owned()) }
1260 }
1261
1262
1263 impl ForType {
1264     pub fn type_ref(&self) -> Option<&TypeRef> {
1265         super::child_opt(self)
1266     }
1267 }
1268
1269 // IfExpr
1270 #[derive(Debug, PartialEq, Eq, Hash)]
1271 #[repr(transparent)]
1272 pub struct IfExpr {
1273     pub(crate) syntax: SyntaxNode,
1274 }
1275 unsafe impl TransparentNewType for IfExpr {
1276     type Repr = rowan::SyntaxNode;
1277 }
1278
1279 impl AstNode for IfExpr {
1280     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1281         match syntax.kind() {
1282             IF_EXPR => Some(IfExpr::from_repr(syntax.into_repr())),
1283             _ => None,
1284         }
1285     }
1286     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1287 }
1288
1289 impl ToOwned for IfExpr {
1290     type Owned = TreeArc<IfExpr>;
1291     fn to_owned(&self) -> TreeArc<IfExpr> { TreeArc::cast(self.syntax.to_owned()) }
1292 }
1293
1294
1295 impl IfExpr {
1296     pub fn condition(&self) -> Option<&Condition> {
1297         super::child_opt(self)
1298     }
1299 }
1300
1301 // ImplBlock
1302 #[derive(Debug, PartialEq, Eq, Hash)]
1303 #[repr(transparent)]
1304 pub struct ImplBlock {
1305     pub(crate) syntax: SyntaxNode,
1306 }
1307 unsafe impl TransparentNewType for ImplBlock {
1308     type Repr = rowan::SyntaxNode;
1309 }
1310
1311 impl AstNode for ImplBlock {
1312     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1313         match syntax.kind() {
1314             IMPL_BLOCK => Some(ImplBlock::from_repr(syntax.into_repr())),
1315             _ => None,
1316         }
1317     }
1318     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1319 }
1320
1321 impl ToOwned for ImplBlock {
1322     type Owned = TreeArc<ImplBlock>;
1323     fn to_owned(&self) -> TreeArc<ImplBlock> { TreeArc::cast(self.syntax.to_owned()) }
1324 }
1325
1326
1327 impl ast::TypeParamsOwner for ImplBlock {}
1328 impl ast::AttrsOwner for ImplBlock {}
1329 impl ImplBlock {
1330     pub fn item_list(&self) -> Option<&ItemList> {
1331         super::child_opt(self)
1332     }
1333 }
1334
1335 // ImplItem
1336 #[derive(Debug, PartialEq, Eq, Hash)]
1337 #[repr(transparent)]
1338 pub struct ImplItem {
1339     pub(crate) syntax: SyntaxNode,
1340 }
1341 unsafe impl TransparentNewType for ImplItem {
1342     type Repr = rowan::SyntaxNode;
1343 }
1344
1345 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
1346 pub enum ImplItemKind<'a> {
1347     FnDef(&'a FnDef),
1348     TypeAliasDef(&'a TypeAliasDef),
1349     ConstDef(&'a ConstDef),
1350 }
1351 impl<'a> From<&'a FnDef> for &'a ImplItem {
1352     fn from(n: &'a FnDef) -> &'a ImplItem {
1353         ImplItem::cast(&n.syntax).unwrap()
1354     }
1355 }
1356 impl<'a> From<&'a TypeAliasDef> for &'a ImplItem {
1357     fn from(n: &'a TypeAliasDef) -> &'a ImplItem {
1358         ImplItem::cast(&n.syntax).unwrap()
1359     }
1360 }
1361 impl<'a> From<&'a ConstDef> for &'a ImplItem {
1362     fn from(n: &'a ConstDef) -> &'a ImplItem {
1363         ImplItem::cast(&n.syntax).unwrap()
1364     }
1365 }
1366
1367
1368 impl AstNode for ImplItem {
1369     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1370         match syntax.kind() {
1371             | FN_DEF
1372             | TYPE_ALIAS_DEF
1373             | CONST_DEF => Some(ImplItem::from_repr(syntax.into_repr())),
1374             _ => None,
1375         }
1376     }
1377     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1378 }
1379
1380 impl ToOwned for ImplItem {
1381     type Owned = TreeArc<ImplItem>;
1382     fn to_owned(&self) -> TreeArc<ImplItem> { TreeArc::cast(self.syntax.to_owned()) }
1383 }
1384
1385 impl ImplItem {
1386     pub fn kind(&self) -> ImplItemKind {
1387         match self.syntax.kind() {
1388             FN_DEF => ImplItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()),
1389             TYPE_ALIAS_DEF => ImplItemKind::TypeAliasDef(TypeAliasDef::cast(&self.syntax).unwrap()),
1390             CONST_DEF => ImplItemKind::ConstDef(ConstDef::cast(&self.syntax).unwrap()),
1391             _ => unreachable!(),
1392         }
1393     }
1394 }
1395
1396 impl ImplItem {}
1397
1398 // ImplTraitType
1399 #[derive(Debug, PartialEq, Eq, Hash)]
1400 #[repr(transparent)]
1401 pub struct ImplTraitType {
1402     pub(crate) syntax: SyntaxNode,
1403 }
1404 unsafe impl TransparentNewType for ImplTraitType {
1405     type Repr = rowan::SyntaxNode;
1406 }
1407
1408 impl AstNode for ImplTraitType {
1409     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1410         match syntax.kind() {
1411             IMPL_TRAIT_TYPE => Some(ImplTraitType::from_repr(syntax.into_repr())),
1412             _ => None,
1413         }
1414     }
1415     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1416 }
1417
1418 impl ToOwned for ImplTraitType {
1419     type Owned = TreeArc<ImplTraitType>;
1420     fn to_owned(&self) -> TreeArc<ImplTraitType> { TreeArc::cast(self.syntax.to_owned()) }
1421 }
1422
1423
1424 impl ast::TypeBoundsOwner for ImplTraitType {}
1425 impl ImplTraitType {}
1426
1427 // IndexExpr
1428 #[derive(Debug, PartialEq, Eq, Hash)]
1429 #[repr(transparent)]
1430 pub struct IndexExpr {
1431     pub(crate) syntax: SyntaxNode,
1432 }
1433 unsafe impl TransparentNewType for IndexExpr {
1434     type Repr = rowan::SyntaxNode;
1435 }
1436
1437 impl AstNode for IndexExpr {
1438     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1439         match syntax.kind() {
1440             INDEX_EXPR => Some(IndexExpr::from_repr(syntax.into_repr())),
1441             _ => None,
1442         }
1443     }
1444     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1445 }
1446
1447 impl ToOwned for IndexExpr {
1448     type Owned = TreeArc<IndexExpr>;
1449     fn to_owned(&self) -> TreeArc<IndexExpr> { TreeArc::cast(self.syntax.to_owned()) }
1450 }
1451
1452
1453 impl IndexExpr {}
1454
1455 // ItemList
1456 #[derive(Debug, PartialEq, Eq, Hash)]
1457 #[repr(transparent)]
1458 pub struct ItemList {
1459     pub(crate) syntax: SyntaxNode,
1460 }
1461 unsafe impl TransparentNewType for ItemList {
1462     type Repr = rowan::SyntaxNode;
1463 }
1464
1465 impl AstNode for ItemList {
1466     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1467         match syntax.kind() {
1468             ITEM_LIST => Some(ItemList::from_repr(syntax.into_repr())),
1469             _ => None,
1470         }
1471     }
1472     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1473 }
1474
1475 impl ToOwned for ItemList {
1476     type Owned = TreeArc<ItemList>;
1477     fn to_owned(&self) -> TreeArc<ItemList> { TreeArc::cast(self.syntax.to_owned()) }
1478 }
1479
1480
1481 impl ast::FnDefOwner for ItemList {}
1482 impl ast::ModuleItemOwner for ItemList {}
1483 impl ItemList {
1484     pub fn impl_items(&self) -> impl Iterator<Item = &ImplItem> {
1485         super::children(self)
1486     }
1487 }
1488
1489 // Label
1490 #[derive(Debug, PartialEq, Eq, Hash)]
1491 #[repr(transparent)]
1492 pub struct Label {
1493     pub(crate) syntax: SyntaxNode,
1494 }
1495 unsafe impl TransparentNewType for Label {
1496     type Repr = rowan::SyntaxNode;
1497 }
1498
1499 impl AstNode for Label {
1500     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1501         match syntax.kind() {
1502             LABEL => Some(Label::from_repr(syntax.into_repr())),
1503             _ => None,
1504         }
1505     }
1506     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1507 }
1508
1509 impl ToOwned for Label {
1510     type Owned = TreeArc<Label>;
1511     fn to_owned(&self) -> TreeArc<Label> { TreeArc::cast(self.syntax.to_owned()) }
1512 }
1513
1514
1515 impl Label {}
1516
1517 // LambdaExpr
1518 #[derive(Debug, PartialEq, Eq, Hash)]
1519 #[repr(transparent)]
1520 pub struct LambdaExpr {
1521     pub(crate) syntax: SyntaxNode,
1522 }
1523 unsafe impl TransparentNewType for LambdaExpr {
1524     type Repr = rowan::SyntaxNode;
1525 }
1526
1527 impl AstNode for LambdaExpr {
1528     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1529         match syntax.kind() {
1530             LAMBDA_EXPR => Some(LambdaExpr::from_repr(syntax.into_repr())),
1531             _ => None,
1532         }
1533     }
1534     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1535 }
1536
1537 impl ToOwned for LambdaExpr {
1538     type Owned = TreeArc<LambdaExpr>;
1539     fn to_owned(&self) -> TreeArc<LambdaExpr> { TreeArc::cast(self.syntax.to_owned()) }
1540 }
1541
1542
1543 impl LambdaExpr {
1544     pub fn param_list(&self) -> Option<&ParamList> {
1545         super::child_opt(self)
1546     }
1547
1548     pub fn body(&self) -> Option<&Expr> {
1549         super::child_opt(self)
1550     }
1551 }
1552
1553 // LetStmt
1554 #[derive(Debug, PartialEq, Eq, Hash)]
1555 #[repr(transparent)]
1556 pub struct LetStmt {
1557     pub(crate) syntax: SyntaxNode,
1558 }
1559 unsafe impl TransparentNewType for LetStmt {
1560     type Repr = rowan::SyntaxNode;
1561 }
1562
1563 impl AstNode for LetStmt {
1564     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1565         match syntax.kind() {
1566             LET_STMT => Some(LetStmt::from_repr(syntax.into_repr())),
1567             _ => None,
1568         }
1569     }
1570     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1571 }
1572
1573 impl ToOwned for LetStmt {
1574     type Owned = TreeArc<LetStmt>;
1575     fn to_owned(&self) -> TreeArc<LetStmt> { TreeArc::cast(self.syntax.to_owned()) }
1576 }
1577
1578
1579 impl ast::TypeAscriptionOwner for LetStmt {}
1580 impl LetStmt {
1581     pub fn pat(&self) -> Option<&Pat> {
1582         super::child_opt(self)
1583     }
1584
1585     pub fn initializer(&self) -> Option<&Expr> {
1586         super::child_opt(self)
1587     }
1588 }
1589
1590 // LifetimeArg
1591 #[derive(Debug, PartialEq, Eq, Hash)]
1592 #[repr(transparent)]
1593 pub struct LifetimeArg {
1594     pub(crate) syntax: SyntaxNode,
1595 }
1596 unsafe impl TransparentNewType for LifetimeArg {
1597     type Repr = rowan::SyntaxNode;
1598 }
1599
1600 impl AstNode for LifetimeArg {
1601     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1602         match syntax.kind() {
1603             LIFETIME_ARG => Some(LifetimeArg::from_repr(syntax.into_repr())),
1604             _ => None,
1605         }
1606     }
1607     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1608 }
1609
1610 impl ToOwned for LifetimeArg {
1611     type Owned = TreeArc<LifetimeArg>;
1612     fn to_owned(&self) -> TreeArc<LifetimeArg> { TreeArc::cast(self.syntax.to_owned()) }
1613 }
1614
1615
1616 impl LifetimeArg {}
1617
1618 // LifetimeParam
1619 #[derive(Debug, PartialEq, Eq, Hash)]
1620 #[repr(transparent)]
1621 pub struct LifetimeParam {
1622     pub(crate) syntax: SyntaxNode,
1623 }
1624 unsafe impl TransparentNewType for LifetimeParam {
1625     type Repr = rowan::SyntaxNode;
1626 }
1627
1628 impl AstNode for LifetimeParam {
1629     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1630         match syntax.kind() {
1631             LIFETIME_PARAM => Some(LifetimeParam::from_repr(syntax.into_repr())),
1632             _ => None,
1633         }
1634     }
1635     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1636 }
1637
1638 impl ToOwned for LifetimeParam {
1639     type Owned = TreeArc<LifetimeParam>;
1640     fn to_owned(&self) -> TreeArc<LifetimeParam> { TreeArc::cast(self.syntax.to_owned()) }
1641 }
1642
1643
1644 impl ast::AttrsOwner for LifetimeParam {}
1645 impl LifetimeParam {}
1646
1647 // Literal
1648 #[derive(Debug, PartialEq, Eq, Hash)]
1649 #[repr(transparent)]
1650 pub struct Literal {
1651     pub(crate) syntax: SyntaxNode,
1652 }
1653 unsafe impl TransparentNewType for Literal {
1654     type Repr = rowan::SyntaxNode;
1655 }
1656
1657 impl AstNode for Literal {
1658     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1659         match syntax.kind() {
1660             LITERAL => Some(Literal::from_repr(syntax.into_repr())),
1661             _ => None,
1662         }
1663     }
1664     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1665 }
1666
1667 impl ToOwned for Literal {
1668     type Owned = TreeArc<Literal>;
1669     fn to_owned(&self) -> TreeArc<Literal> { TreeArc::cast(self.syntax.to_owned()) }
1670 }
1671
1672
1673 impl Literal {}
1674
1675 // LiteralPat
1676 #[derive(Debug, PartialEq, Eq, Hash)]
1677 #[repr(transparent)]
1678 pub struct LiteralPat {
1679     pub(crate) syntax: SyntaxNode,
1680 }
1681 unsafe impl TransparentNewType for LiteralPat {
1682     type Repr = rowan::SyntaxNode;
1683 }
1684
1685 impl AstNode for LiteralPat {
1686     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1687         match syntax.kind() {
1688             LITERAL_PAT => Some(LiteralPat::from_repr(syntax.into_repr())),
1689             _ => None,
1690         }
1691     }
1692     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1693 }
1694
1695 impl ToOwned for LiteralPat {
1696     type Owned = TreeArc<LiteralPat>;
1697     fn to_owned(&self) -> TreeArc<LiteralPat> { TreeArc::cast(self.syntax.to_owned()) }
1698 }
1699
1700
1701 impl LiteralPat {
1702     pub fn literal(&self) -> Option<&Literal> {
1703         super::child_opt(self)
1704     }
1705 }
1706
1707 // LoopExpr
1708 #[derive(Debug, PartialEq, Eq, Hash)]
1709 #[repr(transparent)]
1710 pub struct LoopExpr {
1711     pub(crate) syntax: SyntaxNode,
1712 }
1713 unsafe impl TransparentNewType for LoopExpr {
1714     type Repr = rowan::SyntaxNode;
1715 }
1716
1717 impl AstNode for LoopExpr {
1718     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1719         match syntax.kind() {
1720             LOOP_EXPR => Some(LoopExpr::from_repr(syntax.into_repr())),
1721             _ => None,
1722         }
1723     }
1724     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1725 }
1726
1727 impl ToOwned for LoopExpr {
1728     type Owned = TreeArc<LoopExpr>;
1729     fn to_owned(&self) -> TreeArc<LoopExpr> { TreeArc::cast(self.syntax.to_owned()) }
1730 }
1731
1732
1733 impl ast::LoopBodyOwner for LoopExpr {}
1734 impl LoopExpr {}
1735
1736 // MacroCall
1737 #[derive(Debug, PartialEq, Eq, Hash)]
1738 #[repr(transparent)]
1739 pub struct MacroCall {
1740     pub(crate) syntax: SyntaxNode,
1741 }
1742 unsafe impl TransparentNewType for MacroCall {
1743     type Repr = rowan::SyntaxNode;
1744 }
1745
1746 impl AstNode for MacroCall {
1747     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1748         match syntax.kind() {
1749             MACRO_CALL => Some(MacroCall::from_repr(syntax.into_repr())),
1750             _ => None,
1751         }
1752     }
1753     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1754 }
1755
1756 impl ToOwned for MacroCall {
1757     type Owned = TreeArc<MacroCall>;
1758     fn to_owned(&self) -> TreeArc<MacroCall> { TreeArc::cast(self.syntax.to_owned()) }
1759 }
1760
1761
1762 impl ast::NameOwner for MacroCall {}
1763 impl ast::AttrsOwner for MacroCall {}
1764 impl ast::DocCommentsOwner for MacroCall {}
1765 impl MacroCall {
1766     pub fn token_tree(&self) -> Option<&TokenTree> {
1767         super::child_opt(self)
1768     }
1769
1770     pub fn path(&self) -> Option<&Path> {
1771         super::child_opt(self)
1772     }
1773 }
1774
1775 // MacroItems
1776 #[derive(Debug, PartialEq, Eq, Hash)]
1777 #[repr(transparent)]
1778 pub struct MacroItems {
1779     pub(crate) syntax: SyntaxNode,
1780 }
1781 unsafe impl TransparentNewType for MacroItems {
1782     type Repr = rowan::SyntaxNode;
1783 }
1784
1785 impl AstNode for MacroItems {
1786     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1787         match syntax.kind() {
1788             MACRO_ITEMS => Some(MacroItems::from_repr(syntax.into_repr())),
1789             _ => None,
1790         }
1791     }
1792     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1793 }
1794
1795 impl ToOwned for MacroItems {
1796     type Owned = TreeArc<MacroItems>;
1797     fn to_owned(&self) -> TreeArc<MacroItems> { TreeArc::cast(self.syntax.to_owned()) }
1798 }
1799
1800
1801 impl ast::ModuleItemOwner for MacroItems {}
1802 impl ast::FnDefOwner for MacroItems {}
1803 impl MacroItems {}
1804
1805 // MacroStmts
1806 #[derive(Debug, PartialEq, Eq, Hash)]
1807 #[repr(transparent)]
1808 pub struct MacroStmts {
1809     pub(crate) syntax: SyntaxNode,
1810 }
1811 unsafe impl TransparentNewType for MacroStmts {
1812     type Repr = rowan::SyntaxNode;
1813 }
1814
1815 impl AstNode for MacroStmts {
1816     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1817         match syntax.kind() {
1818             MACRO_STMTS => Some(MacroStmts::from_repr(syntax.into_repr())),
1819             _ => None,
1820         }
1821     }
1822     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1823 }
1824
1825 impl ToOwned for MacroStmts {
1826     type Owned = TreeArc<MacroStmts>;
1827     fn to_owned(&self) -> TreeArc<MacroStmts> { TreeArc::cast(self.syntax.to_owned()) }
1828 }
1829
1830
1831 impl MacroStmts {
1832     pub fn statements(&self) -> impl Iterator<Item = &Stmt> {
1833         super::children(self)
1834     }
1835
1836     pub fn expr(&self) -> Option<&Expr> {
1837         super::child_opt(self)
1838     }
1839 }
1840
1841 // MatchArm
1842 #[derive(Debug, PartialEq, Eq, Hash)]
1843 #[repr(transparent)]
1844 pub struct MatchArm {
1845     pub(crate) syntax: SyntaxNode,
1846 }
1847 unsafe impl TransparentNewType for MatchArm {
1848     type Repr = rowan::SyntaxNode;
1849 }
1850
1851 impl AstNode for MatchArm {
1852     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1853         match syntax.kind() {
1854             MATCH_ARM => Some(MatchArm::from_repr(syntax.into_repr())),
1855             _ => None,
1856         }
1857     }
1858     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1859 }
1860
1861 impl ToOwned for MatchArm {
1862     type Owned = TreeArc<MatchArm>;
1863     fn to_owned(&self) -> TreeArc<MatchArm> { TreeArc::cast(self.syntax.to_owned()) }
1864 }
1865
1866
1867 impl ast::AttrsOwner for MatchArm {}
1868 impl MatchArm {
1869     pub fn pats(&self) -> impl Iterator<Item = &Pat> {
1870         super::children(self)
1871     }
1872
1873     pub fn guard(&self) -> Option<&MatchGuard> {
1874         super::child_opt(self)
1875     }
1876
1877     pub fn expr(&self) -> Option<&Expr> {
1878         super::child_opt(self)
1879     }
1880 }
1881
1882 // MatchArmList
1883 #[derive(Debug, PartialEq, Eq, Hash)]
1884 #[repr(transparent)]
1885 pub struct MatchArmList {
1886     pub(crate) syntax: SyntaxNode,
1887 }
1888 unsafe impl TransparentNewType for MatchArmList {
1889     type Repr = rowan::SyntaxNode;
1890 }
1891
1892 impl AstNode for MatchArmList {
1893     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1894         match syntax.kind() {
1895             MATCH_ARM_LIST => Some(MatchArmList::from_repr(syntax.into_repr())),
1896             _ => None,
1897         }
1898     }
1899     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1900 }
1901
1902 impl ToOwned for MatchArmList {
1903     type Owned = TreeArc<MatchArmList>;
1904     fn to_owned(&self) -> TreeArc<MatchArmList> { TreeArc::cast(self.syntax.to_owned()) }
1905 }
1906
1907
1908 impl ast::AttrsOwner for MatchArmList {}
1909 impl MatchArmList {
1910     pub fn arms(&self) -> impl Iterator<Item = &MatchArm> {
1911         super::children(self)
1912     }
1913 }
1914
1915 // MatchExpr
1916 #[derive(Debug, PartialEq, Eq, Hash)]
1917 #[repr(transparent)]
1918 pub struct MatchExpr {
1919     pub(crate) syntax: SyntaxNode,
1920 }
1921 unsafe impl TransparentNewType for MatchExpr {
1922     type Repr = rowan::SyntaxNode;
1923 }
1924
1925 impl AstNode for MatchExpr {
1926     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1927         match syntax.kind() {
1928             MATCH_EXPR => Some(MatchExpr::from_repr(syntax.into_repr())),
1929             _ => None,
1930         }
1931     }
1932     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1933 }
1934
1935 impl ToOwned for MatchExpr {
1936     type Owned = TreeArc<MatchExpr>;
1937     fn to_owned(&self) -> TreeArc<MatchExpr> { TreeArc::cast(self.syntax.to_owned()) }
1938 }
1939
1940
1941 impl MatchExpr {
1942     pub fn expr(&self) -> Option<&Expr> {
1943         super::child_opt(self)
1944     }
1945
1946     pub fn match_arm_list(&self) -> Option<&MatchArmList> {
1947         super::child_opt(self)
1948     }
1949 }
1950
1951 // MatchGuard
1952 #[derive(Debug, PartialEq, Eq, Hash)]
1953 #[repr(transparent)]
1954 pub struct MatchGuard {
1955     pub(crate) syntax: SyntaxNode,
1956 }
1957 unsafe impl TransparentNewType for MatchGuard {
1958     type Repr = rowan::SyntaxNode;
1959 }
1960
1961 impl AstNode for MatchGuard {
1962     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1963         match syntax.kind() {
1964             MATCH_GUARD => Some(MatchGuard::from_repr(syntax.into_repr())),
1965             _ => None,
1966         }
1967     }
1968     fn syntax(&self) -> &SyntaxNode { &self.syntax }
1969 }
1970
1971 impl ToOwned for MatchGuard {
1972     type Owned = TreeArc<MatchGuard>;
1973     fn to_owned(&self) -> TreeArc<MatchGuard> { TreeArc::cast(self.syntax.to_owned()) }
1974 }
1975
1976
1977 impl MatchGuard {
1978     pub fn expr(&self) -> Option<&Expr> {
1979         super::child_opt(self)
1980     }
1981 }
1982
1983 // MethodCallExpr
1984 #[derive(Debug, PartialEq, Eq, Hash)]
1985 #[repr(transparent)]
1986 pub struct MethodCallExpr {
1987     pub(crate) syntax: SyntaxNode,
1988 }
1989 unsafe impl TransparentNewType for MethodCallExpr {
1990     type Repr = rowan::SyntaxNode;
1991 }
1992
1993 impl AstNode for MethodCallExpr {
1994     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1995         match syntax.kind() {
1996             METHOD_CALL_EXPR => Some(MethodCallExpr::from_repr(syntax.into_repr())),
1997             _ => None,
1998         }
1999     }
2000     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2001 }
2002
2003 impl ToOwned for MethodCallExpr {
2004     type Owned = TreeArc<MethodCallExpr>;
2005     fn to_owned(&self) -> TreeArc<MethodCallExpr> { TreeArc::cast(self.syntax.to_owned()) }
2006 }
2007
2008
2009 impl ast::ArgListOwner for MethodCallExpr {}
2010 impl MethodCallExpr {
2011     pub fn expr(&self) -> Option<&Expr> {
2012         super::child_opt(self)
2013     }
2014
2015     pub fn name_ref(&self) -> Option<&NameRef> {
2016         super::child_opt(self)
2017     }
2018
2019     pub fn type_arg_list(&self) -> Option<&TypeArgList> {
2020         super::child_opt(self)
2021     }
2022 }
2023
2024 // Module
2025 #[derive(Debug, PartialEq, Eq, Hash)]
2026 #[repr(transparent)]
2027 pub struct Module {
2028     pub(crate) syntax: SyntaxNode,
2029 }
2030 unsafe impl TransparentNewType for Module {
2031     type Repr = rowan::SyntaxNode;
2032 }
2033
2034 impl AstNode for Module {
2035     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2036         match syntax.kind() {
2037             MODULE => Some(Module::from_repr(syntax.into_repr())),
2038             _ => None,
2039         }
2040     }
2041     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2042 }
2043
2044 impl ToOwned for Module {
2045     type Owned = TreeArc<Module>;
2046     fn to_owned(&self) -> TreeArc<Module> { TreeArc::cast(self.syntax.to_owned()) }
2047 }
2048
2049
2050 impl ast::VisibilityOwner for Module {}
2051 impl ast::NameOwner for Module {}
2052 impl ast::AttrsOwner for Module {}
2053 impl ast::DocCommentsOwner for Module {}
2054 impl Module {
2055     pub fn item_list(&self) -> Option<&ItemList> {
2056         super::child_opt(self)
2057     }
2058 }
2059
2060 // ModuleItem
2061 #[derive(Debug, PartialEq, Eq, Hash)]
2062 #[repr(transparent)]
2063 pub struct ModuleItem {
2064     pub(crate) syntax: SyntaxNode,
2065 }
2066 unsafe impl TransparentNewType for ModuleItem {
2067     type Repr = rowan::SyntaxNode;
2068 }
2069
2070 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2071 pub enum ModuleItemKind<'a> {
2072     StructDef(&'a StructDef),
2073     EnumDef(&'a EnumDef),
2074     FnDef(&'a FnDef),
2075     TraitDef(&'a TraitDef),
2076     TypeAliasDef(&'a TypeAliasDef),
2077     ImplBlock(&'a ImplBlock),
2078     UseItem(&'a UseItem),
2079     ExternCrateItem(&'a ExternCrateItem),
2080     ConstDef(&'a ConstDef),
2081     StaticDef(&'a StaticDef),
2082     Module(&'a Module),
2083 }
2084 impl<'a> From<&'a StructDef> for &'a ModuleItem {
2085     fn from(n: &'a StructDef) -> &'a ModuleItem {
2086         ModuleItem::cast(&n.syntax).unwrap()
2087     }
2088 }
2089 impl<'a> From<&'a EnumDef> for &'a ModuleItem {
2090     fn from(n: &'a EnumDef) -> &'a ModuleItem {
2091         ModuleItem::cast(&n.syntax).unwrap()
2092     }
2093 }
2094 impl<'a> From<&'a FnDef> for &'a ModuleItem {
2095     fn from(n: &'a FnDef) -> &'a ModuleItem {
2096         ModuleItem::cast(&n.syntax).unwrap()
2097     }
2098 }
2099 impl<'a> From<&'a TraitDef> for &'a ModuleItem {
2100     fn from(n: &'a TraitDef) -> &'a ModuleItem {
2101         ModuleItem::cast(&n.syntax).unwrap()
2102     }
2103 }
2104 impl<'a> From<&'a TypeAliasDef> for &'a ModuleItem {
2105     fn from(n: &'a TypeAliasDef) -> &'a ModuleItem {
2106         ModuleItem::cast(&n.syntax).unwrap()
2107     }
2108 }
2109 impl<'a> From<&'a ImplBlock> for &'a ModuleItem {
2110     fn from(n: &'a ImplBlock) -> &'a ModuleItem {
2111         ModuleItem::cast(&n.syntax).unwrap()
2112     }
2113 }
2114 impl<'a> From<&'a UseItem> for &'a ModuleItem {
2115     fn from(n: &'a UseItem) -> &'a ModuleItem {
2116         ModuleItem::cast(&n.syntax).unwrap()
2117     }
2118 }
2119 impl<'a> From<&'a ExternCrateItem> for &'a ModuleItem {
2120     fn from(n: &'a ExternCrateItem) -> &'a ModuleItem {
2121         ModuleItem::cast(&n.syntax).unwrap()
2122     }
2123 }
2124 impl<'a> From<&'a ConstDef> for &'a ModuleItem {
2125     fn from(n: &'a ConstDef) -> &'a ModuleItem {
2126         ModuleItem::cast(&n.syntax).unwrap()
2127     }
2128 }
2129 impl<'a> From<&'a StaticDef> for &'a ModuleItem {
2130     fn from(n: &'a StaticDef) -> &'a ModuleItem {
2131         ModuleItem::cast(&n.syntax).unwrap()
2132     }
2133 }
2134 impl<'a> From<&'a Module> for &'a ModuleItem {
2135     fn from(n: &'a Module) -> &'a ModuleItem {
2136         ModuleItem::cast(&n.syntax).unwrap()
2137     }
2138 }
2139
2140
2141 impl AstNode for ModuleItem {
2142     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2143         match syntax.kind() {
2144             | STRUCT_DEF
2145             | ENUM_DEF
2146             | FN_DEF
2147             | TRAIT_DEF
2148             | TYPE_ALIAS_DEF
2149             | IMPL_BLOCK
2150             | USE_ITEM
2151             | EXTERN_CRATE_ITEM
2152             | CONST_DEF
2153             | STATIC_DEF
2154             | MODULE => Some(ModuleItem::from_repr(syntax.into_repr())),
2155             _ => None,
2156         }
2157     }
2158     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2159 }
2160
2161 impl ToOwned for ModuleItem {
2162     type Owned = TreeArc<ModuleItem>;
2163     fn to_owned(&self) -> TreeArc<ModuleItem> { TreeArc::cast(self.syntax.to_owned()) }
2164 }
2165
2166 impl ModuleItem {
2167     pub fn kind(&self) -> ModuleItemKind {
2168         match self.syntax.kind() {
2169             STRUCT_DEF => ModuleItemKind::StructDef(StructDef::cast(&self.syntax).unwrap()),
2170             ENUM_DEF => ModuleItemKind::EnumDef(EnumDef::cast(&self.syntax).unwrap()),
2171             FN_DEF => ModuleItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()),
2172             TRAIT_DEF => ModuleItemKind::TraitDef(TraitDef::cast(&self.syntax).unwrap()),
2173             TYPE_ALIAS_DEF => ModuleItemKind::TypeAliasDef(TypeAliasDef::cast(&self.syntax).unwrap()),
2174             IMPL_BLOCK => ModuleItemKind::ImplBlock(ImplBlock::cast(&self.syntax).unwrap()),
2175             USE_ITEM => ModuleItemKind::UseItem(UseItem::cast(&self.syntax).unwrap()),
2176             EXTERN_CRATE_ITEM => ModuleItemKind::ExternCrateItem(ExternCrateItem::cast(&self.syntax).unwrap()),
2177             CONST_DEF => ModuleItemKind::ConstDef(ConstDef::cast(&self.syntax).unwrap()),
2178             STATIC_DEF => ModuleItemKind::StaticDef(StaticDef::cast(&self.syntax).unwrap()),
2179             MODULE => ModuleItemKind::Module(Module::cast(&self.syntax).unwrap()),
2180             _ => unreachable!(),
2181         }
2182     }
2183 }
2184
2185 impl ModuleItem {}
2186
2187 // Name
2188 #[derive(Debug, PartialEq, Eq, Hash)]
2189 #[repr(transparent)]
2190 pub struct Name {
2191     pub(crate) syntax: SyntaxNode,
2192 }
2193 unsafe impl TransparentNewType for Name {
2194     type Repr = rowan::SyntaxNode;
2195 }
2196
2197 impl AstNode for Name {
2198     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2199         match syntax.kind() {
2200             NAME => Some(Name::from_repr(syntax.into_repr())),
2201             _ => None,
2202         }
2203     }
2204     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2205 }
2206
2207 impl ToOwned for Name {
2208     type Owned = TreeArc<Name>;
2209     fn to_owned(&self) -> TreeArc<Name> { TreeArc::cast(self.syntax.to_owned()) }
2210 }
2211
2212
2213 impl Name {}
2214
2215 // NameRef
2216 #[derive(Debug, PartialEq, Eq, Hash)]
2217 #[repr(transparent)]
2218 pub struct NameRef {
2219     pub(crate) syntax: SyntaxNode,
2220 }
2221 unsafe impl TransparentNewType for NameRef {
2222     type Repr = rowan::SyntaxNode;
2223 }
2224
2225 impl AstNode for NameRef {
2226     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2227         match syntax.kind() {
2228             NAME_REF => Some(NameRef::from_repr(syntax.into_repr())),
2229             _ => None,
2230         }
2231     }
2232     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2233 }
2234
2235 impl ToOwned for NameRef {
2236     type Owned = TreeArc<NameRef>;
2237     fn to_owned(&self) -> TreeArc<NameRef> { TreeArc::cast(self.syntax.to_owned()) }
2238 }
2239
2240
2241 impl NameRef {}
2242
2243 // NamedField
2244 #[derive(Debug, PartialEq, Eq, Hash)]
2245 #[repr(transparent)]
2246 pub struct NamedField {
2247     pub(crate) syntax: SyntaxNode,
2248 }
2249 unsafe impl TransparentNewType for NamedField {
2250     type Repr = rowan::SyntaxNode;
2251 }
2252
2253 impl AstNode for NamedField {
2254     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2255         match syntax.kind() {
2256             NAMED_FIELD => Some(NamedField::from_repr(syntax.into_repr())),
2257             _ => None,
2258         }
2259     }
2260     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2261 }
2262
2263 impl ToOwned for NamedField {
2264     type Owned = TreeArc<NamedField>;
2265     fn to_owned(&self) -> TreeArc<NamedField> { TreeArc::cast(self.syntax.to_owned()) }
2266 }
2267
2268
2269 impl NamedField {
2270     pub fn name_ref(&self) -> Option<&NameRef> {
2271         super::child_opt(self)
2272     }
2273
2274     pub fn expr(&self) -> Option<&Expr> {
2275         super::child_opt(self)
2276     }
2277 }
2278
2279 // NamedFieldDef
2280 #[derive(Debug, PartialEq, Eq, Hash)]
2281 #[repr(transparent)]
2282 pub struct NamedFieldDef {
2283     pub(crate) syntax: SyntaxNode,
2284 }
2285 unsafe impl TransparentNewType for NamedFieldDef {
2286     type Repr = rowan::SyntaxNode;
2287 }
2288
2289 impl AstNode for NamedFieldDef {
2290     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2291         match syntax.kind() {
2292             NAMED_FIELD_DEF => Some(NamedFieldDef::from_repr(syntax.into_repr())),
2293             _ => None,
2294         }
2295     }
2296     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2297 }
2298
2299 impl ToOwned for NamedFieldDef {
2300     type Owned = TreeArc<NamedFieldDef>;
2301     fn to_owned(&self) -> TreeArc<NamedFieldDef> { TreeArc::cast(self.syntax.to_owned()) }
2302 }
2303
2304
2305 impl ast::VisibilityOwner for NamedFieldDef {}
2306 impl ast::NameOwner for NamedFieldDef {}
2307 impl ast::AttrsOwner for NamedFieldDef {}
2308 impl ast::DocCommentsOwner for NamedFieldDef {}
2309 impl ast::TypeAscriptionOwner for NamedFieldDef {}
2310 impl NamedFieldDef {}
2311
2312 // NamedFieldDefList
2313 #[derive(Debug, PartialEq, Eq, Hash)]
2314 #[repr(transparent)]
2315 pub struct NamedFieldDefList {
2316     pub(crate) syntax: SyntaxNode,
2317 }
2318 unsafe impl TransparentNewType for NamedFieldDefList {
2319     type Repr = rowan::SyntaxNode;
2320 }
2321
2322 impl AstNode for NamedFieldDefList {
2323     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2324         match syntax.kind() {
2325             NAMED_FIELD_DEF_LIST => Some(NamedFieldDefList::from_repr(syntax.into_repr())),
2326             _ => None,
2327         }
2328     }
2329     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2330 }
2331
2332 impl ToOwned for NamedFieldDefList {
2333     type Owned = TreeArc<NamedFieldDefList>;
2334     fn to_owned(&self) -> TreeArc<NamedFieldDefList> { TreeArc::cast(self.syntax.to_owned()) }
2335 }
2336
2337
2338 impl NamedFieldDefList {
2339     pub fn fields(&self) -> impl Iterator<Item = &NamedFieldDef> {
2340         super::children(self)
2341     }
2342 }
2343
2344 // NamedFieldList
2345 #[derive(Debug, PartialEq, Eq, Hash)]
2346 #[repr(transparent)]
2347 pub struct NamedFieldList {
2348     pub(crate) syntax: SyntaxNode,
2349 }
2350 unsafe impl TransparentNewType for NamedFieldList {
2351     type Repr = rowan::SyntaxNode;
2352 }
2353
2354 impl AstNode for NamedFieldList {
2355     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2356         match syntax.kind() {
2357             NAMED_FIELD_LIST => Some(NamedFieldList::from_repr(syntax.into_repr())),
2358             _ => None,
2359         }
2360     }
2361     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2362 }
2363
2364 impl ToOwned for NamedFieldList {
2365     type Owned = TreeArc<NamedFieldList>;
2366     fn to_owned(&self) -> TreeArc<NamedFieldList> { TreeArc::cast(self.syntax.to_owned()) }
2367 }
2368
2369
2370 impl NamedFieldList {
2371     pub fn fields(&self) -> impl Iterator<Item = &NamedField> {
2372         super::children(self)
2373     }
2374
2375     pub fn spread(&self) -> Option<&Expr> {
2376         super::child_opt(self)
2377     }
2378 }
2379
2380 // NeverType
2381 #[derive(Debug, PartialEq, Eq, Hash)]
2382 #[repr(transparent)]
2383 pub struct NeverType {
2384     pub(crate) syntax: SyntaxNode,
2385 }
2386 unsafe impl TransparentNewType for NeverType {
2387     type Repr = rowan::SyntaxNode;
2388 }
2389
2390 impl AstNode for NeverType {
2391     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2392         match syntax.kind() {
2393             NEVER_TYPE => Some(NeverType::from_repr(syntax.into_repr())),
2394             _ => None,
2395         }
2396     }
2397     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2398 }
2399
2400 impl ToOwned for NeverType {
2401     type Owned = TreeArc<NeverType>;
2402     fn to_owned(&self) -> TreeArc<NeverType> { TreeArc::cast(self.syntax.to_owned()) }
2403 }
2404
2405
2406 impl NeverType {}
2407
2408 // NominalDef
2409 #[derive(Debug, PartialEq, Eq, Hash)]
2410 #[repr(transparent)]
2411 pub struct NominalDef {
2412     pub(crate) syntax: SyntaxNode,
2413 }
2414 unsafe impl TransparentNewType for NominalDef {
2415     type Repr = rowan::SyntaxNode;
2416 }
2417
2418 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2419 pub enum NominalDefKind<'a> {
2420     StructDef(&'a StructDef),
2421     EnumDef(&'a EnumDef),
2422 }
2423 impl<'a> From<&'a StructDef> for &'a NominalDef {
2424     fn from(n: &'a StructDef) -> &'a NominalDef {
2425         NominalDef::cast(&n.syntax).unwrap()
2426     }
2427 }
2428 impl<'a> From<&'a EnumDef> for &'a NominalDef {
2429     fn from(n: &'a EnumDef) -> &'a NominalDef {
2430         NominalDef::cast(&n.syntax).unwrap()
2431     }
2432 }
2433
2434
2435 impl AstNode for NominalDef {
2436     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2437         match syntax.kind() {
2438             | STRUCT_DEF
2439             | ENUM_DEF => Some(NominalDef::from_repr(syntax.into_repr())),
2440             _ => None,
2441         }
2442     }
2443     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2444 }
2445
2446 impl ToOwned for NominalDef {
2447     type Owned = TreeArc<NominalDef>;
2448     fn to_owned(&self) -> TreeArc<NominalDef> { TreeArc::cast(self.syntax.to_owned()) }
2449 }
2450
2451 impl NominalDef {
2452     pub fn kind(&self) -> NominalDefKind {
2453         match self.syntax.kind() {
2454             STRUCT_DEF => NominalDefKind::StructDef(StructDef::cast(&self.syntax).unwrap()),
2455             ENUM_DEF => NominalDefKind::EnumDef(EnumDef::cast(&self.syntax).unwrap()),
2456             _ => unreachable!(),
2457         }
2458     }
2459 }
2460
2461 impl ast::NameOwner for NominalDef {}
2462 impl ast::TypeParamsOwner for NominalDef {}
2463 impl ast::AttrsOwner for NominalDef {}
2464 impl NominalDef {}
2465
2466 // Param
2467 #[derive(Debug, PartialEq, Eq, Hash)]
2468 #[repr(transparent)]
2469 pub struct Param {
2470     pub(crate) syntax: SyntaxNode,
2471 }
2472 unsafe impl TransparentNewType for Param {
2473     type Repr = rowan::SyntaxNode;
2474 }
2475
2476 impl AstNode for Param {
2477     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2478         match syntax.kind() {
2479             PARAM => Some(Param::from_repr(syntax.into_repr())),
2480             _ => None,
2481         }
2482     }
2483     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2484 }
2485
2486 impl ToOwned for Param {
2487     type Owned = TreeArc<Param>;
2488     fn to_owned(&self) -> TreeArc<Param> { TreeArc::cast(self.syntax.to_owned()) }
2489 }
2490
2491
2492 impl ast::TypeAscriptionOwner for Param {}
2493 impl Param {
2494     pub fn pat(&self) -> Option<&Pat> {
2495         super::child_opt(self)
2496     }
2497 }
2498
2499 // ParamList
2500 #[derive(Debug, PartialEq, Eq, Hash)]
2501 #[repr(transparent)]
2502 pub struct ParamList {
2503     pub(crate) syntax: SyntaxNode,
2504 }
2505 unsafe impl TransparentNewType for ParamList {
2506     type Repr = rowan::SyntaxNode;
2507 }
2508
2509 impl AstNode for ParamList {
2510     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2511         match syntax.kind() {
2512             PARAM_LIST => Some(ParamList::from_repr(syntax.into_repr())),
2513             _ => None,
2514         }
2515     }
2516     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2517 }
2518
2519 impl ToOwned for ParamList {
2520     type Owned = TreeArc<ParamList>;
2521     fn to_owned(&self) -> TreeArc<ParamList> { TreeArc::cast(self.syntax.to_owned()) }
2522 }
2523
2524
2525 impl ParamList {
2526     pub fn params(&self) -> impl Iterator<Item = &Param> {
2527         super::children(self)
2528     }
2529
2530     pub fn self_param(&self) -> Option<&SelfParam> {
2531         super::child_opt(self)
2532     }
2533 }
2534
2535 // ParenExpr
2536 #[derive(Debug, PartialEq, Eq, Hash)]
2537 #[repr(transparent)]
2538 pub struct ParenExpr {
2539     pub(crate) syntax: SyntaxNode,
2540 }
2541 unsafe impl TransparentNewType for ParenExpr {
2542     type Repr = rowan::SyntaxNode;
2543 }
2544
2545 impl AstNode for ParenExpr {
2546     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2547         match syntax.kind() {
2548             PAREN_EXPR => Some(ParenExpr::from_repr(syntax.into_repr())),
2549             _ => None,
2550         }
2551     }
2552     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2553 }
2554
2555 impl ToOwned for ParenExpr {
2556     type Owned = TreeArc<ParenExpr>;
2557     fn to_owned(&self) -> TreeArc<ParenExpr> { TreeArc::cast(self.syntax.to_owned()) }
2558 }
2559
2560
2561 impl ParenExpr {
2562     pub fn expr(&self) -> Option<&Expr> {
2563         super::child_opt(self)
2564     }
2565 }
2566
2567 // ParenType
2568 #[derive(Debug, PartialEq, Eq, Hash)]
2569 #[repr(transparent)]
2570 pub struct ParenType {
2571     pub(crate) syntax: SyntaxNode,
2572 }
2573 unsafe impl TransparentNewType for ParenType {
2574     type Repr = rowan::SyntaxNode;
2575 }
2576
2577 impl AstNode for ParenType {
2578     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2579         match syntax.kind() {
2580             PAREN_TYPE => Some(ParenType::from_repr(syntax.into_repr())),
2581             _ => None,
2582         }
2583     }
2584     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2585 }
2586
2587 impl ToOwned for ParenType {
2588     type Owned = TreeArc<ParenType>;
2589     fn to_owned(&self) -> TreeArc<ParenType> { TreeArc::cast(self.syntax.to_owned()) }
2590 }
2591
2592
2593 impl ParenType {
2594     pub fn type_ref(&self) -> Option<&TypeRef> {
2595         super::child_opt(self)
2596     }
2597 }
2598
2599 // Pat
2600 #[derive(Debug, PartialEq, Eq, Hash)]
2601 #[repr(transparent)]
2602 pub struct Pat {
2603     pub(crate) syntax: SyntaxNode,
2604 }
2605 unsafe impl TransparentNewType for Pat {
2606     type Repr = rowan::SyntaxNode;
2607 }
2608
2609 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
2610 pub enum PatKind<'a> {
2611     RefPat(&'a RefPat),
2612     BindPat(&'a BindPat),
2613     PlaceholderPat(&'a PlaceholderPat),
2614     PathPat(&'a PathPat),
2615     StructPat(&'a StructPat),
2616     TupleStructPat(&'a TupleStructPat),
2617     TuplePat(&'a TuplePat),
2618     SlicePat(&'a SlicePat),
2619     RangePat(&'a RangePat),
2620     LiteralPat(&'a LiteralPat),
2621 }
2622 impl<'a> From<&'a RefPat> for &'a Pat {
2623     fn from(n: &'a RefPat) -> &'a Pat {
2624         Pat::cast(&n.syntax).unwrap()
2625     }
2626 }
2627 impl<'a> From<&'a BindPat> for &'a Pat {
2628     fn from(n: &'a BindPat) -> &'a Pat {
2629         Pat::cast(&n.syntax).unwrap()
2630     }
2631 }
2632 impl<'a> From<&'a PlaceholderPat> for &'a Pat {
2633     fn from(n: &'a PlaceholderPat) -> &'a Pat {
2634         Pat::cast(&n.syntax).unwrap()
2635     }
2636 }
2637 impl<'a> From<&'a PathPat> for &'a Pat {
2638     fn from(n: &'a PathPat) -> &'a Pat {
2639         Pat::cast(&n.syntax).unwrap()
2640     }
2641 }
2642 impl<'a> From<&'a StructPat> for &'a Pat {
2643     fn from(n: &'a StructPat) -> &'a Pat {
2644         Pat::cast(&n.syntax).unwrap()
2645     }
2646 }
2647 impl<'a> From<&'a TupleStructPat> for &'a Pat {
2648     fn from(n: &'a TupleStructPat) -> &'a Pat {
2649         Pat::cast(&n.syntax).unwrap()
2650     }
2651 }
2652 impl<'a> From<&'a TuplePat> for &'a Pat {
2653     fn from(n: &'a TuplePat) -> &'a Pat {
2654         Pat::cast(&n.syntax).unwrap()
2655     }
2656 }
2657 impl<'a> From<&'a SlicePat> for &'a Pat {
2658     fn from(n: &'a SlicePat) -> &'a Pat {
2659         Pat::cast(&n.syntax).unwrap()
2660     }
2661 }
2662 impl<'a> From<&'a RangePat> for &'a Pat {
2663     fn from(n: &'a RangePat) -> &'a Pat {
2664         Pat::cast(&n.syntax).unwrap()
2665     }
2666 }
2667 impl<'a> From<&'a LiteralPat> for &'a Pat {
2668     fn from(n: &'a LiteralPat) -> &'a Pat {
2669         Pat::cast(&n.syntax).unwrap()
2670     }
2671 }
2672
2673
2674 impl AstNode for Pat {
2675     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2676         match syntax.kind() {
2677             | REF_PAT
2678             | BIND_PAT
2679             | PLACEHOLDER_PAT
2680             | PATH_PAT
2681             | STRUCT_PAT
2682             | TUPLE_STRUCT_PAT
2683             | TUPLE_PAT
2684             | SLICE_PAT
2685             | RANGE_PAT
2686             | LITERAL_PAT => Some(Pat::from_repr(syntax.into_repr())),
2687             _ => None,
2688         }
2689     }
2690     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2691 }
2692
2693 impl ToOwned for Pat {
2694     type Owned = TreeArc<Pat>;
2695     fn to_owned(&self) -> TreeArc<Pat> { TreeArc::cast(self.syntax.to_owned()) }
2696 }
2697
2698 impl Pat {
2699     pub fn kind(&self) -> PatKind {
2700         match self.syntax.kind() {
2701             REF_PAT => PatKind::RefPat(RefPat::cast(&self.syntax).unwrap()),
2702             BIND_PAT => PatKind::BindPat(BindPat::cast(&self.syntax).unwrap()),
2703             PLACEHOLDER_PAT => PatKind::PlaceholderPat(PlaceholderPat::cast(&self.syntax).unwrap()),
2704             PATH_PAT => PatKind::PathPat(PathPat::cast(&self.syntax).unwrap()),
2705             STRUCT_PAT => PatKind::StructPat(StructPat::cast(&self.syntax).unwrap()),
2706             TUPLE_STRUCT_PAT => PatKind::TupleStructPat(TupleStructPat::cast(&self.syntax).unwrap()),
2707             TUPLE_PAT => PatKind::TuplePat(TuplePat::cast(&self.syntax).unwrap()),
2708             SLICE_PAT => PatKind::SlicePat(SlicePat::cast(&self.syntax).unwrap()),
2709             RANGE_PAT => PatKind::RangePat(RangePat::cast(&self.syntax).unwrap()),
2710             LITERAL_PAT => PatKind::LiteralPat(LiteralPat::cast(&self.syntax).unwrap()),
2711             _ => unreachable!(),
2712         }
2713     }
2714 }
2715
2716 impl Pat {}
2717
2718 // Path
2719 #[derive(Debug, PartialEq, Eq, Hash)]
2720 #[repr(transparent)]
2721 pub struct Path {
2722     pub(crate) syntax: SyntaxNode,
2723 }
2724 unsafe impl TransparentNewType for Path {
2725     type Repr = rowan::SyntaxNode;
2726 }
2727
2728 impl AstNode for Path {
2729     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2730         match syntax.kind() {
2731             PATH => Some(Path::from_repr(syntax.into_repr())),
2732             _ => None,
2733         }
2734     }
2735     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2736 }
2737
2738 impl ToOwned for Path {
2739     type Owned = TreeArc<Path>;
2740     fn to_owned(&self) -> TreeArc<Path> { TreeArc::cast(self.syntax.to_owned()) }
2741 }
2742
2743
2744 impl Path {
2745     pub fn segment(&self) -> Option<&PathSegment> {
2746         super::child_opt(self)
2747     }
2748
2749     pub fn qualifier(&self) -> Option<&Path> {
2750         super::child_opt(self)
2751     }
2752 }
2753
2754 // PathExpr
2755 #[derive(Debug, PartialEq, Eq, Hash)]
2756 #[repr(transparent)]
2757 pub struct PathExpr {
2758     pub(crate) syntax: SyntaxNode,
2759 }
2760 unsafe impl TransparentNewType for PathExpr {
2761     type Repr = rowan::SyntaxNode;
2762 }
2763
2764 impl AstNode for PathExpr {
2765     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2766         match syntax.kind() {
2767             PATH_EXPR => Some(PathExpr::from_repr(syntax.into_repr())),
2768             _ => None,
2769         }
2770     }
2771     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2772 }
2773
2774 impl ToOwned for PathExpr {
2775     type Owned = TreeArc<PathExpr>;
2776     fn to_owned(&self) -> TreeArc<PathExpr> { TreeArc::cast(self.syntax.to_owned()) }
2777 }
2778
2779
2780 impl PathExpr {
2781     pub fn path(&self) -> Option<&Path> {
2782         super::child_opt(self)
2783     }
2784 }
2785
2786 // PathPat
2787 #[derive(Debug, PartialEq, Eq, Hash)]
2788 #[repr(transparent)]
2789 pub struct PathPat {
2790     pub(crate) syntax: SyntaxNode,
2791 }
2792 unsafe impl TransparentNewType for PathPat {
2793     type Repr = rowan::SyntaxNode;
2794 }
2795
2796 impl AstNode for PathPat {
2797     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2798         match syntax.kind() {
2799             PATH_PAT => Some(PathPat::from_repr(syntax.into_repr())),
2800             _ => None,
2801         }
2802     }
2803     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2804 }
2805
2806 impl ToOwned for PathPat {
2807     type Owned = TreeArc<PathPat>;
2808     fn to_owned(&self) -> TreeArc<PathPat> { TreeArc::cast(self.syntax.to_owned()) }
2809 }
2810
2811
2812 impl PathPat {
2813     pub fn path(&self) -> Option<&Path> {
2814         super::child_opt(self)
2815     }
2816 }
2817
2818 // PathSegment
2819 #[derive(Debug, PartialEq, Eq, Hash)]
2820 #[repr(transparent)]
2821 pub struct PathSegment {
2822     pub(crate) syntax: SyntaxNode,
2823 }
2824 unsafe impl TransparentNewType for PathSegment {
2825     type Repr = rowan::SyntaxNode;
2826 }
2827
2828 impl AstNode for PathSegment {
2829     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2830         match syntax.kind() {
2831             PATH_SEGMENT => Some(PathSegment::from_repr(syntax.into_repr())),
2832             _ => None,
2833         }
2834     }
2835     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2836 }
2837
2838 impl ToOwned for PathSegment {
2839     type Owned = TreeArc<PathSegment>;
2840     fn to_owned(&self) -> TreeArc<PathSegment> { TreeArc::cast(self.syntax.to_owned()) }
2841 }
2842
2843
2844 impl PathSegment {
2845     pub fn name_ref(&self) -> Option<&NameRef> {
2846         super::child_opt(self)
2847     }
2848
2849     pub fn type_arg_list(&self) -> Option<&TypeArgList> {
2850         super::child_opt(self)
2851     }
2852 }
2853
2854 // PathType
2855 #[derive(Debug, PartialEq, Eq, Hash)]
2856 #[repr(transparent)]
2857 pub struct PathType {
2858     pub(crate) syntax: SyntaxNode,
2859 }
2860 unsafe impl TransparentNewType for PathType {
2861     type Repr = rowan::SyntaxNode;
2862 }
2863
2864 impl AstNode for PathType {
2865     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2866         match syntax.kind() {
2867             PATH_TYPE => Some(PathType::from_repr(syntax.into_repr())),
2868             _ => None,
2869         }
2870     }
2871     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2872 }
2873
2874 impl ToOwned for PathType {
2875     type Owned = TreeArc<PathType>;
2876     fn to_owned(&self) -> TreeArc<PathType> { TreeArc::cast(self.syntax.to_owned()) }
2877 }
2878
2879
2880 impl PathType {
2881     pub fn path(&self) -> Option<&Path> {
2882         super::child_opt(self)
2883     }
2884 }
2885
2886 // PlaceholderPat
2887 #[derive(Debug, PartialEq, Eq, Hash)]
2888 #[repr(transparent)]
2889 pub struct PlaceholderPat {
2890     pub(crate) syntax: SyntaxNode,
2891 }
2892 unsafe impl TransparentNewType for PlaceholderPat {
2893     type Repr = rowan::SyntaxNode;
2894 }
2895
2896 impl AstNode for PlaceholderPat {
2897     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2898         match syntax.kind() {
2899             PLACEHOLDER_PAT => Some(PlaceholderPat::from_repr(syntax.into_repr())),
2900             _ => None,
2901         }
2902     }
2903     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2904 }
2905
2906 impl ToOwned for PlaceholderPat {
2907     type Owned = TreeArc<PlaceholderPat>;
2908     fn to_owned(&self) -> TreeArc<PlaceholderPat> { TreeArc::cast(self.syntax.to_owned()) }
2909 }
2910
2911
2912 impl PlaceholderPat {}
2913
2914 // PlaceholderType
2915 #[derive(Debug, PartialEq, Eq, Hash)]
2916 #[repr(transparent)]
2917 pub struct PlaceholderType {
2918     pub(crate) syntax: SyntaxNode,
2919 }
2920 unsafe impl TransparentNewType for PlaceholderType {
2921     type Repr = rowan::SyntaxNode;
2922 }
2923
2924 impl AstNode for PlaceholderType {
2925     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2926         match syntax.kind() {
2927             PLACEHOLDER_TYPE => Some(PlaceholderType::from_repr(syntax.into_repr())),
2928             _ => None,
2929         }
2930     }
2931     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2932 }
2933
2934 impl ToOwned for PlaceholderType {
2935     type Owned = TreeArc<PlaceholderType>;
2936     fn to_owned(&self) -> TreeArc<PlaceholderType> { TreeArc::cast(self.syntax.to_owned()) }
2937 }
2938
2939
2940 impl PlaceholderType {}
2941
2942 // PointerType
2943 #[derive(Debug, PartialEq, Eq, Hash)]
2944 #[repr(transparent)]
2945 pub struct PointerType {
2946     pub(crate) syntax: SyntaxNode,
2947 }
2948 unsafe impl TransparentNewType for PointerType {
2949     type Repr = rowan::SyntaxNode;
2950 }
2951
2952 impl AstNode for PointerType {
2953     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2954         match syntax.kind() {
2955             POINTER_TYPE => Some(PointerType::from_repr(syntax.into_repr())),
2956             _ => None,
2957         }
2958     }
2959     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2960 }
2961
2962 impl ToOwned for PointerType {
2963     type Owned = TreeArc<PointerType>;
2964     fn to_owned(&self) -> TreeArc<PointerType> { TreeArc::cast(self.syntax.to_owned()) }
2965 }
2966
2967
2968 impl PointerType {
2969     pub fn type_ref(&self) -> Option<&TypeRef> {
2970         super::child_opt(self)
2971     }
2972 }
2973
2974 // PosFieldDef
2975 #[derive(Debug, PartialEq, Eq, Hash)]
2976 #[repr(transparent)]
2977 pub struct PosFieldDef {
2978     pub(crate) syntax: SyntaxNode,
2979 }
2980 unsafe impl TransparentNewType for PosFieldDef {
2981     type Repr = rowan::SyntaxNode;
2982 }
2983
2984 impl AstNode for PosFieldDef {
2985     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
2986         match syntax.kind() {
2987             POS_FIELD_DEF => Some(PosFieldDef::from_repr(syntax.into_repr())),
2988             _ => None,
2989         }
2990     }
2991     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2992 }
2993
2994 impl ToOwned for PosFieldDef {
2995     type Owned = TreeArc<PosFieldDef>;
2996     fn to_owned(&self) -> TreeArc<PosFieldDef> { TreeArc::cast(self.syntax.to_owned()) }
2997 }
2998
2999
3000 impl ast::VisibilityOwner for PosFieldDef {}
3001 impl ast::AttrsOwner for PosFieldDef {}
3002 impl PosFieldDef {
3003     pub fn type_ref(&self) -> Option<&TypeRef> {
3004         super::child_opt(self)
3005     }
3006 }
3007
3008 // PosFieldDefList
3009 #[derive(Debug, PartialEq, Eq, Hash)]
3010 #[repr(transparent)]
3011 pub struct PosFieldDefList {
3012     pub(crate) syntax: SyntaxNode,
3013 }
3014 unsafe impl TransparentNewType for PosFieldDefList {
3015     type Repr = rowan::SyntaxNode;
3016 }
3017
3018 impl AstNode for PosFieldDefList {
3019     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3020         match syntax.kind() {
3021             POS_FIELD_DEF_LIST => Some(PosFieldDefList::from_repr(syntax.into_repr())),
3022             _ => None,
3023         }
3024     }
3025     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3026 }
3027
3028 impl ToOwned for PosFieldDefList {
3029     type Owned = TreeArc<PosFieldDefList>;
3030     fn to_owned(&self) -> TreeArc<PosFieldDefList> { TreeArc::cast(self.syntax.to_owned()) }
3031 }
3032
3033
3034 impl PosFieldDefList {
3035     pub fn fields(&self) -> impl Iterator<Item = &PosFieldDef> {
3036         super::children(self)
3037     }
3038 }
3039
3040 // PrefixExpr
3041 #[derive(Debug, PartialEq, Eq, Hash)]
3042 #[repr(transparent)]
3043 pub struct PrefixExpr {
3044     pub(crate) syntax: SyntaxNode,
3045 }
3046 unsafe impl TransparentNewType for PrefixExpr {
3047     type Repr = rowan::SyntaxNode;
3048 }
3049
3050 impl AstNode for PrefixExpr {
3051     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3052         match syntax.kind() {
3053             PREFIX_EXPR => Some(PrefixExpr::from_repr(syntax.into_repr())),
3054             _ => None,
3055         }
3056     }
3057     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3058 }
3059
3060 impl ToOwned for PrefixExpr {
3061     type Owned = TreeArc<PrefixExpr>;
3062     fn to_owned(&self) -> TreeArc<PrefixExpr> { TreeArc::cast(self.syntax.to_owned()) }
3063 }
3064
3065
3066 impl PrefixExpr {
3067     pub fn expr(&self) -> Option<&Expr> {
3068         super::child_opt(self)
3069     }
3070 }
3071
3072 // RangeExpr
3073 #[derive(Debug, PartialEq, Eq, Hash)]
3074 #[repr(transparent)]
3075 pub struct RangeExpr {
3076     pub(crate) syntax: SyntaxNode,
3077 }
3078 unsafe impl TransparentNewType for RangeExpr {
3079     type Repr = rowan::SyntaxNode;
3080 }
3081
3082 impl AstNode for RangeExpr {
3083     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3084         match syntax.kind() {
3085             RANGE_EXPR => Some(RangeExpr::from_repr(syntax.into_repr())),
3086             _ => None,
3087         }
3088     }
3089     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3090 }
3091
3092 impl ToOwned for RangeExpr {
3093     type Owned = TreeArc<RangeExpr>;
3094     fn to_owned(&self) -> TreeArc<RangeExpr> { TreeArc::cast(self.syntax.to_owned()) }
3095 }
3096
3097
3098 impl RangeExpr {}
3099
3100 // RangePat
3101 #[derive(Debug, PartialEq, Eq, Hash)]
3102 #[repr(transparent)]
3103 pub struct RangePat {
3104     pub(crate) syntax: SyntaxNode,
3105 }
3106 unsafe impl TransparentNewType for RangePat {
3107     type Repr = rowan::SyntaxNode;
3108 }
3109
3110 impl AstNode for RangePat {
3111     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3112         match syntax.kind() {
3113             RANGE_PAT => Some(RangePat::from_repr(syntax.into_repr())),
3114             _ => None,
3115         }
3116     }
3117     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3118 }
3119
3120 impl ToOwned for RangePat {
3121     type Owned = TreeArc<RangePat>;
3122     fn to_owned(&self) -> TreeArc<RangePat> { TreeArc::cast(self.syntax.to_owned()) }
3123 }
3124
3125
3126 impl RangePat {}
3127
3128 // RefExpr
3129 #[derive(Debug, PartialEq, Eq, Hash)]
3130 #[repr(transparent)]
3131 pub struct RefExpr {
3132     pub(crate) syntax: SyntaxNode,
3133 }
3134 unsafe impl TransparentNewType for RefExpr {
3135     type Repr = rowan::SyntaxNode;
3136 }
3137
3138 impl AstNode for RefExpr {
3139     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3140         match syntax.kind() {
3141             REF_EXPR => Some(RefExpr::from_repr(syntax.into_repr())),
3142             _ => None,
3143         }
3144     }
3145     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3146 }
3147
3148 impl ToOwned for RefExpr {
3149     type Owned = TreeArc<RefExpr>;
3150     fn to_owned(&self) -> TreeArc<RefExpr> { TreeArc::cast(self.syntax.to_owned()) }
3151 }
3152
3153
3154 impl RefExpr {
3155     pub fn expr(&self) -> Option<&Expr> {
3156         super::child_opt(self)
3157     }
3158 }
3159
3160 // RefPat
3161 #[derive(Debug, PartialEq, Eq, Hash)]
3162 #[repr(transparent)]
3163 pub struct RefPat {
3164     pub(crate) syntax: SyntaxNode,
3165 }
3166 unsafe impl TransparentNewType for RefPat {
3167     type Repr = rowan::SyntaxNode;
3168 }
3169
3170 impl AstNode for RefPat {
3171     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3172         match syntax.kind() {
3173             REF_PAT => Some(RefPat::from_repr(syntax.into_repr())),
3174             _ => None,
3175         }
3176     }
3177     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3178 }
3179
3180 impl ToOwned for RefPat {
3181     type Owned = TreeArc<RefPat>;
3182     fn to_owned(&self) -> TreeArc<RefPat> { TreeArc::cast(self.syntax.to_owned()) }
3183 }
3184
3185
3186 impl RefPat {
3187     pub fn pat(&self) -> Option<&Pat> {
3188         super::child_opt(self)
3189     }
3190 }
3191
3192 // ReferenceType
3193 #[derive(Debug, PartialEq, Eq, Hash)]
3194 #[repr(transparent)]
3195 pub struct ReferenceType {
3196     pub(crate) syntax: SyntaxNode,
3197 }
3198 unsafe impl TransparentNewType for ReferenceType {
3199     type Repr = rowan::SyntaxNode;
3200 }
3201
3202 impl AstNode for ReferenceType {
3203     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3204         match syntax.kind() {
3205             REFERENCE_TYPE => Some(ReferenceType::from_repr(syntax.into_repr())),
3206             _ => None,
3207         }
3208     }
3209     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3210 }
3211
3212 impl ToOwned for ReferenceType {
3213     type Owned = TreeArc<ReferenceType>;
3214     fn to_owned(&self) -> TreeArc<ReferenceType> { TreeArc::cast(self.syntax.to_owned()) }
3215 }
3216
3217
3218 impl ReferenceType {
3219     pub fn type_ref(&self) -> Option<&TypeRef> {
3220         super::child_opt(self)
3221     }
3222 }
3223
3224 // RetType
3225 #[derive(Debug, PartialEq, Eq, Hash)]
3226 #[repr(transparent)]
3227 pub struct RetType {
3228     pub(crate) syntax: SyntaxNode,
3229 }
3230 unsafe impl TransparentNewType for RetType {
3231     type Repr = rowan::SyntaxNode;
3232 }
3233
3234 impl AstNode for RetType {
3235     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3236         match syntax.kind() {
3237             RET_TYPE => Some(RetType::from_repr(syntax.into_repr())),
3238             _ => None,
3239         }
3240     }
3241     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3242 }
3243
3244 impl ToOwned for RetType {
3245     type Owned = TreeArc<RetType>;
3246     fn to_owned(&self) -> TreeArc<RetType> { TreeArc::cast(self.syntax.to_owned()) }
3247 }
3248
3249
3250 impl RetType {
3251     pub fn type_ref(&self) -> Option<&TypeRef> {
3252         super::child_opt(self)
3253     }
3254 }
3255
3256 // ReturnExpr
3257 #[derive(Debug, PartialEq, Eq, Hash)]
3258 #[repr(transparent)]
3259 pub struct ReturnExpr {
3260     pub(crate) syntax: SyntaxNode,
3261 }
3262 unsafe impl TransparentNewType for ReturnExpr {
3263     type Repr = rowan::SyntaxNode;
3264 }
3265
3266 impl AstNode for ReturnExpr {
3267     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3268         match syntax.kind() {
3269             RETURN_EXPR => Some(ReturnExpr::from_repr(syntax.into_repr())),
3270             _ => None,
3271         }
3272     }
3273     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3274 }
3275
3276 impl ToOwned for ReturnExpr {
3277     type Owned = TreeArc<ReturnExpr>;
3278     fn to_owned(&self) -> TreeArc<ReturnExpr> { TreeArc::cast(self.syntax.to_owned()) }
3279 }
3280
3281
3282 impl ReturnExpr {
3283     pub fn expr(&self) -> Option<&Expr> {
3284         super::child_opt(self)
3285     }
3286 }
3287
3288 // SelfParam
3289 #[derive(Debug, PartialEq, Eq, Hash)]
3290 #[repr(transparent)]
3291 pub struct SelfParam {
3292     pub(crate) syntax: SyntaxNode,
3293 }
3294 unsafe impl TransparentNewType for SelfParam {
3295     type Repr = rowan::SyntaxNode;
3296 }
3297
3298 impl AstNode for SelfParam {
3299     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3300         match syntax.kind() {
3301             SELF_PARAM => Some(SelfParam::from_repr(syntax.into_repr())),
3302             _ => None,
3303         }
3304     }
3305     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3306 }
3307
3308 impl ToOwned for SelfParam {
3309     type Owned = TreeArc<SelfParam>;
3310     fn to_owned(&self) -> TreeArc<SelfParam> { TreeArc::cast(self.syntax.to_owned()) }
3311 }
3312
3313
3314 impl ast::TypeAscriptionOwner for SelfParam {}
3315 impl SelfParam {}
3316
3317 // SlicePat
3318 #[derive(Debug, PartialEq, Eq, Hash)]
3319 #[repr(transparent)]
3320 pub struct SlicePat {
3321     pub(crate) syntax: SyntaxNode,
3322 }
3323 unsafe impl TransparentNewType for SlicePat {
3324     type Repr = rowan::SyntaxNode;
3325 }
3326
3327 impl AstNode for SlicePat {
3328     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3329         match syntax.kind() {
3330             SLICE_PAT => Some(SlicePat::from_repr(syntax.into_repr())),
3331             _ => None,
3332         }
3333     }
3334     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3335 }
3336
3337 impl ToOwned for SlicePat {
3338     type Owned = TreeArc<SlicePat>;
3339     fn to_owned(&self) -> TreeArc<SlicePat> { TreeArc::cast(self.syntax.to_owned()) }
3340 }
3341
3342
3343 impl SlicePat {}
3344
3345 // SliceType
3346 #[derive(Debug, PartialEq, Eq, Hash)]
3347 #[repr(transparent)]
3348 pub struct SliceType {
3349     pub(crate) syntax: SyntaxNode,
3350 }
3351 unsafe impl TransparentNewType for SliceType {
3352     type Repr = rowan::SyntaxNode;
3353 }
3354
3355 impl AstNode for SliceType {
3356     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3357         match syntax.kind() {
3358             SLICE_TYPE => Some(SliceType::from_repr(syntax.into_repr())),
3359             _ => None,
3360         }
3361     }
3362     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3363 }
3364
3365 impl ToOwned for SliceType {
3366     type Owned = TreeArc<SliceType>;
3367     fn to_owned(&self) -> TreeArc<SliceType> { TreeArc::cast(self.syntax.to_owned()) }
3368 }
3369
3370
3371 impl SliceType {
3372     pub fn type_ref(&self) -> Option<&TypeRef> {
3373         super::child_opt(self)
3374     }
3375 }
3376
3377 // SourceFile
3378 #[derive(Debug, PartialEq, Eq, Hash)]
3379 #[repr(transparent)]
3380 pub struct SourceFile {
3381     pub(crate) syntax: SyntaxNode,
3382 }
3383 unsafe impl TransparentNewType for SourceFile {
3384     type Repr = rowan::SyntaxNode;
3385 }
3386
3387 impl AstNode for SourceFile {
3388     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3389         match syntax.kind() {
3390             SOURCE_FILE => Some(SourceFile::from_repr(syntax.into_repr())),
3391             _ => None,
3392         }
3393     }
3394     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3395 }
3396
3397 impl ToOwned for SourceFile {
3398     type Owned = TreeArc<SourceFile>;
3399     fn to_owned(&self) -> TreeArc<SourceFile> { TreeArc::cast(self.syntax.to_owned()) }
3400 }
3401
3402
3403 impl ast::ModuleItemOwner for SourceFile {}
3404 impl ast::FnDefOwner for SourceFile {}
3405 impl SourceFile {
3406     pub fn modules(&self) -> impl Iterator<Item = &Module> {
3407         super::children(self)
3408     }
3409 }
3410
3411 // StaticDef
3412 #[derive(Debug, PartialEq, Eq, Hash)]
3413 #[repr(transparent)]
3414 pub struct StaticDef {
3415     pub(crate) syntax: SyntaxNode,
3416 }
3417 unsafe impl TransparentNewType for StaticDef {
3418     type Repr = rowan::SyntaxNode;
3419 }
3420
3421 impl AstNode for StaticDef {
3422     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3423         match syntax.kind() {
3424             STATIC_DEF => Some(StaticDef::from_repr(syntax.into_repr())),
3425             _ => None,
3426         }
3427     }
3428     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3429 }
3430
3431 impl ToOwned for StaticDef {
3432     type Owned = TreeArc<StaticDef>;
3433     fn to_owned(&self) -> TreeArc<StaticDef> { TreeArc::cast(self.syntax.to_owned()) }
3434 }
3435
3436
3437 impl ast::VisibilityOwner for StaticDef {}
3438 impl ast::NameOwner for StaticDef {}
3439 impl ast::TypeParamsOwner for StaticDef {}
3440 impl ast::AttrsOwner for StaticDef {}
3441 impl ast::DocCommentsOwner for StaticDef {}
3442 impl ast::TypeAscriptionOwner for StaticDef {}
3443 impl StaticDef {
3444     pub fn body(&self) -> Option<&Expr> {
3445         super::child_opt(self)
3446     }
3447 }
3448
3449 // Stmt
3450 #[derive(Debug, PartialEq, Eq, Hash)]
3451 #[repr(transparent)]
3452 pub struct Stmt {
3453     pub(crate) syntax: SyntaxNode,
3454 }
3455 unsafe impl TransparentNewType for Stmt {
3456     type Repr = rowan::SyntaxNode;
3457 }
3458
3459 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
3460 pub enum StmtKind<'a> {
3461     ExprStmt(&'a ExprStmt),
3462     LetStmt(&'a LetStmt),
3463 }
3464 impl<'a> From<&'a ExprStmt> for &'a Stmt {
3465     fn from(n: &'a ExprStmt) -> &'a Stmt {
3466         Stmt::cast(&n.syntax).unwrap()
3467     }
3468 }
3469 impl<'a> From<&'a LetStmt> for &'a Stmt {
3470     fn from(n: &'a LetStmt) -> &'a Stmt {
3471         Stmt::cast(&n.syntax).unwrap()
3472     }
3473 }
3474
3475
3476 impl AstNode for Stmt {
3477     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3478         match syntax.kind() {
3479             | EXPR_STMT
3480             | LET_STMT => Some(Stmt::from_repr(syntax.into_repr())),
3481             _ => None,
3482         }
3483     }
3484     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3485 }
3486
3487 impl ToOwned for Stmt {
3488     type Owned = TreeArc<Stmt>;
3489     fn to_owned(&self) -> TreeArc<Stmt> { TreeArc::cast(self.syntax.to_owned()) }
3490 }
3491
3492 impl Stmt {
3493     pub fn kind(&self) -> StmtKind {
3494         match self.syntax.kind() {
3495             EXPR_STMT => StmtKind::ExprStmt(ExprStmt::cast(&self.syntax).unwrap()),
3496             LET_STMT => StmtKind::LetStmt(LetStmt::cast(&self.syntax).unwrap()),
3497             _ => unreachable!(),
3498         }
3499     }
3500 }
3501
3502 impl Stmt {}
3503
3504 // StructDef
3505 #[derive(Debug, PartialEq, Eq, Hash)]
3506 #[repr(transparent)]
3507 pub struct StructDef {
3508     pub(crate) syntax: SyntaxNode,
3509 }
3510 unsafe impl TransparentNewType for StructDef {
3511     type Repr = rowan::SyntaxNode;
3512 }
3513
3514 impl AstNode for StructDef {
3515     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3516         match syntax.kind() {
3517             STRUCT_DEF => Some(StructDef::from_repr(syntax.into_repr())),
3518             _ => None,
3519         }
3520     }
3521     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3522 }
3523
3524 impl ToOwned for StructDef {
3525     type Owned = TreeArc<StructDef>;
3526     fn to_owned(&self) -> TreeArc<StructDef> { TreeArc::cast(self.syntax.to_owned()) }
3527 }
3528
3529
3530 impl ast::VisibilityOwner for StructDef {}
3531 impl ast::NameOwner for StructDef {}
3532 impl ast::TypeParamsOwner for StructDef {}
3533 impl ast::AttrsOwner for StructDef {}
3534 impl ast::DocCommentsOwner for StructDef {}
3535 impl StructDef {}
3536
3537 // StructLit
3538 #[derive(Debug, PartialEq, Eq, Hash)]
3539 #[repr(transparent)]
3540 pub struct StructLit {
3541     pub(crate) syntax: SyntaxNode,
3542 }
3543 unsafe impl TransparentNewType for StructLit {
3544     type Repr = rowan::SyntaxNode;
3545 }
3546
3547 impl AstNode for StructLit {
3548     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3549         match syntax.kind() {
3550             STRUCT_LIT => Some(StructLit::from_repr(syntax.into_repr())),
3551             _ => None,
3552         }
3553     }
3554     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3555 }
3556
3557 impl ToOwned for StructLit {
3558     type Owned = TreeArc<StructLit>;
3559     fn to_owned(&self) -> TreeArc<StructLit> { TreeArc::cast(self.syntax.to_owned()) }
3560 }
3561
3562
3563 impl StructLit {
3564     pub fn path(&self) -> Option<&Path> {
3565         super::child_opt(self)
3566     }
3567
3568     pub fn named_field_list(&self) -> Option<&NamedFieldList> {
3569         super::child_opt(self)
3570     }
3571 }
3572
3573 // StructPat
3574 #[derive(Debug, PartialEq, Eq, Hash)]
3575 #[repr(transparent)]
3576 pub struct StructPat {
3577     pub(crate) syntax: SyntaxNode,
3578 }
3579 unsafe impl TransparentNewType for StructPat {
3580     type Repr = rowan::SyntaxNode;
3581 }
3582
3583 impl AstNode for StructPat {
3584     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3585         match syntax.kind() {
3586             STRUCT_PAT => Some(StructPat::from_repr(syntax.into_repr())),
3587             _ => None,
3588         }
3589     }
3590     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3591 }
3592
3593 impl ToOwned for StructPat {
3594     type Owned = TreeArc<StructPat>;
3595     fn to_owned(&self) -> TreeArc<StructPat> { TreeArc::cast(self.syntax.to_owned()) }
3596 }
3597
3598
3599 impl StructPat {
3600     pub fn field_pat_list(&self) -> Option<&FieldPatList> {
3601         super::child_opt(self)
3602     }
3603
3604     pub fn path(&self) -> Option<&Path> {
3605         super::child_opt(self)
3606     }
3607 }
3608
3609 // TokenTree
3610 #[derive(Debug, PartialEq, Eq, Hash)]
3611 #[repr(transparent)]
3612 pub struct TokenTree {
3613     pub(crate) syntax: SyntaxNode,
3614 }
3615 unsafe impl TransparentNewType for TokenTree {
3616     type Repr = rowan::SyntaxNode;
3617 }
3618
3619 impl AstNode for TokenTree {
3620     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3621         match syntax.kind() {
3622             TOKEN_TREE => Some(TokenTree::from_repr(syntax.into_repr())),
3623             _ => None,
3624         }
3625     }
3626     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3627 }
3628
3629 impl ToOwned for TokenTree {
3630     type Owned = TreeArc<TokenTree>;
3631     fn to_owned(&self) -> TreeArc<TokenTree> { TreeArc::cast(self.syntax.to_owned()) }
3632 }
3633
3634
3635 impl TokenTree {}
3636
3637 // TraitDef
3638 #[derive(Debug, PartialEq, Eq, Hash)]
3639 #[repr(transparent)]
3640 pub struct TraitDef {
3641     pub(crate) syntax: SyntaxNode,
3642 }
3643 unsafe impl TransparentNewType for TraitDef {
3644     type Repr = rowan::SyntaxNode;
3645 }
3646
3647 impl AstNode for TraitDef {
3648     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3649         match syntax.kind() {
3650             TRAIT_DEF => Some(TraitDef::from_repr(syntax.into_repr())),
3651             _ => None,
3652         }
3653     }
3654     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3655 }
3656
3657 impl ToOwned for TraitDef {
3658     type Owned = TreeArc<TraitDef>;
3659     fn to_owned(&self) -> TreeArc<TraitDef> { TreeArc::cast(self.syntax.to_owned()) }
3660 }
3661
3662
3663 impl ast::VisibilityOwner for TraitDef {}
3664 impl ast::NameOwner for TraitDef {}
3665 impl ast::AttrsOwner for TraitDef {}
3666 impl ast::DocCommentsOwner for TraitDef {}
3667 impl ast::TypeParamsOwner for TraitDef {}
3668 impl ast::TypeBoundsOwner for TraitDef {}
3669 impl TraitDef {
3670     pub fn item_list(&self) -> Option<&ItemList> {
3671         super::child_opt(self)
3672     }
3673 }
3674
3675 // TryExpr
3676 #[derive(Debug, PartialEq, Eq, Hash)]
3677 #[repr(transparent)]
3678 pub struct TryExpr {
3679     pub(crate) syntax: SyntaxNode,
3680 }
3681 unsafe impl TransparentNewType for TryExpr {
3682     type Repr = rowan::SyntaxNode;
3683 }
3684
3685 impl AstNode for TryExpr {
3686     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3687         match syntax.kind() {
3688             TRY_EXPR => Some(TryExpr::from_repr(syntax.into_repr())),
3689             _ => None,
3690         }
3691     }
3692     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3693 }
3694
3695 impl ToOwned for TryExpr {
3696     type Owned = TreeArc<TryExpr>;
3697     fn to_owned(&self) -> TreeArc<TryExpr> { TreeArc::cast(self.syntax.to_owned()) }
3698 }
3699
3700
3701 impl TryExpr {
3702     pub fn expr(&self) -> Option<&Expr> {
3703         super::child_opt(self)
3704     }
3705 }
3706
3707 // TupleExpr
3708 #[derive(Debug, PartialEq, Eq, Hash)]
3709 #[repr(transparent)]
3710 pub struct TupleExpr {
3711     pub(crate) syntax: SyntaxNode,
3712 }
3713 unsafe impl TransparentNewType for TupleExpr {
3714     type Repr = rowan::SyntaxNode;
3715 }
3716
3717 impl AstNode for TupleExpr {
3718     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3719         match syntax.kind() {
3720             TUPLE_EXPR => Some(TupleExpr::from_repr(syntax.into_repr())),
3721             _ => None,
3722         }
3723     }
3724     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3725 }
3726
3727 impl ToOwned for TupleExpr {
3728     type Owned = TreeArc<TupleExpr>;
3729     fn to_owned(&self) -> TreeArc<TupleExpr> { TreeArc::cast(self.syntax.to_owned()) }
3730 }
3731
3732
3733 impl TupleExpr {
3734     pub fn exprs(&self) -> impl Iterator<Item = &Expr> {
3735         super::children(self)
3736     }
3737 }
3738
3739 // TuplePat
3740 #[derive(Debug, PartialEq, Eq, Hash)]
3741 #[repr(transparent)]
3742 pub struct TuplePat {
3743     pub(crate) syntax: SyntaxNode,
3744 }
3745 unsafe impl TransparentNewType for TuplePat {
3746     type Repr = rowan::SyntaxNode;
3747 }
3748
3749 impl AstNode for TuplePat {
3750     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3751         match syntax.kind() {
3752             TUPLE_PAT => Some(TuplePat::from_repr(syntax.into_repr())),
3753             _ => None,
3754         }
3755     }
3756     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3757 }
3758
3759 impl ToOwned for TuplePat {
3760     type Owned = TreeArc<TuplePat>;
3761     fn to_owned(&self) -> TreeArc<TuplePat> { TreeArc::cast(self.syntax.to_owned()) }
3762 }
3763
3764
3765 impl TuplePat {
3766     pub fn args(&self) -> impl Iterator<Item = &Pat> {
3767         super::children(self)
3768     }
3769 }
3770
3771 // TupleStructPat
3772 #[derive(Debug, PartialEq, Eq, Hash)]
3773 #[repr(transparent)]
3774 pub struct TupleStructPat {
3775     pub(crate) syntax: SyntaxNode,
3776 }
3777 unsafe impl TransparentNewType for TupleStructPat {
3778     type Repr = rowan::SyntaxNode;
3779 }
3780
3781 impl AstNode for TupleStructPat {
3782     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3783         match syntax.kind() {
3784             TUPLE_STRUCT_PAT => Some(TupleStructPat::from_repr(syntax.into_repr())),
3785             _ => None,
3786         }
3787     }
3788     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3789 }
3790
3791 impl ToOwned for TupleStructPat {
3792     type Owned = TreeArc<TupleStructPat>;
3793     fn to_owned(&self) -> TreeArc<TupleStructPat> { TreeArc::cast(self.syntax.to_owned()) }
3794 }
3795
3796
3797 impl TupleStructPat {
3798     pub fn args(&self) -> impl Iterator<Item = &Pat> {
3799         super::children(self)
3800     }
3801
3802     pub fn path(&self) -> Option<&Path> {
3803         super::child_opt(self)
3804     }
3805 }
3806
3807 // TupleType
3808 #[derive(Debug, PartialEq, Eq, Hash)]
3809 #[repr(transparent)]
3810 pub struct TupleType {
3811     pub(crate) syntax: SyntaxNode,
3812 }
3813 unsafe impl TransparentNewType for TupleType {
3814     type Repr = rowan::SyntaxNode;
3815 }
3816
3817 impl AstNode for TupleType {
3818     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3819         match syntax.kind() {
3820             TUPLE_TYPE => Some(TupleType::from_repr(syntax.into_repr())),
3821             _ => None,
3822         }
3823     }
3824     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3825 }
3826
3827 impl ToOwned for TupleType {
3828     type Owned = TreeArc<TupleType>;
3829     fn to_owned(&self) -> TreeArc<TupleType> { TreeArc::cast(self.syntax.to_owned()) }
3830 }
3831
3832
3833 impl TupleType {
3834     pub fn fields(&self) -> impl Iterator<Item = &TypeRef> {
3835         super::children(self)
3836     }
3837 }
3838
3839 // TypeAliasDef
3840 #[derive(Debug, PartialEq, Eq, Hash)]
3841 #[repr(transparent)]
3842 pub struct TypeAliasDef {
3843     pub(crate) syntax: SyntaxNode,
3844 }
3845 unsafe impl TransparentNewType for TypeAliasDef {
3846     type Repr = rowan::SyntaxNode;
3847 }
3848
3849 impl AstNode for TypeAliasDef {
3850     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3851         match syntax.kind() {
3852             TYPE_ALIAS_DEF => Some(TypeAliasDef::from_repr(syntax.into_repr())),
3853             _ => None,
3854         }
3855     }
3856     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3857 }
3858
3859 impl ToOwned for TypeAliasDef {
3860     type Owned = TreeArc<TypeAliasDef>;
3861     fn to_owned(&self) -> TreeArc<TypeAliasDef> { TreeArc::cast(self.syntax.to_owned()) }
3862 }
3863
3864
3865 impl ast::VisibilityOwner for TypeAliasDef {}
3866 impl ast::NameOwner for TypeAliasDef {}
3867 impl ast::TypeParamsOwner for TypeAliasDef {}
3868 impl ast::AttrsOwner for TypeAliasDef {}
3869 impl ast::DocCommentsOwner for TypeAliasDef {}
3870 impl ast::TypeBoundsOwner for TypeAliasDef {}
3871 impl TypeAliasDef {
3872     pub fn type_ref(&self) -> Option<&TypeRef> {
3873         super::child_opt(self)
3874     }
3875 }
3876
3877 // TypeArg
3878 #[derive(Debug, PartialEq, Eq, Hash)]
3879 #[repr(transparent)]
3880 pub struct TypeArg {
3881     pub(crate) syntax: SyntaxNode,
3882 }
3883 unsafe impl TransparentNewType for TypeArg {
3884     type Repr = rowan::SyntaxNode;
3885 }
3886
3887 impl AstNode for TypeArg {
3888     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3889         match syntax.kind() {
3890             TYPE_ARG => Some(TypeArg::from_repr(syntax.into_repr())),
3891             _ => None,
3892         }
3893     }
3894     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3895 }
3896
3897 impl ToOwned for TypeArg {
3898     type Owned = TreeArc<TypeArg>;
3899     fn to_owned(&self) -> TreeArc<TypeArg> { TreeArc::cast(self.syntax.to_owned()) }
3900 }
3901
3902
3903 impl TypeArg {
3904     pub fn type_ref(&self) -> Option<&TypeRef> {
3905         super::child_opt(self)
3906     }
3907 }
3908
3909 // TypeArgList
3910 #[derive(Debug, PartialEq, Eq, Hash)]
3911 #[repr(transparent)]
3912 pub struct TypeArgList {
3913     pub(crate) syntax: SyntaxNode,
3914 }
3915 unsafe impl TransparentNewType for TypeArgList {
3916     type Repr = rowan::SyntaxNode;
3917 }
3918
3919 impl AstNode for TypeArgList {
3920     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3921         match syntax.kind() {
3922             TYPE_ARG_LIST => Some(TypeArgList::from_repr(syntax.into_repr())),
3923             _ => None,
3924         }
3925     }
3926     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3927 }
3928
3929 impl ToOwned for TypeArgList {
3930     type Owned = TreeArc<TypeArgList>;
3931     fn to_owned(&self) -> TreeArc<TypeArgList> { TreeArc::cast(self.syntax.to_owned()) }
3932 }
3933
3934
3935 impl TypeArgList {
3936     pub fn type_args(&self) -> impl Iterator<Item = &TypeArg> {
3937         super::children(self)
3938     }
3939
3940     pub fn lifetime_args(&self) -> impl Iterator<Item = &LifetimeArg> {
3941         super::children(self)
3942     }
3943
3944     pub fn assoc_type_args(&self) -> impl Iterator<Item = &AssocTypeArg> {
3945         super::children(self)
3946     }
3947 }
3948
3949 // TypeBound
3950 #[derive(Debug, PartialEq, Eq, Hash)]
3951 #[repr(transparent)]
3952 pub struct TypeBound {
3953     pub(crate) syntax: SyntaxNode,
3954 }
3955 unsafe impl TransparentNewType for TypeBound {
3956     type Repr = rowan::SyntaxNode;
3957 }
3958
3959 impl AstNode for TypeBound {
3960     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3961         match syntax.kind() {
3962             TYPE_BOUND => Some(TypeBound::from_repr(syntax.into_repr())),
3963             _ => None,
3964         }
3965     }
3966     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3967 }
3968
3969 impl ToOwned for TypeBound {
3970     type Owned = TreeArc<TypeBound>;
3971     fn to_owned(&self) -> TreeArc<TypeBound> { TreeArc::cast(self.syntax.to_owned()) }
3972 }
3973
3974
3975 impl TypeBound {
3976     pub fn type_ref(&self) -> Option<&TypeRef> {
3977         super::child_opt(self)
3978     }
3979 }
3980
3981 // TypeBoundList
3982 #[derive(Debug, PartialEq, Eq, Hash)]
3983 #[repr(transparent)]
3984 pub struct TypeBoundList {
3985     pub(crate) syntax: SyntaxNode,
3986 }
3987 unsafe impl TransparentNewType for TypeBoundList {
3988     type Repr = rowan::SyntaxNode;
3989 }
3990
3991 impl AstNode for TypeBoundList {
3992     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
3993         match syntax.kind() {
3994             TYPE_BOUND_LIST => Some(TypeBoundList::from_repr(syntax.into_repr())),
3995             _ => None,
3996         }
3997     }
3998     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3999 }
4000
4001 impl ToOwned for TypeBoundList {
4002     type Owned = TreeArc<TypeBoundList>;
4003     fn to_owned(&self) -> TreeArc<TypeBoundList> { TreeArc::cast(self.syntax.to_owned()) }
4004 }
4005
4006
4007 impl TypeBoundList {
4008     pub fn bounds(&self) -> impl Iterator<Item = &TypeBound> {
4009         super::children(self)
4010     }
4011 }
4012
4013 // TypeParam
4014 #[derive(Debug, PartialEq, Eq, Hash)]
4015 #[repr(transparent)]
4016 pub struct TypeParam {
4017     pub(crate) syntax: SyntaxNode,
4018 }
4019 unsafe impl TransparentNewType for TypeParam {
4020     type Repr = rowan::SyntaxNode;
4021 }
4022
4023 impl AstNode for TypeParam {
4024     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4025         match syntax.kind() {
4026             TYPE_PARAM => Some(TypeParam::from_repr(syntax.into_repr())),
4027             _ => None,
4028         }
4029     }
4030     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4031 }
4032
4033 impl ToOwned for TypeParam {
4034     type Owned = TreeArc<TypeParam>;
4035     fn to_owned(&self) -> TreeArc<TypeParam> { TreeArc::cast(self.syntax.to_owned()) }
4036 }
4037
4038
4039 impl ast::NameOwner for TypeParam {}
4040 impl ast::AttrsOwner for TypeParam {}
4041 impl ast::TypeBoundsOwner for TypeParam {}
4042 impl ast::DefaultTypeParamOwner for TypeParam {}
4043 impl TypeParam {}
4044
4045 // TypeParamList
4046 #[derive(Debug, PartialEq, Eq, Hash)]
4047 #[repr(transparent)]
4048 pub struct TypeParamList {
4049     pub(crate) syntax: SyntaxNode,
4050 }
4051 unsafe impl TransparentNewType for TypeParamList {
4052     type Repr = rowan::SyntaxNode;
4053 }
4054
4055 impl AstNode for TypeParamList {
4056     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4057         match syntax.kind() {
4058             TYPE_PARAM_LIST => Some(TypeParamList::from_repr(syntax.into_repr())),
4059             _ => None,
4060         }
4061     }
4062     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4063 }
4064
4065 impl ToOwned for TypeParamList {
4066     type Owned = TreeArc<TypeParamList>;
4067     fn to_owned(&self) -> TreeArc<TypeParamList> { TreeArc::cast(self.syntax.to_owned()) }
4068 }
4069
4070
4071 impl TypeParamList {
4072     pub fn type_params(&self) -> impl Iterator<Item = &TypeParam> {
4073         super::children(self)
4074     }
4075
4076     pub fn lifetime_params(&self) -> impl Iterator<Item = &LifetimeParam> {
4077         super::children(self)
4078     }
4079 }
4080
4081 // TypeRef
4082 #[derive(Debug, PartialEq, Eq, Hash)]
4083 #[repr(transparent)]
4084 pub struct TypeRef {
4085     pub(crate) syntax: SyntaxNode,
4086 }
4087 unsafe impl TransparentNewType for TypeRef {
4088     type Repr = rowan::SyntaxNode;
4089 }
4090
4091 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
4092 pub enum TypeRefKind<'a> {
4093     ParenType(&'a ParenType),
4094     TupleType(&'a TupleType),
4095     NeverType(&'a NeverType),
4096     PathType(&'a PathType),
4097     PointerType(&'a PointerType),
4098     ArrayType(&'a ArrayType),
4099     SliceType(&'a SliceType),
4100     ReferenceType(&'a ReferenceType),
4101     PlaceholderType(&'a PlaceholderType),
4102     FnPointerType(&'a FnPointerType),
4103     ForType(&'a ForType),
4104     ImplTraitType(&'a ImplTraitType),
4105     DynTraitType(&'a DynTraitType),
4106 }
4107 impl<'a> From<&'a ParenType> for &'a TypeRef {
4108     fn from(n: &'a ParenType) -> &'a TypeRef {
4109         TypeRef::cast(&n.syntax).unwrap()
4110     }
4111 }
4112 impl<'a> From<&'a TupleType> for &'a TypeRef {
4113     fn from(n: &'a TupleType) -> &'a TypeRef {
4114         TypeRef::cast(&n.syntax).unwrap()
4115     }
4116 }
4117 impl<'a> From<&'a NeverType> for &'a TypeRef {
4118     fn from(n: &'a NeverType) -> &'a TypeRef {
4119         TypeRef::cast(&n.syntax).unwrap()
4120     }
4121 }
4122 impl<'a> From<&'a PathType> for &'a TypeRef {
4123     fn from(n: &'a PathType) -> &'a TypeRef {
4124         TypeRef::cast(&n.syntax).unwrap()
4125     }
4126 }
4127 impl<'a> From<&'a PointerType> for &'a TypeRef {
4128     fn from(n: &'a PointerType) -> &'a TypeRef {
4129         TypeRef::cast(&n.syntax).unwrap()
4130     }
4131 }
4132 impl<'a> From<&'a ArrayType> for &'a TypeRef {
4133     fn from(n: &'a ArrayType) -> &'a TypeRef {
4134         TypeRef::cast(&n.syntax).unwrap()
4135     }
4136 }
4137 impl<'a> From<&'a SliceType> for &'a TypeRef {
4138     fn from(n: &'a SliceType) -> &'a TypeRef {
4139         TypeRef::cast(&n.syntax).unwrap()
4140     }
4141 }
4142 impl<'a> From<&'a ReferenceType> for &'a TypeRef {
4143     fn from(n: &'a ReferenceType) -> &'a TypeRef {
4144         TypeRef::cast(&n.syntax).unwrap()
4145     }
4146 }
4147 impl<'a> From<&'a PlaceholderType> for &'a TypeRef {
4148     fn from(n: &'a PlaceholderType) -> &'a TypeRef {
4149         TypeRef::cast(&n.syntax).unwrap()
4150     }
4151 }
4152 impl<'a> From<&'a FnPointerType> for &'a TypeRef {
4153     fn from(n: &'a FnPointerType) -> &'a TypeRef {
4154         TypeRef::cast(&n.syntax).unwrap()
4155     }
4156 }
4157 impl<'a> From<&'a ForType> for &'a TypeRef {
4158     fn from(n: &'a ForType) -> &'a TypeRef {
4159         TypeRef::cast(&n.syntax).unwrap()
4160     }
4161 }
4162 impl<'a> From<&'a ImplTraitType> for &'a TypeRef {
4163     fn from(n: &'a ImplTraitType) -> &'a TypeRef {
4164         TypeRef::cast(&n.syntax).unwrap()
4165     }
4166 }
4167 impl<'a> From<&'a DynTraitType> for &'a TypeRef {
4168     fn from(n: &'a DynTraitType) -> &'a TypeRef {
4169         TypeRef::cast(&n.syntax).unwrap()
4170     }
4171 }
4172
4173
4174 impl AstNode for TypeRef {
4175     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4176         match syntax.kind() {
4177             | PAREN_TYPE
4178             | TUPLE_TYPE
4179             | NEVER_TYPE
4180             | PATH_TYPE
4181             | POINTER_TYPE
4182             | ARRAY_TYPE
4183             | SLICE_TYPE
4184             | REFERENCE_TYPE
4185             | PLACEHOLDER_TYPE
4186             | FN_POINTER_TYPE
4187             | FOR_TYPE
4188             | IMPL_TRAIT_TYPE
4189             | DYN_TRAIT_TYPE => Some(TypeRef::from_repr(syntax.into_repr())),
4190             _ => None,
4191         }
4192     }
4193     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4194 }
4195
4196 impl ToOwned for TypeRef {
4197     type Owned = TreeArc<TypeRef>;
4198     fn to_owned(&self) -> TreeArc<TypeRef> { TreeArc::cast(self.syntax.to_owned()) }
4199 }
4200
4201 impl TypeRef {
4202     pub fn kind(&self) -> TypeRefKind {
4203         match self.syntax.kind() {
4204             PAREN_TYPE => TypeRefKind::ParenType(ParenType::cast(&self.syntax).unwrap()),
4205             TUPLE_TYPE => TypeRefKind::TupleType(TupleType::cast(&self.syntax).unwrap()),
4206             NEVER_TYPE => TypeRefKind::NeverType(NeverType::cast(&self.syntax).unwrap()),
4207             PATH_TYPE => TypeRefKind::PathType(PathType::cast(&self.syntax).unwrap()),
4208             POINTER_TYPE => TypeRefKind::PointerType(PointerType::cast(&self.syntax).unwrap()),
4209             ARRAY_TYPE => TypeRefKind::ArrayType(ArrayType::cast(&self.syntax).unwrap()),
4210             SLICE_TYPE => TypeRefKind::SliceType(SliceType::cast(&self.syntax).unwrap()),
4211             REFERENCE_TYPE => TypeRefKind::ReferenceType(ReferenceType::cast(&self.syntax).unwrap()),
4212             PLACEHOLDER_TYPE => TypeRefKind::PlaceholderType(PlaceholderType::cast(&self.syntax).unwrap()),
4213             FN_POINTER_TYPE => TypeRefKind::FnPointerType(FnPointerType::cast(&self.syntax).unwrap()),
4214             FOR_TYPE => TypeRefKind::ForType(ForType::cast(&self.syntax).unwrap()),
4215             IMPL_TRAIT_TYPE => TypeRefKind::ImplTraitType(ImplTraitType::cast(&self.syntax).unwrap()),
4216             DYN_TRAIT_TYPE => TypeRefKind::DynTraitType(DynTraitType::cast(&self.syntax).unwrap()),
4217             _ => unreachable!(),
4218         }
4219     }
4220 }
4221
4222 impl TypeRef {}
4223
4224 // UseItem
4225 #[derive(Debug, PartialEq, Eq, Hash)]
4226 #[repr(transparent)]
4227 pub struct UseItem {
4228     pub(crate) syntax: SyntaxNode,
4229 }
4230 unsafe impl TransparentNewType for UseItem {
4231     type Repr = rowan::SyntaxNode;
4232 }
4233
4234 impl AstNode for UseItem {
4235     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4236         match syntax.kind() {
4237             USE_ITEM => Some(UseItem::from_repr(syntax.into_repr())),
4238             _ => None,
4239         }
4240     }
4241     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4242 }
4243
4244 impl ToOwned for UseItem {
4245     type Owned = TreeArc<UseItem>;
4246     fn to_owned(&self) -> TreeArc<UseItem> { TreeArc::cast(self.syntax.to_owned()) }
4247 }
4248
4249
4250 impl ast::AttrsOwner for UseItem {}
4251 impl UseItem {
4252     pub fn use_tree(&self) -> Option<&UseTree> {
4253         super::child_opt(self)
4254     }
4255 }
4256
4257 // UseTree
4258 #[derive(Debug, PartialEq, Eq, Hash)]
4259 #[repr(transparent)]
4260 pub struct UseTree {
4261     pub(crate) syntax: SyntaxNode,
4262 }
4263 unsafe impl TransparentNewType for UseTree {
4264     type Repr = rowan::SyntaxNode;
4265 }
4266
4267 impl AstNode for UseTree {
4268     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4269         match syntax.kind() {
4270             USE_TREE => Some(UseTree::from_repr(syntax.into_repr())),
4271             _ => None,
4272         }
4273     }
4274     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4275 }
4276
4277 impl ToOwned for UseTree {
4278     type Owned = TreeArc<UseTree>;
4279     fn to_owned(&self) -> TreeArc<UseTree> { TreeArc::cast(self.syntax.to_owned()) }
4280 }
4281
4282
4283 impl UseTree {
4284     pub fn path(&self) -> Option<&Path> {
4285         super::child_opt(self)
4286     }
4287
4288     pub fn use_tree_list(&self) -> Option<&UseTreeList> {
4289         super::child_opt(self)
4290     }
4291
4292     pub fn alias(&self) -> Option<&Alias> {
4293         super::child_opt(self)
4294     }
4295 }
4296
4297 // UseTreeList
4298 #[derive(Debug, PartialEq, Eq, Hash)]
4299 #[repr(transparent)]
4300 pub struct UseTreeList {
4301     pub(crate) syntax: SyntaxNode,
4302 }
4303 unsafe impl TransparentNewType for UseTreeList {
4304     type Repr = rowan::SyntaxNode;
4305 }
4306
4307 impl AstNode for UseTreeList {
4308     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4309         match syntax.kind() {
4310             USE_TREE_LIST => Some(UseTreeList::from_repr(syntax.into_repr())),
4311             _ => None,
4312         }
4313     }
4314     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4315 }
4316
4317 impl ToOwned for UseTreeList {
4318     type Owned = TreeArc<UseTreeList>;
4319     fn to_owned(&self) -> TreeArc<UseTreeList> { TreeArc::cast(self.syntax.to_owned()) }
4320 }
4321
4322
4323 impl UseTreeList {
4324     pub fn use_trees(&self) -> impl Iterator<Item = &UseTree> {
4325         super::children(self)
4326     }
4327 }
4328
4329 // Visibility
4330 #[derive(Debug, PartialEq, Eq, Hash)]
4331 #[repr(transparent)]
4332 pub struct Visibility {
4333     pub(crate) syntax: SyntaxNode,
4334 }
4335 unsafe impl TransparentNewType for Visibility {
4336     type Repr = rowan::SyntaxNode;
4337 }
4338
4339 impl AstNode for Visibility {
4340     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4341         match syntax.kind() {
4342             VISIBILITY => Some(Visibility::from_repr(syntax.into_repr())),
4343             _ => None,
4344         }
4345     }
4346     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4347 }
4348
4349 impl ToOwned for Visibility {
4350     type Owned = TreeArc<Visibility>;
4351     fn to_owned(&self) -> TreeArc<Visibility> { TreeArc::cast(self.syntax.to_owned()) }
4352 }
4353
4354
4355 impl Visibility {}
4356
4357 // WhereClause
4358 #[derive(Debug, PartialEq, Eq, Hash)]
4359 #[repr(transparent)]
4360 pub struct WhereClause {
4361     pub(crate) syntax: SyntaxNode,
4362 }
4363 unsafe impl TransparentNewType for WhereClause {
4364     type Repr = rowan::SyntaxNode;
4365 }
4366
4367 impl AstNode for WhereClause {
4368     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4369         match syntax.kind() {
4370             WHERE_CLAUSE => Some(WhereClause::from_repr(syntax.into_repr())),
4371             _ => None,
4372         }
4373     }
4374     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4375 }
4376
4377 impl ToOwned for WhereClause {
4378     type Owned = TreeArc<WhereClause>;
4379     fn to_owned(&self) -> TreeArc<WhereClause> { TreeArc::cast(self.syntax.to_owned()) }
4380 }
4381
4382
4383 impl WhereClause {
4384     pub fn predicates(&self) -> impl Iterator<Item = &WherePred> {
4385         super::children(self)
4386     }
4387 }
4388
4389 // WherePred
4390 #[derive(Debug, PartialEq, Eq, Hash)]
4391 #[repr(transparent)]
4392 pub struct WherePred {
4393     pub(crate) syntax: SyntaxNode,
4394 }
4395 unsafe impl TransparentNewType for WherePred {
4396     type Repr = rowan::SyntaxNode;
4397 }
4398
4399 impl AstNode for WherePred {
4400     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4401         match syntax.kind() {
4402             WHERE_PRED => Some(WherePred::from_repr(syntax.into_repr())),
4403             _ => None,
4404         }
4405     }
4406     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4407 }
4408
4409 impl ToOwned for WherePred {
4410     type Owned = TreeArc<WherePred>;
4411     fn to_owned(&self) -> TreeArc<WherePred> { TreeArc::cast(self.syntax.to_owned()) }
4412 }
4413
4414
4415 impl ast::TypeBoundsOwner for WherePred {}
4416 impl WherePred {
4417     pub fn type_ref(&self) -> Option<&TypeRef> {
4418         super::child_opt(self)
4419     }
4420 }
4421
4422 // WhileExpr
4423 #[derive(Debug, PartialEq, Eq, Hash)]
4424 #[repr(transparent)]
4425 pub struct WhileExpr {
4426     pub(crate) syntax: SyntaxNode,
4427 }
4428 unsafe impl TransparentNewType for WhileExpr {
4429     type Repr = rowan::SyntaxNode;
4430 }
4431
4432 impl AstNode for WhileExpr {
4433     fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4434         match syntax.kind() {
4435             WHILE_EXPR => Some(WhileExpr::from_repr(syntax.into_repr())),
4436             _ => None,
4437         }
4438     }
4439     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4440 }
4441
4442 impl ToOwned for WhileExpr {
4443     type Owned = TreeArc<WhileExpr>;
4444     fn to_owned(&self) -> TreeArc<WhileExpr> { TreeArc::cast(self.syntax.to_owned()) }
4445 }
4446
4447
4448 impl ast::LoopBodyOwner for WhileExpr {}
4449 impl WhileExpr {
4450     pub fn condition(&self) -> Option<&Condition> {
4451         super::child_opt(self)
4452     }
4453 }
4454