]> git.lizzy.rs Git - rust.git/blob - crates/ra_syntax/src/ast/generated/nodes.rs
Properly document const impl as per flodiebold
[rust.git] / crates / ra_syntax / src / ast / generated / nodes.rs
1 //! Generated file, do not edit by hand, see `xtask/src/codegen`
2
3 use crate::{
4     ast::{self, support, AstChildren, AstNode},
5     SyntaxKind::{self, *},
6     SyntaxNode, SyntaxToken, T,
7 };
8 /// The entire Rust source file. Includes all top-level inner attributes and module items.
9 ///
10 /// [Reference](https://doc.rust-lang.org/reference/crates-and-source-files.html)
11 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
12 pub struct SourceFile {
13     pub(crate) syntax: SyntaxNode,
14 }
15 impl ast::ModuleItemOwner for SourceFile {}
16 impl ast::AttrsOwner for SourceFile {}
17 impl ast::DocCommentsOwner for SourceFile {}
18 impl SourceFile {
19     pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) }
20 }
21 /// Function definition either with body or not.
22 /// Includes all of its attributes and doc comments.
23 ///
24 /// ```
25 /// ❰
26 ///     /// Docs
27 ///     #[attr]
28 ///     pub extern "C" fn foo<T>(#[attr] Patern {p}: Pattern) -> u32
29 ///     where
30 ///         T: Debug
31 ///     {
32 ///         42
33 ///     }
34 /// ❱
35 ///
36 /// extern "C" {
37 ///     ❰ fn fn_decl(also_variadic_ffi: u32, ...) -> u32; ❱
38 /// }
39 /// ```
40 ///
41 /// - [Reference](https://doc.rust-lang.org/reference/items/functions.html)
42 /// - [Nomicon](https://doc.rust-lang.org/nomicon/ffi.html#variadic-functions)
43 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
44 pub struct FnDef {
45     pub(crate) syntax: SyntaxNode,
46 }
47 impl ast::VisibilityOwner for FnDef {}
48 impl ast::NameOwner for FnDef {}
49 impl ast::TypeParamsOwner for FnDef {}
50 impl ast::DocCommentsOwner for FnDef {}
51 impl ast::AttrsOwner for FnDef {}
52 impl FnDef {
53     pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
54     pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
55     pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
56     pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
57     pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
58     pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
59     pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
60     pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
61     pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
62     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
63 }
64 /// Return type annotation.
65 ///
66 /// ```
67 /// fn foo(a: u32) ❰ -> Option<u32> ❱ { Some(a) }
68 /// ```
69 ///
70 /// [Reference](https://doc.rust-lang.org/reference/items/functions.html)
71 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
72 pub struct RetType {
73     pub(crate) syntax: SyntaxNode,
74 }
75 impl RetType {
76     pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) }
77     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
78 }
79 /// Struct definition.
80 /// Includes all of its attributes and doc comments.
81 ///
82 /// ```
83 /// ❰
84 ///     /// Docs
85 ///     #[attr]
86 ///     struct Foo<T> where T: Debug {
87 ///         /// Docs
88 ///         #[attr]
89 ///         pub a: u32,
90 ///         b: T,
91 ///     }
92 /// ❱
93 ///
94 /// ❰ struct Foo; ❱
95 /// ❰ struct Foo<T>(#[attr] T) where T: Debug; ❱
96 /// ```
97 ///
98 /// [Reference](https://doc.rust-lang.org/reference/items/structs.html)
99 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
100 pub struct StructDef {
101     pub(crate) syntax: SyntaxNode,
102 }
103 impl ast::VisibilityOwner for StructDef {}
104 impl ast::NameOwner for StructDef {}
105 impl ast::TypeParamsOwner for StructDef {}
106 impl ast::AttrsOwner for StructDef {}
107 impl ast::DocCommentsOwner for StructDef {}
108 impl StructDef {
109     pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
110     pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
111     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
112 }
113 /// Union definition.
114 /// Includes all of its attributes and doc comments.
115 ///
116 /// ```
117 /// ❰
118 ///     /// Docs
119 ///     #[attr]
120 ///     pub union Foo<T> where T: Debug {
121 ///         /// Docs
122 ///         #[attr]
123 ///         a: T,
124 ///         b: u32,
125 ///     }
126 /// ❱
127 /// ```
128 ///
129 /// [Reference](https://doc.rust-lang.org/reference/items/unions.html)
130 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
131 pub struct UnionDef {
132     pub(crate) syntax: SyntaxNode,
133 }
134 impl ast::VisibilityOwner for UnionDef {}
135 impl ast::NameOwner for UnionDef {}
136 impl ast::TypeParamsOwner for UnionDef {}
137 impl ast::AttrsOwner for UnionDef {}
138 impl ast::DocCommentsOwner for UnionDef {}
139 impl UnionDef {
140     pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
141     pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> {
142         support::child(&self.syntax)
143     }
144 }
145 /// Record field definition list including enclosing curly braces.
146 ///
147 /// ```
148 /// struct Foo // same for union
149 /// ❰
150 ///     {
151 ///         a: u32,
152 ///         b: bool,
153 ///     }
154 /// ❱
155 /// ```
156 ///
157 /// [Reference](https://doc.rust-lang.org/reference/items/structs.html)
158 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
159 pub struct RecordFieldDefList {
160     pub(crate) syntax: SyntaxNode,
161 }
162 impl RecordFieldDefList {
163     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
164     pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) }
165     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
166 }
167 /// Record field definition including its attributes and doc comments.
168 ///
169 /// ` ``
170 /// same for union
171 /// struct Foo {
172 ///      ❰
173 ///          /// Docs
174 ///          #[attr]
175 ///          pub a: u32
176 ///      ❱
177 ///
178 ///      ❰ b: bool ❱
179 /// }
180 /// ```
181 ///
182 /// [Reference](https://doc.rust-lang.org/reference/items/structs.html)
183 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
184 pub struct RecordFieldDef {
185     pub(crate) syntax: SyntaxNode,
186 }
187 impl ast::VisibilityOwner for RecordFieldDef {}
188 impl ast::NameOwner for RecordFieldDef {}
189 impl ast::AttrsOwner for RecordFieldDef {}
190 impl ast::DocCommentsOwner for RecordFieldDef {}
191 impl ast::TypeAscriptionOwner for RecordFieldDef {}
192 impl RecordFieldDef {}
193 /// Tuple field definition list including enclosing parens.
194 ///
195 /// ```
196 /// struct Foo ❰ (u32, String, Vec<u32>) ❱;
197 /// ```
198 ///
199 /// [Reference](https://doc.rust-lang.org/reference/items/structs.html)
200 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
201 pub struct TupleFieldDefList {
202     pub(crate) syntax: SyntaxNode,
203 }
204 impl TupleFieldDefList {
205     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
206     pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) }
207     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
208 }
209 /// Tuple field definition including its attributes.
210 ///
211 /// ```
212 /// struct Foo(❰ #[attr] u32 ❱);
213 /// ```
214 ///
215 /// [Reference](https://doc.rust-lang.org/reference/items/structs.html)
216 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
217 pub struct TupleFieldDef {
218     pub(crate) syntax: SyntaxNode,
219 }
220 impl ast::VisibilityOwner for TupleFieldDef {}
221 impl ast::AttrsOwner for TupleFieldDef {}
222 impl TupleFieldDef {
223     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
224 }
225 /// Enum definition.
226 /// Includes all of its attributes and doc comments.
227 ///
228 /// ```
229 /// ❰
230 ///     /// Docs
231 ///     #[attr]
232 ///     pub enum Foo<T> where T: Debug {
233 ///         /// Docs
234 ///         #[attr]
235 ///         Bar,
236 ///         Baz(#[attr] u32),
237 ///         Bruh {
238 ///             a: u32,
239 ///             /// Docs
240 ///             #[attr]
241 ///             b: T,
242 ///         }
243 ///     }
244 /// ❱
245 /// ```
246 ///
247 /// [Reference](https://doc.rust-lang.org/reference/items/enumerations.html)
248 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
249 pub struct EnumDef {
250     pub(crate) syntax: SyntaxNode,
251 }
252 impl ast::VisibilityOwner for EnumDef {}
253 impl ast::NameOwner for EnumDef {}
254 impl ast::TypeParamsOwner for EnumDef {}
255 impl ast::AttrsOwner for EnumDef {}
256 impl ast::DocCommentsOwner for EnumDef {}
257 impl EnumDef {
258     pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
259     pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) }
260 }
261 /// Enum variant definition list including enclosing curly braces.
262 ///
263 /// ```
264 /// enum Foo
265 /// ❰
266 ///     {
267 ///         Bar,
268 ///         Baz(u32),
269 ///         Bruh {
270 ///             a: u32
271 ///         }
272 ///     }
273 /// ❱
274 /// ```
275 ///
276 /// [Reference](https://doc.rust-lang.org/reference/items/enumerations.html)
277 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
278 pub struct EnumVariantList {
279     pub(crate) syntax: SyntaxNode,
280 }
281 impl EnumVariantList {
282     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
283     pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) }
284     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
285 }
286 /// Enum variant definition including its attributes and discriminant value definition.
287 ///
288 /// ```
289 /// enum Foo {
290 ///     ❰
291 ///         /// Docs
292 ///         #[attr]
293 ///         Bar
294 ///     ❱
295 ///
296 ///     // same for tuple and record variants
297 /// }
298 /// ```
299 ///
300 /// [Reference](https://doc.rust-lang.org/reference/items/enumerations.html)
301 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
302 pub struct EnumVariant {
303     pub(crate) syntax: SyntaxNode,
304 }
305 impl ast::VisibilityOwner for EnumVariant {}
306 impl ast::NameOwner for EnumVariant {}
307 impl ast::DocCommentsOwner for EnumVariant {}
308 impl ast::AttrsOwner for EnumVariant {}
309 impl EnumVariant {
310     pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) }
311     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
312     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
313 }
314 /// Trait definition.
315 /// Includes all of its attributes and doc comments.
316 ///
317 /// ```
318 /// ❰
319 ///     /// Docs
320 ///     #[attr]
321 ///     pub unsafe trait Foo<T>: Debug where T: Debug {
322 ///         // ...
323 ///     }
324 /// ❱
325 /// ```
326 ///
327 /// [Reference](https://doc.rust-lang.org/reference/items/traits.html)
328 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
329 pub struct TraitDef {
330     pub(crate) syntax: SyntaxNode,
331 }
332 impl ast::VisibilityOwner for TraitDef {}
333 impl ast::NameOwner for TraitDef {}
334 impl ast::AttrsOwner for TraitDef {}
335 impl ast::DocCommentsOwner for TraitDef {}
336 impl ast::TypeParamsOwner for TraitDef {}
337 impl ast::TypeBoundsOwner for TraitDef {}
338 impl TraitDef {
339     pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
340     pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
341     pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
342     pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
343 }
344 /// Module definition either with body or not.
345 /// Includes all of its inner and outer attributes, module items, doc comments.
346 ///
347 /// ```
348 /// ❰
349 ///     /// Docs
350 ///     #[attr]
351 ///     pub mod foo;
352 /// ❱
353 ///
354 /// ❰
355 ///     /// Docs
356 ///     #[attr]
357 ///     pub mod bar {
358 ///        //! Inner docs
359 ///        #![inner_attr]
360 ///     }
361 /// ❱
362 /// ```
363 ///
364 /// [Reference](https://doc.rust-lang.org/reference/items/modules.html)
365 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
366 pub struct Module {
367     pub(crate) syntax: SyntaxNode,
368 }
369 impl ast::VisibilityOwner for Module {}
370 impl ast::NameOwner for Module {}
371 impl ast::AttrsOwner for Module {}
372 impl ast::DocCommentsOwner for Module {}
373 impl Module {
374     pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) }
375     pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
376     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
377 }
378 /// Item defintion list.
379 /// This is used for both top-level items and impl block items.
380 ///
381 /// ```
382 /// ❰
383 ///     fn foo {}
384 ///     struct Bar;
385 ///     enum Baz;
386 ///     trait Bruh;
387 ///     const BRUUH: u32 = 42;
388 /// ❱
389 ///
390 /// impl Foo
391 /// ❰
392 ///     {
393 ///         fn bar() {}
394 ///         const BAZ: u32 = 42;
395 ///     }
396 /// ❱
397 /// ```
398 ///
399 /// [Reference](https://doc.rust-lang.org/reference/items.html)
400 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
401 pub struct ItemList {
402     pub(crate) syntax: SyntaxNode,
403 }
404 impl ast::ModuleItemOwner for ItemList {}
405 impl ItemList {
406     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
407     pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
408     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
409 }
410 /// Constant variable definition.
411 /// Includes all of its attributes and doc comments.
412 ///
413 /// ```
414 /// ❰
415 ///     /// Docs
416 ///     #[attr]
417 ///     pub const FOO: u32 = 42;
418 /// ❱
419 /// ```
420 ///
421 /// [Reference](https://doc.rust-lang.org/reference/items/constant-items.html)
422 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
423 pub struct ConstDef {
424     pub(crate) syntax: SyntaxNode,
425 }
426 impl ast::VisibilityOwner for ConstDef {}
427 impl ast::NameOwner for ConstDef {}
428 impl ast::TypeParamsOwner for ConstDef {}
429 impl ast::AttrsOwner for ConstDef {}
430 impl ast::DocCommentsOwner for ConstDef {}
431 impl ast::TypeAscriptionOwner for ConstDef {}
432 impl ConstDef {
433     pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
434     pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
435     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
436     pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
437     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
438 }
439 /// Static variable definition.
440 /// Includes all of its attributes and doc comments.
441 ///
442 /// ```
443 /// ❰
444 ///     /// Docs
445 ///     #[attr]
446 ///     pub static mut FOO: u32 = 42;
447 /// ❱
448 /// ```
449 ///
450 /// [Reference](https://doc.rust-lang.org/reference/items/static-items.html)
451 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
452 pub struct StaticDef {
453     pub(crate) syntax: SyntaxNode,
454 }
455 impl ast::VisibilityOwner for StaticDef {}
456 impl ast::NameOwner for StaticDef {}
457 impl ast::TypeParamsOwner for StaticDef {}
458 impl ast::AttrsOwner for StaticDef {}
459 impl ast::DocCommentsOwner for StaticDef {}
460 impl ast::TypeAscriptionOwner for StaticDef {}
461 impl StaticDef {
462     pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
463     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
464     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
465     pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
466     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
467 }
468 /// Type alias definition.
469 /// Includes associated type clauses with type bounds.
470 ///
471 /// ```
472 /// ❰
473 ///     /// Docs
474 ///     #[attr]
475 ///     pub type Foo<T> where T: Debug = T;
476 /// ❱
477 ///
478 /// trait Bar {
479 ///     ❰ type Baz: Debug; ❱
480 ///     ❰ type Bruh = String; ❱
481 ///     ❰ type Bruuh: Debug = u32; ❱
482 /// }
483 /// ```
484 ///
485 /// [Reference](https://doc.rust-lang.org/reference/items/type-aliases.html)
486 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
487 pub struct TypeAliasDef {
488     pub(crate) syntax: SyntaxNode,
489 }
490 impl ast::VisibilityOwner for TypeAliasDef {}
491 impl ast::NameOwner for TypeAliasDef {}
492 impl ast::TypeParamsOwner for TypeAliasDef {}
493 impl ast::AttrsOwner for TypeAliasDef {}
494 impl ast::DocCommentsOwner for TypeAliasDef {}
495 impl ast::TypeBoundsOwner for TypeAliasDef {}
496 impl TypeAliasDef {
497     pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
498     pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
499     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
500     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
501     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
502 }
503 /// Inherent and trait impl definition.
504 /// Includes all of its inner and outer attributes.
505 ///
506 /// ```
507 /// ❰
508 ///     #[attr]
509 ///     unsafe impl<T> const !Foo for Bar where T: Debug {
510 ///         #![inner_attr]
511 ///         // ...
512 ///     }
513 /// ❱
514 /// ```
515 ///
516 /// [Reference](https://doc.rust-lang.org/reference/items/implementations.html)
517 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
518 pub struct ImplDef {
519     pub(crate) syntax: SyntaxNode,
520 }
521 impl ast::TypeParamsOwner for ImplDef {}
522 impl ast::AttrsOwner for ImplDef {}
523 impl ast::DocCommentsOwner for ImplDef {}
524 impl ImplDef {
525     pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
526     pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
527     pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
528     pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
529     pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
530     pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
531     pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
532 }
533 /// Parenthesized type reference.
534 /// Note: parens are only used for grouping, this is not a tuple type.
535 ///
536 /// ```
537 /// // This is effectively just `u32`.
538 /// // Single-item tuple must be defined with a trailing comma: `(u32,)`
539 /// type Foo = ❰ (u32) ❱;
540 ///
541 /// let bar: &'static ❰ (dyn Debug) ❱ = "bruh";
542 /// ```
543 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
544 pub struct ParenType {
545     pub(crate) syntax: SyntaxNode,
546 }
547 impl ParenType {
548     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
549     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
550     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
551 }
552 /// Unnamed tuple type.
553 ///
554 /// ```
555 /// let foo: ❰ (u32, bool) ❱ = (42, true);
556 /// ```
557 ///
558 /// [Reference](https://doc.rust-lang.org/reference/types/tuple.html)
559 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
560 pub struct TupleType {
561     pub(crate) syntax: SyntaxNode,
562 }
563 impl TupleType {
564     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
565     pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) }
566     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
567 }
568 /// The never type (i.e. the exclamation point).
569 ///
570 /// ```
571 /// type T = ❰ ! ❱;
572 ///
573 /// fn no_return() -> ❰ ! ❱ {
574 ///     loop {}
575 /// }
576 /// ```
577 ///
578 /// [Reference](https://doc.rust-lang.org/reference/types/never.html)
579 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
580 pub struct NeverType {
581     pub(crate) syntax: SyntaxNode,
582 }
583 impl NeverType {
584     pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
585 }
586 /// Path to a type.
587 /// Includes single identifier type names and elaborate paths with
588 /// generic parameters.
589 ///
590 /// ```
591 /// type Foo = ❰ String ❱;
592 /// type Bar = ❰ std::vec::Vec<T> ❱;
593 /// type Baz = ❰ ::bruh::<Bruuh as Iterator>::Item ❱;
594 /// ```
595 ///
596 /// [Reference](https://doc.rust-lang.org/reference/paths.html)
597 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
598 pub struct PathType {
599     pub(crate) syntax: SyntaxNode,
600 }
601 impl PathType {
602     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
603 }
604 /// Raw pointer type.
605 ///
606 /// ```
607 /// type Foo = ❰ *const u32 ❱;
608 /// type Bar = ❰ *mut u32 ❱;
609 /// ```
610 ///
611 /// [Reference](https://doc.rust-lang.org/reference/types/pointer.html#raw-pointers-const-and-mut)
612 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
613 pub struct PointerType {
614     pub(crate) syntax: SyntaxNode,
615 }
616 impl PointerType {
617     pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
618     pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
619     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
620     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
621 }
622 /// Array type.
623 ///
624 /// ```
625 /// type Foo = ❰ [u32; 24 - 3] ❱;
626 /// ```
627 ///
628 /// [Reference](https://doc.rust-lang.org/reference/types/array.html)
629 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
630 pub struct ArrayType {
631     pub(crate) syntax: SyntaxNode,
632 }
633 impl ArrayType {
634     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
635     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
636     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
637     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
638     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
639 }
640 /// Slice type.
641 ///
642 /// ```
643 /// type Foo = ❰ [u8] ❱;
644 /// ```
645 ///
646 /// [Reference](https://doc.rust-lang.org/reference/types/slice.html)
647 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
648 pub struct SliceType {
649     pub(crate) syntax: SyntaxNode,
650 }
651 impl SliceType {
652     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
653     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
654     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
655 }
656 /// Reference type.
657 ///
658 /// ```
659 /// type Foo = ❰ &'static str ❱;
660 /// ```
661 ///
662 /// [Reference](https://doc.rust-lang.org/reference/types/pointer.html)
663 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
664 pub struct ReferenceType {
665     pub(crate) syntax: SyntaxNode,
666 }
667 impl ReferenceType {
668     pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
669     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
670         support::token(&self.syntax, T![lifetime])
671     }
672     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
673     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
674 }
675 /// Placeholder type (i.e. the underscore).
676 ///
677 /// ```
678 /// let foo: ❰ _ ❱ = 42_u32;
679 /// ```
680 ///
681 /// [Reference](https://doc.rust-lang.org/reference/types/inferred.html)
682 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
683 pub struct PlaceholderType {
684     pub(crate) syntax: SyntaxNode,
685 }
686 impl PlaceholderType {
687     pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
688 }
689 /// Function pointer type (not to be confused with `Fn*` family of traits).
690 ///
691 /// ```
692 /// type Foo = ❰ async fn(#[attr] u32, named: bool) -> u32 ❱;
693 ///
694 /// type Bar = ❰ extern "C" fn(variadic: u32, #[attr] ...) ❱;
695 /// ```
696 ///
697 /// [Reference](https://doc.rust-lang.org/reference/types/function-pointer.html)
698 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
699 pub struct FnPointerType {
700     pub(crate) syntax: SyntaxNode,
701 }
702 impl FnPointerType {
703     pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
704     pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
705     pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
706     pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
707     pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
708 }
709 /// Higher order type.
710 ///
711 /// ```
712 /// type Foo = ❰ for<'a> fn(&'a str) ❱;
713 /// ```
714 ///
715 /// [Reference](https://doc.rust-lang.org/nomicon/hrtb.html)
716 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
717 pub struct ForType {
718     pub(crate) syntax: SyntaxNode,
719 }
720 impl ForType {
721     pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
722     pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) }
723     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
724 }
725 /// Opaque `impl Trait` type.
726 ///
727 /// ```
728 /// fn foo(bar: ❰ impl Debug + Eq ❱) {}
729 /// ```
730 ///
731 /// [Reference](https://doc.rust-lang.org/reference/types/impl-trait.html)
732 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
733 pub struct ImplTraitType {
734     pub(crate) syntax: SyntaxNode,
735 }
736 impl ast::TypeBoundsOwner for ImplTraitType {}
737 impl ImplTraitType {
738     pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
739 }
740 /// Trait object type.
741 ///
742 /// ```
743 /// type Foo = ❰ dyn Debug ❱;
744 /// ```
745 ///
746 /// [Reference](https://doc.rust-lang.org/reference/types/trait-object.html)
747 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
748 pub struct DynTraitType {
749     pub(crate) syntax: SyntaxNode,
750 }
751 impl ast::TypeBoundsOwner for DynTraitType {}
752 impl DynTraitType {
753     pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
754 }
755 /// Tuple literal.
756 ///
757 /// ```
758 /// ❰ (42, true) ❱;
759 /// ```
760 ///
761 /// [Reference](https://doc.rust-lang.org/reference/expressions/tuple-expr.html)
762 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
763 pub struct TupleExpr {
764     pub(crate) syntax: SyntaxNode,
765 }
766 impl ast::AttrsOwner for TupleExpr {}
767 impl TupleExpr {
768     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
769     pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
770     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
771 }
772 /// Array literal.
773 ///
774 /// ```
775 /// ❰ [#![inner_attr] true, false, true] ❱;
776 ///
777 /// ❰ ["baz"; 24] ❱;
778 /// ```
779 ///
780 /// [Reference](https://doc.rust-lang.org/reference/expressions/array-expr.html)
781 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
782 pub struct ArrayExpr {
783     pub(crate) syntax: SyntaxNode,
784 }
785 impl ast::AttrsOwner for ArrayExpr {}
786 impl ArrayExpr {
787     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
788     pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
789     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
790     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
791 }
792 /// Parenthesized expression.
793 /// Note: parens are only used for grouping, this is not a tuple literal.
794 ///
795 /// ```
796 /// ❰ (#![inner_attr] 2 + 2) ❱ * 2;
797 /// ```
798 ///
799 /// [Reference](https://doc.rust-lang.org/reference/expressions/grouped-expr.html)
800 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
801 pub struct ParenExpr {
802     pub(crate) syntax: SyntaxNode,
803 }
804 impl ast::AttrsOwner for ParenExpr {}
805 impl ParenExpr {
806     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
807     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
808     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
809 }
810 /// Path to a symbol in expression context.
811 /// Includes single identifier variable names and elaborate paths with
812 /// generic parameters.
813 ///
814 /// ```
815 /// ❰ Some::<i32> ❱;
816 /// ❰ foo ❱ + 42;
817 /// ❰ Vec::<i32>::push ❱;
818 /// ❰ <[i32]>::reverse ❱;
819 /// ❰ <String as std::borrow::Borrow<str>>::borrow ❱;
820 /// ```
821 ///
822 /// [Reference](https://doc.rust-lang.org/reference/expressions/path-expr.html)
823 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
824 pub struct PathExpr {
825     pub(crate) syntax: SyntaxNode,
826 }
827 impl PathExpr {
828     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
829 }
830 /// Anonymous callable object literal a.k.a. closure, lambda or functor.
831 ///
832 /// ```
833 /// ❰ || 42 ❱;
834 /// ❰ |a: u32| val + 1 ❱;
835 /// ❰ async |#[attr] Pattern(_): Pattern| { bar } ❱;
836 /// ❰ move || baz ❱;
837 /// ❰ || -> u32 { closure_with_ret_type_annotation_requires_block_expr } ❱
838 /// ```
839 ///
840 /// [Reference](https://doc.rust-lang.org/reference/expressions/closure-expr.html)
841 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
842 pub struct LambdaExpr {
843     pub(crate) syntax: SyntaxNode,
844 }
845 impl ast::AttrsOwner for LambdaExpr {}
846 impl LambdaExpr {
847     pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
848     pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
849     pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
850     pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
851     pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
852 }
853 /// If expression. Includes both regular `if` and `if let` forms.
854 /// Beware that `else if` is a special case syntax sugar, because in general
855 /// there has to be block expression after `else`.
856 ///
857 /// ```
858 /// ❰ if bool_cond { 42 } ❱
859 /// ❰ if bool_cond { 42 } else { 24 } ❱
860 /// ❰ if bool_cond { 42 } else if bool_cond2 { 42 } ❱
861 ///
862 /// ❰
863 ///     if let Pattern(foo) = bar {
864 ///         foo
865 ///     } else {
866 ///         panic!();
867 ///     }
868 /// ❱
869 /// ```
870 ///
871 /// [Reference](https://doc.rust-lang.org/reference/expressions/if-expr.html)
872 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
873 pub struct IfExpr {
874     pub(crate) syntax: SyntaxNode,
875 }
876 impl ast::AttrsOwner for IfExpr {}
877 impl IfExpr {
878     pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
879     pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
880 }
881 /// Unconditional loop expression.
882 ///
883 /// ```
884 /// ❰
885 ///     loop {
886 ///         // yeah, it's that simple...
887 ///     }
888 /// ❱
889 /// ```
890 ///
891 /// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html)
892 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
893 pub struct LoopExpr {
894     pub(crate) syntax: SyntaxNode,
895 }
896 impl ast::AttrsOwner for LoopExpr {}
897 impl ast::LoopBodyOwner for LoopExpr {}
898 impl LoopExpr {
899     pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
900 }
901 /// Block expression with an optional prefix (label, try ketword,
902 /// unsafe keyword, async keyword...).
903 ///
904 /// ```
905 /// ❰
906 ///     'label: try {
907 ///         None?
908 ///     }
909 /// ❱
910 /// ```
911 ///
912 /// - [try block](https://doc.rust-lang.org/unstable-book/language-features/try-blocks.html)
913 /// - [unsafe block](https://doc.rust-lang.org/reference/expressions/block-expr.html#unsafe-blocks)
914 /// - [async block](https://doc.rust-lang.org/reference/expressions/block-expr.html#async-blocks)
915 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
916 pub struct EffectExpr {
917     pub(crate) syntax: SyntaxNode,
918 }
919 impl ast::AttrsOwner for EffectExpr {}
920 impl EffectExpr {
921     pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
922     pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
923     pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
924     pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
925     pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
926 }
927 /// For loop expression.
928 /// Note: record struct literals are not valid as iterable expression
929 /// due to ambiguity.
930 ///
931 /// ```
932 /// ❰
933 /// for i in (0..4) {
934 ///     dbg!(i);
935 /// }
936 /// ❱
937 /// ```
938 ///
939 /// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops)
940 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
941 pub struct ForExpr {
942     pub(crate) syntax: SyntaxNode,
943 }
944 impl ast::AttrsOwner for ForExpr {}
945 impl ast::LoopBodyOwner for ForExpr {}
946 impl ForExpr {
947     pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
948     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
949     pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
950     pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
951 }
952 /// While loop expression. Includes both regular `while` and `while let` forms.
953 ///
954 /// ```
955 /// ❰
956 ///     while bool_cond {
957 ///         42;
958 ///     }
959 /// ❱
960 /// ❰
961 ///     while let Pattern(foo) = bar {
962 ///         bar += 1;
963 ///     }
964 /// ❱
965 /// ```
966 ///
967 /// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops)
968 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
969 pub struct WhileExpr {
970     pub(crate) syntax: SyntaxNode,
971 }
972 impl ast::AttrsOwner for WhileExpr {}
973 impl ast::LoopBodyOwner for WhileExpr {}
974 impl WhileExpr {
975     pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
976     pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
977 }
978 /// Continue expression.
979 ///
980 /// ```
981 /// while bool_cond {
982 ///     ❰ continue ❱;
983 /// }
984 ///
985 /// 'outer: loop {
986 ///     loop {
987 ///         ❰ continue 'outer ❱;
988 ///     }
989 /// }
990 ///
991 /// ```
992 ///
993 /// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)
994 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
995 pub struct ContinueExpr {
996     pub(crate) syntax: SyntaxNode,
997 }
998 impl ast::AttrsOwner for ContinueExpr {}
999 impl ContinueExpr {
1000     pub fn continue_token(&self) -> Option<SyntaxToken> {
1001         support::token(&self.syntax, T![continue])
1002     }
1003     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1004         support::token(&self.syntax, T![lifetime])
1005     }
1006 }
1007 /// Break expression.
1008 ///
1009 /// ```
1010 /// while bool_cond {
1011 ///     ❰ break ❱;
1012 /// }
1013 /// 'outer: loop {
1014 ///     for foo in bar {
1015 ///         ❰ break 'outer ❱;
1016 ///     }
1017 /// }
1018 /// 'outer: loop {
1019 ///     loop {
1020 ///         ❰ break 'outer 42 ❱;
1021 ///     }
1022 /// }
1023 /// ```
1024 ///
1025 /// [Refernce](https://doc.rust-lang.org/reference/expressions/loop-expr.html#break-expressions)
1026 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1027 pub struct BreakExpr {
1028     pub(crate) syntax: SyntaxNode,
1029 }
1030 impl ast::AttrsOwner for BreakExpr {}
1031 impl BreakExpr {
1032     pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
1033     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1034         support::token(&self.syntax, T![lifetime])
1035     }
1036     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1037 }
1038 /// Label.
1039 ///
1040 /// ```
1041 /// ❰ 'outer: ❱ loop {}
1042 ///
1043 /// let foo = ❰ 'bar: ❱ loop {}
1044 ///
1045 /// ❰ 'baz: ❱ {
1046 ///     break 'baz;
1047 /// }
1048 /// ```
1049 ///
1050 /// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html?highlight=label#loop-labels)
1051 /// [Labels for blocks RFC](https://github.com/rust-lang/rfcs/blob/master/text/2046-label-break-value.md)
1052 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1053 pub struct Label {
1054     pub(crate) syntax: SyntaxNode,
1055 }
1056 impl Label {
1057     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1058         support::token(&self.syntax, T![lifetime])
1059     }
1060 }
1061 /// Block expression. Includes unsafe blocks and block labels.
1062 ///
1063 /// ```
1064 ///     let foo = ❰
1065 ///         {
1066 ///             #![inner_attr]
1067 ///             ❰ { } ❱
1068 ///
1069 ///             ❰ 'label: { break 'label } ❱
1070 ///         }
1071 ///     ❱;
1072 /// ```
1073 ///
1074 /// [Reference](https://doc.rust-lang.org/reference/expressions/block-expr.html)
1075 /// [Labels for blocks RFC](https://github.com/rust-lang/rfcs/blob/master/text/2046-label-break-value.md)
1076 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1077 pub struct BlockExpr {
1078     pub(crate) syntax: SyntaxNode,
1079 }
1080 impl ast::AttrsOwner for BlockExpr {}
1081 impl ast::ModuleItemOwner for BlockExpr {}
1082 impl BlockExpr {
1083     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1084     pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
1085     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1086     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1087 }
1088 /// Return expression.
1089 ///
1090 /// ```
1091 /// || ❰ return 42 ❱;
1092 ///
1093 /// fn bar() {
1094 ///     ❰ return ❱;
1095 /// }
1096 /// ```
1097 ///
1098 /// [Reference](https://doc.rust-lang.org/reference/expressions/return-expr.html)
1099 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1100 pub struct ReturnExpr {
1101     pub(crate) syntax: SyntaxNode,
1102 }
1103 impl ast::AttrsOwner for ReturnExpr {}
1104 impl ReturnExpr {
1105     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1106 }
1107 /// Call expression (not to be confused with method call expression, it is
1108 /// a separate ast node).
1109 ///
1110 /// ```
1111 /// ❰ foo() ❱;
1112 /// ❰ &str::len("bar") ❱;
1113 /// ❰ <&str as PartialEq<&str>>::eq(&"", &"") ❱;
1114 /// ```
1115 ///
1116 /// [Reference](https://doc.rust-lang.org/reference/expressions/call-expr.html)
1117 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1118 pub struct CallExpr {
1119     pub(crate) syntax: SyntaxNode,
1120 }
1121 impl ast::ArgListOwner for CallExpr {}
1122 impl CallExpr {
1123     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1124 }
1125 /// Method call expression.
1126 ///
1127 /// ```
1128 /// ❰ receiver_expr.method() ❱;
1129 /// ❰ receiver_expr.method::<T>(42, true) ❱;
1130 ///
1131 /// ❰ ❰ ❰ foo.bar() ❱ .baz() ❱ .bruh() ❱;
1132 /// ```
1133 ///
1134 /// [Reference](https://doc.rust-lang.org/reference/expressions/method-call-expr.html)
1135 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1136 pub struct MethodCallExpr {
1137     pub(crate) syntax: SyntaxNode,
1138 }
1139 impl ast::AttrsOwner for MethodCallExpr {}
1140 impl ast::ArgListOwner for MethodCallExpr {}
1141 impl MethodCallExpr {
1142     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1143     pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1144     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1145     pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1146 }
1147 /// Index expression a.k.a. subscript operator call.
1148 ///
1149 /// ```
1150 /// ❰ foo[42] ❱;
1151 /// ```
1152 ///
1153 /// [Reference](https://doc.rust-lang.org/reference/expressions/array-expr.html)
1154 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1155 pub struct IndexExpr {
1156     pub(crate) syntax: SyntaxNode,
1157 }
1158 impl ast::AttrsOwner for IndexExpr {}
1159 impl IndexExpr {
1160     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1161     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1162 }
1163 /// Field access expression.
1164 ///
1165 /// ```
1166 /// ❰ expr.bar ❱;
1167 ///
1168 /// ❰ ❰ ❰ foo.bar ❱ .baz ❱ .bruh ❱;
1169 /// ```
1170 ///
1171 /// [Reference](https://doc.rust-lang.org/reference/expressions/field-expr.html)
1172 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1173 pub struct FieldExpr {
1174     pub(crate) syntax: SyntaxNode,
1175 }
1176 impl ast::AttrsOwner for FieldExpr {}
1177 impl FieldExpr {
1178     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1179     pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1180     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1181 }
1182 /// Await operator call expression.
1183 ///
1184 /// ```
1185 /// ❰ expr.await ❱;
1186 /// ```
1187 ///
1188 /// [Reference](https://doc.rust-lang.org/reference/expressions/await-expr.html)
1189 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1190 pub struct AwaitExpr {
1191     pub(crate) syntax: SyntaxNode,
1192 }
1193 impl ast::AttrsOwner for AwaitExpr {}
1194 impl AwaitExpr {
1195     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1196     pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1197     pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
1198 }
1199 /// The question mark operator call.
1200 ///
1201 /// ```
1202 /// ❰ expr? ❱;
1203 /// ```
1204 ///
1205 /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator)
1206 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1207 pub struct TryExpr {
1208     pub(crate) syntax: SyntaxNode,
1209 }
1210 impl ast::AttrsOwner for TryExpr {}
1211 impl TryExpr {
1212     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1213     pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1214 }
1215 /// Type cast expression.
1216 ///
1217 /// ```
1218 /// ❰ expr as T ❱;
1219 /// ```
1220 ///
1221 /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions)
1222 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1223 pub struct CastExpr {
1224     pub(crate) syntax: SyntaxNode,
1225 }
1226 impl ast::AttrsOwner for CastExpr {}
1227 impl CastExpr {
1228     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1229     pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
1230     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1231 }
1232 /// Borrow operator call.
1233 ///
1234 /// ```
1235 /// ❰ &foo ❱;
1236 /// ❰ &mut bar ❱;
1237 /// ```
1238 ///
1239 /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#borrow-operators)
1240 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1241 pub struct RefExpr {
1242     pub(crate) syntax: SyntaxNode,
1243 }
1244 impl ast::AttrsOwner for RefExpr {}
1245 impl RefExpr {
1246     pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1247     pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
1248     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1249     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1250 }
1251 /// Prefix operator call. This is either `!` or `*` or `-`.
1252 ///
1253 /// ```
1254 /// ❰ !foo ❱;
1255 /// ❰ *bar ❱;
1256 /// ❰ -42 ❱;
1257 /// ```
1258 ///
1259 /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html)
1260 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1261 pub struct PrefixExpr {
1262     pub(crate) syntax: SyntaxNode,
1263 }
1264 impl ast::AttrsOwner for PrefixExpr {}
1265 impl PrefixExpr {
1266     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1267 }
1268 /// Box operator call.
1269 ///
1270 /// ```
1271 /// ❰ box 42 ❱;
1272 /// ```
1273 ///
1274 /// [RFC](https://github.com/rust-lang/rfcs/blob/0806be4f282144cfcd55b1d20284b43f87cbe1c6/text/0809-box-and-in-for-stdlib.md)
1275 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1276 pub struct BoxExpr {
1277     pub(crate) syntax: SyntaxNode,
1278 }
1279 impl ast::AttrsOwner for BoxExpr {}
1280 impl BoxExpr {
1281     pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1282     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1283 }
1284 /// Range operator call.
1285 ///
1286 /// ```
1287 /// ❰ 0..42 ❱;
1288 /// ❰ ..42 ❱;
1289 /// ❰ 0.. ❱;
1290 /// ❰ .. ❱;
1291 /// ❰ 0..=42 ❱;
1292 /// ❰ ..=42 ❱;
1293 /// ```
1294 ///
1295 /// [Reference](https://doc.rust-lang.org/reference/expressions/range-expr.html)
1296 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1297 pub struct RangeExpr {
1298     pub(crate) syntax: SyntaxNode,
1299 }
1300 impl ast::AttrsOwner for RangeExpr {}
1301 impl RangeExpr {}
1302 /// Binary operator call.
1303 /// Includes all arithmetic, logic, bitwise and assignment operators.
1304 ///
1305 /// ```
1306 /// ❰ 2 + ❰ 2 * 2 ❱ ❱;
1307 /// ❰ ❰ true && false ❱ || true ❱;
1308 /// ```
1309 ///
1310 /// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#arithmetic-and-logical-binary-operators)
1311 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1312 pub struct BinExpr {
1313     pub(crate) syntax: SyntaxNode,
1314 }
1315 impl ast::AttrsOwner for BinExpr {}
1316 impl BinExpr {}
1317 /// [Raw] string, [raw] byte string, char, byte, integer, float or bool literal.
1318 ///
1319 /// ```
1320 /// ❰ "str" ❱;
1321 /// ❰ br##"raw byte str"## ❱;
1322 /// ❰ 'c' ❱;
1323 /// ❰ b'c' ❱;
1324 /// ❰ 42 ❱;
1325 /// ❰ 1e9 ❱;
1326 /// ❰ true ❱;
1327 /// ```
1328 ///
1329 /// [Reference](https://doc.rust-lang.org/reference/expressions/literal-expr.html)
1330 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1331 pub struct Literal {
1332     pub(crate) syntax: SyntaxNode,
1333 }
1334 impl Literal {}
1335 /// Match expression.
1336 ///
1337 /// ```
1338 /// ❰
1339 ///     match expr {
1340 ///         Pat1 => {}
1341 ///         Pat2(_) => 42,
1342 ///     }
1343 /// ❱
1344 /// ```
1345 ///
1346 /// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1347 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1348 pub struct MatchExpr {
1349     pub(crate) syntax: SyntaxNode,
1350 }
1351 impl ast::AttrsOwner for MatchExpr {}
1352 impl MatchExpr {
1353     pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
1354     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1355     pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
1356 }
1357 /// Match arm list part of match expression. Includes its inner attributes.
1358 ///
1359 /// ```
1360 /// match expr
1361 /// ❰
1362 ///     {
1363 ///         #![inner_attr]
1364 ///         Pat1 => {}
1365 ///         Pat2(_) => 42,
1366 ///     }
1367 /// ❱
1368 /// ```
1369 ///
1370 /// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1371 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1372 pub struct MatchArmList {
1373     pub(crate) syntax: SyntaxNode,
1374 }
1375 impl ast::AttrsOwner for MatchArmList {}
1376 impl MatchArmList {
1377     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1378     pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
1379     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1380 }
1381 /// Match arm.
1382 /// Note: record struct literals are not valid as target match expression
1383 /// due to ambiguity.
1384 /// ```
1385 /// match expr {
1386 ///     ❰ #[attr] Pattern(it) if bool_cond => it ❱,
1387 /// }
1388 /// ```
1389 ///
1390 /// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1391 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1392 pub struct MatchArm {
1393     pub(crate) syntax: SyntaxNode,
1394 }
1395 impl ast::AttrsOwner for MatchArm {}
1396 impl MatchArm {
1397     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1398     pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
1399     pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
1400     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1401 }
1402 /// Match guard.
1403 ///
1404 /// ```
1405 /// match expr {
1406 ///     Pattern(it) ❰ if bool_cond ❱ => it,
1407 /// }
1408 /// ```
1409 ///
1410 /// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html#match-guards)
1411 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1412 pub struct MatchGuard {
1413     pub(crate) syntax: SyntaxNode,
1414 }
1415 impl MatchGuard {
1416     pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
1417     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1418 }
1419 /// Record literal expression. The same syntax is used for structs,
1420 /// unions and record enum variants.
1421 ///
1422 /// ```
1423 /// ❰
1424 ///     foo::Bar {
1425 ///         #![inner_attr]
1426 ///         baz: 42,
1427 ///         bruh: true,
1428 ///         ..spread
1429 ///     }
1430 /// ❱
1431 /// ```
1432 ///
1433 /// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1434 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1435 pub struct RecordLit {
1436     pub(crate) syntax: SyntaxNode,
1437 }
1438 impl RecordLit {
1439     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1440     pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
1441 }
1442 /// Record field list including enclosing curly braces.
1443 ///
1444 /// foo::Bar ❰
1445 ///     {
1446 ///         baz: 42,
1447 ///         ..spread
1448 ///     }
1449 /// ❱
1450 ///
1451 /// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1452 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1453 pub struct RecordFieldList {
1454     pub(crate) syntax: SyntaxNode,
1455 }
1456 impl RecordFieldList {
1457     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1458     pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
1459     pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1460     pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1461     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1462 }
1463 /// Record field.
1464 ///
1465 /// ```
1466 /// foo::Bar {
1467 ///     ❰ #[attr] baz: 42 ❱
1468 /// }
1469 /// ```
1470 ///
1471 /// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1472 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1473 pub struct RecordField {
1474     pub(crate) syntax: SyntaxNode,
1475 }
1476 impl ast::AttrsOwner for RecordField {}
1477 impl RecordField {
1478     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1479     pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1480     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1481 }
1482 /// Disjunction of patterns.
1483 ///
1484 /// ```
1485 /// let ❰ Foo(it) | Bar(it) | Baz(it) ❱ = bruh;
1486 /// ```
1487 ///
1488 /// [Reference](https://doc.rust-lang.org/reference/patterns.html)
1489 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1490 pub struct OrPat {
1491     pub(crate) syntax: SyntaxNode,
1492 }
1493 impl OrPat {
1494     pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1495 }
1496 /// Parenthesized pattern.
1497 /// Note: parens are only used for grouping, this is not a tuple pattern.
1498 ///
1499 /// ```
1500 /// if let ❰ &(0..=42) ❱ = foo {}
1501 /// ```
1502 ///
1503 /// https://doc.rust-lang.org/reference/patterns.html#grouped-patterns
1504 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1505 pub struct ParenPat {
1506     pub(crate) syntax: SyntaxNode,
1507 }
1508 impl ParenPat {
1509     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1510     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1511     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1512 }
1513 /// Reference pattern.
1514 /// Note: this has nothing to do with `ref` keyword, the latter is used in bind patterns.
1515 ///
1516 /// ```
1517 /// let ❰ &mut foo ❱ = bar;
1518 /// ```
1519 /// // TODO: clarify on the special case of double reference pattern
1520 /// // described in the link bellow
1521 ///
1522 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#reference-patterns)
1523 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1524 pub struct RefPat {
1525     pub(crate) syntax: SyntaxNode,
1526 }
1527 impl RefPat {
1528     pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
1529     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1530     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1531 }
1532 /// Box pattern.
1533 ///
1534 /// ```
1535 /// let ❰ box foo ❱ = box 42;
1536 /// ```
1537 ///
1538 /// [Unstable book](https://doc.rust-lang.org/unstable-book/language-features/box-patterns.html)
1539 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1540 pub struct BoxPat {
1541     pub(crate) syntax: SyntaxNode,
1542 }
1543 impl BoxPat {
1544     pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1545     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1546 }
1547 /// Bind pattern.
1548 ///
1549 /// ```
1550 /// match foo {
1551 ///     Some(❰ ref mut bar ❱) => {}
1552 ///     ❰ baz @ None ❱ => {}
1553 /// }
1554 /// ```
1555 ///
1556 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#identifier-patterns)
1557 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1558 pub struct BindPat {
1559     pub(crate) syntax: SyntaxNode,
1560 }
1561 impl ast::AttrsOwner for BindPat {}
1562 impl ast::NameOwner for BindPat {}
1563 impl BindPat {
1564     pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1565     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1566     pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1567     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1568 }
1569 /// Placeholder pattern a.k.a. the wildcard pattern or the underscore.
1570 ///
1571 /// ```
1572 /// let ❰ _ ❱ = foo;
1573 /// ```
1574 ///
1575 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#wildcard-pattern)
1576 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1577 pub struct PlaceholderPat {
1578     pub(crate) syntax: SyntaxNode,
1579 }
1580 impl PlaceholderPat {
1581     pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
1582 }
1583 /// Rest-of-the record/tuple pattern.
1584 /// Note: this is not the unbonded range pattern (even more: it doesn't exist).
1585 ///
1586 /// ```
1587 /// let Foo { bar, ❰ .. ❱ } = baz;
1588 /// let (❰ .. ❱, bruh) = (42, 24, 42);
1589 /// let Bruuh(❰ .. ❱) = bruuuh;
1590 /// ```
1591 ///
1592 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1593 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1594 pub struct DotDotPat {
1595     pub(crate) syntax: SyntaxNode,
1596 }
1597 impl DotDotPat {
1598     pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1599 }
1600 /// Path pattern.
1601 /// Doesn't include the underscore pattern (it is a special case, namely `PlaceholderPat`).
1602 ///
1603 /// ```
1604 /// let ❰ foo::bar::Baz ❱ { .. } = bruh;
1605 /// if let ❰ CONST ❱ = 42 {}
1606 /// ```
1607 ///
1608 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#path-patterns)
1609 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1610 pub struct PathPat {
1611     pub(crate) syntax: SyntaxNode,
1612 }
1613 impl PathPat {
1614     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1615 }
1616 /// Slice pattern.
1617 ///
1618 /// ```
1619 /// let ❰ [foo, bar, baz] ❱ = [1, 2, 3];
1620 /// ```
1621 ///
1622 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#slice-patterns)
1623 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1624 pub struct SlicePat {
1625     pub(crate) syntax: SyntaxNode,
1626 }
1627 impl SlicePat {
1628     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1629     pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1630     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1631 }
1632 /// Range pattern.
1633 ///
1634 /// ```
1635 /// match foo {
1636 ///     ❰ 0..42 ❱ => {}
1637 ///     ❰ 0..=42 ❱ => {}
1638 /// }
1639 /// ```
1640 ///
1641 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#range-patterns)
1642 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1643 pub struct RangePat {
1644     pub(crate) syntax: SyntaxNode,
1645 }
1646 impl RangePat {}
1647 /// Literal pattern.
1648 /// Includes only bool, number, char, and string literals.
1649 ///
1650 /// ```
1651 /// match foo {
1652 ///     Number(❰ 42 ❱) => {}
1653 ///     String(❰ "42" ❱) => {}
1654 ///     Bool(❰ true ❱) => {}
1655 /// }
1656 /// ```
1657 ///
1658 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#literal-patterns)
1659 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1660 pub struct LiteralPat {
1661     pub(crate) syntax: SyntaxNode,
1662 }
1663 impl LiteralPat {
1664     pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
1665 }
1666 /// Macro invocation in pattern position.
1667 ///
1668 /// ```
1669 /// let ❰ foo!(my custom syntax) ❱ = baz;
1670 ///
1671 /// ```
1672 /// [Reference](https://doc.rust-lang.org/reference/macros.html#macro-invocation)
1673 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1674 pub struct MacroPat {
1675     pub(crate) syntax: SyntaxNode,
1676 }
1677 impl MacroPat {
1678     pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
1679 }
1680 /// Record literal pattern.
1681 ///
1682 /// ```
1683 /// let ❰ foo::Bar { baz, .. } ❱ = bruh;
1684 /// ```
1685 ///
1686 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1687 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1688 pub struct RecordPat {
1689     pub(crate) syntax: SyntaxNode,
1690 }
1691 impl RecordPat {
1692     pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> {
1693         support::child(&self.syntax)
1694     }
1695     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1696 }
1697 /// Record literal's field patterns list including enclosing curly braces.
1698 ///
1699 /// ```
1700 /// let foo::Bar ❰ { baz, bind @ bruh, .. } ❱ = bruuh;
1701 /// ``
1702 ///
1703 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1704 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1705 pub struct RecordFieldPatList {
1706     pub(crate) syntax: SyntaxNode,
1707 }
1708 impl RecordFieldPatList {
1709     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1710     pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) }
1711     pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
1712         support::children(&self.syntax)
1713     }
1714     pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1715     pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
1716     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1717 }
1718 /// Record literal's field pattern.
1719 /// Note: record literal can also match tuple structs.
1720 ///
1721 /// ```
1722 /// let Foo { ❰ bar: _ ❱ } = baz;
1723 /// let TupleStruct { ❰ 0: _ ❱ } = bruh;
1724 /// ```
1725 ///
1726 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1727 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1728 pub struct RecordFieldPat {
1729     pub(crate) syntax: SyntaxNode,
1730 }
1731 impl ast::AttrsOwner for RecordFieldPat {}
1732 impl RecordFieldPat {
1733     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1734     pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1735     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1736 }
1737 /// Tuple struct literal pattern.
1738 ///
1739 /// ```
1740 /// let ❰ foo::Bar(baz, bruh) ❱ = bruuh;
1741 /// ```
1742 ///
1743 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#tuple-struct-patterns)
1744 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1745 pub struct TupleStructPat {
1746     pub(crate) syntax: SyntaxNode,
1747 }
1748 impl TupleStructPat {
1749     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1750     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1751     pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1752     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1753 }
1754 /// Tuple pattern.
1755 /// Note: this doesn't include tuple structs (see `TupleStructPat`)
1756 ///
1757 /// ```
1758 /// let ❰ (foo, bar, .., baz) ❱ = bruh;
1759 /// ```
1760 ///
1761 /// [Reference](https://doc.rust-lang.org/reference/patterns.html#tuple-patterns)
1762 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1763 pub struct TuplePat {
1764     pub(crate) syntax: SyntaxNode,
1765 }
1766 impl TuplePat {
1767     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1768     pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1769     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1770 }
1771 /// Visibility.
1772 ///
1773 /// ```
1774 /// ❰ pub mod ❱ foo;
1775 /// ❰ pub(crate) ❱ struct Bar;
1776 /// ❰ pub(self) ❱ enum Baz {}
1777 /// ❰ pub(super) ❱ fn bruh() {}
1778 /// ❰ pub(in bruuh::bruuuh) ❱ type T = u64;
1779 /// ```
1780 ///
1781 /// [Reference](https://doc.rust-lang.org/reference/visibility-and-privacy.html)
1782 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1783 pub struct Visibility {
1784     pub(crate) syntax: SyntaxNode,
1785 }
1786 impl Visibility {
1787     pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) }
1788     pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
1789     pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
1790     pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
1791 }
1792 /// Single identifier.
1793 /// // TODO: clarify the difference between Name and NameRef
1794 ///
1795 /// ```
1796 /// let ❰ foo ❱ = bar;
1797 /// struct ❰ Baz ❱;
1798 /// fn ❰ bruh ❱() {}
1799 /// ```
1800 ///
1801 /// [Reference](https://doc.rust-lang.org/reference/identifiers.html)
1802 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1803 pub struct Name {
1804     pub(crate) syntax: SyntaxNode,
1805 }
1806 impl Name {
1807     pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
1808 }
1809 /// Reference to a name.
1810 ///
1811 /// ```
1812 /// let foo = ❰ bar ❱(❰ Baz(❰ bruh ❱) ❱;
1813 /// ```
1814 ///
1815 /// [Reference](https://doc.rust-lang.org/reference/identifiers.html)
1816 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1817 pub struct NameRef {
1818     pub(crate) syntax: SyntaxNode,
1819 }
1820 impl NameRef {}
1821 /// Macro call.
1822 /// Includes all of its attributes and doc comments.
1823 ///
1824 /// ```
1825 /// ❰
1826 ///     /// Docs
1827 ///     #[attr]
1828 ///     macro_rules! foo {   // macro rules is also a macro call
1829 ///         ($bar: tt) => {}
1830 ///     }
1831 /// ❱
1832 ///
1833 /// ❰ foo!() ❱
1834 /// ```
1835 ///
1836 /// [Reference](https://doc.rust-lang.org/reference/macros.html)
1837 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1838 pub struct MacroCall {
1839     pub(crate) syntax: SyntaxNode,
1840 }
1841 impl ast::NameOwner for MacroCall {}
1842 impl ast::AttrsOwner for MacroCall {}
1843 impl ast::DocCommentsOwner for MacroCall {}
1844 impl MacroCall {
1845     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1846     pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1847     pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1848     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1849 }
1850 /// Attribute.
1851 ///
1852 /// ```
1853 /// ❰ #![inner_attr] ❱
1854 ///
1855 /// ❰ #[attr] ❱
1856 /// ❰ #[foo = "bar"] ❱
1857 /// ❰ #[baz(bruh::bruuh = "42")] ❱
1858 /// struct Foo;
1859 /// ```
1860 ///
1861 /// [Reference](https://doc.rust-lang.org/reference/attributes.html)
1862 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1863 pub struct Attr {
1864     pub(crate) syntax: SyntaxNode,
1865 }
1866 impl Attr {
1867     pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
1868     pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1869     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1870     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1871     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1872     pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
1873     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1874 }
1875 /// Stores a list of lexer tokens and other `TokenTree`s.
1876 /// It appears in attributes, macro_rules and macro call (foo!)
1877 ///
1878 /// ```
1879 /// macro_call! ❰ { my syntax here } ❱;
1880 /// ```
1881 ///
1882 /// [Reference](https://doc.rust-lang.org/reference/macros.html)
1883 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1884 pub struct TokenTree {
1885     pub(crate) syntax: SyntaxNode,
1886 }
1887 impl TokenTree {}
1888 /// Generic lifetime, type and constants parameters list **declaration**.
1889 ///
1890 /// ```
1891 /// fn foo❰ <'a, 'b, T, U, const BAR: u64> ❱() {}
1892 ///
1893 /// struct Baz❰ <T> ❱(T);
1894 ///
1895 /// impl❰ <T> ❱ Bruh<T> {}
1896 ///
1897 /// type Bruuh = for❰ <'a> ❱ fn(&'a str) -> &'a str;
1898 /// ```
1899 ///
1900 /// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1901 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1902 pub struct TypeParamList {
1903     pub(crate) syntax: SyntaxNode,
1904 }
1905 impl TypeParamList {
1906     pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
1907     pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) }
1908     pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) }
1909     pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) }
1910     pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) }
1911     pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
1912 }
1913 /// Single type parameter **declaration**.
1914 ///
1915 /// ```
1916 /// fn foo<❰ K ❱, ❰ I ❱, ❰ E: Debug ❱, ❰ V = DefaultType ❱>() {}
1917 /// ```
1918 ///
1919 /// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1920 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1921 pub struct TypeParam {
1922     pub(crate) syntax: SyntaxNode,
1923 }
1924 impl ast::NameOwner for TypeParam {}
1925 impl ast::AttrsOwner for TypeParam {}
1926 impl ast::TypeBoundsOwner for TypeParam {}
1927 impl TypeParam {
1928     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1929     pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1930 }
1931 /// Const generic parameter **declaration**.
1932 /// ```
1933 /// fn foo<T, U, ❰ const BAR: usize ❱, ❰ const BAZ: bool ❱>() {}
1934 /// ```
1935 ///
1936 /// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md#declaring-a-const-parameter)
1937 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1938 pub struct ConstParam {
1939     pub(crate) syntax: SyntaxNode,
1940 }
1941 impl ast::NameOwner for ConstParam {}
1942 impl ast::AttrsOwner for ConstParam {}
1943 impl ast::TypeAscriptionOwner for ConstParam {}
1944 impl ConstParam {
1945     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1946     pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
1947 }
1948 /// Lifetime parameter **declaration**.
1949 ///
1950 /// ```
1951 /// fn foo<❰ 'a ❱, ❰ 'b ❱, V, G, D>(bar: &'a str, baz: &'b mut str) {}
1952 /// ```
1953 ///
1954 /// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1955 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1956 pub struct LifetimeParam {
1957     pub(crate) syntax: SyntaxNode,
1958 }
1959 impl ast::AttrsOwner for LifetimeParam {}
1960 impl LifetimeParam {
1961     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1962         support::token(&self.syntax, T![lifetime])
1963     }
1964 }
1965 /// Type bound declaration clause.
1966 ///
1967 /// ```
1968 /// fn foo<T: ❰ ?Sized ❱ + ❰ Debug ❱>() {}
1969 ///
1970 /// trait Bar<T>
1971 /// where
1972 ///     T: ❰ Send ❱ + ❰ Sync ❱
1973 /// {
1974 ///     type Baz: ❰ !Sync ❱ + ❰ Debug ❱;
1975 /// }
1976 /// ```
1977 ///
1978 /// [Reference](https://doc.rust-lang.org/reference/trait-bounds.html)
1979 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
1980 pub struct TypeBound {
1981     pub(crate) syntax: SyntaxNode,
1982 }
1983 impl TypeBound {
1984     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1985         support::token(&self.syntax, T![lifetime])
1986     }
1987     pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1988     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1989 }
1990 /// Type bounds list.
1991 ///
1992 /// ```
1993 ///
1994 /// fn foo<T: ❰ ?Sized + Debug ❱>() {}
1995 ///
1996 /// trait Bar<T>
1997 /// where
1998 ///     T: ❰ Send + Sync ❱
1999 /// {
2000 ///     type Baz: ❰ !Sync + Debug ❱;
2001 /// }
2002 /// ```
2003 ///
2004 /// [Reference](https://doc.rust-lang.org/reference/trait-bounds.html)
2005 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2006 pub struct TypeBoundList {
2007     pub(crate) syntax: SyntaxNode,
2008 }
2009 impl TypeBoundList {
2010     pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
2011 }
2012 /// Single where predicate.
2013 ///
2014 /// ```
2015 /// trait Foo<'a, 'b, T>
2016 /// where
2017 ///     ❰ 'a: 'b ❱,
2018 ///     ❰ T: IntoIterator ❱,
2019 ///     ❰ for<'c> <T as IntoIterator>::Item: Bar<'c> ❱
2020 /// {}
2021 /// ```
2022 ///
2023 /// [Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses)
2024 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2025 pub struct WherePred {
2026     pub(crate) syntax: SyntaxNode,
2027 }
2028 impl ast::TypeBoundsOwner for WherePred {}
2029 impl WherePred {
2030     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2031         support::token(&self.syntax, T![lifetime])
2032     }
2033     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2034 }
2035 /// Where clause.
2036 ///
2037 /// ```
2038 /// trait Foo<'a, T> ❰ where 'a: 'static, T: Debug ❱ {}
2039 ///
2040 /// ```
2041 ///
2042 /// [Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses)
2043 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2044 pub struct WhereClause {
2045     pub(crate) syntax: SyntaxNode,
2046 }
2047 impl WhereClause {
2048     pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) }
2049     pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
2050 }
2051 /// Abi declaration.
2052 /// Note: the abi string is optional.
2053 ///
2054 /// ```
2055 /// ❰ extern "C" ❱ {
2056 ///     fn foo() {}
2057 /// }
2058 ///
2059 /// type Bar = ❰ extern ❱ fn() -> u32;
2060 ///
2061 /// type Baz = ❰ extern r#"stdcall"# ❱ fn() -> bool;
2062 /// ```
2063 ///
2064 /// - [Extern blocks reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2065 /// - [FFI function pointers reference](https://doc.rust-lang.org/reference/items/functions.html#functions)
2066 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2067 pub struct Abi {
2068     pub(crate) syntax: SyntaxNode,
2069 }
2070 impl Abi {}
2071 /// Expression statement.
2072 /// Note: may be empty (i.e. only semicolon).
2073 ///
2074 /// ```
2075 /// ❰ 42; ❱
2076 /// ❰ foo(); ❱
2077 /// ❰ (); ❱
2078 /// ❰ {}; ❱
2079 /// ❰ /* empty */; ❱
2080 ///
2081 /// // constructions with trailing curly brace can omit the semicolon // TODO: clarify
2082 /// ❰ if bool_cond { } ❱
2083 /// ❰ loop {} ❱
2084 /// ```
2085 ///
2086 /// [Reference](https://doc.rust-lang.org/reference/statements.html)
2087 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2088 pub struct ExprStmt {
2089     pub(crate) syntax: SyntaxNode,
2090 }
2091 impl ast::AttrsOwner for ExprStmt {}
2092 impl ExprStmt {
2093     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2094     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
2095 }
2096 /// Let statement.
2097 ///
2098 /// ```
2099 /// ❰ #[attr] let foo; ❱
2100 /// ❰ let bar: u64; ❱
2101 /// ❰ let baz = 42; ❱
2102 /// ❰ let bruh: bool = true; ❱
2103 /// ```
2104 ///
2105 /// [Reference](https://doc.rust-lang.org/reference/statements.html#let-statements)
2106 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2107 pub struct LetStmt {
2108     pub(crate) syntax: SyntaxNode,
2109 }
2110 impl ast::AttrsOwner for LetStmt {}
2111 impl ast::TypeAscriptionOwner for LetStmt {}
2112 impl LetStmt {
2113     pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
2114     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2115     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2116     pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
2117     pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
2118 }
2119 /// Condition of `if` or `while` expression.
2120 ///
2121 /// ```
2122 /// if ❰ true ❱ {}
2123 /// if ❰ let Pat(foo) = bar ❱ {}
2124 ///
2125 /// while ❰ true ❱ {}
2126 /// while ❰ let Pat(baz) = bruh ❱ {}
2127 /// ```
2128 ///
2129 /// [If expression reference](https://doc.rust-lang.org/reference/expressions/if-expr.html)
2130 /// [While expression reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops)
2131 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2132 pub struct Condition {
2133     pub(crate) syntax: SyntaxNode,
2134 }
2135 impl Condition {
2136     pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
2137     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2138     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2139     pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2140 }
2141 /// Parameter list **declaration**.
2142 ///
2143 /// ```
2144 /// fn foo❰ (a: u32, b: bool) ❱ -> u32 {}
2145 /// let bar = ❰ |a, b| ❱ {};
2146 ///
2147 /// impl Baz {
2148 ///     fn bruh❰ (&self, a: u32) ❱ {}
2149 /// }
2150 /// ```
2151 ///
2152 /// [Reference](https://doc.rust-lang.org/reference/items/functions.html)ocs to codegen script
2153 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2154 pub struct ParamList {
2155     pub(crate) syntax: SyntaxNode,
2156 }
2157 impl ParamList {
2158     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2159     pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
2160     pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
2161     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2162 }
2163 /// Self parameter **declaration**.
2164 ///
2165 /// ```
2166 /// impl Bruh {
2167 ///     fn foo(❰ self ❱) {}
2168 ///     fn bar(❰ &self ❱) {}
2169 ///     fn baz(❰ &mut self ❱) {}
2170 ///     fn blah<'a>(❰ &'a self ❱) {}
2171 ///     fn blin(❰ self: Box<Self> ❱) {}
2172 /// }
2173 /// ```
2174 ///
2175 /// [Reference](https://doc.rust-lang.org/reference/items/functions.html)
2176 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2177 pub struct SelfParam {
2178     pub(crate) syntax: SyntaxNode,
2179 }
2180 impl ast::TypeAscriptionOwner for SelfParam {}
2181 impl ast::AttrsOwner for SelfParam {}
2182 impl SelfParam {
2183     pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2184     pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2185     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2186         support::token(&self.syntax, T![lifetime])
2187     }
2188     pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
2189 }
2190 /// Parameter **declaration**.
2191 ///
2192 /// ```
2193 /// fn foo(❰ #[attr] Pat(bar): Pat(u32) ❱, ❰ #[attr] _: bool ❱) {}
2194 ///
2195 /// extern "C" {
2196 ///     fn bar(❰ baz: u32 ❱, ❰ ... ❱) -> u32;
2197 /// }
2198 /// ```
2199 ///
2200 /// [Reference](https://doc.rust-lang.org/reference/items/functions.html)
2201 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2202 pub struct Param {
2203     pub(crate) syntax: SyntaxNode,
2204 }
2205 impl ast::TypeAscriptionOwner for Param {}
2206 impl ast::AttrsOwner for Param {}
2207 impl Param {
2208     pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2209     pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
2210 }
2211 /// Use declaration.
2212 ///
2213 /// ```
2214 /// ❰ #[attr] pub use foo; ❱
2215 /// ❰ use bar as baz; ❱
2216 /// ❰ use bruh::{self, bruuh}; ❱
2217 /// ❰ use { blin::blen, blah::* };
2218 /// ```
2219 ///
2220 /// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2221 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2222 pub struct UseItem {
2223     pub(crate) syntax: SyntaxNode,
2224 }
2225 impl ast::AttrsOwner for UseItem {}
2226 impl ast::VisibilityOwner for UseItem {}
2227 impl UseItem {
2228     pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) }
2229     pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
2230 }
2231 /// Use tree.
2232 ///
2233 /// ```
2234 /// pub use ❰ foo::❰ * ❱ ❱;
2235 /// use ❰ bar as baz ❱;
2236 /// use ❰ bruh::bruuh::{ ❰ self ❱, ❰ blin ❱ } ❱;
2237 /// use ❰ { ❰ blin::blen ❱ } ❱ // TODO: clarify if top-level curlies are `UseTree`
2238 /// ```
2239 ///
2240 /// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2241 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2242 pub struct UseTree {
2243     pub(crate) syntax: SyntaxNode,
2244 }
2245 impl UseTree {
2246     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2247     pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
2248     pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
2249     pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2250 }
2251 /// Item alias.
2252 /// Note: this is not the type alias.
2253 ///
2254 /// ```
2255 /// use foo ❰ as bar ❱;
2256 /// use baz::{bruh ❰ as _ ❱};
2257 /// extern crate bruuh ❰ as blin ❱;
2258 /// ```
2259 ///
2260 /// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2261 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2262 pub struct Alias {
2263     pub(crate) syntax: SyntaxNode,
2264 }
2265 impl ast::NameOwner for Alias {}
2266 impl Alias {
2267     pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
2268 }
2269 /// Sublist of use trees.
2270 ///
2271 /// ```
2272 /// use bruh::bruuh::❰ { ❰ self ❱, ❰ blin ❱ } ❱;
2273 /// use ❰ { blin::blen::❰ {} ❱ } ❱
2274 /// ```
2275 ///
2276 /// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2277 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2278 pub struct UseTreeList {
2279     pub(crate) syntax: SyntaxNode,
2280 }
2281 impl UseTreeList {
2282     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2283     pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
2284     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2285 }
2286 /// Extern crate item.
2287 ///
2288 /// ```
2289 /// ❰ #[attr] pub extern crate foo; ❱
2290 /// ❰ extern crate self as bar; ❱
2291 /// ```
2292 ///
2293 /// [Reference](https://doc.rust-lang.org/reference/items/extern-crates.html)
2294 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2295 pub struct ExternCrateItem {
2296     pub(crate) syntax: SyntaxNode,
2297 }
2298 impl ast::AttrsOwner for ExternCrateItem {}
2299 impl ast::VisibilityOwner for ExternCrateItem {}
2300 impl ExternCrateItem {
2301     pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
2302     pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
2303     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2304     pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2305 }
2306 /// Call site arguments list.
2307 ///
2308 /// ```
2309 /// foo::<T, U>❰ (42, true) ❱;
2310 /// ```
2311 ///
2312 /// [Reference](https://doc.rust-lang.org/reference/expressions/call-expr.html)
2313 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2314 pub struct ArgList {
2315     pub(crate) syntax: SyntaxNode,
2316 }
2317 impl ArgList {
2318     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2319     pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
2320     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2321 }
2322 /// Path to a symbol. Includes single identifier names and elaborate paths with
2323 /// generic parameters.
2324 ///
2325 /// ```
2326 /// (0..10).❰ collect ❰ ::<Vec<_>> ❱ ❱();
2327 /// ❰ Vec ❰ ::<u8> ❰ ::with_capacity ❱ ❱ ❱(1024);
2328 /// ❰ <Foo as Bar> ❰ ::baz ❱ ❱();
2329 /// ❰ <bruh> ❰ ::bruuh ❱ ❱();
2330 /// ```
2331 ///
2332 /// [Reference](https://doc.rust-lang.org/reference/paths.html)
2333 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2334 pub struct Path {
2335     pub(crate) syntax: SyntaxNode,
2336 }
2337 impl Path {
2338     pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
2339     pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
2340 }
2341 /// Segment of the path to a symbol.
2342 ///
2343 /// ```
2344 /// (0..10).❰ collect ❱ ❰ ::<Vec<_>> ❱();
2345 /// ❰ Vec >| ❰ ::<u8> ❱ ❰ ::with_capacity ❱(1024);
2346 /// ❰ <Foo as Bar> ❱ ❰ ::baz ❱();
2347 /// ❰ <bruh> ❱ ❰ ::bruuh ❱();
2348 /// ```
2349 ///
2350 /// [Reference](https://doc.rust-lang.org/reference/paths.html)
2351 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2352 pub struct PathSegment {
2353     pub(crate) syntax: SyntaxNode,
2354 }
2355 impl PathSegment {
2356     pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2357     pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
2358     pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
2359     pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
2360     pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2361     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2362     pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
2363     pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
2364     pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
2365     pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
2366     pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2367 }
2368 /// List of type arguments that are passed at generic instantiation site.
2369 ///
2370 /// ```
2371 /// use foo ❰ ::<'a, u64, Item = Bar, 42, true> ❱::bar;
2372 ///
2373 /// Vec❰ ::<bool> ❱::();
2374 /// ```
2375 ///
2376 /// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2377 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2378 pub struct TypeArgList {
2379     pub(crate) syntax: SyntaxNode,
2380 }
2381 impl TypeArgList {
2382     pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2383     pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2384     pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
2385     pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
2386     pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
2387     pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
2388     pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
2389     pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2390 }
2391 /// Type argument that is passed at generic instantiation site.
2392 ///
2393 /// ```
2394 /// use foo::<'a, ❰ u64 ❱, ❰ bool ❱, Item = Bar, 42>::baz;
2395 /// ```
2396 ///
2397 /// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2398 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2399 pub struct TypeArg {
2400     pub(crate) syntax: SyntaxNode,
2401 }
2402 impl TypeArg {
2403     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2404 }
2405 /// Associated type argument that is passed at generic instantiation site.
2406 /// ```
2407 /// use foo::<'a, u64, bool, ❰ Item = Bar ❱, 42>::baz;
2408 ///
2409 /// trait Bruh<T>: Iterator<❰ Item: Debug ❱> {}
2410 /// ```
2411 ///
2412 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2413 pub struct AssocTypeArg {
2414     pub(crate) syntax: SyntaxNode,
2415 }
2416 impl ast::TypeBoundsOwner for AssocTypeArg {}
2417 impl AssocTypeArg {
2418     pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2419     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2420     pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2421 }
2422 /// Lifetime argument that is passed at generic instantiation site.
2423 ///
2424 /// ```
2425 /// fn foo<'a>(s: &'a str) {
2426 ///     bar::<❰ 'a ❱>(s);
2427 /// }
2428 /// ```
2429 ///
2430 /// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2431 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2432 pub struct LifetimeArg {
2433     pub(crate) syntax: SyntaxNode,
2434 }
2435 impl LifetimeArg {
2436     pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2437         support::token(&self.syntax, T![lifetime])
2438     }
2439 }
2440 /// Constant value argument that is passed at generic instantiation site.
2441 ///
2442 /// ```
2443 /// foo::<❰ u32 ❱, ❰ true ❱>();
2444 ///
2445 /// bar::<❰ { 2 + 2} ❱>();
2446 /// ```
2447 ///
2448 /// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md#declaring-a-const-parameter)
2449 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2450 pub struct ConstArg {
2451     pub(crate) syntax: SyntaxNode,
2452 }
2453 impl ConstArg {
2454     pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
2455     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2456     pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
2457 }
2458 /// Macro items is a node that holds all the items created by expanding a macro.
2459 ///
2460 /// ```
2461 /// foo!(); // expands into some items -v
2462 ///         // ❰ struct Foo; impl Bar for Foo; ❱
2463 /// ```
2464 ///
2465 /// [Reference](https://doc.rust-lang.org/reference/macros.html)
2466 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2467 pub struct MacroItems {
2468     pub(crate) syntax: SyntaxNode,
2469 }
2470 impl ast::ModuleItemOwner for MacroItems {}
2471 impl MacroItems {}
2472 /// List of items in an extern block.
2473 ///
2474 /// ```
2475 /// extern "C" ❰
2476 ///     {
2477 ///         fn foo();
2478 ///         static var: u32;
2479 ///     }
2480 /// ❱
2481 /// ```
2482 ///
2483 /// [Reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2484 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2485 pub struct ExternItemList {
2486     pub(crate) syntax: SyntaxNode,
2487 }
2488 impl ast::ModuleItemOwner for ExternItemList {}
2489 impl ExternItemList {
2490     pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2491     pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) }
2492     pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2493 }
2494 /// Extern block.
2495 ///
2496 /// ```
2497 /// ❰
2498 ///     extern "C" {
2499 ///         fn foo();
2500 ///     }
2501 /// ❱
2502 ///
2503 /// ```
2504 ///
2505 /// [Reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2506 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2507 pub struct ExternBlock {
2508     pub(crate) syntax: SyntaxNode,
2509 }
2510 impl ExternBlock {
2511     pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
2512     pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) }
2513 }
2514 /// Meta item in an attribute.
2515 ///
2516 /// ```
2517 /// #[❰ bar::baz = "42" ❱]
2518 /// #[❰ bruh(bruuh("true")) ❱]
2519 /// struct Foo;
2520 /// ```
2521 ///
2522 /// [Reference](https://doc.rust-lang.org/reference/attributes.html?highlight=meta,item#meta-item-attribute-syntax)
2523 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2524 pub struct MetaItem {
2525     pub(crate) syntax: SyntaxNode,
2526 }
2527 impl MetaItem {
2528     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2529     pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2530     pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
2531     pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
2532 }
2533 /// Macro definition.
2534 ///
2535 /// ```
2536 /// ❰
2537 ///     macro_rules! foo {
2538 ///         ($bar:tt) => {$bar}
2539 ///     }
2540 /// ❱
2541 /// ```
2542 ///
2543 /// [Reference](https://doc.rust-lang.org/reference/macros-by-example.html)
2544 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2545 pub struct MacroDef {
2546     pub(crate) syntax: SyntaxNode,
2547 }
2548 impl MacroDef {
2549     pub fn name(&self) -> Option<Name> { support::child(&self.syntax) }
2550     pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
2551 }
2552 /// Any kind of nominal type definition.
2553 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2554 pub enum NominalDef {
2555     StructDef(StructDef),
2556     EnumDef(EnumDef),
2557     UnionDef(UnionDef),
2558 }
2559 impl ast::NameOwner for NominalDef {}
2560 impl ast::TypeParamsOwner for NominalDef {}
2561 impl ast::AttrsOwner for NominalDef {}
2562 /// Any kind of **declared** generic parameter
2563 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2564 pub enum GenericParam {
2565     LifetimeParam(LifetimeParam),
2566     TypeParam(TypeParam),
2567     ConstParam(ConstParam),
2568 }
2569 /// Any kind of generic argument passed at instantiation site
2570 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2571 pub enum GenericArg {
2572     LifetimeArg(LifetimeArg),
2573     TypeArg(TypeArg),
2574     ConstArg(ConstArg),
2575     AssocTypeArg(AssocTypeArg),
2576 }
2577 /// Any kind of construct valid in type context
2578 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2579 pub enum TypeRef {
2580     ParenType(ParenType),
2581     TupleType(TupleType),
2582     NeverType(NeverType),
2583     PathType(PathType),
2584     PointerType(PointerType),
2585     ArrayType(ArrayType),
2586     SliceType(SliceType),
2587     ReferenceType(ReferenceType),
2588     PlaceholderType(PlaceholderType),
2589     FnPointerType(FnPointerType),
2590     ForType(ForType),
2591     ImplTraitType(ImplTraitType),
2592     DynTraitType(DynTraitType),
2593 }
2594 /// Any kind of top-level item that may appear in a module
2595 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2596 pub enum ModuleItem {
2597     StructDef(StructDef),
2598     UnionDef(UnionDef),
2599     EnumDef(EnumDef),
2600     FnDef(FnDef),
2601     TraitDef(TraitDef),
2602     TypeAliasDef(TypeAliasDef),
2603     ImplDef(ImplDef),
2604     UseItem(UseItem),
2605     ExternCrateItem(ExternCrateItem),
2606     ConstDef(ConstDef),
2607     StaticDef(StaticDef),
2608     Module(Module),
2609     MacroCall(MacroCall),
2610     ExternBlock(ExternBlock),
2611 }
2612 impl ast::NameOwner for ModuleItem {}
2613 impl ast::AttrsOwner for ModuleItem {}
2614 impl ast::VisibilityOwner for ModuleItem {}
2615 /// Any kind of item that may appear in an impl block
2616 ///
2617 /// // TODO: is the following a fixme?
2618 /// impl blocks can also contain MacroCall
2619 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2620 pub enum AssocItem {
2621     FnDef(FnDef),
2622     TypeAliasDef(TypeAliasDef),
2623     ConstDef(ConstDef),
2624 }
2625 impl ast::NameOwner for AssocItem {}
2626 impl ast::AttrsOwner for AssocItem {}
2627 /// Any kind of item that may appear in an extern block
2628 ///
2629 /// // TODO: is the following a fixme?
2630 /// extern blocks can also contain MacroCall
2631 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2632 pub enum ExternItem {
2633     FnDef(FnDef),
2634     StaticDef(StaticDef),
2635 }
2636 impl ast::NameOwner for ExternItem {}
2637 impl ast::AttrsOwner for ExternItem {}
2638 impl ast::VisibilityOwner for ExternItem {}
2639 /// Any kind of expression
2640 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2641 pub enum Expr {
2642     TupleExpr(TupleExpr),
2643     ArrayExpr(ArrayExpr),
2644     ParenExpr(ParenExpr),
2645     PathExpr(PathExpr),
2646     LambdaExpr(LambdaExpr),
2647     IfExpr(IfExpr),
2648     LoopExpr(LoopExpr),
2649     ForExpr(ForExpr),
2650     WhileExpr(WhileExpr),
2651     ContinueExpr(ContinueExpr),
2652     BreakExpr(BreakExpr),
2653     Label(Label),
2654     BlockExpr(BlockExpr),
2655     ReturnExpr(ReturnExpr),
2656     MatchExpr(MatchExpr),
2657     RecordLit(RecordLit),
2658     CallExpr(CallExpr),
2659     IndexExpr(IndexExpr),
2660     MethodCallExpr(MethodCallExpr),
2661     FieldExpr(FieldExpr),
2662     AwaitExpr(AwaitExpr),
2663     TryExpr(TryExpr),
2664     EffectExpr(EffectExpr),
2665     CastExpr(CastExpr),
2666     RefExpr(RefExpr),
2667     PrefixExpr(PrefixExpr),
2668     RangeExpr(RangeExpr),
2669     BinExpr(BinExpr),
2670     Literal(Literal),
2671     MacroCall(MacroCall),
2672     BoxExpr(BoxExpr),
2673 }
2674 impl ast::AttrsOwner for Expr {}
2675 /// Any kind of pattern
2676 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2677 pub enum Pat {
2678     OrPat(OrPat),
2679     ParenPat(ParenPat),
2680     RefPat(RefPat),
2681     BoxPat(BoxPat),
2682     BindPat(BindPat),
2683     PlaceholderPat(PlaceholderPat),
2684     DotDotPat(DotDotPat),
2685     PathPat(PathPat),
2686     RecordPat(RecordPat),
2687     TupleStructPat(TupleStructPat),
2688     TuplePat(TuplePat),
2689     SlicePat(SlicePat),
2690     RangePat(RangePat),
2691     LiteralPat(LiteralPat),
2692     MacroPat(MacroPat),
2693 }
2694 /// Any kind of pattern that appears directly inside of the curly
2695 /// braces of a record pattern
2696 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2697 pub enum RecordInnerPat {
2698     RecordFieldPat(RecordFieldPat),
2699     BindPat(BindPat),
2700 }
2701 /// Any kind of input to an attribute
2702 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2703 pub enum AttrInput {
2704     Literal(Literal),
2705     TokenTree(TokenTree),
2706 }
2707 /// Any kind of statement
2708 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2709 pub enum Stmt {
2710     LetStmt(LetStmt),
2711     ExprStmt(ExprStmt),
2712 }
2713 /// Any kind of fields list (record or tuple field lists)
2714 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
2715 pub enum FieldDefList {
2716     RecordFieldDefList(RecordFieldDefList),
2717     TupleFieldDefList(TupleFieldDefList),
2718 }
2719 impl AstNode for SourceFile {
2720     fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
2721     fn cast(syntax: SyntaxNode) -> Option<Self> {
2722         if Self::can_cast(syntax.kind()) {
2723             Some(Self { syntax })
2724         } else {
2725             None
2726         }
2727     }
2728     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2729 }
2730 impl AstNode for FnDef {
2731     fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF }
2732     fn cast(syntax: SyntaxNode) -> Option<Self> {
2733         if Self::can_cast(syntax.kind()) {
2734             Some(Self { syntax })
2735         } else {
2736             None
2737         }
2738     }
2739     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2740 }
2741 impl AstNode for RetType {
2742     fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
2743     fn cast(syntax: SyntaxNode) -> Option<Self> {
2744         if Self::can_cast(syntax.kind()) {
2745             Some(Self { syntax })
2746         } else {
2747             None
2748         }
2749     }
2750     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2751 }
2752 impl AstNode for StructDef {
2753     fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF }
2754     fn cast(syntax: SyntaxNode) -> Option<Self> {
2755         if Self::can_cast(syntax.kind()) {
2756             Some(Self { syntax })
2757         } else {
2758             None
2759         }
2760     }
2761     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2762 }
2763 impl AstNode for UnionDef {
2764     fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF }
2765     fn cast(syntax: SyntaxNode) -> Option<Self> {
2766         if Self::can_cast(syntax.kind()) {
2767             Some(Self { syntax })
2768         } else {
2769             None
2770         }
2771     }
2772     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2773 }
2774 impl AstNode for RecordFieldDefList {
2775     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST }
2776     fn cast(syntax: SyntaxNode) -> Option<Self> {
2777         if Self::can_cast(syntax.kind()) {
2778             Some(Self { syntax })
2779         } else {
2780             None
2781         }
2782     }
2783     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2784 }
2785 impl AstNode for RecordFieldDef {
2786     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF }
2787     fn cast(syntax: SyntaxNode) -> Option<Self> {
2788         if Self::can_cast(syntax.kind()) {
2789             Some(Self { syntax })
2790         } else {
2791             None
2792         }
2793     }
2794     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2795 }
2796 impl AstNode for TupleFieldDefList {
2797     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST }
2798     fn cast(syntax: SyntaxNode) -> Option<Self> {
2799         if Self::can_cast(syntax.kind()) {
2800             Some(Self { syntax })
2801         } else {
2802             None
2803         }
2804     }
2805     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2806 }
2807 impl AstNode for TupleFieldDef {
2808     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF }
2809     fn cast(syntax: SyntaxNode) -> Option<Self> {
2810         if Self::can_cast(syntax.kind()) {
2811             Some(Self { syntax })
2812         } else {
2813             None
2814         }
2815     }
2816     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2817 }
2818 impl AstNode for EnumDef {
2819     fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF }
2820     fn cast(syntax: SyntaxNode) -> Option<Self> {
2821         if Self::can_cast(syntax.kind()) {
2822             Some(Self { syntax })
2823         } else {
2824             None
2825         }
2826     }
2827     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2828 }
2829 impl AstNode for EnumVariantList {
2830     fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST }
2831     fn cast(syntax: SyntaxNode) -> Option<Self> {
2832         if Self::can_cast(syntax.kind()) {
2833             Some(Self { syntax })
2834         } else {
2835             None
2836         }
2837     }
2838     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2839 }
2840 impl AstNode for EnumVariant {
2841     fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT }
2842     fn cast(syntax: SyntaxNode) -> Option<Self> {
2843         if Self::can_cast(syntax.kind()) {
2844             Some(Self { syntax })
2845         } else {
2846             None
2847         }
2848     }
2849     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2850 }
2851 impl AstNode for TraitDef {
2852     fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF }
2853     fn cast(syntax: SyntaxNode) -> Option<Self> {
2854         if Self::can_cast(syntax.kind()) {
2855             Some(Self { syntax })
2856         } else {
2857             None
2858         }
2859     }
2860     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2861 }
2862 impl AstNode for Module {
2863     fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
2864     fn cast(syntax: SyntaxNode) -> Option<Self> {
2865         if Self::can_cast(syntax.kind()) {
2866             Some(Self { syntax })
2867         } else {
2868             None
2869         }
2870     }
2871     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2872 }
2873 impl AstNode for ItemList {
2874     fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
2875     fn cast(syntax: SyntaxNode) -> Option<Self> {
2876         if Self::can_cast(syntax.kind()) {
2877             Some(Self { syntax })
2878         } else {
2879             None
2880         }
2881     }
2882     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2883 }
2884 impl AstNode for ConstDef {
2885     fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF }
2886     fn cast(syntax: SyntaxNode) -> Option<Self> {
2887         if Self::can_cast(syntax.kind()) {
2888             Some(Self { syntax })
2889         } else {
2890             None
2891         }
2892     }
2893     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2894 }
2895 impl AstNode for StaticDef {
2896     fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF }
2897     fn cast(syntax: SyntaxNode) -> Option<Self> {
2898         if Self::can_cast(syntax.kind()) {
2899             Some(Self { syntax })
2900         } else {
2901             None
2902         }
2903     }
2904     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2905 }
2906 impl AstNode for TypeAliasDef {
2907     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF }
2908     fn cast(syntax: SyntaxNode) -> Option<Self> {
2909         if Self::can_cast(syntax.kind()) {
2910             Some(Self { syntax })
2911         } else {
2912             None
2913         }
2914     }
2915     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2916 }
2917 impl AstNode for ImplDef {
2918     fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF }
2919     fn cast(syntax: SyntaxNode) -> Option<Self> {
2920         if Self::can_cast(syntax.kind()) {
2921             Some(Self { syntax })
2922         } else {
2923             None
2924         }
2925     }
2926     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2927 }
2928 impl AstNode for ParenType {
2929     fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
2930     fn cast(syntax: SyntaxNode) -> Option<Self> {
2931         if Self::can_cast(syntax.kind()) {
2932             Some(Self { syntax })
2933         } else {
2934             None
2935         }
2936     }
2937     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2938 }
2939 impl AstNode for TupleType {
2940     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
2941     fn cast(syntax: SyntaxNode) -> Option<Self> {
2942         if Self::can_cast(syntax.kind()) {
2943             Some(Self { syntax })
2944         } else {
2945             None
2946         }
2947     }
2948     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2949 }
2950 impl AstNode for NeverType {
2951     fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
2952     fn cast(syntax: SyntaxNode) -> Option<Self> {
2953         if Self::can_cast(syntax.kind()) {
2954             Some(Self { syntax })
2955         } else {
2956             None
2957         }
2958     }
2959     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2960 }
2961 impl AstNode for PathType {
2962     fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
2963     fn cast(syntax: SyntaxNode) -> Option<Self> {
2964         if Self::can_cast(syntax.kind()) {
2965             Some(Self { syntax })
2966         } else {
2967             None
2968         }
2969     }
2970     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2971 }
2972 impl AstNode for PointerType {
2973     fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE }
2974     fn cast(syntax: SyntaxNode) -> Option<Self> {
2975         if Self::can_cast(syntax.kind()) {
2976             Some(Self { syntax })
2977         } else {
2978             None
2979         }
2980     }
2981     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2982 }
2983 impl AstNode for ArrayType {
2984     fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
2985     fn cast(syntax: SyntaxNode) -> Option<Self> {
2986         if Self::can_cast(syntax.kind()) {
2987             Some(Self { syntax })
2988         } else {
2989             None
2990         }
2991     }
2992     fn syntax(&self) -> &SyntaxNode { &self.syntax }
2993 }
2994 impl AstNode for SliceType {
2995     fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
2996     fn cast(syntax: SyntaxNode) -> Option<Self> {
2997         if Self::can_cast(syntax.kind()) {
2998             Some(Self { syntax })
2999         } else {
3000             None
3001         }
3002     }
3003     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3004 }
3005 impl AstNode for ReferenceType {
3006     fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE }
3007     fn cast(syntax: SyntaxNode) -> Option<Self> {
3008         if Self::can_cast(syntax.kind()) {
3009             Some(Self { syntax })
3010         } else {
3011             None
3012         }
3013     }
3014     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3015 }
3016 impl AstNode for PlaceholderType {
3017     fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE }
3018     fn cast(syntax: SyntaxNode) -> Option<Self> {
3019         if Self::can_cast(syntax.kind()) {
3020             Some(Self { syntax })
3021         } else {
3022             None
3023         }
3024     }
3025     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3026 }
3027 impl AstNode for FnPointerType {
3028     fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE }
3029     fn cast(syntax: SyntaxNode) -> Option<Self> {
3030         if Self::can_cast(syntax.kind()) {
3031             Some(Self { syntax })
3032         } else {
3033             None
3034         }
3035     }
3036     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3037 }
3038 impl AstNode for ForType {
3039     fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
3040     fn cast(syntax: SyntaxNode) -> Option<Self> {
3041         if Self::can_cast(syntax.kind()) {
3042             Some(Self { syntax })
3043         } else {
3044             None
3045         }
3046     }
3047     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3048 }
3049 impl AstNode for ImplTraitType {
3050     fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
3051     fn cast(syntax: SyntaxNode) -> Option<Self> {
3052         if Self::can_cast(syntax.kind()) {
3053             Some(Self { syntax })
3054         } else {
3055             None
3056         }
3057     }
3058     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3059 }
3060 impl AstNode for DynTraitType {
3061     fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
3062     fn cast(syntax: SyntaxNode) -> Option<Self> {
3063         if Self::can_cast(syntax.kind()) {
3064             Some(Self { syntax })
3065         } else {
3066             None
3067         }
3068     }
3069     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3070 }
3071 impl AstNode for TupleExpr {
3072     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
3073     fn cast(syntax: SyntaxNode) -> Option<Self> {
3074         if Self::can_cast(syntax.kind()) {
3075             Some(Self { syntax })
3076         } else {
3077             None
3078         }
3079     }
3080     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3081 }
3082 impl AstNode for ArrayExpr {
3083     fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
3084     fn cast(syntax: SyntaxNode) -> Option<Self> {
3085         if Self::can_cast(syntax.kind()) {
3086             Some(Self { syntax })
3087         } else {
3088             None
3089         }
3090     }
3091     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3092 }
3093 impl AstNode for ParenExpr {
3094     fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
3095     fn cast(syntax: SyntaxNode) -> Option<Self> {
3096         if Self::can_cast(syntax.kind()) {
3097             Some(Self { syntax })
3098         } else {
3099             None
3100         }
3101     }
3102     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3103 }
3104 impl AstNode for PathExpr {
3105     fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
3106     fn cast(syntax: SyntaxNode) -> Option<Self> {
3107         if Self::can_cast(syntax.kind()) {
3108             Some(Self { syntax })
3109         } else {
3110             None
3111         }
3112     }
3113     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3114 }
3115 impl AstNode for LambdaExpr {
3116     fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR }
3117     fn cast(syntax: SyntaxNode) -> Option<Self> {
3118         if Self::can_cast(syntax.kind()) {
3119             Some(Self { syntax })
3120         } else {
3121             None
3122         }
3123     }
3124     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3125 }
3126 impl AstNode for IfExpr {
3127     fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
3128     fn cast(syntax: SyntaxNode) -> Option<Self> {
3129         if Self::can_cast(syntax.kind()) {
3130             Some(Self { syntax })
3131         } else {
3132             None
3133         }
3134     }
3135     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3136 }
3137 impl AstNode for LoopExpr {
3138     fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
3139     fn cast(syntax: SyntaxNode) -> Option<Self> {
3140         if Self::can_cast(syntax.kind()) {
3141             Some(Self { syntax })
3142         } else {
3143             None
3144         }
3145     }
3146     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3147 }
3148 impl AstNode for EffectExpr {
3149     fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
3150     fn cast(syntax: SyntaxNode) -> Option<Self> {
3151         if Self::can_cast(syntax.kind()) {
3152             Some(Self { syntax })
3153         } else {
3154             None
3155         }
3156     }
3157     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3158 }
3159 impl AstNode for ForExpr {
3160     fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
3161     fn cast(syntax: SyntaxNode) -> Option<Self> {
3162         if Self::can_cast(syntax.kind()) {
3163             Some(Self { syntax })
3164         } else {
3165             None
3166         }
3167     }
3168     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3169 }
3170 impl AstNode for WhileExpr {
3171     fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
3172     fn cast(syntax: SyntaxNode) -> Option<Self> {
3173         if Self::can_cast(syntax.kind()) {
3174             Some(Self { syntax })
3175         } else {
3176             None
3177         }
3178     }
3179     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3180 }
3181 impl AstNode for ContinueExpr {
3182     fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
3183     fn cast(syntax: SyntaxNode) -> Option<Self> {
3184         if Self::can_cast(syntax.kind()) {
3185             Some(Self { syntax })
3186         } else {
3187             None
3188         }
3189     }
3190     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3191 }
3192 impl AstNode for BreakExpr {
3193     fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
3194     fn cast(syntax: SyntaxNode) -> Option<Self> {
3195         if Self::can_cast(syntax.kind()) {
3196             Some(Self { syntax })
3197         } else {
3198             None
3199         }
3200     }
3201     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3202 }
3203 impl AstNode for Label {
3204     fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
3205     fn cast(syntax: SyntaxNode) -> Option<Self> {
3206         if Self::can_cast(syntax.kind()) {
3207             Some(Self { syntax })
3208         } else {
3209             None
3210         }
3211     }
3212     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3213 }
3214 impl AstNode for BlockExpr {
3215     fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
3216     fn cast(syntax: SyntaxNode) -> Option<Self> {
3217         if Self::can_cast(syntax.kind()) {
3218             Some(Self { syntax })
3219         } else {
3220             None
3221         }
3222     }
3223     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3224 }
3225 impl AstNode for ReturnExpr {
3226     fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
3227     fn cast(syntax: SyntaxNode) -> Option<Self> {
3228         if Self::can_cast(syntax.kind()) {
3229             Some(Self { syntax })
3230         } else {
3231             None
3232         }
3233     }
3234     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3235 }
3236 impl AstNode for CallExpr {
3237     fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
3238     fn cast(syntax: SyntaxNode) -> Option<Self> {
3239         if Self::can_cast(syntax.kind()) {
3240             Some(Self { syntax })
3241         } else {
3242             None
3243         }
3244     }
3245     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3246 }
3247 impl AstNode for MethodCallExpr {
3248     fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
3249     fn cast(syntax: SyntaxNode) -> Option<Self> {
3250         if Self::can_cast(syntax.kind()) {
3251             Some(Self { syntax })
3252         } else {
3253             None
3254         }
3255     }
3256     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3257 }
3258 impl AstNode for IndexExpr {
3259     fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
3260     fn cast(syntax: SyntaxNode) -> Option<Self> {
3261         if Self::can_cast(syntax.kind()) {
3262             Some(Self { syntax })
3263         } else {
3264             None
3265         }
3266     }
3267     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3268 }
3269 impl AstNode for FieldExpr {
3270     fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
3271     fn cast(syntax: SyntaxNode) -> Option<Self> {
3272         if Self::can_cast(syntax.kind()) {
3273             Some(Self { syntax })
3274         } else {
3275             None
3276         }
3277     }
3278     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3279 }
3280 impl AstNode for AwaitExpr {
3281     fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
3282     fn cast(syntax: SyntaxNode) -> Option<Self> {
3283         if Self::can_cast(syntax.kind()) {
3284             Some(Self { syntax })
3285         } else {
3286             None
3287         }
3288     }
3289     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3290 }
3291 impl AstNode for TryExpr {
3292     fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
3293     fn cast(syntax: SyntaxNode) -> Option<Self> {
3294         if Self::can_cast(syntax.kind()) {
3295             Some(Self { syntax })
3296         } else {
3297             None
3298         }
3299     }
3300     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3301 }
3302 impl AstNode for CastExpr {
3303     fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
3304     fn cast(syntax: SyntaxNode) -> Option<Self> {
3305         if Self::can_cast(syntax.kind()) {
3306             Some(Self { syntax })
3307         } else {
3308             None
3309         }
3310     }
3311     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3312 }
3313 impl AstNode for RefExpr {
3314     fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
3315     fn cast(syntax: SyntaxNode) -> Option<Self> {
3316         if Self::can_cast(syntax.kind()) {
3317             Some(Self { syntax })
3318         } else {
3319             None
3320         }
3321     }
3322     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3323 }
3324 impl AstNode for PrefixExpr {
3325     fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
3326     fn cast(syntax: SyntaxNode) -> Option<Self> {
3327         if Self::can_cast(syntax.kind()) {
3328             Some(Self { syntax })
3329         } else {
3330             None
3331         }
3332     }
3333     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3334 }
3335 impl AstNode for BoxExpr {
3336     fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
3337     fn cast(syntax: SyntaxNode) -> Option<Self> {
3338         if Self::can_cast(syntax.kind()) {
3339             Some(Self { syntax })
3340         } else {
3341             None
3342         }
3343     }
3344     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3345 }
3346 impl AstNode for RangeExpr {
3347     fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
3348     fn cast(syntax: SyntaxNode) -> Option<Self> {
3349         if Self::can_cast(syntax.kind()) {
3350             Some(Self { syntax })
3351         } else {
3352             None
3353         }
3354     }
3355     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3356 }
3357 impl AstNode for BinExpr {
3358     fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
3359     fn cast(syntax: SyntaxNode) -> Option<Self> {
3360         if Self::can_cast(syntax.kind()) {
3361             Some(Self { syntax })
3362         } else {
3363             None
3364         }
3365     }
3366     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3367 }
3368 impl AstNode for Literal {
3369     fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
3370     fn cast(syntax: SyntaxNode) -> Option<Self> {
3371         if Self::can_cast(syntax.kind()) {
3372             Some(Self { syntax })
3373         } else {
3374             None
3375         }
3376     }
3377     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3378 }
3379 impl AstNode for MatchExpr {
3380     fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
3381     fn cast(syntax: SyntaxNode) -> Option<Self> {
3382         if Self::can_cast(syntax.kind()) {
3383             Some(Self { syntax })
3384         } else {
3385             None
3386         }
3387     }
3388     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3389 }
3390 impl AstNode for MatchArmList {
3391     fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
3392     fn cast(syntax: SyntaxNode) -> Option<Self> {
3393         if Self::can_cast(syntax.kind()) {
3394             Some(Self { syntax })
3395         } else {
3396             None
3397         }
3398     }
3399     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3400 }
3401 impl AstNode for MatchArm {
3402     fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
3403     fn cast(syntax: SyntaxNode) -> Option<Self> {
3404         if Self::can_cast(syntax.kind()) {
3405             Some(Self { syntax })
3406         } else {
3407             None
3408         }
3409     }
3410     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3411 }
3412 impl AstNode for MatchGuard {
3413     fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
3414     fn cast(syntax: SyntaxNode) -> Option<Self> {
3415         if Self::can_cast(syntax.kind()) {
3416             Some(Self { syntax })
3417         } else {
3418             None
3419         }
3420     }
3421     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3422 }
3423 impl AstNode for RecordLit {
3424     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT }
3425     fn cast(syntax: SyntaxNode) -> Option<Self> {
3426         if Self::can_cast(syntax.kind()) {
3427             Some(Self { syntax })
3428         } else {
3429             None
3430         }
3431     }
3432     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3433 }
3434 impl AstNode for RecordFieldList {
3435     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
3436     fn cast(syntax: SyntaxNode) -> Option<Self> {
3437         if Self::can_cast(syntax.kind()) {
3438             Some(Self { syntax })
3439         } else {
3440             None
3441         }
3442     }
3443     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3444 }
3445 impl AstNode for RecordField {
3446     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
3447     fn cast(syntax: SyntaxNode) -> Option<Self> {
3448         if Self::can_cast(syntax.kind()) {
3449             Some(Self { syntax })
3450         } else {
3451             None
3452         }
3453     }
3454     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3455 }
3456 impl AstNode for OrPat {
3457     fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT }
3458     fn cast(syntax: SyntaxNode) -> Option<Self> {
3459         if Self::can_cast(syntax.kind()) {
3460             Some(Self { syntax })
3461         } else {
3462             None
3463         }
3464     }
3465     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3466 }
3467 impl AstNode for ParenPat {
3468     fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT }
3469     fn cast(syntax: SyntaxNode) -> Option<Self> {
3470         if Self::can_cast(syntax.kind()) {
3471             Some(Self { syntax })
3472         } else {
3473             None
3474         }
3475     }
3476     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3477 }
3478 impl AstNode for RefPat {
3479     fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT }
3480     fn cast(syntax: SyntaxNode) -> Option<Self> {
3481         if Self::can_cast(syntax.kind()) {
3482             Some(Self { syntax })
3483         } else {
3484             None
3485         }
3486     }
3487     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3488 }
3489 impl AstNode for BoxPat {
3490     fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT }
3491     fn cast(syntax: SyntaxNode) -> Option<Self> {
3492         if Self::can_cast(syntax.kind()) {
3493             Some(Self { syntax })
3494         } else {
3495             None
3496         }
3497     }
3498     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3499 }
3500 impl AstNode for BindPat {
3501     fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT }
3502     fn cast(syntax: SyntaxNode) -> Option<Self> {
3503         if Self::can_cast(syntax.kind()) {
3504             Some(Self { syntax })
3505         } else {
3506             None
3507         }
3508     }
3509     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3510 }
3511 impl AstNode for PlaceholderPat {
3512     fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT }
3513     fn cast(syntax: SyntaxNode) -> Option<Self> {
3514         if Self::can_cast(syntax.kind()) {
3515             Some(Self { syntax })
3516         } else {
3517             None
3518         }
3519     }
3520     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3521 }
3522 impl AstNode for DotDotPat {
3523     fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT }
3524     fn cast(syntax: SyntaxNode) -> Option<Self> {
3525         if Self::can_cast(syntax.kind()) {
3526             Some(Self { syntax })
3527         } else {
3528             None
3529         }
3530     }
3531     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3532 }
3533 impl AstNode for PathPat {
3534     fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT }
3535     fn cast(syntax: SyntaxNode) -> Option<Self> {
3536         if Self::can_cast(syntax.kind()) {
3537             Some(Self { syntax })
3538         } else {
3539             None
3540         }
3541     }
3542     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3543 }
3544 impl AstNode for SlicePat {
3545     fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT }
3546     fn cast(syntax: SyntaxNode) -> Option<Self> {
3547         if Self::can_cast(syntax.kind()) {
3548             Some(Self { syntax })
3549         } else {
3550             None
3551         }
3552     }
3553     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3554 }
3555 impl AstNode for RangePat {
3556     fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT }
3557     fn cast(syntax: SyntaxNode) -> Option<Self> {
3558         if Self::can_cast(syntax.kind()) {
3559             Some(Self { syntax })
3560         } else {
3561             None
3562         }
3563     }
3564     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3565 }
3566 impl AstNode for LiteralPat {
3567     fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT }
3568     fn cast(syntax: SyntaxNode) -> Option<Self> {
3569         if Self::can_cast(syntax.kind()) {
3570             Some(Self { syntax })
3571         } else {
3572             None
3573         }
3574     }
3575     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3576 }
3577 impl AstNode for MacroPat {
3578     fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT }
3579     fn cast(syntax: SyntaxNode) -> Option<Self> {
3580         if Self::can_cast(syntax.kind()) {
3581             Some(Self { syntax })
3582         } else {
3583             None
3584         }
3585     }
3586     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3587 }
3588 impl AstNode for RecordPat {
3589     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT }
3590     fn cast(syntax: SyntaxNode) -> Option<Self> {
3591         if Self::can_cast(syntax.kind()) {
3592             Some(Self { syntax })
3593         } else {
3594             None
3595         }
3596     }
3597     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3598 }
3599 impl AstNode for RecordFieldPatList {
3600     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST }
3601     fn cast(syntax: SyntaxNode) -> Option<Self> {
3602         if Self::can_cast(syntax.kind()) {
3603             Some(Self { syntax })
3604         } else {
3605             None
3606         }
3607     }
3608     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3609 }
3610 impl AstNode for RecordFieldPat {
3611     fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT }
3612     fn cast(syntax: SyntaxNode) -> Option<Self> {
3613         if Self::can_cast(syntax.kind()) {
3614             Some(Self { syntax })
3615         } else {
3616             None
3617         }
3618     }
3619     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3620 }
3621 impl AstNode for TupleStructPat {
3622     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT }
3623     fn cast(syntax: SyntaxNode) -> Option<Self> {
3624         if Self::can_cast(syntax.kind()) {
3625             Some(Self { syntax })
3626         } else {
3627             None
3628         }
3629     }
3630     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3631 }
3632 impl AstNode for TuplePat {
3633     fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT }
3634     fn cast(syntax: SyntaxNode) -> Option<Self> {
3635         if Self::can_cast(syntax.kind()) {
3636             Some(Self { syntax })
3637         } else {
3638             None
3639         }
3640     }
3641     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3642 }
3643 impl AstNode for Visibility {
3644     fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
3645     fn cast(syntax: SyntaxNode) -> Option<Self> {
3646         if Self::can_cast(syntax.kind()) {
3647             Some(Self { syntax })
3648         } else {
3649             None
3650         }
3651     }
3652     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3653 }
3654 impl AstNode for Name {
3655     fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
3656     fn cast(syntax: SyntaxNode) -> Option<Self> {
3657         if Self::can_cast(syntax.kind()) {
3658             Some(Self { syntax })
3659         } else {
3660             None
3661         }
3662     }
3663     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3664 }
3665 impl AstNode for NameRef {
3666     fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
3667     fn cast(syntax: SyntaxNode) -> Option<Self> {
3668         if Self::can_cast(syntax.kind()) {
3669             Some(Self { syntax })
3670         } else {
3671             None
3672         }
3673     }
3674     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3675 }
3676 impl AstNode for MacroCall {
3677     fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
3678     fn cast(syntax: SyntaxNode) -> Option<Self> {
3679         if Self::can_cast(syntax.kind()) {
3680             Some(Self { syntax })
3681         } else {
3682             None
3683         }
3684     }
3685     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3686 }
3687 impl AstNode for Attr {
3688     fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
3689     fn cast(syntax: SyntaxNode) -> Option<Self> {
3690         if Self::can_cast(syntax.kind()) {
3691             Some(Self { syntax })
3692         } else {
3693             None
3694         }
3695     }
3696     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3697 }
3698 impl AstNode for TokenTree {
3699     fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
3700     fn cast(syntax: SyntaxNode) -> Option<Self> {
3701         if Self::can_cast(syntax.kind()) {
3702             Some(Self { syntax })
3703         } else {
3704             None
3705         }
3706     }
3707     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3708 }
3709 impl AstNode for TypeParamList {
3710     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST }
3711     fn cast(syntax: SyntaxNode) -> Option<Self> {
3712         if Self::can_cast(syntax.kind()) {
3713             Some(Self { syntax })
3714         } else {
3715             None
3716         }
3717     }
3718     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3719 }
3720 impl AstNode for TypeParam {
3721     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
3722     fn cast(syntax: SyntaxNode) -> Option<Self> {
3723         if Self::can_cast(syntax.kind()) {
3724             Some(Self { syntax })
3725         } else {
3726             None
3727         }
3728     }
3729     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3730 }
3731 impl AstNode for ConstParam {
3732     fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
3733     fn cast(syntax: SyntaxNode) -> Option<Self> {
3734         if Self::can_cast(syntax.kind()) {
3735             Some(Self { syntax })
3736         } else {
3737             None
3738         }
3739     }
3740     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3741 }
3742 impl AstNode for LifetimeParam {
3743     fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
3744     fn cast(syntax: SyntaxNode) -> Option<Self> {
3745         if Self::can_cast(syntax.kind()) {
3746             Some(Self { syntax })
3747         } else {
3748             None
3749         }
3750     }
3751     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3752 }
3753 impl AstNode for TypeBound {
3754     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
3755     fn cast(syntax: SyntaxNode) -> Option<Self> {
3756         if Self::can_cast(syntax.kind()) {
3757             Some(Self { syntax })
3758         } else {
3759             None
3760         }
3761     }
3762     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3763 }
3764 impl AstNode for TypeBoundList {
3765     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
3766     fn cast(syntax: SyntaxNode) -> Option<Self> {
3767         if Self::can_cast(syntax.kind()) {
3768             Some(Self { syntax })
3769         } else {
3770             None
3771         }
3772     }
3773     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3774 }
3775 impl AstNode for WherePred {
3776     fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
3777     fn cast(syntax: SyntaxNode) -> Option<Self> {
3778         if Self::can_cast(syntax.kind()) {
3779             Some(Self { syntax })
3780         } else {
3781             None
3782         }
3783     }
3784     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3785 }
3786 impl AstNode for WhereClause {
3787     fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
3788     fn cast(syntax: SyntaxNode) -> Option<Self> {
3789         if Self::can_cast(syntax.kind()) {
3790             Some(Self { syntax })
3791         } else {
3792             None
3793         }
3794     }
3795     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3796 }
3797 impl AstNode for Abi {
3798     fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
3799     fn cast(syntax: SyntaxNode) -> Option<Self> {
3800         if Self::can_cast(syntax.kind()) {
3801             Some(Self { syntax })
3802         } else {
3803             None
3804         }
3805     }
3806     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3807 }
3808 impl AstNode for ExprStmt {
3809     fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
3810     fn cast(syntax: SyntaxNode) -> Option<Self> {
3811         if Self::can_cast(syntax.kind()) {
3812             Some(Self { syntax })
3813         } else {
3814             None
3815         }
3816     }
3817     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3818 }
3819 impl AstNode for LetStmt {
3820     fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
3821     fn cast(syntax: SyntaxNode) -> Option<Self> {
3822         if Self::can_cast(syntax.kind()) {
3823             Some(Self { syntax })
3824         } else {
3825             None
3826         }
3827     }
3828     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3829 }
3830 impl AstNode for Condition {
3831     fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
3832     fn cast(syntax: SyntaxNode) -> Option<Self> {
3833         if Self::can_cast(syntax.kind()) {
3834             Some(Self { syntax })
3835         } else {
3836             None
3837         }
3838     }
3839     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3840 }
3841 impl AstNode for ParamList {
3842     fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
3843     fn cast(syntax: SyntaxNode) -> Option<Self> {
3844         if Self::can_cast(syntax.kind()) {
3845             Some(Self { syntax })
3846         } else {
3847             None
3848         }
3849     }
3850     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3851 }
3852 impl AstNode for SelfParam {
3853     fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
3854     fn cast(syntax: SyntaxNode) -> Option<Self> {
3855         if Self::can_cast(syntax.kind()) {
3856             Some(Self { syntax })
3857         } else {
3858             None
3859         }
3860     }
3861     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3862 }
3863 impl AstNode for Param {
3864     fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
3865     fn cast(syntax: SyntaxNode) -> Option<Self> {
3866         if Self::can_cast(syntax.kind()) {
3867             Some(Self { syntax })
3868         } else {
3869             None
3870         }
3871     }
3872     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3873 }
3874 impl AstNode for UseItem {
3875     fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM }
3876     fn cast(syntax: SyntaxNode) -> Option<Self> {
3877         if Self::can_cast(syntax.kind()) {
3878             Some(Self { syntax })
3879         } else {
3880             None
3881         }
3882     }
3883     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3884 }
3885 impl AstNode for UseTree {
3886     fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
3887     fn cast(syntax: SyntaxNode) -> Option<Self> {
3888         if Self::can_cast(syntax.kind()) {
3889             Some(Self { syntax })
3890         } else {
3891             None
3892         }
3893     }
3894     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3895 }
3896 impl AstNode for Alias {
3897     fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS }
3898     fn cast(syntax: SyntaxNode) -> Option<Self> {
3899         if Self::can_cast(syntax.kind()) {
3900             Some(Self { syntax })
3901         } else {
3902             None
3903         }
3904     }
3905     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3906 }
3907 impl AstNode for UseTreeList {
3908     fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
3909     fn cast(syntax: SyntaxNode) -> Option<Self> {
3910         if Self::can_cast(syntax.kind()) {
3911             Some(Self { syntax })
3912         } else {
3913             None
3914         }
3915     }
3916     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3917 }
3918 impl AstNode for ExternCrateItem {
3919     fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM }
3920     fn cast(syntax: SyntaxNode) -> Option<Self> {
3921         if Self::can_cast(syntax.kind()) {
3922             Some(Self { syntax })
3923         } else {
3924             None
3925         }
3926     }
3927     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3928 }
3929 impl AstNode for ArgList {
3930     fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST }
3931     fn cast(syntax: SyntaxNode) -> Option<Self> {
3932         if Self::can_cast(syntax.kind()) {
3933             Some(Self { syntax })
3934         } else {
3935             None
3936         }
3937     }
3938     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3939 }
3940 impl AstNode for Path {
3941     fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
3942     fn cast(syntax: SyntaxNode) -> Option<Self> {
3943         if Self::can_cast(syntax.kind()) {
3944             Some(Self { syntax })
3945         } else {
3946             None
3947         }
3948     }
3949     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3950 }
3951 impl AstNode for PathSegment {
3952     fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
3953     fn cast(syntax: SyntaxNode) -> Option<Self> {
3954         if Self::can_cast(syntax.kind()) {
3955             Some(Self { syntax })
3956         } else {
3957             None
3958         }
3959     }
3960     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3961 }
3962 impl AstNode for TypeArgList {
3963     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST }
3964     fn cast(syntax: SyntaxNode) -> Option<Self> {
3965         if Self::can_cast(syntax.kind()) {
3966             Some(Self { syntax })
3967         } else {
3968             None
3969         }
3970     }
3971     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3972 }
3973 impl AstNode for TypeArg {
3974     fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
3975     fn cast(syntax: SyntaxNode) -> Option<Self> {
3976         if Self::can_cast(syntax.kind()) {
3977             Some(Self { syntax })
3978         } else {
3979             None
3980         }
3981     }
3982     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3983 }
3984 impl AstNode for AssocTypeArg {
3985     fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
3986     fn cast(syntax: SyntaxNode) -> Option<Self> {
3987         if Self::can_cast(syntax.kind()) {
3988             Some(Self { syntax })
3989         } else {
3990             None
3991         }
3992     }
3993     fn syntax(&self) -> &SyntaxNode { &self.syntax }
3994 }
3995 impl AstNode for LifetimeArg {
3996     fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
3997     fn cast(syntax: SyntaxNode) -> Option<Self> {
3998         if Self::can_cast(syntax.kind()) {
3999             Some(Self { syntax })
4000         } else {
4001             None
4002         }
4003     }
4004     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4005 }
4006 impl AstNode for ConstArg {
4007     fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
4008     fn cast(syntax: SyntaxNode) -> Option<Self> {
4009         if Self::can_cast(syntax.kind()) {
4010             Some(Self { syntax })
4011         } else {
4012             None
4013         }
4014     }
4015     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4016 }
4017 impl AstNode for MacroItems {
4018     fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
4019     fn cast(syntax: SyntaxNode) -> Option<Self> {
4020         if Self::can_cast(syntax.kind()) {
4021             Some(Self { syntax })
4022         } else {
4023             None
4024         }
4025     }
4026     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4027 }
4028 impl AstNode for ExternItemList {
4029     fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
4030     fn cast(syntax: SyntaxNode) -> Option<Self> {
4031         if Self::can_cast(syntax.kind()) {
4032             Some(Self { syntax })
4033         } else {
4034             None
4035         }
4036     }
4037     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4038 }
4039 impl AstNode for ExternBlock {
4040     fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
4041     fn cast(syntax: SyntaxNode) -> Option<Self> {
4042         if Self::can_cast(syntax.kind()) {
4043             Some(Self { syntax })
4044         } else {
4045             None
4046         }
4047     }
4048     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4049 }
4050 impl AstNode for MetaItem {
4051     fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM }
4052     fn cast(syntax: SyntaxNode) -> Option<Self> {
4053         if Self::can_cast(syntax.kind()) {
4054             Some(Self { syntax })
4055         } else {
4056             None
4057         }
4058     }
4059     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4060 }
4061 impl AstNode for MacroDef {
4062     fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF }
4063     fn cast(syntax: SyntaxNode) -> Option<Self> {
4064         if Self::can_cast(syntax.kind()) {
4065             Some(Self { syntax })
4066         } else {
4067             None
4068         }
4069     }
4070     fn syntax(&self) -> &SyntaxNode { &self.syntax }
4071 }
4072 impl From<StructDef> for NominalDef {
4073     fn from(node: StructDef) -> NominalDef { NominalDef::StructDef(node) }
4074 }
4075 impl From<EnumDef> for NominalDef {
4076     fn from(node: EnumDef) -> NominalDef { NominalDef::EnumDef(node) }
4077 }
4078 impl From<UnionDef> for NominalDef {
4079     fn from(node: UnionDef) -> NominalDef { NominalDef::UnionDef(node) }
4080 }
4081 impl AstNode for NominalDef {
4082     fn can_cast(kind: SyntaxKind) -> bool {
4083         match kind {
4084             STRUCT_DEF | ENUM_DEF | UNION_DEF => true,
4085             _ => false,
4086         }
4087     }
4088     fn cast(syntax: SyntaxNode) -> Option<Self> {
4089         let res = match syntax.kind() {
4090             STRUCT_DEF => NominalDef::StructDef(StructDef { syntax }),
4091             ENUM_DEF => NominalDef::EnumDef(EnumDef { syntax }),
4092             UNION_DEF => NominalDef::UnionDef(UnionDef { syntax }),
4093             _ => return None,
4094         };
4095         Some(res)
4096     }
4097     fn syntax(&self) -> &SyntaxNode {
4098         match self {
4099             NominalDef::StructDef(it) => &it.syntax,
4100             NominalDef::EnumDef(it) => &it.syntax,
4101             NominalDef::UnionDef(it) => &it.syntax,
4102         }
4103     }
4104 }
4105 impl From<LifetimeParam> for GenericParam {
4106     fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
4107 }
4108 impl From<TypeParam> for GenericParam {
4109     fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
4110 }
4111 impl From<ConstParam> for GenericParam {
4112     fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
4113 }
4114 impl AstNode for GenericParam {
4115     fn can_cast(kind: SyntaxKind) -> bool {
4116         match kind {
4117             LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true,
4118             _ => false,
4119         }
4120     }
4121     fn cast(syntax: SyntaxNode) -> Option<Self> {
4122         let res = match syntax.kind() {
4123             LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
4124             TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
4125             CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
4126             _ => return None,
4127         };
4128         Some(res)
4129     }
4130     fn syntax(&self) -> &SyntaxNode {
4131         match self {
4132             GenericParam::LifetimeParam(it) => &it.syntax,
4133             GenericParam::TypeParam(it) => &it.syntax,
4134             GenericParam::ConstParam(it) => &it.syntax,
4135         }
4136     }
4137 }
4138 impl From<LifetimeArg> for GenericArg {
4139     fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) }
4140 }
4141 impl From<TypeArg> for GenericArg {
4142     fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
4143 }
4144 impl From<ConstArg> for GenericArg {
4145     fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) }
4146 }
4147 impl From<AssocTypeArg> for GenericArg {
4148     fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
4149 }
4150 impl AstNode for GenericArg {
4151     fn can_cast(kind: SyntaxKind) -> bool {
4152         match kind {
4153             LIFETIME_ARG | TYPE_ARG | CONST_ARG | ASSOC_TYPE_ARG => true,
4154             _ => false,
4155         }
4156     }
4157     fn cast(syntax: SyntaxNode) -> Option<Self> {
4158         let res = match syntax.kind() {
4159             LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
4160             TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
4161             CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
4162             ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
4163             _ => return None,
4164         };
4165         Some(res)
4166     }
4167     fn syntax(&self) -> &SyntaxNode {
4168         match self {
4169             GenericArg::LifetimeArg(it) => &it.syntax,
4170             GenericArg::TypeArg(it) => &it.syntax,
4171             GenericArg::ConstArg(it) => &it.syntax,
4172             GenericArg::AssocTypeArg(it) => &it.syntax,
4173         }
4174     }
4175 }
4176 impl From<ParenType> for TypeRef {
4177     fn from(node: ParenType) -> TypeRef { TypeRef::ParenType(node) }
4178 }
4179 impl From<TupleType> for TypeRef {
4180     fn from(node: TupleType) -> TypeRef { TypeRef::TupleType(node) }
4181 }
4182 impl From<NeverType> for TypeRef {
4183     fn from(node: NeverType) -> TypeRef { TypeRef::NeverType(node) }
4184 }
4185 impl From<PathType> for TypeRef {
4186     fn from(node: PathType) -> TypeRef { TypeRef::PathType(node) }
4187 }
4188 impl From<PointerType> for TypeRef {
4189     fn from(node: PointerType) -> TypeRef { TypeRef::PointerType(node) }
4190 }
4191 impl From<ArrayType> for TypeRef {
4192     fn from(node: ArrayType) -> TypeRef { TypeRef::ArrayType(node) }
4193 }
4194 impl From<SliceType> for TypeRef {
4195     fn from(node: SliceType) -> TypeRef { TypeRef::SliceType(node) }
4196 }
4197 impl From<ReferenceType> for TypeRef {
4198     fn from(node: ReferenceType) -> TypeRef { TypeRef::ReferenceType(node) }
4199 }
4200 impl From<PlaceholderType> for TypeRef {
4201     fn from(node: PlaceholderType) -> TypeRef { TypeRef::PlaceholderType(node) }
4202 }
4203 impl From<FnPointerType> for TypeRef {
4204     fn from(node: FnPointerType) -> TypeRef { TypeRef::FnPointerType(node) }
4205 }
4206 impl From<ForType> for TypeRef {
4207     fn from(node: ForType) -> TypeRef { TypeRef::ForType(node) }
4208 }
4209 impl From<ImplTraitType> for TypeRef {
4210     fn from(node: ImplTraitType) -> TypeRef { TypeRef::ImplTraitType(node) }
4211 }
4212 impl From<DynTraitType> for TypeRef {
4213     fn from(node: DynTraitType) -> TypeRef { TypeRef::DynTraitType(node) }
4214 }
4215 impl AstNode for TypeRef {
4216     fn can_cast(kind: SyntaxKind) -> bool {
4217         match kind {
4218             PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
4219             | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE
4220             | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
4221             _ => false,
4222         }
4223     }
4224     fn cast(syntax: SyntaxNode) -> Option<Self> {
4225         let res = match syntax.kind() {
4226             PAREN_TYPE => TypeRef::ParenType(ParenType { syntax }),
4227             TUPLE_TYPE => TypeRef::TupleType(TupleType { syntax }),
4228             NEVER_TYPE => TypeRef::NeverType(NeverType { syntax }),
4229             PATH_TYPE => TypeRef::PathType(PathType { syntax }),
4230             POINTER_TYPE => TypeRef::PointerType(PointerType { syntax }),
4231             ARRAY_TYPE => TypeRef::ArrayType(ArrayType { syntax }),
4232             SLICE_TYPE => TypeRef::SliceType(SliceType { syntax }),
4233             REFERENCE_TYPE => TypeRef::ReferenceType(ReferenceType { syntax }),
4234             PLACEHOLDER_TYPE => TypeRef::PlaceholderType(PlaceholderType { syntax }),
4235             FN_POINTER_TYPE => TypeRef::FnPointerType(FnPointerType { syntax }),
4236             FOR_TYPE => TypeRef::ForType(ForType { syntax }),
4237             IMPL_TRAIT_TYPE => TypeRef::ImplTraitType(ImplTraitType { syntax }),
4238             DYN_TRAIT_TYPE => TypeRef::DynTraitType(DynTraitType { syntax }),
4239             _ => return None,
4240         };
4241         Some(res)
4242     }
4243     fn syntax(&self) -> &SyntaxNode {
4244         match self {
4245             TypeRef::ParenType(it) => &it.syntax,
4246             TypeRef::TupleType(it) => &it.syntax,
4247             TypeRef::NeverType(it) => &it.syntax,
4248             TypeRef::PathType(it) => &it.syntax,
4249             TypeRef::PointerType(it) => &it.syntax,
4250             TypeRef::ArrayType(it) => &it.syntax,
4251             TypeRef::SliceType(it) => &it.syntax,
4252             TypeRef::ReferenceType(it) => &it.syntax,
4253             TypeRef::PlaceholderType(it) => &it.syntax,
4254             TypeRef::FnPointerType(it) => &it.syntax,
4255             TypeRef::ForType(it) => &it.syntax,
4256             TypeRef::ImplTraitType(it) => &it.syntax,
4257             TypeRef::DynTraitType(it) => &it.syntax,
4258         }
4259     }
4260 }
4261 impl From<StructDef> for ModuleItem {
4262     fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) }
4263 }
4264 impl From<UnionDef> for ModuleItem {
4265     fn from(node: UnionDef) -> ModuleItem { ModuleItem::UnionDef(node) }
4266 }
4267 impl From<EnumDef> for ModuleItem {
4268     fn from(node: EnumDef) -> ModuleItem { ModuleItem::EnumDef(node) }
4269 }
4270 impl From<FnDef> for ModuleItem {
4271     fn from(node: FnDef) -> ModuleItem { ModuleItem::FnDef(node) }
4272 }
4273 impl From<TraitDef> for ModuleItem {
4274     fn from(node: TraitDef) -> ModuleItem { ModuleItem::TraitDef(node) }
4275 }
4276 impl From<TypeAliasDef> for ModuleItem {
4277     fn from(node: TypeAliasDef) -> ModuleItem { ModuleItem::TypeAliasDef(node) }
4278 }
4279 impl From<ImplDef> for ModuleItem {
4280     fn from(node: ImplDef) -> ModuleItem { ModuleItem::ImplDef(node) }
4281 }
4282 impl From<UseItem> for ModuleItem {
4283     fn from(node: UseItem) -> ModuleItem { ModuleItem::UseItem(node) }
4284 }
4285 impl From<ExternCrateItem> for ModuleItem {
4286     fn from(node: ExternCrateItem) -> ModuleItem { ModuleItem::ExternCrateItem(node) }
4287 }
4288 impl From<ConstDef> for ModuleItem {
4289     fn from(node: ConstDef) -> ModuleItem { ModuleItem::ConstDef(node) }
4290 }
4291 impl From<StaticDef> for ModuleItem {
4292     fn from(node: StaticDef) -> ModuleItem { ModuleItem::StaticDef(node) }
4293 }
4294 impl From<Module> for ModuleItem {
4295     fn from(node: Module) -> ModuleItem { ModuleItem::Module(node) }
4296 }
4297 impl From<MacroCall> for ModuleItem {
4298     fn from(node: MacroCall) -> ModuleItem { ModuleItem::MacroCall(node) }
4299 }
4300 impl From<ExternBlock> for ModuleItem {
4301     fn from(node: ExternBlock) -> ModuleItem { ModuleItem::ExternBlock(node) }
4302 }
4303 impl AstNode for ModuleItem {
4304     fn can_cast(kind: SyntaxKind) -> bool {
4305         match kind {
4306             STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF
4307             | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL
4308             | EXTERN_BLOCK => true,
4309             _ => false,
4310         }
4311     }
4312     fn cast(syntax: SyntaxNode) -> Option<Self> {
4313         let res = match syntax.kind() {
4314             STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }),
4315             UNION_DEF => ModuleItem::UnionDef(UnionDef { syntax }),
4316             ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }),
4317             FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
4318             TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
4319             TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
4320             IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }),
4321             USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
4322             EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
4323             CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
4324             STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }),
4325             MODULE => ModuleItem::Module(Module { syntax }),
4326             MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }),
4327             EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }),
4328             _ => return None,
4329         };
4330         Some(res)
4331     }
4332     fn syntax(&self) -> &SyntaxNode {
4333         match self {
4334             ModuleItem::StructDef(it) => &it.syntax,
4335             ModuleItem::UnionDef(it) => &it.syntax,
4336             ModuleItem::EnumDef(it) => &it.syntax,
4337             ModuleItem::FnDef(it) => &it.syntax,
4338             ModuleItem::TraitDef(it) => &it.syntax,
4339             ModuleItem::TypeAliasDef(it) => &it.syntax,
4340             ModuleItem::ImplDef(it) => &it.syntax,
4341             ModuleItem::UseItem(it) => &it.syntax,
4342             ModuleItem::ExternCrateItem(it) => &it.syntax,
4343             ModuleItem::ConstDef(it) => &it.syntax,
4344             ModuleItem::StaticDef(it) => &it.syntax,
4345             ModuleItem::Module(it) => &it.syntax,
4346             ModuleItem::MacroCall(it) => &it.syntax,
4347             ModuleItem::ExternBlock(it) => &it.syntax,
4348         }
4349     }
4350 }
4351 impl From<FnDef> for AssocItem {
4352     fn from(node: FnDef) -> AssocItem { AssocItem::FnDef(node) }
4353 }
4354 impl From<TypeAliasDef> for AssocItem {
4355     fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) }
4356 }
4357 impl From<ConstDef> for AssocItem {
4358     fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
4359 }
4360 impl AstNode for AssocItem {
4361     fn can_cast(kind: SyntaxKind) -> bool {
4362         match kind {
4363             FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
4364             _ => false,
4365         }
4366     }
4367     fn cast(syntax: SyntaxNode) -> Option<Self> {
4368         let res = match syntax.kind() {
4369             FN_DEF => AssocItem::FnDef(FnDef { syntax }),
4370             TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
4371             CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
4372             _ => return None,
4373         };
4374         Some(res)
4375     }
4376     fn syntax(&self) -> &SyntaxNode {
4377         match self {
4378             AssocItem::FnDef(it) => &it.syntax,
4379             AssocItem::TypeAliasDef(it) => &it.syntax,
4380             AssocItem::ConstDef(it) => &it.syntax,
4381         }
4382     }
4383 }
4384 impl From<FnDef> for ExternItem {
4385     fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) }
4386 }
4387 impl From<StaticDef> for ExternItem {
4388     fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) }
4389 }
4390 impl AstNode for ExternItem {
4391     fn can_cast(kind: SyntaxKind) -> bool {
4392         match kind {
4393             FN_DEF | STATIC_DEF => true,
4394             _ => false,
4395         }
4396     }
4397     fn cast(syntax: SyntaxNode) -> Option<Self> {
4398         let res = match syntax.kind() {
4399             FN_DEF => ExternItem::FnDef(FnDef { syntax }),
4400             STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }),
4401             _ => return None,
4402         };
4403         Some(res)
4404     }
4405     fn syntax(&self) -> &SyntaxNode {
4406         match self {
4407             ExternItem::FnDef(it) => &it.syntax,
4408             ExternItem::StaticDef(it) => &it.syntax,
4409         }
4410     }
4411 }
4412 impl From<TupleExpr> for Expr {
4413     fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
4414 }
4415 impl From<ArrayExpr> for Expr {
4416     fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
4417 }
4418 impl From<ParenExpr> for Expr {
4419     fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) }
4420 }
4421 impl From<PathExpr> for Expr {
4422     fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) }
4423 }
4424 impl From<LambdaExpr> for Expr {
4425     fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) }
4426 }
4427 impl From<IfExpr> for Expr {
4428     fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
4429 }
4430 impl From<LoopExpr> for Expr {
4431     fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) }
4432 }
4433 impl From<ForExpr> for Expr {
4434     fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) }
4435 }
4436 impl From<WhileExpr> for Expr {
4437     fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) }
4438 }
4439 impl From<ContinueExpr> for Expr {
4440     fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
4441 }
4442 impl From<BreakExpr> for Expr {
4443     fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) }
4444 }
4445 impl From<Label> for Expr {
4446     fn from(node: Label) -> Expr { Expr::Label(node) }
4447 }
4448 impl From<BlockExpr> for Expr {
4449     fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
4450 }
4451 impl From<ReturnExpr> for Expr {
4452     fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
4453 }
4454 impl From<MatchExpr> for Expr {
4455     fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) }
4456 }
4457 impl From<RecordLit> for Expr {
4458     fn from(node: RecordLit) -> Expr { Expr::RecordLit(node) }
4459 }
4460 impl From<CallExpr> for Expr {
4461     fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
4462 }
4463 impl From<IndexExpr> for Expr {
4464     fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
4465 }
4466 impl From<MethodCallExpr> for Expr {
4467     fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) }
4468 }
4469 impl From<FieldExpr> for Expr {
4470     fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) }
4471 }
4472 impl From<AwaitExpr> for Expr {
4473     fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
4474 }
4475 impl From<TryExpr> for Expr {
4476     fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
4477 }
4478 impl From<EffectExpr> for Expr {
4479     fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
4480 }
4481 impl From<CastExpr> for Expr {
4482     fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
4483 }
4484 impl From<RefExpr> for Expr {
4485     fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) }
4486 }
4487 impl From<PrefixExpr> for Expr {
4488     fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) }
4489 }
4490 impl From<RangeExpr> for Expr {
4491     fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) }
4492 }
4493 impl From<BinExpr> for Expr {
4494     fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) }
4495 }
4496 impl From<Literal> for Expr {
4497     fn from(node: Literal) -> Expr { Expr::Literal(node) }
4498 }
4499 impl From<MacroCall> for Expr {
4500     fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) }
4501 }
4502 impl From<BoxExpr> for Expr {
4503     fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) }
4504 }
4505 impl AstNode for Expr {
4506     fn can_cast(kind: SyntaxKind) -> bool {
4507         match kind {
4508             TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR
4509             | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
4510             | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR
4511             | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR
4512             | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => {
4513                 true
4514             }
4515             _ => false,
4516         }
4517     }
4518     fn cast(syntax: SyntaxNode) -> Option<Self> {
4519         let res = match syntax.kind() {
4520             TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
4521             ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
4522             PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
4523             PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
4524             LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }),
4525             IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
4526             LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
4527             FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
4528             WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
4529             CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
4530             BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
4531             LABEL => Expr::Label(Label { syntax }),
4532             BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
4533             RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
4534             MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
4535             RECORD_LIT => Expr::RecordLit(RecordLit { syntax }),
4536             CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
4537             INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
4538             METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
4539             FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
4540             AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
4541             TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
4542             EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
4543             CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
4544             REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
4545             PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
4546             RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
4547             BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
4548             LITERAL => Expr::Literal(Literal { syntax }),
4549             MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
4550             BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
4551             _ => return None,
4552         };
4553         Some(res)
4554     }
4555     fn syntax(&self) -> &SyntaxNode {
4556         match self {
4557             Expr::TupleExpr(it) => &it.syntax,
4558             Expr::ArrayExpr(it) => &it.syntax,
4559             Expr::ParenExpr(it) => &it.syntax,
4560             Expr::PathExpr(it) => &it.syntax,
4561             Expr::LambdaExpr(it) => &it.syntax,
4562             Expr::IfExpr(it) => &it.syntax,
4563             Expr::LoopExpr(it) => &it.syntax,
4564             Expr::ForExpr(it) => &it.syntax,
4565             Expr::WhileExpr(it) => &it.syntax,
4566             Expr::ContinueExpr(it) => &it.syntax,
4567             Expr::BreakExpr(it) => &it.syntax,
4568             Expr::Label(it) => &it.syntax,
4569             Expr::BlockExpr(it) => &it.syntax,
4570             Expr::ReturnExpr(it) => &it.syntax,
4571             Expr::MatchExpr(it) => &it.syntax,
4572             Expr::RecordLit(it) => &it.syntax,
4573             Expr::CallExpr(it) => &it.syntax,
4574             Expr::IndexExpr(it) => &it.syntax,
4575             Expr::MethodCallExpr(it) => &it.syntax,
4576             Expr::FieldExpr(it) => &it.syntax,
4577             Expr::AwaitExpr(it) => &it.syntax,
4578             Expr::TryExpr(it) => &it.syntax,
4579             Expr::EffectExpr(it) => &it.syntax,
4580             Expr::CastExpr(it) => &it.syntax,
4581             Expr::RefExpr(it) => &it.syntax,
4582             Expr::PrefixExpr(it) => &it.syntax,
4583             Expr::RangeExpr(it) => &it.syntax,
4584             Expr::BinExpr(it) => &it.syntax,
4585             Expr::Literal(it) => &it.syntax,
4586             Expr::MacroCall(it) => &it.syntax,
4587             Expr::BoxExpr(it) => &it.syntax,
4588         }
4589     }
4590 }
4591 impl From<OrPat> for Pat {
4592     fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
4593 }
4594 impl From<ParenPat> for Pat {
4595     fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
4596 }
4597 impl From<RefPat> for Pat {
4598     fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
4599 }
4600 impl From<BoxPat> for Pat {
4601     fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
4602 }
4603 impl From<BindPat> for Pat {
4604     fn from(node: BindPat) -> Pat { Pat::BindPat(node) }
4605 }
4606 impl From<PlaceholderPat> for Pat {
4607     fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) }
4608 }
4609 impl From<DotDotPat> for Pat {
4610     fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) }
4611 }
4612 impl From<PathPat> for Pat {
4613     fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
4614 }
4615 impl From<RecordPat> for Pat {
4616     fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
4617 }
4618 impl From<TupleStructPat> for Pat {
4619     fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
4620 }
4621 impl From<TuplePat> for Pat {
4622     fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
4623 }
4624 impl From<SlicePat> for Pat {
4625     fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
4626 }
4627 impl From<RangePat> for Pat {
4628     fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
4629 }
4630 impl From<LiteralPat> for Pat {
4631     fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
4632 }
4633 impl From<MacroPat> for Pat {
4634     fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
4635 }
4636 impl AstNode for Pat {
4637     fn can_cast(kind: SyntaxKind) -> bool {
4638         match kind {
4639             OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT
4640             | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT
4641             | LITERAL_PAT | MACRO_PAT => true,
4642             _ => false,
4643         }
4644     }
4645     fn cast(syntax: SyntaxNode) -> Option<Self> {
4646         let res = match syntax.kind() {
4647             OR_PAT => Pat::OrPat(OrPat { syntax }),
4648             PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
4649             REF_PAT => Pat::RefPat(RefPat { syntax }),
4650             BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
4651             BIND_PAT => Pat::BindPat(BindPat { syntax }),
4652             PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
4653             DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
4654             PATH_PAT => Pat::PathPat(PathPat { syntax }),
4655             RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
4656             TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
4657             TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
4658             SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
4659             RANGE_PAT => Pat::RangePat(RangePat { syntax }),
4660             LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
4661             MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
4662             _ => return None,
4663         };
4664         Some(res)
4665     }
4666     fn syntax(&self) -> &SyntaxNode {
4667         match self {
4668             Pat::OrPat(it) => &it.syntax,
4669             Pat::ParenPat(it) => &it.syntax,
4670             Pat::RefPat(it) => &it.syntax,
4671             Pat::BoxPat(it) => &it.syntax,
4672             Pat::BindPat(it) => &it.syntax,
4673             Pat::PlaceholderPat(it) => &it.syntax,
4674             Pat::DotDotPat(it) => &it.syntax,
4675             Pat::PathPat(it) => &it.syntax,
4676             Pat::RecordPat(it) => &it.syntax,
4677             Pat::TupleStructPat(it) => &it.syntax,
4678             Pat::TuplePat(it) => &it.syntax,
4679             Pat::SlicePat(it) => &it.syntax,
4680             Pat::RangePat(it) => &it.syntax,
4681             Pat::LiteralPat(it) => &it.syntax,
4682             Pat::MacroPat(it) => &it.syntax,
4683         }
4684     }
4685 }
4686 impl From<RecordFieldPat> for RecordInnerPat {
4687     fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) }
4688 }
4689 impl From<BindPat> for RecordInnerPat {
4690     fn from(node: BindPat) -> RecordInnerPat { RecordInnerPat::BindPat(node) }
4691 }
4692 impl AstNode for RecordInnerPat {
4693     fn can_cast(kind: SyntaxKind) -> bool {
4694         match kind {
4695             RECORD_FIELD_PAT | BIND_PAT => true,
4696             _ => false,
4697         }
4698     }
4699     fn cast(syntax: SyntaxNode) -> Option<Self> {
4700         let res = match syntax.kind() {
4701             RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }),
4702             BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }),
4703             _ => return None,
4704         };
4705         Some(res)
4706     }
4707     fn syntax(&self) -> &SyntaxNode {
4708         match self {
4709             RecordInnerPat::RecordFieldPat(it) => &it.syntax,
4710             RecordInnerPat::BindPat(it) => &it.syntax,
4711         }
4712     }
4713 }
4714 impl From<Literal> for AttrInput {
4715     fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) }
4716 }
4717 impl From<TokenTree> for AttrInput {
4718     fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) }
4719 }
4720 impl AstNode for AttrInput {
4721     fn can_cast(kind: SyntaxKind) -> bool {
4722         match kind {
4723             LITERAL | TOKEN_TREE => true,
4724             _ => false,
4725         }
4726     }
4727     fn cast(syntax: SyntaxNode) -> Option<Self> {
4728         let res = match syntax.kind() {
4729             LITERAL => AttrInput::Literal(Literal { syntax }),
4730             TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }),
4731             _ => return None,
4732         };
4733         Some(res)
4734     }
4735     fn syntax(&self) -> &SyntaxNode {
4736         match self {
4737             AttrInput::Literal(it) => &it.syntax,
4738             AttrInput::TokenTree(it) => &it.syntax,
4739         }
4740     }
4741 }
4742 impl From<LetStmt> for Stmt {
4743     fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
4744 }
4745 impl From<ExprStmt> for Stmt {
4746     fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
4747 }
4748 impl AstNode for Stmt {
4749     fn can_cast(kind: SyntaxKind) -> bool {
4750         match kind {
4751             LET_STMT | EXPR_STMT => true,
4752             _ => false,
4753         }
4754     }
4755     fn cast(syntax: SyntaxNode) -> Option<Self> {
4756         let res = match syntax.kind() {
4757             LET_STMT => Stmt::LetStmt(LetStmt { syntax }),
4758             EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }),
4759             _ => return None,
4760         };
4761         Some(res)
4762     }
4763     fn syntax(&self) -> &SyntaxNode {
4764         match self {
4765             Stmt::LetStmt(it) => &it.syntax,
4766             Stmt::ExprStmt(it) => &it.syntax,
4767         }
4768     }
4769 }
4770 impl From<RecordFieldDefList> for FieldDefList {
4771     fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) }
4772 }
4773 impl From<TupleFieldDefList> for FieldDefList {
4774     fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) }
4775 }
4776 impl AstNode for FieldDefList {
4777     fn can_cast(kind: SyntaxKind) -> bool {
4778         match kind {
4779             RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true,
4780             _ => false,
4781         }
4782     }
4783     fn cast(syntax: SyntaxNode) -> Option<Self> {
4784         let res = match syntax.kind() {
4785             RECORD_FIELD_DEF_LIST => {
4786                 FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax })
4787             }
4788             TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
4789             _ => return None,
4790         };
4791         Some(res)
4792     }
4793     fn syntax(&self) -> &SyntaxNode {
4794         match self {
4795             FieldDefList::RecordFieldDefList(it) => &it.syntax,
4796             FieldDefList::TupleFieldDefList(it) => &it.syntax,
4797         }
4798     }
4799 }
4800 impl std::fmt::Display for NominalDef {
4801     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4802         std::fmt::Display::fmt(self.syntax(), f)
4803     }
4804 }
4805 impl std::fmt::Display for GenericParam {
4806     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4807         std::fmt::Display::fmt(self.syntax(), f)
4808     }
4809 }
4810 impl std::fmt::Display for GenericArg {
4811     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4812         std::fmt::Display::fmt(self.syntax(), f)
4813     }
4814 }
4815 impl std::fmt::Display for TypeRef {
4816     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4817         std::fmt::Display::fmt(self.syntax(), f)
4818     }
4819 }
4820 impl std::fmt::Display for ModuleItem {
4821     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4822         std::fmt::Display::fmt(self.syntax(), f)
4823     }
4824 }
4825 impl std::fmt::Display for AssocItem {
4826     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4827         std::fmt::Display::fmt(self.syntax(), f)
4828     }
4829 }
4830 impl std::fmt::Display for ExternItem {
4831     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4832         std::fmt::Display::fmt(self.syntax(), f)
4833     }
4834 }
4835 impl std::fmt::Display for Expr {
4836     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4837         std::fmt::Display::fmt(self.syntax(), f)
4838     }
4839 }
4840 impl std::fmt::Display for Pat {
4841     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4842         std::fmt::Display::fmt(self.syntax(), f)
4843     }
4844 }
4845 impl std::fmt::Display for RecordInnerPat {
4846     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4847         std::fmt::Display::fmt(self.syntax(), f)
4848     }
4849 }
4850 impl std::fmt::Display for AttrInput {
4851     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4852         std::fmt::Display::fmt(self.syntax(), f)
4853     }
4854 }
4855 impl std::fmt::Display for Stmt {
4856     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4857         std::fmt::Display::fmt(self.syntax(), f)
4858     }
4859 }
4860 impl std::fmt::Display for FieldDefList {
4861     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4862         std::fmt::Display::fmt(self.syntax(), f)
4863     }
4864 }
4865 impl std::fmt::Display for SourceFile {
4866     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4867         std::fmt::Display::fmt(self.syntax(), f)
4868     }
4869 }
4870 impl std::fmt::Display for FnDef {
4871     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4872         std::fmt::Display::fmt(self.syntax(), f)
4873     }
4874 }
4875 impl std::fmt::Display for RetType {
4876     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4877         std::fmt::Display::fmt(self.syntax(), f)
4878     }
4879 }
4880 impl std::fmt::Display for StructDef {
4881     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4882         std::fmt::Display::fmt(self.syntax(), f)
4883     }
4884 }
4885 impl std::fmt::Display for UnionDef {
4886     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4887         std::fmt::Display::fmt(self.syntax(), f)
4888     }
4889 }
4890 impl std::fmt::Display for RecordFieldDefList {
4891     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4892         std::fmt::Display::fmt(self.syntax(), f)
4893     }
4894 }
4895 impl std::fmt::Display for RecordFieldDef {
4896     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4897         std::fmt::Display::fmt(self.syntax(), f)
4898     }
4899 }
4900 impl std::fmt::Display for TupleFieldDefList {
4901     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4902         std::fmt::Display::fmt(self.syntax(), f)
4903     }
4904 }
4905 impl std::fmt::Display for TupleFieldDef {
4906     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4907         std::fmt::Display::fmt(self.syntax(), f)
4908     }
4909 }
4910 impl std::fmt::Display for EnumDef {
4911     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4912         std::fmt::Display::fmt(self.syntax(), f)
4913     }
4914 }
4915 impl std::fmt::Display for EnumVariantList {
4916     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4917         std::fmt::Display::fmt(self.syntax(), f)
4918     }
4919 }
4920 impl std::fmt::Display for EnumVariant {
4921     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4922         std::fmt::Display::fmt(self.syntax(), f)
4923     }
4924 }
4925 impl std::fmt::Display for TraitDef {
4926     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4927         std::fmt::Display::fmt(self.syntax(), f)
4928     }
4929 }
4930 impl std::fmt::Display for Module {
4931     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4932         std::fmt::Display::fmt(self.syntax(), f)
4933     }
4934 }
4935 impl std::fmt::Display for ItemList {
4936     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4937         std::fmt::Display::fmt(self.syntax(), f)
4938     }
4939 }
4940 impl std::fmt::Display for ConstDef {
4941     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4942         std::fmt::Display::fmt(self.syntax(), f)
4943     }
4944 }
4945 impl std::fmt::Display for StaticDef {
4946     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4947         std::fmt::Display::fmt(self.syntax(), f)
4948     }
4949 }
4950 impl std::fmt::Display for TypeAliasDef {
4951     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4952         std::fmt::Display::fmt(self.syntax(), f)
4953     }
4954 }
4955 impl std::fmt::Display for ImplDef {
4956     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4957         std::fmt::Display::fmt(self.syntax(), f)
4958     }
4959 }
4960 impl std::fmt::Display for ParenType {
4961     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4962         std::fmt::Display::fmt(self.syntax(), f)
4963     }
4964 }
4965 impl std::fmt::Display for TupleType {
4966     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4967         std::fmt::Display::fmt(self.syntax(), f)
4968     }
4969 }
4970 impl std::fmt::Display for NeverType {
4971     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4972         std::fmt::Display::fmt(self.syntax(), f)
4973     }
4974 }
4975 impl std::fmt::Display for PathType {
4976     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4977         std::fmt::Display::fmt(self.syntax(), f)
4978     }
4979 }
4980 impl std::fmt::Display for PointerType {
4981     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4982         std::fmt::Display::fmt(self.syntax(), f)
4983     }
4984 }
4985 impl std::fmt::Display for ArrayType {
4986     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4987         std::fmt::Display::fmt(self.syntax(), f)
4988     }
4989 }
4990 impl std::fmt::Display for SliceType {
4991     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4992         std::fmt::Display::fmt(self.syntax(), f)
4993     }
4994 }
4995 impl std::fmt::Display for ReferenceType {
4996     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4997         std::fmt::Display::fmt(self.syntax(), f)
4998     }
4999 }
5000 impl std::fmt::Display for PlaceholderType {
5001     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5002         std::fmt::Display::fmt(self.syntax(), f)
5003     }
5004 }
5005 impl std::fmt::Display for FnPointerType {
5006     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5007         std::fmt::Display::fmt(self.syntax(), f)
5008     }
5009 }
5010 impl std::fmt::Display for ForType {
5011     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5012         std::fmt::Display::fmt(self.syntax(), f)
5013     }
5014 }
5015 impl std::fmt::Display for ImplTraitType {
5016     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5017         std::fmt::Display::fmt(self.syntax(), f)
5018     }
5019 }
5020 impl std::fmt::Display for DynTraitType {
5021     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5022         std::fmt::Display::fmt(self.syntax(), f)
5023     }
5024 }
5025 impl std::fmt::Display for TupleExpr {
5026     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5027         std::fmt::Display::fmt(self.syntax(), f)
5028     }
5029 }
5030 impl std::fmt::Display for ArrayExpr {
5031     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5032         std::fmt::Display::fmt(self.syntax(), f)
5033     }
5034 }
5035 impl std::fmt::Display for ParenExpr {
5036     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5037         std::fmt::Display::fmt(self.syntax(), f)
5038     }
5039 }
5040 impl std::fmt::Display for PathExpr {
5041     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5042         std::fmt::Display::fmt(self.syntax(), f)
5043     }
5044 }
5045 impl std::fmt::Display for LambdaExpr {
5046     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5047         std::fmt::Display::fmt(self.syntax(), f)
5048     }
5049 }
5050 impl std::fmt::Display for IfExpr {
5051     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5052         std::fmt::Display::fmt(self.syntax(), f)
5053     }
5054 }
5055 impl std::fmt::Display for LoopExpr {
5056     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5057         std::fmt::Display::fmt(self.syntax(), f)
5058     }
5059 }
5060 impl std::fmt::Display for EffectExpr {
5061     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5062         std::fmt::Display::fmt(self.syntax(), f)
5063     }
5064 }
5065 impl std::fmt::Display for ForExpr {
5066     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5067         std::fmt::Display::fmt(self.syntax(), f)
5068     }
5069 }
5070 impl std::fmt::Display for WhileExpr {
5071     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5072         std::fmt::Display::fmt(self.syntax(), f)
5073     }
5074 }
5075 impl std::fmt::Display for ContinueExpr {
5076     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5077         std::fmt::Display::fmt(self.syntax(), f)
5078     }
5079 }
5080 impl std::fmt::Display for BreakExpr {
5081     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5082         std::fmt::Display::fmt(self.syntax(), f)
5083     }
5084 }
5085 impl std::fmt::Display for Label {
5086     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5087         std::fmt::Display::fmt(self.syntax(), f)
5088     }
5089 }
5090 impl std::fmt::Display for BlockExpr {
5091     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5092         std::fmt::Display::fmt(self.syntax(), f)
5093     }
5094 }
5095 impl std::fmt::Display for ReturnExpr {
5096     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5097         std::fmt::Display::fmt(self.syntax(), f)
5098     }
5099 }
5100 impl std::fmt::Display for CallExpr {
5101     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5102         std::fmt::Display::fmt(self.syntax(), f)
5103     }
5104 }
5105 impl std::fmt::Display for MethodCallExpr {
5106     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5107         std::fmt::Display::fmt(self.syntax(), f)
5108     }
5109 }
5110 impl std::fmt::Display for IndexExpr {
5111     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5112         std::fmt::Display::fmt(self.syntax(), f)
5113     }
5114 }
5115 impl std::fmt::Display for FieldExpr {
5116     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5117         std::fmt::Display::fmt(self.syntax(), f)
5118     }
5119 }
5120 impl std::fmt::Display for AwaitExpr {
5121     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5122         std::fmt::Display::fmt(self.syntax(), f)
5123     }
5124 }
5125 impl std::fmt::Display for TryExpr {
5126     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5127         std::fmt::Display::fmt(self.syntax(), f)
5128     }
5129 }
5130 impl std::fmt::Display for CastExpr {
5131     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5132         std::fmt::Display::fmt(self.syntax(), f)
5133     }
5134 }
5135 impl std::fmt::Display for RefExpr {
5136     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5137         std::fmt::Display::fmt(self.syntax(), f)
5138     }
5139 }
5140 impl std::fmt::Display for PrefixExpr {
5141     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5142         std::fmt::Display::fmt(self.syntax(), f)
5143     }
5144 }
5145 impl std::fmt::Display for BoxExpr {
5146     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5147         std::fmt::Display::fmt(self.syntax(), f)
5148     }
5149 }
5150 impl std::fmt::Display for RangeExpr {
5151     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5152         std::fmt::Display::fmt(self.syntax(), f)
5153     }
5154 }
5155 impl std::fmt::Display for BinExpr {
5156     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5157         std::fmt::Display::fmt(self.syntax(), f)
5158     }
5159 }
5160 impl std::fmt::Display for Literal {
5161     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5162         std::fmt::Display::fmt(self.syntax(), f)
5163     }
5164 }
5165 impl std::fmt::Display for MatchExpr {
5166     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5167         std::fmt::Display::fmt(self.syntax(), f)
5168     }
5169 }
5170 impl std::fmt::Display for MatchArmList {
5171     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5172         std::fmt::Display::fmt(self.syntax(), f)
5173     }
5174 }
5175 impl std::fmt::Display for MatchArm {
5176     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5177         std::fmt::Display::fmt(self.syntax(), f)
5178     }
5179 }
5180 impl std::fmt::Display for MatchGuard {
5181     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5182         std::fmt::Display::fmt(self.syntax(), f)
5183     }
5184 }
5185 impl std::fmt::Display for RecordLit {
5186     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5187         std::fmt::Display::fmt(self.syntax(), f)
5188     }
5189 }
5190 impl std::fmt::Display for RecordFieldList {
5191     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5192         std::fmt::Display::fmt(self.syntax(), f)
5193     }
5194 }
5195 impl std::fmt::Display for RecordField {
5196     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5197         std::fmt::Display::fmt(self.syntax(), f)
5198     }
5199 }
5200 impl std::fmt::Display for OrPat {
5201     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5202         std::fmt::Display::fmt(self.syntax(), f)
5203     }
5204 }
5205 impl std::fmt::Display for ParenPat {
5206     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5207         std::fmt::Display::fmt(self.syntax(), f)
5208     }
5209 }
5210 impl std::fmt::Display for RefPat {
5211     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5212         std::fmt::Display::fmt(self.syntax(), f)
5213     }
5214 }
5215 impl std::fmt::Display for BoxPat {
5216     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5217         std::fmt::Display::fmt(self.syntax(), f)
5218     }
5219 }
5220 impl std::fmt::Display for BindPat {
5221     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5222         std::fmt::Display::fmt(self.syntax(), f)
5223     }
5224 }
5225 impl std::fmt::Display for PlaceholderPat {
5226     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5227         std::fmt::Display::fmt(self.syntax(), f)
5228     }
5229 }
5230 impl std::fmt::Display for DotDotPat {
5231     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5232         std::fmt::Display::fmt(self.syntax(), f)
5233     }
5234 }
5235 impl std::fmt::Display for PathPat {
5236     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5237         std::fmt::Display::fmt(self.syntax(), f)
5238     }
5239 }
5240 impl std::fmt::Display for SlicePat {
5241     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5242         std::fmt::Display::fmt(self.syntax(), f)
5243     }
5244 }
5245 impl std::fmt::Display for RangePat {
5246     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5247         std::fmt::Display::fmt(self.syntax(), f)
5248     }
5249 }
5250 impl std::fmt::Display for LiteralPat {
5251     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5252         std::fmt::Display::fmt(self.syntax(), f)
5253     }
5254 }
5255 impl std::fmt::Display for MacroPat {
5256     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5257         std::fmt::Display::fmt(self.syntax(), f)
5258     }
5259 }
5260 impl std::fmt::Display for RecordPat {
5261     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5262         std::fmt::Display::fmt(self.syntax(), f)
5263     }
5264 }
5265 impl std::fmt::Display for RecordFieldPatList {
5266     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5267         std::fmt::Display::fmt(self.syntax(), f)
5268     }
5269 }
5270 impl std::fmt::Display for RecordFieldPat {
5271     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5272         std::fmt::Display::fmt(self.syntax(), f)
5273     }
5274 }
5275 impl std::fmt::Display for TupleStructPat {
5276     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5277         std::fmt::Display::fmt(self.syntax(), f)
5278     }
5279 }
5280 impl std::fmt::Display for TuplePat {
5281     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5282         std::fmt::Display::fmt(self.syntax(), f)
5283     }
5284 }
5285 impl std::fmt::Display for Visibility {
5286     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5287         std::fmt::Display::fmt(self.syntax(), f)
5288     }
5289 }
5290 impl std::fmt::Display for Name {
5291     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5292         std::fmt::Display::fmt(self.syntax(), f)
5293     }
5294 }
5295 impl std::fmt::Display for NameRef {
5296     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5297         std::fmt::Display::fmt(self.syntax(), f)
5298     }
5299 }
5300 impl std::fmt::Display for MacroCall {
5301     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5302         std::fmt::Display::fmt(self.syntax(), f)
5303     }
5304 }
5305 impl std::fmt::Display for Attr {
5306     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5307         std::fmt::Display::fmt(self.syntax(), f)
5308     }
5309 }
5310 impl std::fmt::Display for TokenTree {
5311     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5312         std::fmt::Display::fmt(self.syntax(), f)
5313     }
5314 }
5315 impl std::fmt::Display for TypeParamList {
5316     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5317         std::fmt::Display::fmt(self.syntax(), f)
5318     }
5319 }
5320 impl std::fmt::Display for TypeParam {
5321     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5322         std::fmt::Display::fmt(self.syntax(), f)
5323     }
5324 }
5325 impl std::fmt::Display for ConstParam {
5326     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5327         std::fmt::Display::fmt(self.syntax(), f)
5328     }
5329 }
5330 impl std::fmt::Display for LifetimeParam {
5331     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5332         std::fmt::Display::fmt(self.syntax(), f)
5333     }
5334 }
5335 impl std::fmt::Display for TypeBound {
5336     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5337         std::fmt::Display::fmt(self.syntax(), f)
5338     }
5339 }
5340 impl std::fmt::Display for TypeBoundList {
5341     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5342         std::fmt::Display::fmt(self.syntax(), f)
5343     }
5344 }
5345 impl std::fmt::Display for WherePred {
5346     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5347         std::fmt::Display::fmt(self.syntax(), f)
5348     }
5349 }
5350 impl std::fmt::Display for WhereClause {
5351     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5352         std::fmt::Display::fmt(self.syntax(), f)
5353     }
5354 }
5355 impl std::fmt::Display for Abi {
5356     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5357         std::fmt::Display::fmt(self.syntax(), f)
5358     }
5359 }
5360 impl std::fmt::Display for ExprStmt {
5361     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5362         std::fmt::Display::fmt(self.syntax(), f)
5363     }
5364 }
5365 impl std::fmt::Display for LetStmt {
5366     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5367         std::fmt::Display::fmt(self.syntax(), f)
5368     }
5369 }
5370 impl std::fmt::Display for Condition {
5371     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5372         std::fmt::Display::fmt(self.syntax(), f)
5373     }
5374 }
5375 impl std::fmt::Display for ParamList {
5376     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5377         std::fmt::Display::fmt(self.syntax(), f)
5378     }
5379 }
5380 impl std::fmt::Display for SelfParam {
5381     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5382         std::fmt::Display::fmt(self.syntax(), f)
5383     }
5384 }
5385 impl std::fmt::Display for Param {
5386     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5387         std::fmt::Display::fmt(self.syntax(), f)
5388     }
5389 }
5390 impl std::fmt::Display for UseItem {
5391     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5392         std::fmt::Display::fmt(self.syntax(), f)
5393     }
5394 }
5395 impl std::fmt::Display for UseTree {
5396     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5397         std::fmt::Display::fmt(self.syntax(), f)
5398     }
5399 }
5400 impl std::fmt::Display for Alias {
5401     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5402         std::fmt::Display::fmt(self.syntax(), f)
5403     }
5404 }
5405 impl std::fmt::Display for UseTreeList {
5406     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5407         std::fmt::Display::fmt(self.syntax(), f)
5408     }
5409 }
5410 impl std::fmt::Display for ExternCrateItem {
5411     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5412         std::fmt::Display::fmt(self.syntax(), f)
5413     }
5414 }
5415 impl std::fmt::Display for ArgList {
5416     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5417         std::fmt::Display::fmt(self.syntax(), f)
5418     }
5419 }
5420 impl std::fmt::Display for Path {
5421     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5422         std::fmt::Display::fmt(self.syntax(), f)
5423     }
5424 }
5425 impl std::fmt::Display for PathSegment {
5426     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5427         std::fmt::Display::fmt(self.syntax(), f)
5428     }
5429 }
5430 impl std::fmt::Display for TypeArgList {
5431     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5432         std::fmt::Display::fmt(self.syntax(), f)
5433     }
5434 }
5435 impl std::fmt::Display for TypeArg {
5436     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5437         std::fmt::Display::fmt(self.syntax(), f)
5438     }
5439 }
5440 impl std::fmt::Display for AssocTypeArg {
5441     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5442         std::fmt::Display::fmt(self.syntax(), f)
5443     }
5444 }
5445 impl std::fmt::Display for LifetimeArg {
5446     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5447         std::fmt::Display::fmt(self.syntax(), f)
5448     }
5449 }
5450 impl std::fmt::Display for ConstArg {
5451     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5452         std::fmt::Display::fmt(self.syntax(), f)
5453     }
5454 }
5455 impl std::fmt::Display for MacroItems {
5456     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5457         std::fmt::Display::fmt(self.syntax(), f)
5458     }
5459 }
5460 impl std::fmt::Display for ExternItemList {
5461     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5462         std::fmt::Display::fmt(self.syntax(), f)
5463     }
5464 }
5465 impl std::fmt::Display for ExternBlock {
5466     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5467         std::fmt::Display::fmt(self.syntax(), f)
5468     }
5469 }
5470 impl std::fmt::Display for MetaItem {
5471     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5472         std::fmt::Display::fmt(self.syntax(), f)
5473     }
5474 }
5475 impl std::fmt::Display for MacroDef {
5476     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5477         std::fmt::Display::fmt(self.syntax(), f)
5478     }
5479 }