aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated
diff options
context:
space:
mode:
authorDmitry <[email protected]>2020-08-09 14:35:51 +0100
committerDmitry <[email protected]>2020-08-09 14:39:32 +0100
commit8068302fefc75440b823f4bf1731a5f347d7c767 (patch)
tree251b967182e79bc82a58c2fb208c688f6152df1f /crates/ra_syntax/src/ast/generated
parent1a43a0f63e0008787225abb6fb2baef97b6a39e0 (diff)
parent8a57afe5a4bfab40072a83f7dc4ca560bf860919 (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs4754
1 files changed, 1642 insertions, 3112 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 58141da11..3d49309d1 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -5,1189 +5,649 @@ use crate::{
5 SyntaxKind::{self, *}, 5 SyntaxKind::{self, *},
6 SyntaxNode, SyntaxToken, T, 6 SyntaxNode, SyntaxToken, T,
7}; 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)] 8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
12pub struct SourceFile { 9pub struct Name {
13 pub(crate) syntax: SyntaxNode, 10 pub(crate) syntax: SyntaxNode,
14} 11}
15impl ast::ModuleItemOwner for SourceFile {} 12impl Name {
16impl ast::AttrsOwner for SourceFile {} 13 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
17impl ast::DocCommentsOwner for SourceFile {} 14}
18impl SourceFile { 15#[derive(Debug, Clone, PartialEq, Eq, Hash)]
19 pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } 16pub struct NameRef {
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)]
44pub struct FnDef {
45 pub(crate) syntax: SyntaxNode, 17 pub(crate) syntax: SyntaxNode,
46} 18}
47impl ast::VisibilityOwner for FnDef {} 19impl NameRef {
48impl ast::NameOwner for FnDef {} 20 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
49impl ast::TypeParamsOwner for FnDef {} 21}
50impl ast::DocCommentsOwner for FnDef {} 22#[derive(Debug, Clone, PartialEq, Eq, Hash)]
51impl ast::AttrsOwner for FnDef {} 23pub struct Path {
52impl FnDef { 24 pub(crate) syntax: SyntaxNode,
53 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 25}
54 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 26impl Path {
55 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 27 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
56 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 28 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
57 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 29 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) }
58 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } 30}
31#[derive(Debug, Clone, PartialEq, Eq, Hash)]
32pub struct PathSegment {
33 pub(crate) syntax: SyntaxNode,
34}
35impl PathSegment {
36 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
37 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
38 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
39 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
40 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
41 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
59 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 42 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
60 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 43 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
61 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 44 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
62 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 45 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
46 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
47 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
48}
49#[derive(Debug, Clone, PartialEq, Eq, Hash)]
50pub struct GenericArgList {
51 pub(crate) syntax: SyntaxNode,
52}
53impl GenericArgList {
54 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
55 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
56 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
57 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
58}
59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
60pub struct ParamList {
61 pub(crate) syntax: SyntaxNode,
62}
63impl ParamList {
64 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
65 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) }
66 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
67 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
68 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
63} 69}
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)] 70#[derive(Debug, Clone, PartialEq, Eq, Hash)]
72pub struct RetType { 71pub struct RetType {
73 pub(crate) syntax: SyntaxNode, 72 pub(crate) syntax: SyntaxNode,
74} 73}
75impl RetType { 74impl RetType {
76 pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } 75 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) } 76 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
78} 77}
79/// Struct definition. 78#[derive(Debug, Clone, PartialEq, Eq, Hash)]
80/// Includes all of its attributes and doc comments. 79pub struct PathType {
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)]
100pub struct StructDef {
101 pub(crate) syntax: SyntaxNode, 80 pub(crate) syntax: SyntaxNode,
102} 81}
103impl ast::VisibilityOwner for StructDef {} 82impl PathType {
104impl ast::NameOwner for StructDef {} 83 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
105impl ast::TypeParamsOwner for StructDef {}
106impl ast::AttrsOwner for StructDef {}
107impl ast::DocCommentsOwner for StructDef {}
108impl 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} 84}
113/// Union definition. 85#[derive(Debug, Clone, PartialEq, Eq, Hash)]
114/// Includes all of its attributes and doc comments. 86pub struct TypeArg {
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)]
131pub struct UnionDef {
132 pub(crate) syntax: SyntaxNode, 87 pub(crate) syntax: SyntaxNode,
133} 88}
134impl ast::VisibilityOwner for UnionDef {} 89impl TypeArg {
135impl ast::NameOwner for UnionDef {} 90 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
136impl ast::TypeParamsOwner for UnionDef {}
137impl ast::AttrsOwner for UnionDef {}
138impl ast::DocCommentsOwner for UnionDef {}
139impl 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} 91}
145/// Record field definition list including enclosing curly braces. 92#[derive(Debug, Clone, PartialEq, Eq, Hash)]
146/// 93pub struct AssocTypeArg {
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)]
159pub struct RecordFieldDefList {
160 pub(crate) syntax: SyntaxNode, 94 pub(crate) syntax: SyntaxNode,
161} 95}
162impl RecordFieldDefList { 96impl ast::TypeBoundsOwner for AssocTypeArg {}
163 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 97impl AssocTypeArg {
164 pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } 98 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
165 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 99 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
100 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
166} 101}
167/// Record field definition including its attributes and doc comments. 102#[derive(Debug, Clone, PartialEq, Eq, Hash)]
168/// 103pub struct LifetimeArg {
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)]
184pub struct RecordFieldDef {
185 pub(crate) syntax: SyntaxNode, 104 pub(crate) syntax: SyntaxNode,
186} 105}
187impl ast::VisibilityOwner for RecordFieldDef {} 106impl LifetimeArg {
188impl ast::NameOwner for RecordFieldDef {} 107 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
189impl ast::AttrsOwner for RecordFieldDef {} 108 support::token(&self.syntax, T![lifetime])
190impl ast::DocCommentsOwner for RecordFieldDef {} 109 }
191impl ast::TypeAscriptionOwner for RecordFieldDef {} 110}
192impl RecordFieldDef {} 111#[derive(Debug, Clone, PartialEq, Eq, Hash)]
193/// Tuple field definition list including enclosing parens. 112pub struct ConstArg {
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)]
201pub struct TupleFieldDefList {
202 pub(crate) syntax: SyntaxNode, 113 pub(crate) syntax: SyntaxNode,
203} 114}
204impl TupleFieldDefList { 115impl ConstArg {
205 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 116 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
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} 117}
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)] 118#[derive(Debug, Clone, PartialEq, Eq, Hash)]
217pub struct TupleFieldDef { 119pub struct TypeBoundList {
218 pub(crate) syntax: SyntaxNode, 120 pub(crate) syntax: SyntaxNode,
219} 121}
220impl ast::VisibilityOwner for TupleFieldDef {} 122impl TypeBoundList {
221impl ast::AttrsOwner for TupleFieldDef {} 123 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
222impl 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)]
249pub struct EnumDef {
250 pub(crate) syntax: SyntaxNode,
251} 124}
252impl ast::VisibilityOwner for EnumDef {} 125#[derive(Debug, Clone, PartialEq, Eq, Hash)]
253impl ast::NameOwner for EnumDef {} 126pub struct MacroCall {
254impl ast::TypeParamsOwner for EnumDef {}
255impl ast::AttrsOwner for EnumDef {}
256impl ast::DocCommentsOwner for EnumDef {}
257impl 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)]
278pub struct EnumVariantList {
279 pub(crate) syntax: SyntaxNode, 127 pub(crate) syntax: SyntaxNode,
280} 128}
281impl EnumVariantList { 129impl ast::AttrsOwner for MacroCall {}
282 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 130impl ast::NameOwner for MacroCall {}
283 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } 131impl MacroCall {
284 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 132 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
133 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
134 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
135 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
285} 136}
286/// Enum variant definition including its attributes and discriminant value definition. 137#[derive(Debug, Clone, PartialEq, Eq, Hash)]
287/// 138pub struct Attr {
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)]
302pub struct EnumVariant {
303 pub(crate) syntax: SyntaxNode, 139 pub(crate) syntax: SyntaxNode,
304} 140}
305impl ast::VisibilityOwner for EnumVariant {} 141impl Attr {
306impl ast::NameOwner for EnumVariant {} 142 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
307impl ast::DocCommentsOwner for EnumVariant {} 143 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
308impl ast::AttrsOwner for EnumVariant {} 144 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
309impl EnumVariant { 145 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
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![=]) } 146 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
312 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 147 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
148 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
149 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
313} 150}
314/// Trait definition. 151#[derive(Debug, Clone, PartialEq, Eq, Hash)]
315/// Includes all of its attributes and doc comments. 152pub struct TokenTree {
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)]
329pub struct TraitDef {
330 pub(crate) syntax: SyntaxNode, 153 pub(crate) syntax: SyntaxNode,
331} 154}
332impl ast::VisibilityOwner for TraitDef {} 155impl TokenTree {
333impl ast::NameOwner for TraitDef {} 156 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
334impl ast::AttrsOwner for TraitDef {} 157 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
335impl ast::DocCommentsOwner for TraitDef {} 158 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
336impl ast::TypeParamsOwner for TraitDef {} 159 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
337impl ast::TypeBoundsOwner for TraitDef {} 160 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
338impl TraitDef { 161 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
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} 162}
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)] 163#[derive(Debug, Clone, PartialEq, Eq, Hash)]
366pub struct Module { 164pub struct MacroItems {
367 pub(crate) syntax: SyntaxNode, 165 pub(crate) syntax: SyntaxNode,
368} 166}
369impl ast::VisibilityOwner for Module {} 167impl ast::ModuleItemOwner for MacroItems {}
370impl ast::NameOwner for Module {} 168impl MacroItems {}
371impl ast::AttrsOwner for Module {} 169#[derive(Debug, Clone, PartialEq, Eq, Hash)]
372impl ast::DocCommentsOwner for Module {} 170pub struct MacroStmts {
373impl Module { 171 pub(crate) syntax: SyntaxNode,
374 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } 172}
375 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 173impl MacroStmts {
376 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 174 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
175 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
377} 176}
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)] 177#[derive(Debug, Clone, PartialEq, Eq, Hash)]
401pub struct ItemList { 178pub struct SourceFile {
402 pub(crate) syntax: SyntaxNode, 179 pub(crate) syntax: SyntaxNode,
403} 180}
404impl ast::ModuleItemOwner for ItemList {} 181impl ast::AttrsOwner for SourceFile {}
405impl ItemList { 182impl ast::ModuleItemOwner for SourceFile {}
406 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 183impl SourceFile {
407 pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } 184 pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) }
408 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
409} 185}
410/// Constant variable definition. 186#[derive(Debug, Clone, PartialEq, Eq, Hash)]
411/// Includes all of its attributes and doc comments. 187pub struct Const {
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)]
423pub struct ConstDef {
424 pub(crate) syntax: SyntaxNode, 188 pub(crate) syntax: SyntaxNode,
425} 189}
426impl ast::VisibilityOwner for ConstDef {} 190impl ast::AttrsOwner for Const {}
427impl ast::NameOwner for ConstDef {} 191impl ast::NameOwner for Const {}
428impl ast::TypeParamsOwner for ConstDef {} 192impl ast::VisibilityOwner for Const {}
429impl ast::AttrsOwner for ConstDef {} 193impl Const {
430impl ast::DocCommentsOwner for ConstDef {}
431impl ast::TypeAscriptionOwner for ConstDef {}
432impl ConstDef {
433 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 194 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]) } 195 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
196 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
197 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
198 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
435 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 199 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
436 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 200 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
437 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 201 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
438} 202}
439/// Static variable definition. 203#[derive(Debug, Clone, PartialEq, Eq, Hash)]
440/// Includes all of its attributes and doc comments. 204pub struct Enum {
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)]
452pub struct StaticDef {
453 pub(crate) syntax: SyntaxNode, 205 pub(crate) syntax: SyntaxNode,
454} 206}
455impl ast::VisibilityOwner for StaticDef {} 207impl ast::AttrsOwner for Enum {}
456impl ast::NameOwner for StaticDef {} 208impl ast::NameOwner for Enum {}
457impl ast::TypeParamsOwner for StaticDef {} 209impl ast::VisibilityOwner for Enum {}
458impl ast::AttrsOwner for StaticDef {} 210impl ast::GenericParamsOwner for Enum {}
459impl ast::DocCommentsOwner for StaticDef {} 211impl Enum {
460impl ast::TypeAscriptionOwner for StaticDef {} 212 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
461impl StaticDef { 213 pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) }
462 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 214}
463 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 215#[derive(Debug, Clone, PartialEq, Eq, Hash)]
464 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 216pub struct ExternBlock {
465 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } 217 pub(crate) syntax: SyntaxNode,
218}
219impl ast::AttrsOwner for ExternBlock {}
220impl ExternBlock {
221 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
222 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) }
223}
224#[derive(Debug, Clone, PartialEq, Eq, Hash)]
225pub struct ExternCrate {
226 pub(crate) syntax: SyntaxNode,
227}
228impl ast::AttrsOwner for ExternCrate {}
229impl ast::VisibilityOwner for ExternCrate {}
230impl ExternCrate {
231 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
232 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
233 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
234 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
235 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
466 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 236 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
467} 237}
468/// Type alias definition. 238#[derive(Debug, Clone, PartialEq, Eq, Hash)]
469/// Includes associated type clauses with type bounds. 239pub struct Fn {
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)]
487pub struct TypeAliasDef {
488 pub(crate) syntax: SyntaxNode, 240 pub(crate) syntax: SyntaxNode,
489} 241}
490impl ast::VisibilityOwner for TypeAliasDef {} 242impl ast::AttrsOwner for Fn {}
491impl ast::NameOwner for TypeAliasDef {} 243impl ast::NameOwner for Fn {}
492impl ast::TypeParamsOwner for TypeAliasDef {} 244impl ast::VisibilityOwner for Fn {}
493impl ast::AttrsOwner for TypeAliasDef {} 245impl ast::GenericParamsOwner for Fn {}
494impl ast::DocCommentsOwner for TypeAliasDef {} 246impl Fn {
495impl ast::TypeBoundsOwner for TypeAliasDef {}
496impl TypeAliasDef {
497 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 247 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]) } 248 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
499 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 249 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
500 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 250 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
251 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
252 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
253 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
254 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
255 pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
501 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 256 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
502} 257}
503/// Inherent and trait impl definition. 258#[derive(Debug, Clone, PartialEq, Eq, Hash)]
504/// Includes all of its inner and outer attributes. 259pub struct Impl {
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)]
518pub struct ImplDef {
519 pub(crate) syntax: SyntaxNode, 260 pub(crate) syntax: SyntaxNode,
520} 261}
521impl ast::TypeParamsOwner for ImplDef {} 262impl ast::AttrsOwner for Impl {}
522impl ast::AttrsOwner for ImplDef {} 263impl ast::VisibilityOwner for Impl {}
523impl ast::DocCommentsOwner for ImplDef {} 264impl ast::GenericParamsOwner for Impl {}
524impl ImplDef { 265impl Impl {
525 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 266 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]) } 267 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]) } 268 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
269 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
529 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 270 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
530 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 271 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
272 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
273}
274#[derive(Debug, Clone, PartialEq, Eq, Hash)]
275pub struct Module {
276 pub(crate) syntax: SyntaxNode,
277}
278impl ast::AttrsOwner for Module {}
279impl ast::NameOwner for Module {}
280impl ast::VisibilityOwner for Module {}
281impl Module {
282 pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) }
531 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } 283 pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
284 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
532} 285}
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)] 286#[derive(Debug, Clone, PartialEq, Eq, Hash)]
544pub struct ParenType { 287pub struct Static {
545 pub(crate) syntax: SyntaxNode, 288 pub(crate) syntax: SyntaxNode,
546} 289}
547impl ParenType { 290impl ast::AttrsOwner for Static {}
548 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 291impl ast::NameOwner for Static {}
549 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 292impl ast::VisibilityOwner for Static {}
550 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 293impl Static {
294 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
295 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
296 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
297 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
298 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
299 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
300 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
551} 301}
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)] 302#[derive(Debug, Clone, PartialEq, Eq, Hash)]
560pub struct TupleType { 303pub struct Struct {
561 pub(crate) syntax: SyntaxNode, 304 pub(crate) syntax: SyntaxNode,
562} 305}
563impl TupleType { 306impl ast::AttrsOwner for Struct {}
564 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 307impl ast::NameOwner for Struct {}
565 pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } 308impl ast::VisibilityOwner for Struct {}
566 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 309impl ast::GenericParamsOwner for Struct {}
310impl Struct {
311 pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) }
312 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
313 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
567} 314}
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)] 315#[derive(Debug, Clone, PartialEq, Eq, Hash)]
580pub struct NeverType { 316pub struct Trait {
581 pub(crate) syntax: SyntaxNode, 317 pub(crate) syntax: SyntaxNode,
582} 318}
583impl NeverType { 319impl ast::AttrsOwner for Trait {}
584 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 320impl ast::NameOwner for Trait {}
321impl ast::VisibilityOwner for Trait {}
322impl ast::GenericParamsOwner for Trait {}
323impl ast::TypeBoundsOwner for Trait {}
324impl Trait {
325 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
326 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
327 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
328 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
585} 329}
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)] 330#[derive(Debug, Clone, PartialEq, Eq, Hash)]
598pub struct PathType { 331pub struct TypeAlias {
599 pub(crate) syntax: SyntaxNode, 332 pub(crate) syntax: SyntaxNode,
600} 333}
601impl PathType { 334impl ast::AttrsOwner for TypeAlias {}
602 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 335impl ast::NameOwner for TypeAlias {}
336impl ast::VisibilityOwner for TypeAlias {}
337impl ast::GenericParamsOwner for TypeAlias {}
338impl ast::TypeBoundsOwner for TypeAlias {}
339impl TypeAlias {
340 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
341 pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) }
342 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
343 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
344 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
603} 345}
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)] 346#[derive(Debug, Clone, PartialEq, Eq, Hash)]
613pub struct PointerType { 347pub struct Union {
614 pub(crate) syntax: SyntaxNode, 348 pub(crate) syntax: SyntaxNode,
615} 349}
616impl PointerType { 350impl ast::AttrsOwner for Union {}
617 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } 351impl ast::NameOwner for Union {}
618 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 352impl ast::VisibilityOwner for Union {}
619 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 353impl ast::GenericParamsOwner for Union {}
620 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 354impl Union {
355 pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) }
356 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) }
621} 357}
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)] 358#[derive(Debug, Clone, PartialEq, Eq, Hash)]
630pub struct ArrayType { 359pub struct Use {
631 pub(crate) syntax: SyntaxNode, 360 pub(crate) syntax: SyntaxNode,
632} 361}
633impl ArrayType { 362impl ast::AttrsOwner for Use {}
634 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 363impl ast::VisibilityOwner for Use {}
635 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 364impl Use {
365 pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) }
366 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
636 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 367 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} 368}
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)] 369#[derive(Debug, Clone, PartialEq, Eq, Hash)]
648pub struct SliceType { 370pub struct Visibility {
649 pub(crate) syntax: SyntaxNode, 371 pub(crate) syntax: SyntaxNode,
650} 372}
651impl SliceType { 373impl Visibility {
652 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 374 pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) }
653 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 375 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
654 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 376 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
377 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
378 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
379 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
380 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
381 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
655} 382}
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)] 383#[derive(Debug, Clone, PartialEq, Eq, Hash)]
664pub struct ReferenceType { 384pub struct ItemList {
665 pub(crate) syntax: SyntaxNode, 385 pub(crate) syntax: SyntaxNode,
666} 386}
667impl ReferenceType { 387impl ast::AttrsOwner for ItemList {}
668 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 388impl ast::ModuleItemOwner for ItemList {}
669 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 389impl ItemList {
670 support::token(&self.syntax, T![lifetime]) 390 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
671 } 391 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
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} 392}
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)] 393#[derive(Debug, Clone, PartialEq, Eq, Hash)]
683pub struct PlaceholderType { 394pub struct Rename {
684 pub(crate) syntax: SyntaxNode, 395 pub(crate) syntax: SyntaxNode,
685} 396}
686impl PlaceholderType { 397impl ast::NameOwner for Rename {}
398impl Rename {
399 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
687 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 400 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
688} 401}
689/// Function pointer type (not to be confused with `Fn*` family of traits). 402#[derive(Debug, Clone, PartialEq, Eq, Hash)]
690/// 403pub struct UseTree {
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)]
699pub struct FnPointerType {
700 pub(crate) syntax: SyntaxNode, 404 pub(crate) syntax: SyntaxNode,
701} 405}
702impl FnPointerType { 406impl UseTree {
703 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 407 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
704 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 408 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
705 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } 409 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
706 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } 410 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) }
707 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } 411 pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) }
708} 412}
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)] 413#[derive(Debug, Clone, PartialEq, Eq, Hash)]
717pub struct ForType { 414pub struct UseTreeList {
718 pub(crate) syntax: SyntaxNode, 415 pub(crate) syntax: SyntaxNode,
719} 416}
720impl ForType { 417impl UseTreeList {
721 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 418 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
722 pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } 419 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
723 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 420 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
724} 421}
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)] 422#[derive(Debug, Clone, PartialEq, Eq, Hash)]
733pub struct ImplTraitType { 423pub struct Abi {
734 pub(crate) syntax: SyntaxNode, 424 pub(crate) syntax: SyntaxNode,
735} 425}
736impl ast::TypeBoundsOwner for ImplTraitType {} 426impl Abi {
737impl ImplTraitType { 427 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
738 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
739} 428}
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)] 429#[derive(Debug, Clone, PartialEq, Eq, Hash)]
748pub struct DynTraitType { 430pub struct GenericParamList {
749 pub(crate) syntax: SyntaxNode, 431 pub(crate) syntax: SyntaxNode,
750} 432}
751impl ast::TypeBoundsOwner for DynTraitType {} 433impl GenericParamList {
752impl DynTraitType { 434 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
753 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } 435 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) }
436 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
754} 437}
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)] 438#[derive(Debug, Clone, PartialEq, Eq, Hash)]
763pub struct TupleExpr { 439pub struct WhereClause {
764 pub(crate) syntax: SyntaxNode, 440 pub(crate) syntax: SyntaxNode,
765} 441}
766impl ast::AttrsOwner for TupleExpr {} 442impl WhereClause {
767impl TupleExpr { 443 pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) }
768 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 444 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) }
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} 445}
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)] 446#[derive(Debug, Clone, PartialEq, Eq, Hash)]
782pub struct ArrayExpr { 447pub struct BlockExpr {
783 pub(crate) syntax: SyntaxNode, 448 pub(crate) syntax: SyntaxNode,
784} 449}
785impl ast::AttrsOwner for ArrayExpr {} 450impl ast::AttrsOwner for BlockExpr {}
786impl ArrayExpr { 451impl BlockExpr {
787 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 452 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
788 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 453 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
789 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 454 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
790 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 455 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
791} 456}
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)] 457#[derive(Debug, Clone, PartialEq, Eq, Hash)]
801pub struct ParenExpr { 458pub struct SelfParam {
802 pub(crate) syntax: SyntaxNode, 459 pub(crate) syntax: SyntaxNode,
803} 460}
804impl ast::AttrsOwner for ParenExpr {} 461impl ast::AttrsOwner for SelfParam {}
805impl ParenExpr { 462impl SelfParam {
806 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 463 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
807 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 464 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
808 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 465 support::token(&self.syntax, T![lifetime])
466 }
467 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
468 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
469 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
470 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
809} 471}
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)] 472#[derive(Debug, Clone, PartialEq, Eq, Hash)]
824pub struct PathExpr { 473pub struct Param {
825 pub(crate) syntax: SyntaxNode, 474 pub(crate) syntax: SyntaxNode,
826} 475}
827impl PathExpr { 476impl ast::AttrsOwner for Param {}
828 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 477impl Param {
478 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
479 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
480 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
481 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
829} 482}
830/// Anonymous callable object literal a.k.a. closure, lambda or functor. 483#[derive(Debug, Clone, PartialEq, Eq, Hash)]
831/// 484pub struct RecordFieldList {
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)]
842pub struct LambdaExpr {
843 pub(crate) syntax: SyntaxNode, 485 pub(crate) syntax: SyntaxNode,
844} 486}
845impl ast::AttrsOwner for LambdaExpr {} 487impl RecordFieldList {
846impl LambdaExpr { 488 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
847 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } 489 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) }
848 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 490 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
849 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
850 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
851 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
852 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
853} 491}
854/// If expression. Includes both regular `if` and `if let` forms.
855/// Beware that `else if` is a special case syntax sugar, because in general
856/// there has to be block expression after `else`.
857///
858/// ```
859/// ❰ if bool_cond { 42 } ❱
860/// ❰ if bool_cond { 42 } else { 24 } ❱
861/// ❰ if bool_cond { 42 } else if bool_cond2 { 42 } ❱
862///
863/// ❰
864/// if let Pattern(foo) = bar {
865/// foo
866/// } else {
867/// panic!();
868/// }
869/// ❱
870/// ```
871///
872/// [Reference](https://doc.rust-lang.org/reference/expressions/if-expr.html)
873#[derive(Debug, Clone, PartialEq, Eq, Hash)] 492#[derive(Debug, Clone, PartialEq, Eq, Hash)]
874pub struct IfExpr { 493pub struct TupleFieldList {
875 pub(crate) syntax: SyntaxNode, 494 pub(crate) syntax: SyntaxNode,
876} 495}
877impl ast::AttrsOwner for IfExpr {} 496impl TupleFieldList {
878impl IfExpr { 497 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
879 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } 498 pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) }
880 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 499 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
881} 500}
882/// Unconditional loop expression.
883///
884/// ```
885/// ❰
886/// loop {
887/// // yeah, it's that simple...
888/// }
889/// ❱
890/// ```
891///
892/// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html)
893#[derive(Debug, Clone, PartialEq, Eq, Hash)] 501#[derive(Debug, Clone, PartialEq, Eq, Hash)]
894pub struct LoopExpr { 502pub struct RecordField {
895 pub(crate) syntax: SyntaxNode, 503 pub(crate) syntax: SyntaxNode,
896} 504}
897impl ast::AttrsOwner for LoopExpr {} 505impl ast::AttrsOwner for RecordField {}
898impl ast::LoopBodyOwner for LoopExpr {} 506impl ast::NameOwner for RecordField {}
899impl LoopExpr { 507impl ast::VisibilityOwner for RecordField {}
900 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } 508impl RecordField {
509 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
510 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
901} 511}
902/// Block expression with an optional prefix (label, try ketword,
903/// unsafe keyword, async keyword...).
904///
905/// ```
906/// ❰
907/// 'label: try {
908/// None?
909/// }
910/// ❱
911/// ```
912///
913/// - [try block](https://doc.rust-lang.org/unstable-book/language-features/try-blocks.html)
914/// - [unsafe block](https://doc.rust-lang.org/reference/expressions/block-expr.html#unsafe-blocks)
915/// - [async block](https://doc.rust-lang.org/reference/expressions/block-expr.html#async-blocks)
916#[derive(Debug, Clone, PartialEq, Eq, Hash)] 512#[derive(Debug, Clone, PartialEq, Eq, Hash)]
917pub struct EffectExpr { 513pub struct TupleField {
918 pub(crate) syntax: SyntaxNode, 514 pub(crate) syntax: SyntaxNode,
919} 515}
920impl ast::AttrsOwner for EffectExpr {} 516impl ast::AttrsOwner for TupleField {}
921impl EffectExpr { 517impl ast::VisibilityOwner for TupleField {}
922 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } 518impl TupleField {
923 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } 519 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
924 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
925 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
926 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
927} 520}
928/// For loop expression.
929/// Note: record struct literals are not valid as iterable expression
930/// due to ambiguity.
931///
932/// ```
933/// ❰
934/// for i in (0..4) {
935/// dbg!(i);
936/// }
937/// ❱
938/// ```
939///
940/// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops)
941#[derive(Debug, Clone, PartialEq, Eq, Hash)] 521#[derive(Debug, Clone, PartialEq, Eq, Hash)]
942pub struct ForExpr { 522pub struct VariantList {
943 pub(crate) syntax: SyntaxNode, 523 pub(crate) syntax: SyntaxNode,
944} 524}
945impl ast::AttrsOwner for ForExpr {} 525impl VariantList {
946impl ast::LoopBodyOwner for ForExpr {} 526 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
947impl ForExpr { 527 pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) }
948 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 528 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
949 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
950 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
951 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
952} 529}
953/// While loop expression. Includes both regular `while` and `while let` forms.
954///
955/// ```
956/// ❰
957/// while bool_cond {
958/// 42;
959/// }
960/// ❱
961/// ❰
962/// while let Pattern(foo) = bar {
963/// bar += 1;
964/// }
965/// ❱
966/// ```
967///
968/// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops)
969#[derive(Debug, Clone, PartialEq, Eq, Hash)] 530#[derive(Debug, Clone, PartialEq, Eq, Hash)]
970pub struct WhileExpr { 531pub struct Variant {
971 pub(crate) syntax: SyntaxNode, 532 pub(crate) syntax: SyntaxNode,
972} 533}
973impl ast::AttrsOwner for WhileExpr {} 534impl ast::AttrsOwner for Variant {}
974impl ast::LoopBodyOwner for WhileExpr {} 535impl ast::NameOwner for Variant {}
975impl WhileExpr { 536impl ast::VisibilityOwner for Variant {}
976 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } 537impl Variant {
977 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } 538 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
539 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
540 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
978} 541}
979/// Continue expression.
980///
981/// ```
982/// while bool_cond {
983/// ❰ continue ❱;
984/// }
985///
986/// 'outer: loop {
987/// loop {
988/// ❰ continue 'outer ❱;
989/// }
990/// }
991///
992/// ```
993///
994/// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#continue-expressions)
995#[derive(Debug, Clone, PartialEq, Eq, Hash)] 542#[derive(Debug, Clone, PartialEq, Eq, Hash)]
996pub struct ContinueExpr { 543pub struct AssocItemList {
997 pub(crate) syntax: SyntaxNode, 544 pub(crate) syntax: SyntaxNode,
998} 545}
999impl ast::AttrsOwner for ContinueExpr {} 546impl ast::AttrsOwner for AssocItemList {}
1000impl ContinueExpr { 547impl AssocItemList {
1001 pub fn continue_token(&self) -> Option<SyntaxToken> { 548 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1002 support::token(&self.syntax, T![continue]) 549 pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
1003 } 550 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1004 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1005 support::token(&self.syntax, T![lifetime])
1006 }
1007} 551}
1008/// Break expression.
1009///
1010/// ```
1011/// while bool_cond {
1012/// ❰ break ❱;
1013/// }
1014/// 'outer: loop {
1015/// for foo in bar {
1016/// ❰ break 'outer ❱;
1017/// }
1018/// }
1019/// 'outer: loop {
1020/// loop {
1021/// ❰ break 'outer 42 ❱;
1022/// }
1023/// }
1024/// ```
1025///
1026/// [Refernce](https://doc.rust-lang.org/reference/expressions/loop-expr.html#break-expressions)
1027#[derive(Debug, Clone, PartialEq, Eq, Hash)] 552#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1028pub struct BreakExpr { 553pub struct ExternItemList {
1029 pub(crate) syntax: SyntaxNode, 554 pub(crate) syntax: SyntaxNode,
1030} 555}
1031impl ast::AttrsOwner for BreakExpr {} 556impl ast::AttrsOwner for ExternItemList {}
1032impl BreakExpr { 557impl ExternItemList {
1033 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } 558 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1034 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 559 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) }
1035 support::token(&self.syntax, T![lifetime]) 560 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1036 }
1037 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1038} 561}
1039/// Label.
1040///
1041/// ```
1042/// ❰ 'outer: ❱ loop {}
1043///
1044/// let foo = ❰ 'bar: ❱ loop {}
1045///
1046/// ❰ 'baz: ❱ {
1047/// break 'baz;
1048/// }
1049/// ```
1050///
1051/// [Reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html?highlight=label#loop-labels)
1052/// [Labels for blocks RFC](https://github.com/rust-lang/rfcs/blob/master/text/2046-label-break-value.md)
1053#[derive(Debug, Clone, PartialEq, Eq, Hash)] 562#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1054pub struct Label { 563pub struct ConstParam {
1055 pub(crate) syntax: SyntaxNode, 564 pub(crate) syntax: SyntaxNode,
1056} 565}
1057impl Label { 566impl ast::AttrsOwner for ConstParam {}
567impl ast::NameOwner for ConstParam {}
568impl ConstParam {
569 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
570 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
571 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
572 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
573 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
574}
575#[derive(Debug, Clone, PartialEq, Eq, Hash)]
576pub struct LifetimeParam {
577 pub(crate) syntax: SyntaxNode,
578}
579impl ast::AttrsOwner for LifetimeParam {}
580impl ast::TypeBoundsOwner for LifetimeParam {}
581impl LifetimeParam {
1058 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 582 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1059 support::token(&self.syntax, T![lifetime]) 583 support::token(&self.syntax, T![lifetime])
1060 } 584 }
1061} 585}
1062/// Block expression. Includes unsafe blocks and block labels.
1063///
1064/// ```
1065/// let foo = ❰
1066/// {
1067/// #![inner_attr]
1068/// ❰ { } ❱
1069///
1070/// ❰ 'label: { break 'label } ❱
1071/// }
1072/// ❱;
1073/// ```
1074///
1075/// [Reference](https://doc.rust-lang.org/reference/expressions/block-expr.html)
1076/// [Labels for blocks RFC](https://github.com/rust-lang/rfcs/blob/master/text/2046-label-break-value.md)
1077#[derive(Debug, Clone, PartialEq, Eq, Hash)] 586#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1078pub struct BlockExpr { 587pub struct TypeParam {
1079 pub(crate) syntax: SyntaxNode, 588 pub(crate) syntax: SyntaxNode,
1080} 589}
1081impl ast::AttrsOwner for BlockExpr {} 590impl ast::AttrsOwner for TypeParam {}
1082impl ast::ModuleItemOwner for BlockExpr {} 591impl ast::NameOwner for TypeParam {}
1083impl BlockExpr { 592impl ast::TypeBoundsOwner for TypeParam {}
1084 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } 593impl TypeParam {
1085 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 594 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1086 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 595 pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) }
1087 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1088 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1089} 596}
1090/// Return expression.
1091///
1092/// ```
1093/// || ❰ return 42 ❱;
1094///
1095/// fn bar() {
1096/// ❰ return ❱;
1097/// }
1098/// ```
1099///
1100/// [Reference](https://doc.rust-lang.org/reference/expressions/return-expr.html)
1101#[derive(Debug, Clone, PartialEq, Eq, Hash)] 597#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1102pub struct ReturnExpr { 598pub struct WherePred {
1103 pub(crate) syntax: SyntaxNode, 599 pub(crate) syntax: SyntaxNode,
1104} 600}
1105impl ast::AttrsOwner for ReturnExpr {} 601impl ast::TypeBoundsOwner for WherePred {}
1106impl ReturnExpr { 602impl WherePred {
1107 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 603 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
604 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
605 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
606 support::token(&self.syntax, T![lifetime])
607 }
608 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1108} 609}
1109/// Call expression (not to be confused with method call expression, it is
1110/// a separate ast node).
1111///
1112/// ```
1113/// ❰ foo() ❱;
1114/// ❰ &str::len("bar") ❱;
1115/// ❰ <&str as PartialEq<&str>>::eq(&"", &"") ❱;
1116/// ```
1117///
1118/// [Reference](https://doc.rust-lang.org/reference/expressions/call-expr.html)
1119#[derive(Debug, Clone, PartialEq, Eq, Hash)] 610#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1120pub struct CallExpr { 611pub struct Literal {
1121 pub(crate) syntax: SyntaxNode, 612 pub(crate) syntax: SyntaxNode,
1122} 613}
1123impl ast::ArgListOwner for CallExpr {} 614impl ast::AttrsOwner for Literal {}
1124impl CallExpr { 615impl Literal {}
1125 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1126}
1127/// Method call expression.
1128///
1129/// ```
1130/// ❰ receiver_expr.method() ❱;
1131/// ❰ receiver_expr.method::<T>(42, true) ❱;
1132///
1133/// ❰ ❰ ❰ foo.bar() ❱ .baz() ❱ .bruh() ❱;
1134/// ```
1135///
1136/// [Reference](https://doc.rust-lang.org/reference/expressions/method-call-expr.html)
1137#[derive(Debug, Clone, PartialEq, Eq, Hash)] 616#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1138pub struct MethodCallExpr { 617pub struct ExprStmt {
1139 pub(crate) syntax: SyntaxNode, 618 pub(crate) syntax: SyntaxNode,
1140} 619}
1141impl ast::AttrsOwner for MethodCallExpr {} 620impl ast::AttrsOwner for ExprStmt {}
1142impl ast::ArgListOwner for MethodCallExpr {} 621impl ExprStmt {
1143impl MethodCallExpr {
1144 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 622 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1145 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 623 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1146 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1147 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
1148} 624}
1149/// Index expression a.k.a. subscript operator call.
1150///
1151/// ```
1152/// ❰ foo[42] ❱;
1153/// ```
1154///
1155/// [Reference](https://doc.rust-lang.org/reference/expressions/array-expr.html)
1156#[derive(Debug, Clone, PartialEq, Eq, Hash)] 625#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1157pub struct IndexExpr { 626pub struct LetStmt {
1158 pub(crate) syntax: SyntaxNode, 627 pub(crate) syntax: SyntaxNode,
1159} 628}
1160impl ast::AttrsOwner for IndexExpr {} 629impl ast::AttrsOwner for LetStmt {}
1161impl IndexExpr { 630impl LetStmt {
1162 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 631 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
1163 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 632 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
633 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
634 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
635 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
636 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) }
637 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1164} 638}
1165/// Field access expression.
1166///
1167/// ```
1168/// ❰ expr.bar ❱;
1169///
1170/// ❰ ❰ ❰ foo.bar ❱ .baz ❱ .bruh ❱;
1171/// ```
1172///
1173/// [Reference](https://doc.rust-lang.org/reference/expressions/field-expr.html)
1174#[derive(Debug, Clone, PartialEq, Eq, Hash)] 639#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1175pub struct FieldExpr { 640pub struct ArrayExpr {
1176 pub(crate) syntax: SyntaxNode, 641 pub(crate) syntax: SyntaxNode,
1177} 642}
1178impl ast::AttrsOwner for FieldExpr {} 643impl ast::AttrsOwner for ArrayExpr {}
1179impl FieldExpr { 644impl ArrayExpr {
645 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
646 pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
1180 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 647 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1181 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 648 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1182 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 649 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1183} 650}
1184/// Await operator call expression.
1185///
1186/// ```
1187/// ❰ expr.await ❱;
1188/// ```
1189///
1190/// [Reference](https://doc.rust-lang.org/reference/expressions/await-expr.html)
1191#[derive(Debug, Clone, PartialEq, Eq, Hash)] 651#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1192pub struct AwaitExpr { 652pub struct AwaitExpr {
1193 pub(crate) syntax: SyntaxNode, 653 pub(crate) syntax: SyntaxNode,
@@ -1198,1579 +658,739 @@ impl AwaitExpr {
1198 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } 658 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1199 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } 659 pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) }
1200} 660}
1201/// The question mark operator call.
1202///
1203/// ```
1204/// ❰ expr? ❱;
1205/// ```
1206///
1207/// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#the-question-mark-operator)
1208#[derive(Debug, Clone, PartialEq, Eq, Hash)] 661#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1209pub struct TryExpr { 662pub struct BinExpr {
1210 pub(crate) syntax: SyntaxNode, 663 pub(crate) syntax: SyntaxNode,
1211} 664}
1212impl ast::AttrsOwner for TryExpr {} 665impl ast::AttrsOwner for BinExpr {}
1213impl TryExpr { 666impl BinExpr {}
1214 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1215 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1216}
1217/// Type cast expression.
1218///
1219/// ```
1220/// ❰ expr as T ❱;
1221/// ```
1222///
1223/// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#type-cast-expressions)
1224#[derive(Debug, Clone, PartialEq, Eq, Hash)] 667#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1225pub struct CastExpr { 668pub struct BoxExpr {
1226 pub(crate) syntax: SyntaxNode, 669 pub(crate) syntax: SyntaxNode,
1227} 670}
1228impl ast::AttrsOwner for CastExpr {} 671impl ast::AttrsOwner for BoxExpr {}
1229impl CastExpr { 672impl BoxExpr {
673 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1230 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 674 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1231 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } 675}
1232 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
1233}
1234/// Borrow operator call.
1235///
1236/// ```
1237/// ❰ &foo ❱;
1238/// ❰ &mut bar ❱;
1239/// ❰ &raw const bar ❱;
1240/// ❰ &raw mut bar ❱;
1241/// ```
1242///
1243/// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#borrow-operators)
1244#[derive(Debug, Clone, PartialEq, Eq, Hash)] 676#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1245pub struct RefExpr { 677pub struct BreakExpr {
1246 pub(crate) syntax: SyntaxNode, 678 pub(crate) syntax: SyntaxNode,
1247} 679}
1248impl ast::AttrsOwner for RefExpr {} 680impl ast::AttrsOwner for BreakExpr {}
1249impl RefExpr { 681impl BreakExpr {
1250 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 682 pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) }
1251 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } 683 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1252 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 684 support::token(&self.syntax, T![lifetime])
1253 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } 685 }
1254 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 686 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1255} 687}
1256/// Prefix operator call. This is either `!` or `*` or `-`.
1257///
1258/// ```
1259/// ❰ !foo ❱;
1260/// ❰ *bar ❱;
1261/// ❰ -42 ❱;
1262/// ```
1263///
1264/// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html)
1265#[derive(Debug, Clone, PartialEq, Eq, Hash)] 688#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1266pub struct PrefixExpr { 689pub struct CallExpr {
1267 pub(crate) syntax: SyntaxNode, 690 pub(crate) syntax: SyntaxNode,
1268} 691}
1269impl ast::AttrsOwner for PrefixExpr {} 692impl ast::AttrsOwner for CallExpr {}
1270impl PrefixExpr { 693impl ast::ArgListOwner for CallExpr {}
694impl CallExpr {
1271 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 695 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1272} 696}
1273/// Box operator call.
1274///
1275/// ```
1276/// ❰ box 42 ❱;
1277/// ```
1278///
1279/// [RFC](https://github.com/rust-lang/rfcs/blob/0806be4f282144cfcd55b1d20284b43f87cbe1c6/text/0809-box-and-in-for-stdlib.md)
1280#[derive(Debug, Clone, PartialEq, Eq, Hash)] 697#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1281pub struct BoxExpr { 698pub struct CastExpr {
1282 pub(crate) syntax: SyntaxNode, 699 pub(crate) syntax: SyntaxNode,
1283} 700}
1284impl ast::AttrsOwner for BoxExpr {} 701impl ast::AttrsOwner for CastExpr {}
1285impl BoxExpr { 702impl CastExpr {
1286 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1287 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 703 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
704 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
705 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1288} 706}
1289/// Range operator call.
1290///
1291/// ```
1292/// ❰ 0..42 ❱;
1293/// ❰ ..42 ❱;
1294/// ❰ 0.. ❱;
1295/// ❰ .. ❱;
1296/// ❰ 0..=42 ❱;
1297/// ❰ ..=42 ❱;
1298/// ```
1299///
1300/// [Reference](https://doc.rust-lang.org/reference/expressions/range-expr.html)
1301#[derive(Debug, Clone, PartialEq, Eq, Hash)] 707#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1302pub struct RangeExpr { 708pub struct ClosureExpr {
1303 pub(crate) syntax: SyntaxNode, 709 pub(crate) syntax: SyntaxNode,
1304} 710}
1305impl ast::AttrsOwner for RangeExpr {} 711impl ast::AttrsOwner for ClosureExpr {}
1306impl RangeExpr {} 712impl ClosureExpr {
1307/// Binary operator call. 713 pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) }
1308/// Includes all arithmetic, logic, bitwise and assignment operators. 714 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
1309/// 715 pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) }
1310/// ``` 716 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1311/// ❰ 2 + ❰ 2 * 2 ❱ ❱; 717 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1312/// ❰ ❰ true && false ❱ || true ❱; 718 pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) }
1313/// ```
1314///
1315/// [Reference](https://doc.rust-lang.org/reference/expressions/operator-expr.html#arithmetic-and-logical-binary-operators)
1316#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1317pub struct BinExpr {
1318 pub(crate) syntax: SyntaxNode,
1319} 719}
1320impl ast::AttrsOwner for BinExpr {}
1321impl BinExpr {}
1322/// [Raw] string, [raw] byte string, char, byte, integer, float or bool literal.
1323///
1324/// ```
1325/// ❰ "str" ❱;
1326/// ❰ br##"raw byte str"## ❱;
1327/// ❰ 'c' ❱;
1328/// ❰ b'c' ❱;
1329/// ❰ 42 ❱;
1330/// ❰ 1e9 ❱;
1331/// ❰ true ❱;
1332/// ```
1333///
1334/// [Reference](https://doc.rust-lang.org/reference/expressions/literal-expr.html)
1335#[derive(Debug, Clone, PartialEq, Eq, Hash)] 720#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1336pub struct Literal { 721pub struct ContinueExpr {
1337 pub(crate) syntax: SyntaxNode, 722 pub(crate) syntax: SyntaxNode,
1338} 723}
1339impl Literal {} 724impl ast::AttrsOwner for ContinueExpr {}
1340/// Match expression. 725impl ContinueExpr {
1341/// 726 pub fn continue_token(&self) -> Option<SyntaxToken> {
1342/// ``` 727 support::token(&self.syntax, T![continue])
1343/// ❰ 728 }
1344/// match expr { 729 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1345/// Pat1 => {} 730 support::token(&self.syntax, T![lifetime])
1346/// Pat2(_) => 42, 731 }
1347/// } 732}
1348/// ❱
1349/// ```
1350///
1351/// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1352#[derive(Debug, Clone, PartialEq, Eq, Hash)] 733#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1353pub struct MatchExpr { 734pub struct EffectExpr {
1354 pub(crate) syntax: SyntaxNode, 735 pub(crate) syntax: SyntaxNode,
1355} 736}
1356impl ast::AttrsOwner for MatchExpr {} 737impl ast::AttrsOwner for EffectExpr {}
1357impl MatchExpr { 738impl EffectExpr {
1358 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } 739 pub fn label(&self) -> Option<Label> { support::child(&self.syntax) }
1359 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 740 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
1360 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } 741 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
742 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
743 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) }
1361} 744}
1362/// Match arm list part of match expression. Includes its inner attributes.
1363///
1364/// ```
1365/// match expr
1366/// ❰
1367/// {
1368/// #![inner_attr]
1369/// Pat1 => {}
1370/// Pat2(_) => 42,
1371/// }
1372/// ❱
1373/// ```
1374///
1375/// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1376#[derive(Debug, Clone, PartialEq, Eq, Hash)] 745#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1377pub struct MatchArmList { 746pub struct FieldExpr {
1378 pub(crate) syntax: SyntaxNode, 747 pub(crate) syntax: SyntaxNode,
1379} 748}
1380impl ast::AttrsOwner for MatchArmList {} 749impl ast::AttrsOwner for FieldExpr {}
1381impl MatchArmList { 750impl FieldExpr {
1382 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 751 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1383 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } 752 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
1384 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 753 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1385} 754}
1386/// Match arm.
1387/// Note: record struct literals are not valid as target match expression
1388/// due to ambiguity.
1389/// ```
1390/// match expr {
1391/// ❰ #[attr] Pattern(it) if bool_cond => it ❱,
1392/// }
1393/// ```
1394///
1395/// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html)
1396#[derive(Debug, Clone, PartialEq, Eq, Hash)] 755#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1397pub struct MatchArm { 756pub struct ForExpr {
1398 pub(crate) syntax: SyntaxNode, 757 pub(crate) syntax: SyntaxNode,
1399} 758}
1400impl ast::AttrsOwner for MatchArm {} 759impl ast::AttrsOwner for ForExpr {}
1401impl MatchArm { 760impl ast::LoopBodyOwner for ForExpr {}
761impl ForExpr {
762 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
1402 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 763 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1403 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } 764 pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) }
1404 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } 765 pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) }
1405 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1406} 766}
1407/// Match guard.
1408///
1409/// ```
1410/// match expr {
1411/// Pattern(it) ❰ if bool_cond ❱ => it,
1412/// }
1413/// ```
1414///
1415/// [Reference](https://doc.rust-lang.org/reference/expressions/match-expr.html#match-guards)
1416#[derive(Debug, Clone, PartialEq, Eq, Hash)] 767#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1417pub struct MatchGuard { 768pub struct IfExpr {
1418 pub(crate) syntax: SyntaxNode, 769 pub(crate) syntax: SyntaxNode,
1419} 770}
1420impl MatchGuard { 771impl ast::AttrsOwner for IfExpr {}
772impl IfExpr {
1421 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } 773 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
1422 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 774 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
775 pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) }
1423} 776}
1424/// Record literal expression. The same syntax is used for structs, 777#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1425/// unions and record enum variants. 778pub struct IndexExpr {
1426///
1427/// ```
1428/// ❰
1429/// foo::Bar {
1430/// #![inner_attr]
1431/// baz: 42,
1432/// bruh: true,
1433/// ..spread
1434/// }
1435/// ❱
1436/// ```
1437///
1438/// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1439#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1440pub struct RecordLit {
1441 pub(crate) syntax: SyntaxNode, 779 pub(crate) syntax: SyntaxNode,
1442} 780}
1443impl RecordLit { 781impl ast::AttrsOwner for IndexExpr {}
1444 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 782impl IndexExpr {
1445 pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } 783 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
784 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1446} 785}
1447/// Record field list including enclosing curly braces.
1448///
1449/// foo::Bar ❰
1450/// {
1451/// baz: 42,
1452/// ..spread
1453/// }
1454/// ❱
1455///
1456/// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1457#[derive(Debug, Clone, PartialEq, Eq, Hash)] 786#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1458pub struct RecordFieldList { 787pub struct LoopExpr {
1459 pub(crate) syntax: SyntaxNode, 788 pub(crate) syntax: SyntaxNode,
1460} 789}
1461impl RecordFieldList { 790impl ast::AttrsOwner for LoopExpr {}
1462 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 791impl ast::LoopBodyOwner for LoopExpr {}
1463 pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } 792impl LoopExpr {
1464 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 793 pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) }
1465 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1466 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1467} 794}
1468/// Record field.
1469///
1470/// ```
1471/// foo::Bar {
1472/// ❰ #[attr] baz: 42 ❱
1473/// }
1474/// ```
1475///
1476/// [Reference](https://doc.rust-lang.org/reference/expressions/struct-expr.html)
1477#[derive(Debug, Clone, PartialEq, Eq, Hash)] 795#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1478pub struct RecordField { 796pub struct MatchExpr {
1479 pub(crate) syntax: SyntaxNode, 797 pub(crate) syntax: SyntaxNode,
1480} 798}
1481impl ast::AttrsOwner for RecordField {} 799impl ast::AttrsOwner for MatchExpr {}
1482impl RecordField { 800impl MatchExpr {
1483 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 801 pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) }
1484 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1485 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 802 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
803 pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) }
1486} 804}
1487/// Disjunction of patterns.
1488///
1489/// ```
1490/// let ❰ Foo(it) | Bar(it) | Baz(it) ❱ = bruh;
1491/// ```
1492///
1493/// [Reference](https://doc.rust-lang.org/reference/patterns.html)
1494#[derive(Debug, Clone, PartialEq, Eq, Hash)] 805#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1495pub struct OrPat { 806pub struct MethodCallExpr {
1496 pub(crate) syntax: SyntaxNode, 807 pub(crate) syntax: SyntaxNode,
1497} 808}
1498impl OrPat { 809impl ast::AttrsOwner for MethodCallExpr {}
1499 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 810impl ast::ArgListOwner for MethodCallExpr {}
811impl MethodCallExpr {
812 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
813 pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) }
814 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
815 pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) }
1500} 816}
1501/// Parenthesized pattern.
1502/// Note: parens are only used for grouping, this is not a tuple pattern.
1503///
1504/// ```
1505/// if let ❰ &(0..=42) ❱ = foo {}
1506/// ```
1507///
1508/// https://doc.rust-lang.org/reference/patterns.html#grouped-patterns
1509#[derive(Debug, Clone, PartialEq, Eq, Hash)] 817#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1510pub struct ParenPat { 818pub struct ParenExpr {
1511 pub(crate) syntax: SyntaxNode, 819 pub(crate) syntax: SyntaxNode,
1512} 820}
1513impl ParenPat { 821impl ast::AttrsOwner for ParenExpr {}
822impl ParenExpr {
1514 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 823 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1515 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 824 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1516 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 825 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1517} 826}
1518/// Reference pattern.
1519/// Note: this has nothing to do with `ref` keyword, the latter is used in bind patterns.
1520///
1521/// ```
1522/// let ❰ &mut foo ❱ = bar;
1523///
1524/// let ❰ & ❰ &mut ❰ &_ ❱ ❱ ❱ = baz;
1525/// ```
1526///
1527/// [Reference](https://doc.rust-lang.org/reference/patterns.html#reference-patterns)
1528#[derive(Debug, Clone, PartialEq, Eq, Hash)] 827#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1529pub struct RefPat { 828pub struct PathExpr {
1530 pub(crate) syntax: SyntaxNode, 829 pub(crate) syntax: SyntaxNode,
1531} 830}
1532impl RefPat { 831impl ast::AttrsOwner for PathExpr {}
1533 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } 832impl PathExpr {
1534 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } 833 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1535 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1536} 834}
1537/// Box pattern.
1538///
1539/// ```
1540/// let ❰ box foo ❱ = box 42;
1541/// ```
1542///
1543/// [Unstable book](https://doc.rust-lang.org/unstable-book/language-features/box-patterns.html)
1544#[derive(Debug, Clone, PartialEq, Eq, Hash)] 835#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1545pub struct BoxPat { 836pub struct PrefixExpr {
1546 pub(crate) syntax: SyntaxNode,
1547}
1548impl BoxPat {
1549 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
1550 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1551}
1552/// Bind pattern.
1553///
1554/// ```
1555/// match foo {
1556/// Some(❰ ref mut bar ❱) => {}
1557/// ❰ baz @ None ❱ => {}
1558/// }
1559/// ```
1560///
1561/// [Reference](https://doc.rust-lang.org/reference/patterns.html#identifier-patterns)
1562#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1563pub struct BindPat {
1564 pub(crate) syntax: SyntaxNode, 837 pub(crate) syntax: SyntaxNode,
1565} 838}
1566impl ast::AttrsOwner for BindPat {} 839impl ast::AttrsOwner for PrefixExpr {}
1567impl ast::NameOwner for BindPat {} 840impl PrefixExpr {
1568impl BindPat { 841 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1569 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1570 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1571 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
1572 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1573} 842}
1574/// Placeholder pattern a.k.a. the wildcard pattern or the underscore.
1575///
1576/// ```
1577/// let ❰ _ ❱ = foo;
1578/// ```
1579///
1580/// [Reference](https://doc.rust-lang.org/reference/patterns.html#wildcard-pattern)
1581#[derive(Debug, Clone, PartialEq, Eq, Hash)] 843#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1582pub struct PlaceholderPat { 844pub struct RangeExpr {
1583 pub(crate) syntax: SyntaxNode, 845 pub(crate) syntax: SyntaxNode,
1584} 846}
1585impl PlaceholderPat { 847impl ast::AttrsOwner for RangeExpr {}
1586 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } 848impl RangeExpr {}
1587} 849#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1588/// Rest-of-the record/tuple pattern. 850pub struct RecordExpr {
1589/// Note: this is not the unbonded range pattern (even more: it doesn't exist).
1590///
1591/// ```
1592/// let Foo { bar, ❰ .. ❱ } = baz;
1593/// let (❰ .. ❱, bruh) = (42, 24, 42);
1594/// let Bruuh(❰ .. ❱) = bruuuh;
1595/// ```
1596///
1597/// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1598#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1599pub struct DotDotPat {
1600 pub(crate) syntax: SyntaxNode, 851 pub(crate) syntax: SyntaxNode,
1601} 852}
1602impl DotDotPat { 853impl RecordExpr {
1603 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 854 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
855 pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> {
856 support::child(&self.syntax)
857 }
1604} 858}
1605/// Path pattern.
1606/// Doesn't include the underscore pattern (it is a special case, namely `PlaceholderPat`).
1607///
1608/// ```
1609/// let ❰ foo::bar::Baz ❱ { .. } = bruh;
1610/// if let ❰ CONST ❱ = 42 {}
1611/// ```
1612///
1613/// [Reference](https://doc.rust-lang.org/reference/patterns.html#path-patterns)
1614#[derive(Debug, Clone, PartialEq, Eq, Hash)] 859#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1615pub struct PathPat { 860pub struct RefExpr {
1616 pub(crate) syntax: SyntaxNode, 861 pub(crate) syntax: SyntaxNode,
1617} 862}
1618impl PathPat { 863impl ast::AttrsOwner for RefExpr {}
1619 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 864impl RefExpr {
865 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
866 pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) }
867 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
868 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
869 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1620} 870}
1621/// Slice pattern.
1622///
1623/// ```
1624/// let ❰ [foo, bar, baz] ❱ = [1, 2, 3];
1625/// ```
1626///
1627/// [Reference](https://doc.rust-lang.org/reference/patterns.html#slice-patterns)
1628#[derive(Debug, Clone, PartialEq, Eq, Hash)] 871#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1629pub struct SlicePat { 872pub struct ReturnExpr {
1630 pub(crate) syntax: SyntaxNode, 873 pub(crate) syntax: SyntaxNode,
1631} 874}
1632impl SlicePat { 875impl ast::AttrsOwner for ReturnExpr {}
1633 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 876impl ReturnExpr {
1634 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 877 pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) }
1635 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 878 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1636} 879}
1637/// Range pattern.
1638///
1639/// ```
1640/// match foo {
1641/// ❰ 0..42 ❱ => {}
1642/// ❰ 0..=42 ❱ => {}
1643/// }
1644/// ```
1645///
1646/// [Reference](https://doc.rust-lang.org/reference/patterns.html#range-patterns)
1647#[derive(Debug, Clone, PartialEq, Eq, Hash)] 880#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1648pub struct RangePat { 881pub struct TryExpr {
1649 pub(crate) syntax: SyntaxNode, 882 pub(crate) syntax: SyntaxNode,
1650} 883}
1651impl RangePat {} 884impl ast::AttrsOwner for TryExpr {}
1652/// Literal pattern. 885impl TryExpr {
1653/// Includes only bool, number, char, and string literals. 886 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1654/// 887 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1655/// ``` 888}
1656/// match foo {
1657/// Number(❰ 42 ❱) => {}
1658/// String(❰ "42" ❱) => {}
1659/// Bool(❰ true ❱) => {}
1660/// }
1661/// ```
1662///
1663/// [Reference](https://doc.rust-lang.org/reference/patterns.html#literal-patterns)
1664#[derive(Debug, Clone, PartialEq, Eq, Hash)] 889#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1665pub struct LiteralPat { 890pub struct TupleExpr {
1666 pub(crate) syntax: SyntaxNode, 891 pub(crate) syntax: SyntaxNode,
1667} 892}
1668impl LiteralPat { 893impl ast::AttrsOwner for TupleExpr {}
1669 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 894impl TupleExpr {
895 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
896 pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
897 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1670} 898}
1671/// Macro invocation in pattern position.
1672///
1673/// ```
1674/// let ❰ foo!(my custom syntax) ❱ = baz;
1675///
1676/// ```
1677/// [Reference](https://doc.rust-lang.org/reference/macros.html#macro-invocation)
1678#[derive(Debug, Clone, PartialEq, Eq, Hash)] 899#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1679pub struct MacroPat { 900pub struct WhileExpr {
1680 pub(crate) syntax: SyntaxNode, 901 pub(crate) syntax: SyntaxNode,
1681} 902}
1682impl MacroPat { 903impl ast::AttrsOwner for WhileExpr {}
1683 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } 904impl ast::LoopBodyOwner for WhileExpr {}
905impl WhileExpr {
906 pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) }
907 pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) }
1684} 908}
1685/// Record literal pattern.
1686///
1687/// ```
1688/// let ❰ foo::Bar { baz, .. } ❱ = bruh;
1689/// ```
1690///
1691/// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1692#[derive(Debug, Clone, PartialEq, Eq, Hash)] 909#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1693pub struct RecordPat { 910pub struct Label {
1694 pub(crate) syntax: SyntaxNode, 911 pub(crate) syntax: SyntaxNode,
1695} 912}
1696impl RecordPat { 913impl Label {
1697 pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { 914 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
1698 support::child(&self.syntax) 915 support::token(&self.syntax, T![lifetime])
1699 } 916 }
1700 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1701} 917}
1702/// Record literal's field patterns list including enclosing curly braces.
1703///
1704/// ```
1705/// let foo::Bar ❰ { baz, bind @ bruh, .. } ❱ = bruuh;
1706/// ``
1707///
1708/// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1709#[derive(Debug, Clone, PartialEq, Eq, Hash)] 918#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1710pub struct RecordFieldPatList { 919pub struct RecordExprFieldList {
1711 pub(crate) syntax: SyntaxNode, 920 pub(crate) syntax: SyntaxNode,
1712} 921}
1713impl RecordFieldPatList { 922impl ast::AttrsOwner for RecordExprFieldList {}
923impl RecordExprFieldList {
1714 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 924 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1715 pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } 925 pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) }
1716 pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> {
1717 support::children(&self.syntax)
1718 }
1719 pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) }
1720 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } 926 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
927 pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) }
1721 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 928 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1722} 929}
1723/// Record literal's field pattern. 930#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1724/// Note: record literal can also match tuple structs. 931pub struct RecordExprField {
1725///
1726/// ```
1727/// let Foo { ❰ bar: _ ❱ } = baz;
1728/// let TupleStruct { ❰ 0: _ ❱ } = bruh;
1729/// ```
1730///
1731/// [Reference](https://doc.rust-lang.org/reference/patterns.html#struct-patterns)
1732#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1733pub struct RecordFieldPat {
1734 pub(crate) syntax: SyntaxNode, 932 pub(crate) syntax: SyntaxNode,
1735} 933}
1736impl ast::AttrsOwner for RecordFieldPat {} 934impl ast::AttrsOwner for RecordExprField {}
1737impl RecordFieldPat { 935impl RecordExprField {
1738 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 936 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
1739 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } 937 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
1740 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 938 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1741} 939}
1742/// Tuple struct literal pattern.
1743///
1744/// ```
1745/// let ❰ foo::Bar(baz, bruh) ❱ = bruuh;
1746/// ```
1747///
1748/// [Reference](https://doc.rust-lang.org/reference/patterns.html#tuple-struct-patterns)
1749#[derive(Debug, Clone, PartialEq, Eq, Hash)] 940#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1750pub struct TupleStructPat { 941pub struct ArgList {
1751 pub(crate) syntax: SyntaxNode, 942 pub(crate) syntax: SyntaxNode,
1752} 943}
1753impl TupleStructPat { 944impl ArgList {
1754 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1755 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 945 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1756 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 946 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
1757 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 947 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
1758} 948}
1759/// Tuple pattern.
1760/// Note: this doesn't include tuple structs (see `TupleStructPat`)
1761///
1762/// ```
1763/// let ❰ (foo, bar, .., baz) ❱ = bruh;
1764/// ```
1765///
1766/// [Reference](https://doc.rust-lang.org/reference/patterns.html#tuple-patterns)
1767#[derive(Debug, Clone, PartialEq, Eq, Hash)] 949#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1768pub struct TuplePat { 950pub struct Condition {
1769 pub(crate) syntax: SyntaxNode, 951 pub(crate) syntax: SyntaxNode,
1770} 952}
1771impl TuplePat { 953impl Condition {
1772 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 954 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) }
1773 pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } 955 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1774 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 956 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
957 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1775} 958}
1776/// Visibility.
1777///
1778/// ```
1779/// ❰ pub mod ❱ foo;
1780/// ❰ pub(crate) ❱ struct Bar;
1781/// ❰ pub(self) ❱ enum Baz {}
1782/// ❰ pub(super) ❱ fn bruh() {}
1783/// ❰ pub(in bruuh::bruuuh) ❱ type T = u64;
1784/// ```
1785///
1786/// [Reference](https://doc.rust-lang.org/reference/visibility-and-privacy.html)
1787#[derive(Debug, Clone, PartialEq, Eq, Hash)] 959#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1788pub struct Visibility { 960pub struct MatchArmList {
1789 pub(crate) syntax: SyntaxNode, 961 pub(crate) syntax: SyntaxNode,
1790} 962}
1791impl Visibility { 963impl ast::AttrsOwner for MatchArmList {}
1792 pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } 964impl MatchArmList {
1793 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } 965 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1794 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 966 pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) }
1795 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } 967 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1796} 968}
1797/// Single identifier.
1798/// Note(@matklad): `Name` is for things that install a new name into the scope,
1799/// `NameRef` is a usage of a name. Most of the time, this definition/reference
1800/// distinction can be determined purely syntactically, ie in
1801/// ```
1802/// fn foo() { foo() }
1803/// ```
1804/// the first foo is `Name`, the second one is `NameRef`.
1805/// The notable exception are patterns, where in
1806/// ``
1807/// let x = 92
1808/// ```
1809/// `x` can be semantically either a name or a name ref, depeding on
1810/// wether there's an `x` constant in scope.
1811/// We use `Name` for patterns, and disambiguate semantically (see `NameClass` in ide_db).
1812///
1813/// ```
1814/// let ❰ foo ❱ = bar;
1815/// struct ❰ Baz ❱;
1816/// fn ❰ bruh ❱() {}
1817/// ```
1818///
1819/// [Reference](https://doc.rust-lang.org/reference/identifiers.html)
1820#[derive(Debug, Clone, PartialEq, Eq, Hash)] 969#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1821pub struct Name { 970pub struct MatchArm {
1822 pub(crate) syntax: SyntaxNode, 971 pub(crate) syntax: SyntaxNode,
1823} 972}
1824impl Name { 973impl ast::AttrsOwner for MatchArm {}
1825 pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } 974impl MatchArm {
1826} 975 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
1827/// Reference to a name. 976 pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) }
1828/// See the explanation on the difference between `Name` and `NameRef` 977 pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) }
1829/// in `Name` ast node docs. 978 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1830/// 979 pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) }
1831/// ```
1832/// let foo = ❰ bar ❱(❰ Baz(❰ bruh ❱) ❱;
1833/// ```
1834///
1835/// [Reference](https://doc.rust-lang.org/reference/identifiers.html)
1836#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1837pub struct NameRef {
1838 pub(crate) syntax: SyntaxNode,
1839} 980}
1840impl NameRef {}
1841/// Macro call.
1842/// Includes all of its attributes and doc comments.
1843///
1844/// ```
1845/// ❰
1846/// /// Docs
1847/// #[attr]
1848/// macro_rules! foo { // macro rules is also a macro call
1849/// ($bar: tt) => {}
1850/// }
1851/// ❱
1852///
1853/// // semicolon is a part of `MacroCall` when it is used in item positions
1854/// ❰ foo!(); ❱
1855///
1856/// fn main() {
1857/// ❰ foo!() ❱; // macro call in expression positions doesn't include the semi
1858/// }
1859/// ```
1860///
1861/// [Reference](https://doc.rust-lang.org/reference/macros.html)
1862#[derive(Debug, Clone, PartialEq, Eq, Hash)] 981#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1863pub struct MacroCall { 982pub struct MatchGuard {
1864 pub(crate) syntax: SyntaxNode, 983 pub(crate) syntax: SyntaxNode,
1865} 984}
1866impl ast::NameOwner for MacroCall {} 985impl MatchGuard {
1867impl ast::AttrsOwner for MacroCall {} 986 pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) }
1868impl ast::DocCommentsOwner for MacroCall {} 987 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1869impl MacroCall {
1870 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
1871 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1872 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
1873 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1874} 988}
1875/// Attribute.
1876///
1877/// ```
1878/// ❰ #![inner_attr] ❱
1879///
1880/// ❰ #[attr] ❱
1881/// ❰ #[foo = "bar"] ❱
1882/// ❰ #[baz(bruh::bruuh = "42")] ❱
1883/// struct Foo;
1884/// ```
1885///
1886/// [Reference](https://doc.rust-lang.org/reference/attributes.html)
1887#[derive(Debug, Clone, PartialEq, Eq, Hash)] 989#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1888pub struct Attr { 990pub struct ArrayType {
1889 pub(crate) syntax: SyntaxNode, 991 pub(crate) syntax: SyntaxNode,
1890} 992}
1891impl Attr { 993impl ArrayType {
1892 pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) }
1893 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
1894 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } 994 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
1895 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 995 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1896 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 996 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
1897 pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } 997 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1898 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } 998 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
1899} 999}
1900/// Stores a list of lexer tokens and other `TokenTree`s.
1901/// It appears in attributes, macro_rules and macro call (foo!)
1902///
1903/// ```
1904/// macro_call! ❰ { my syntax here } ❱;
1905/// ```
1906///
1907/// [Reference](https://doc.rust-lang.org/reference/macros.html)
1908#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1000#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1909pub struct TokenTree { 1001pub struct DynTraitType {
1910 pub(crate) syntax: SyntaxNode,
1911}
1912impl TokenTree {}
1913/// Generic lifetime, type and constants parameters list **declaration**.
1914///
1915/// ```
1916/// fn foo❰ <'a, 'b, T, U, const BAR: u64> ❱() {}
1917///
1918/// struct Baz❰ <T> ❱(T);
1919///
1920/// impl❰ <T> ❱ Bruh<T> {}
1921///
1922/// type Bruuh = for❰ <'a> ❱ fn(&'a str) -> &'a str;
1923/// ```
1924///
1925/// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1926#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1927pub struct TypeParamList {
1928 pub(crate) syntax: SyntaxNode, 1002 pub(crate) syntax: SyntaxNode,
1929} 1003}
1930impl TypeParamList { 1004impl DynTraitType {
1931 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } 1005 pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) }
1932 pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } 1006 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
1933 pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) }
1934 pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) }
1935 pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) }
1936 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
1937} 1007}
1938/// Single type parameter **declaration**.
1939///
1940/// ```
1941/// fn foo<❰ K ❱, ❰ I ❱, ❰ E: Debug ❱, ❰ V = DefaultType ❱>() {}
1942/// ```
1943///
1944/// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1945#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1008#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1946pub struct TypeParam { 1009pub struct FnPtrType {
1947 pub(crate) syntax: SyntaxNode, 1010 pub(crate) syntax: SyntaxNode,
1948} 1011}
1949impl ast::NameOwner for TypeParam {} 1012impl FnPtrType {
1950impl ast::AttrsOwner for TypeParam {} 1013 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
1951impl ast::TypeBoundsOwner for TypeParam {} 1014 pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) }
1952impl TypeParam { 1015 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
1953 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1016 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) }
1954 pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1017 pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) }
1018 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
1019 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
1955} 1020}
1956/// Const generic parameter **declaration**.
1957/// ```
1958/// fn foo<T, U, ❰ const BAR: usize ❱, ❰ const BAZ: bool ❱>() {}
1959/// ```
1960///
1961/// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md#declaring-a-const-parameter)
1962#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1021#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1963pub struct ConstParam { 1022pub struct ForType {
1964 pub(crate) syntax: SyntaxNode, 1023 pub(crate) syntax: SyntaxNode,
1965} 1024}
1966impl ast::NameOwner for ConstParam {} 1025impl ForType {
1967impl ast::AttrsOwner for ConstParam {} 1026 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
1968impl ast::TypeAscriptionOwner for ConstParam {} 1027 pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) }
1969impl ConstParam { 1028 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
1970 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
1971 pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) }
1972} 1029}
1973/// Lifetime parameter **declaration**.
1974///
1975/// ```
1976/// fn foo<❰ 'a ❱, ❰ 'b ❱, V, G, D>(bar: &'a str, baz: &'b mut str) {}
1977/// ```
1978///
1979/// [Reference](https://doc.rust-lang.org/reference/items/generics.html)
1980#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1030#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1981pub struct LifetimeParam { 1031pub struct ImplTraitType {
1982 pub(crate) syntax: SyntaxNode, 1032 pub(crate) syntax: SyntaxNode,
1983} 1033}
1984impl ast::AttrsOwner for LifetimeParam {} 1034impl ImplTraitType {
1985impl LifetimeParam { 1035 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
1986 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1036 pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) }
1987 support::token(&self.syntax, T![lifetime])
1988 }
1989}
1990/// Type bound declaration clause.
1991///
1992/// ```
1993/// fn foo<T: ❰ ?Sized ❱ + ❰ Debug ❱>() {}
1994///
1995/// trait Bar<T>
1996/// where
1997/// T: ❰ Send ❱ + ❰ Sync ❱
1998/// {
1999/// type Baz: ❰ !Sync ❱ + ❰ Debug ❱ + ❰ ?const Add ❱;
2000/// }
2001/// ```
2002///
2003/// [Reference](https://doc.rust-lang.org/reference/trait-bounds.html)
2004#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2005pub struct TypeBound {
2006 pub(crate) syntax: SyntaxNode,
2007} 1037}
2008impl TypeBound {
2009 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2010 support::token(&self.syntax, T![lifetime])
2011 }
2012 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
2013 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2014}
2015/// Type bounds list.
2016///
2017/// ```
2018///
2019/// fn foo<T: ❰ ?Sized + Debug ❱>() {}
2020///
2021/// trait Bar<T>
2022/// where
2023/// T: ❰ Send + Sync ❱
2024/// {
2025/// type Baz: ❰ !Sync + Debug ❱;
2026/// }
2027/// ```
2028///
2029/// [Reference](https://doc.rust-lang.org/reference/trait-bounds.html)
2030#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1038#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2031pub struct TypeBoundList { 1039pub struct InferType {
2032 pub(crate) syntax: SyntaxNode, 1040 pub(crate) syntax: SyntaxNode,
2033} 1041}
2034impl TypeBoundList { 1042impl InferType {
2035 pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } 1043 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
2036} 1044}
2037/// Single where predicate.
2038///
2039/// ```
2040/// trait Foo<'a, 'b, T>
2041/// where
2042/// ❰ 'a: 'b ❱,
2043/// ❰ T: IntoIterator ❱,
2044/// ❰ for<'c> <T as IntoIterator>::Item: Bar<'c> ❱
2045/// {}
2046/// ```
2047///
2048/// [Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses)
2049#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1045#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2050pub struct WherePred { 1046pub struct NeverType {
2051 pub(crate) syntax: SyntaxNode, 1047 pub(crate) syntax: SyntaxNode,
2052} 1048}
2053impl ast::TypeBoundsOwner for WherePred {} 1049impl NeverType {
2054impl WherePred { 1050 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
2055 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
2056 pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) }
2057 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2058 support::token(&self.syntax, T![lifetime])
2059 }
2060 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2061} 1051}
2062/// Where clause.
2063///
2064/// ```
2065/// trait Foo<'a, T> ❰ where 'a: 'static, T: Debug ❱ {}
2066///
2067/// ```
2068///
2069/// [Reference](https://doc.rust-lang.org/reference/items/generics.html#where-clauses)
2070#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1052#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2071pub struct WhereClause { 1053pub struct ParenType {
2072 pub(crate) syntax: SyntaxNode, 1054 pub(crate) syntax: SyntaxNode,
2073} 1055}
2074impl WhereClause { 1056impl ParenType {
2075 pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } 1057 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2076 pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } 1058 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
2077} 1059 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2078/// Abi declaration.
2079/// Note: the abi string is optional.
2080///
2081/// ```
2082/// ❰ extern "C" ❱ {
2083/// fn foo() {}
2084/// }
2085///
2086/// type Bar = ❰ extern ❱ fn() -> u32;
2087///
2088/// type Baz = ❰ extern r#"stdcall"# ❱ fn() -> bool;
2089/// ```
2090///
2091/// - [Extern blocks reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2092/// - [FFI function pointers reference](https://doc.rust-lang.org/reference/items/functions.html#functions)
2093#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2094pub struct Abi {
2095 pub(crate) syntax: SyntaxNode,
2096} 1060}
2097impl Abi {}
2098/// Expression statement.
2099///
2100/// ```
2101/// ❰ 42; ❱
2102/// ❰ foo(); ❱
2103/// ❰ (); ❱
2104/// ❰ {}; ❱
2105///
2106/// // constructions with trailing curly brace can omit the semicolon
2107/// // but only when there are satements immediately after them (this is important!)
2108/// ❰ if bool_cond { } ❱
2109/// ❰ loop {} ❱
2110/// ❰ somestatment; ❱
2111/// ```
2112///
2113/// [Reference](https://doc.rust-lang.org/reference/statements.html)
2114#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1061#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2115pub struct ExprStmt { 1062pub struct PtrType {
2116 pub(crate) syntax: SyntaxNode, 1063 pub(crate) syntax: SyntaxNode,
2117} 1064}
2118impl ast::AttrsOwner for ExprStmt {} 1065impl PtrType {
2119impl ExprStmt { 1066 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) }
2120 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1067 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
2121 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 1068 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1069 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
2122} 1070}
2123/// Let statement.
2124///
2125/// ```
2126/// ❰ #[attr] let foo; ❱
2127/// ❰ let bar: u64; ❱
2128/// ❰ let baz = 42; ❱
2129/// ❰ let bruh: bool = true; ❱
2130/// ```
2131///
2132/// [Reference](https://doc.rust-lang.org/reference/statements.html#let-statements)
2133#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1071#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2134pub struct LetStmt { 1072pub struct RefType {
2135 pub(crate) syntax: SyntaxNode, 1073 pub(crate) syntax: SyntaxNode,
2136} 1074}
2137impl ast::AttrsOwner for LetStmt {} 1075impl RefType {
2138impl ast::TypeAscriptionOwner for LetStmt {} 1076 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2139impl LetStmt { 1077 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2140 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 1078 support::token(&self.syntax, T![lifetime])
2141 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1079 }
2142 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1080 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2143 pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } 1081 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
2144 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
2145} 1082}
2146/// Condition of `if` or `while` expression.
2147///
2148/// ```
2149/// if ❰ true ❱ {}
2150/// if ❰ let Pat(foo) = bar ❱ {}
2151///
2152/// while ❰ true ❱ {}
2153/// while ❰ let Pat(baz) = bruh ❱ {}
2154/// ```
2155///
2156/// [If expression reference](https://doc.rust-lang.org/reference/expressions/if-expr.html)
2157/// [While expression reference](https://doc.rust-lang.org/reference/expressions/loop-expr.html#predicate-loops)
2158#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1083#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2159pub struct Condition { 1084pub struct SliceType {
2160 pub(crate) syntax: SyntaxNode, 1085 pub(crate) syntax: SyntaxNode,
2161} 1086}
2162impl Condition { 1087impl SliceType {
2163 pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } 1088 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
2164 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1089 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
2165 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1090 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
2166 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
2167} 1091}
2168/// Parameter list **declaration**.
2169///
2170/// ```
2171/// fn foo❰ (a: u32, b: bool) ❱ -> u32 {}
2172/// let bar = ❰ |a, b| ❱ {};
2173///
2174/// impl Baz {
2175/// fn bruh❰ (&self, a: u32) ❱ {}
2176/// }
2177/// ```
2178///
2179/// [Reference](https://doc.rust-lang.org/reference/items/functions.html)ocs to codegen script
2180#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1092#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2181pub struct ParamList { 1093pub struct TupleType {
2182 pub(crate) syntax: SyntaxNode, 1094 pub(crate) syntax: SyntaxNode,
2183} 1095}
2184impl ParamList { 1096impl TupleType {
2185 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 1097 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2186 pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } 1098 pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) }
2187 pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) }
2188 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1099 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2189} 1100}
2190/// Self parameter **declaration**.
2191///
2192/// ```
2193/// impl Bruh {
2194/// fn foo(❰ self ❱) {}
2195/// fn bar(❰ &self ❱) {}
2196/// fn baz(❰ &mut self ❱) {}
2197/// fn blah<'a>(❰ &'a self ❱) {}
2198/// fn blin(❰ self: Box<Self> ❱) {}
2199/// }
2200/// ```
2201///
2202/// [Reference](https://doc.rust-lang.org/reference/items/functions.html)
2203#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1101#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2204pub struct SelfParam { 1102pub struct TypeBound {
2205 pub(crate) syntax: SyntaxNode, 1103 pub(crate) syntax: SyntaxNode,
2206} 1104}
2207impl ast::TypeAscriptionOwner for SelfParam {} 1105impl TypeBound {
2208impl ast::AttrsOwner for SelfParam {}
2209impl SelfParam {
2210 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2211 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2212 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1106 pub fn lifetime_token(&self) -> Option<SyntaxToken> {
2213 support::token(&self.syntax, T![lifetime]) 1107 support::token(&self.syntax, T![lifetime])
2214 } 1108 }
2215 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } 1109 pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) }
1110 pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) }
2216} 1111}
2217/// Parameter **declaration**.
2218///
2219/// ```
2220/// fn foo(❰ #[attr] Pat(bar): Pat(u32) ❱, ❰ #[attr] _: bool ❱) {}
2221///
2222/// extern "C" {
2223/// fn bar(❰ baz: u32 ❱, ❰ ... ❱) -> u32;
2224/// }
2225/// ```
2226///
2227/// [Reference](https://doc.rust-lang.org/reference/items/functions.html)
2228#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1112#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2229pub struct Param { 1113pub struct IdentPat {
2230 pub(crate) syntax: SyntaxNode, 1114 pub(crate) syntax: SyntaxNode,
2231} 1115}
2232impl ast::TypeAscriptionOwner for Param {} 1116impl ast::AttrsOwner for IdentPat {}
2233impl ast::AttrsOwner for Param {} 1117impl ast::NameOwner for IdentPat {}
2234impl Param { 1118impl IdentPat {
1119 pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) }
1120 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
1121 pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) }
2235 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } 1122 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2236 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) }
2237} 1123}
2238/// Use declaration. 1124#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2239/// 1125pub struct BoxPat {
2240/// ```
2241/// ❰ #[attr] pub use foo; ❱
2242/// ❰ use bar as baz; ❱
2243/// ❰ use bruh::{self, bruuh}; ❱
2244/// ❰ use { blin::blen, blah::* };
2245/// ```
2246///
2247/// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2248#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2249pub struct UseItem {
2250 pub(crate) syntax: SyntaxNode, 1126 pub(crate) syntax: SyntaxNode,
2251} 1127}
2252impl ast::AttrsOwner for UseItem {} 1128impl BoxPat {
2253impl ast::VisibilityOwner for UseItem {} 1129 pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) }
2254impl UseItem { 1130 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2255 pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) }
2256 pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) }
2257} 1131}
2258/// Use tree.
2259///
2260/// ```
2261/// pub use ❰ foo::❰ * ❱ ❱;
2262/// use ❰ bar as baz ❱;
2263/// use ❰ bruh::bruuh::{ ❰ self ❱, ❰ blin ❱ } ❱;
2264/// use ❰ { ❰ blin::blen ❱ } ❱
2265/// ```
2266///
2267/// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2268#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1132#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2269pub struct UseTree { 1133pub struct RestPat {
2270 pub(crate) syntax: SyntaxNode, 1134 pub(crate) syntax: SyntaxNode,
2271} 1135}
2272impl UseTree { 1136impl RestPat {
2273 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } 1137 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
2274 pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } 1138}
2275 pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } 1139#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2276 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } 1140pub struct LiteralPat {
2277}
2278/// Item alias.
2279/// Note: this is not the type alias.
2280///
2281/// ```
2282/// use foo ❰ as bar ❱;
2283/// use baz::{bruh ❰ as _ ❱};
2284/// extern crate bruuh ❰ as blin ❱;
2285/// ```
2286///
2287/// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2288#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2289pub struct Alias {
2290 pub(crate) syntax: SyntaxNode, 1141 pub(crate) syntax: SyntaxNode,
2291} 1142}
2292impl ast::NameOwner for Alias {} 1143impl LiteralPat {
2293impl Alias { 1144 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) }
2294 pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) }
2295} 1145}
2296/// Sublist of use trees.
2297///
2298/// ```
2299/// use bruh::bruuh::❰ { ❰ self ❱, ❰ blin ❱ } ❱;
2300/// use ❰ { blin::blen::❰ {} ❱ } ❱
2301/// ```
2302///
2303/// [Reference](https://doc.rust-lang.org/reference/items/use-declarations.html)
2304#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1146#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2305pub struct UseTreeList { 1147pub struct MacroPat {
2306 pub(crate) syntax: SyntaxNode, 1148 pub(crate) syntax: SyntaxNode,
2307} 1149}
2308impl UseTreeList { 1150impl MacroPat {
2309 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 1151 pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) }
2310 pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) }
2311 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2312} 1152}
2313/// Extern crate item.
2314///
2315/// ```
2316/// ❰ #[attr] pub extern crate foo; ❱
2317/// ❰ extern crate self as bar; ❱
2318/// ```
2319///
2320/// [Reference](https://doc.rust-lang.org/reference/items/extern-crates.html)
2321#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1153#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2322pub struct ExternCrateItem { 1154pub struct OrPat {
2323 pub(crate) syntax: SyntaxNode, 1155 pub(crate) syntax: SyntaxNode,
2324} 1156}
2325impl ast::AttrsOwner for ExternCrateItem {} 1157impl OrPat {
2326impl ast::VisibilityOwner for ExternCrateItem {} 1158 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
2327impl ExternCrateItem {
2328 pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) }
2329 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
2330 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2331 pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) }
2332} 1159}
2333/// Call site arguments list.
2334///
2335/// ```
2336/// foo::<T, U>❰ (42, true) ❱;
2337/// ```
2338///
2339/// [Reference](https://doc.rust-lang.org/reference/expressions/call-expr.html)
2340#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1160#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2341pub struct ArgList { 1161pub struct ParenPat {
2342 pub(crate) syntax: SyntaxNode, 1162 pub(crate) syntax: SyntaxNode,
2343} 1163}
2344impl ArgList { 1164impl ParenPat {
2345 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } 1165 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2346 pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } 1166 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2347 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } 1167 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2348} 1168}
2349/// Path to a symbol. Includes single identifier names and elaborate paths with
2350/// generic parameters.
2351///
2352/// ```
2353/// (0..10).❰ ❰ collect ❱ ::<Vec<_>> ❱();
2354/// ❰ ❰ ❰ Vec ❱ ::<u8> ❱ ::with_capacity ❱(1024);
2355/// ❰ ❰ <❰ Foo ❱ as ❰ ❰ bar ❱ ::Bar ❱> ❱ ::baz ❱();
2356/// ❰ ❰ <❰ bruh ❱> ❱ ::bruuh ❱();
2357/// ```
2358///
2359/// [Reference](https://doc.rust-lang.org/reference/paths.html)
2360#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1169#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2361pub struct Path { 1170pub struct PathPat {
2362 pub(crate) syntax: SyntaxNode, 1171 pub(crate) syntax: SyntaxNode,
2363} 1172}
2364impl Path { 1173impl PathPat {
2365 pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } 1174 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2366 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2367 pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) }
2368} 1175}
2369/// Segment of the path to a symbol.
2370/// Only path segment of an absolute path holds the `::` token,
2371/// all other `::` tokens that connect path segments reside under `Path` itself.`
2372///
2373/// ```
2374/// (0..10).❰ collect ❱ :: ❰ <Vec<_>> ❱();
2375/// ❰ Vec ❱ :: ❰ <u8> ❱ :: ❰ with_capacity ❱(1024);
2376/// ❰ <❰ Foo ❱ as ❰ bar ❱ :: ❰ Bar ❱> ❱ :: ❰ baz ❱();
2377/// ❰ <❰ bruh ❱> ❱ :: ❰ bruuh ❱();
2378///
2379/// // Note that only in this case `::` token is inlcuded:
2380/// ❰ ::foo ❱;
2381/// ```
2382///
2383/// [Reference](https://doc.rust-lang.org/reference/paths.html)
2384#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1176#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2385pub struct PathSegment { 1177pub struct WildcardPat {
2386 pub(crate) syntax: SyntaxNode, 1178 pub(crate) syntax: SyntaxNode,
2387} 1179}
2388impl PathSegment { 1180impl WildcardPat {
2389 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } 1181 pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) }
2390 pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) }
2391 pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) }
2392 pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) }
2393 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2394 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2395 pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) }
2396 pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) }
2397 pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) }
2398 pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) }
2399 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2400}
2401/// List of type arguments that are passed at generic instantiation site.
2402///
2403/// ```
2404/// type _ = Foo ❰ ::<'a, u64, Item = Bar, 42, {true}> ❱::Bar;
2405///
2406/// Vec❰ ::<bool> ❱::();
2407/// ```
2408///
2409/// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2410#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2411pub struct TypeArgList {
2412 pub(crate) syntax: SyntaxNode,
2413}
2414impl TypeArgList {
2415 pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) }
2416 pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) }
2417 pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) }
2418 pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) }
2419 pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) }
2420 pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) }
2421 pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) }
2422 pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) }
2423} 1182}
2424/// Type argument that is passed at generic instantiation site.
2425///
2426/// ```
2427/// type _ = Foo::<'a, ❰ u64 ❱, ❰ bool ❱, Item = Bar, 42>::Baz;
2428/// ```
2429///
2430/// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2431#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1183#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2432pub struct TypeArg { 1184pub struct RangePat {
2433 pub(crate) syntax: SyntaxNode, 1185 pub(crate) syntax: SyntaxNode,
2434} 1186}
2435impl TypeArg { 1187impl RangePat {}
2436 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
2437}
2438/// Associated type argument that is passed at generic instantiation site.
2439/// ```
2440/// type Foo = Bar::<'a, u64, bool, ❰ Item = Baz ❱, 42>::Bruh;
2441///
2442/// trait Bruh<T>: Iterator<❰ Item: Debug ❱> {}
2443/// ```
2444///
2445#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1188#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2446pub struct AssocTypeArg { 1189pub struct RecordPat {
2447 pub(crate) syntax: SyntaxNode, 1190 pub(crate) syntax: SyntaxNode,
2448} 1191}
2449impl ast::TypeBoundsOwner for AssocTypeArg {} 1192impl RecordPat {
2450impl AssocTypeArg { 1193 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2451 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } 1194 pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> {
2452 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 1195 support::child(&self.syntax)
2453 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 1196 }
2454} 1197}
2455/// Lifetime argument that is passed at generic instantiation site.
2456///
2457/// ```
2458/// fn foo<'a>(s: &'a str) {
2459/// bar::<❰ 'a ❱>(s);
2460/// }
2461/// ```
2462///
2463/// [Reference](https://doc.rust-lang.org/reference/paths.html#paths-in-expressions)
2464#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1198#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2465pub struct LifetimeArg { 1199pub struct RefPat {
2466 pub(crate) syntax: SyntaxNode, 1200 pub(crate) syntax: SyntaxNode,
2467} 1201}
2468impl LifetimeArg { 1202impl RefPat {
2469 pub fn lifetime_token(&self) -> Option<SyntaxToken> { 1203 pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) }
2470 support::token(&self.syntax, T![lifetime]) 1204 pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) }
2471 } 1205 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2472} 1206}
2473/// Constant value argument that is passed at generic instantiation site.
2474///
2475/// ```
2476/// foo::<u32, ❰ { true } ❱>();
2477///
2478/// bar::<❰ { 2 + 2} ❱>();
2479/// ```
2480///
2481/// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md#declaring-a-const-parameter)
2482#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1207#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2483pub struct ConstArg { 1208pub struct SlicePat {
2484 pub(crate) syntax: SyntaxNode, 1209 pub(crate) syntax: SyntaxNode,
2485} 1210}
2486impl ConstArg { 1211impl SlicePat {
2487 pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } 1212 pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
2488 pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } 1213 pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1214 pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
2489} 1215}
2490/// FIXME: (@edwin0cheng) Remove it to use ItemList instead
2491/// https://github.com/rust-analyzer/rust-analyzer/pull/4083#discussion_r422666243
2492///
2493/// [Reference](https://doc.rust-lang.org/reference/macros.html)
2494#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1216#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2495pub struct MacroItems { 1217pub struct TuplePat {
2496 pub(crate) syntax: SyntaxNode, 1218 pub(crate) syntax: SyntaxNode,
2497} 1219}
2498impl ast::ModuleItemOwner for MacroItems {} 1220impl TuplePat {
2499impl MacroItems {} 1221 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
2500/// FIXME: (@edwin0cheng) add some documentation here. As per the writing 1222 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
2501/// of this comment this ast node is not used. 1223 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2502/// 1224}
2503/// ```
2504/// // FIXME: example here
2505/// ```
2506///
2507/// [Reference](https://doc.rust-lang.org/reference/macros.html)
2508#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1225#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2509pub struct MacroStmts { 1226pub struct TupleStructPat {
2510 pub(crate) syntax: SyntaxNode, 1227 pub(crate) syntax: SyntaxNode,
2511} 1228}
2512impl MacroStmts { 1229impl TupleStructPat {
2513 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } 1230 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2514 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 1231 pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
1232 pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
1233 pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
2515} 1234}
2516/// List of items in an extern block.
2517///
2518/// ```
2519/// extern "C" ❰
2520/// {
2521/// fn foo();
2522/// static var: u32;
2523/// }
2524/// ❱
2525/// ```
2526///
2527/// [Reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2528#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1235#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2529pub struct ExternItemList { 1236pub struct RecordPatFieldList {
2530 pub(crate) syntax: SyntaxNode, 1237 pub(crate) syntax: SyntaxNode,
2531} 1238}
2532impl ast::ModuleItemOwner for ExternItemList {} 1239impl RecordPatFieldList {
2533impl ExternItemList {
2534 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 1240 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
2535 pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } 1241 pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) }
1242 pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) }
2536 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 1243 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
2537} 1244}
2538/// Extern block.
2539///
2540/// ```
2541/// ❰
2542/// extern "C" {
2543/// fn foo();
2544/// }
2545/// ❱
2546///
2547/// ```
2548///
2549/// [Reference](https://doc.rust-lang.org/reference/items/external-blocks.html)
2550#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1245#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2551pub struct ExternBlock { 1246pub struct RecordPatField {
2552 pub(crate) syntax: SyntaxNode, 1247 pub(crate) syntax: SyntaxNode,
2553} 1248}
2554impl ExternBlock { 1249impl ast::AttrsOwner for RecordPatField {}
2555 pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } 1250impl RecordPatField {
2556 pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } 1251 pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) }
2557} 1252 pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) }
2558/// Meta item in an attribute. 1253 pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) }
2559///
2560/// ```
2561/// #[❰ bar::baz = "42" ❱]
2562/// #[❰ bruh(bruuh("true")) ❱]
2563/// struct Foo;
2564/// ```
2565///
2566/// [Reference](https://doc.rust-lang.org/reference/attributes.html?highlight=meta,item#meta-item-attribute-syntax)
2567#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2568pub struct MetaItem {
2569 pub(crate) syntax: SyntaxNode,
2570}
2571impl MetaItem {
2572 pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
2573 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
2574 pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) }
2575 pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) }
2576}
2577/// Macro 2.0 definition.
2578/// Their syntax is still WIP by rustc team...
2579/// ```
2580/// ❰
2581/// macro foo { }
2582/// ❱
2583/// ```
2584///
2585/// [RFC](https://github.com/rust-lang/rfcs/blob/master/text/1584-macros.md)
2586#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2587pub struct MacroDef {
2588 pub(crate) syntax: SyntaxNode,
2589}
2590impl MacroDef {
2591 pub fn name(&self) -> Option<Name> { support::child(&self.syntax) }
2592 pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) }
2593}
2594/// Any kind of nominal type definition.
2595#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2596pub enum NominalDef {
2597 StructDef(StructDef),
2598 EnumDef(EnumDef),
2599 UnionDef(UnionDef),
2600}
2601impl ast::NameOwner for NominalDef {}
2602impl ast::TypeParamsOwner for NominalDef {}
2603impl ast::AttrsOwner for NominalDef {}
2604/// Any kind of **declared** generic parameter
2605#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2606pub enum GenericParam {
2607 LifetimeParam(LifetimeParam),
2608 TypeParam(TypeParam),
2609 ConstParam(ConstParam),
2610} 1254}
2611/// Any kind of generic argument passed at instantiation site
2612#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1255#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2613pub enum GenericArg { 1256pub enum GenericArg {
2614 LifetimeArg(LifetimeArg),
2615 TypeArg(TypeArg), 1257 TypeArg(TypeArg),
2616 ConstArg(ConstArg),
2617 AssocTypeArg(AssocTypeArg), 1258 AssocTypeArg(AssocTypeArg),
1259 LifetimeArg(LifetimeArg),
1260 ConstArg(ConstArg),
2618} 1261}
2619/// Any kind of construct valid in type context
2620#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1262#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2621pub enum TypeRef { 1263pub enum Type {
2622 ParenType(ParenType),
2623 TupleType(TupleType),
2624 NeverType(NeverType),
2625 PathType(PathType),
2626 PointerType(PointerType),
2627 ArrayType(ArrayType), 1264 ArrayType(ArrayType),
2628 SliceType(SliceType), 1265 DynTraitType(DynTraitType),
2629 ReferenceType(ReferenceType), 1266 FnPtrType(FnPtrType),
2630 PlaceholderType(PlaceholderType),
2631 FnPointerType(FnPointerType),
2632 ForType(ForType), 1267 ForType(ForType),
2633 ImplTraitType(ImplTraitType), 1268 ImplTraitType(ImplTraitType),
2634 DynTraitType(DynTraitType), 1269 InferType(InferType),
2635} 1270 NeverType(NeverType),
2636/// Any kind of top-level item that may appear in a module 1271 ParenType(ParenType),
2637#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1272 PathType(PathType),
2638pub enum ModuleItem { 1273 PtrType(PtrType),
2639 StructDef(StructDef), 1274 RefType(RefType),
2640 UnionDef(UnionDef), 1275 SliceType(SliceType),
2641 EnumDef(EnumDef), 1276 TupleType(TupleType),
2642 FnDef(FnDef),
2643 TraitDef(TraitDef),
2644 TypeAliasDef(TypeAliasDef),
2645 ImplDef(ImplDef),
2646 UseItem(UseItem),
2647 ExternCrateItem(ExternCrateItem),
2648 ConstDef(ConstDef),
2649 StaticDef(StaticDef),
2650 Module(Module),
2651 MacroCall(MacroCall),
2652 ExternBlock(ExternBlock),
2653}
2654impl ast::NameOwner for ModuleItem {}
2655impl ast::AttrsOwner for ModuleItem {}
2656impl ast::VisibilityOwner for ModuleItem {}
2657/// Any kind of item that may appear in an impl block
2658///
2659/// // FIXME: impl blocks can also contain MacroCall
2660#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2661pub enum AssocItem {
2662 FnDef(FnDef),
2663 TypeAliasDef(TypeAliasDef),
2664 ConstDef(ConstDef),
2665}
2666impl ast::NameOwner for AssocItem {}
2667impl ast::AttrsOwner for AssocItem {}
2668/// Any kind of item that may appear in an extern block
2669///
2670/// // FIXME: extern blocks can also contain MacroCall
2671#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2672pub enum ExternItem {
2673 FnDef(FnDef),
2674 StaticDef(StaticDef),
2675} 1277}
2676impl ast::NameOwner for ExternItem {}
2677impl ast::AttrsOwner for ExternItem {}
2678impl ast::VisibilityOwner for ExternItem {}
2679/// Any kind of expression
2680#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1278#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2681pub enum Expr { 1279pub enum Expr {
2682 TupleExpr(TupleExpr),
2683 ArrayExpr(ArrayExpr), 1280 ArrayExpr(ArrayExpr),
2684 ParenExpr(ParenExpr), 1281 AwaitExpr(AwaitExpr),
2685 PathExpr(PathExpr), 1282 BinExpr(BinExpr),
2686 LambdaExpr(LambdaExpr),
2687 IfExpr(IfExpr),
2688 LoopExpr(LoopExpr),
2689 ForExpr(ForExpr),
2690 WhileExpr(WhileExpr),
2691 ContinueExpr(ContinueExpr),
2692 BreakExpr(BreakExpr),
2693 Label(Label),
2694 BlockExpr(BlockExpr), 1283 BlockExpr(BlockExpr),
2695 ReturnExpr(ReturnExpr), 1284 BoxExpr(BoxExpr),
2696 MatchExpr(MatchExpr), 1285 BreakExpr(BreakExpr),
2697 RecordLit(RecordLit),
2698 CallExpr(CallExpr), 1286 CallExpr(CallExpr),
1287 CastExpr(CastExpr),
1288 ClosureExpr(ClosureExpr),
1289 ContinueExpr(ContinueExpr),
1290 EffectExpr(EffectExpr),
1291 FieldExpr(FieldExpr),
1292 ForExpr(ForExpr),
1293 IfExpr(IfExpr),
2699 IndexExpr(IndexExpr), 1294 IndexExpr(IndexExpr),
1295 Literal(Literal),
1296 LoopExpr(LoopExpr),
1297 MacroCall(MacroCall),
1298 MatchExpr(MatchExpr),
2700 MethodCallExpr(MethodCallExpr), 1299 MethodCallExpr(MethodCallExpr),
2701 FieldExpr(FieldExpr), 1300 ParenExpr(ParenExpr),
2702 AwaitExpr(AwaitExpr), 1301 PathExpr(PathExpr),
2703 TryExpr(TryExpr),
2704 EffectExpr(EffectExpr),
2705 CastExpr(CastExpr),
2706 RefExpr(RefExpr),
2707 PrefixExpr(PrefixExpr), 1302 PrefixExpr(PrefixExpr),
2708 RangeExpr(RangeExpr), 1303 RangeExpr(RangeExpr),
2709 BinExpr(BinExpr), 1304 RecordExpr(RecordExpr),
2710 Literal(Literal), 1305 RefExpr(RefExpr),
1306 ReturnExpr(ReturnExpr),
1307 TryExpr(TryExpr),
1308 TupleExpr(TupleExpr),
1309 WhileExpr(WhileExpr),
1310}
1311#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1312pub enum Item {
1313 Const(Const),
1314 Enum(Enum),
1315 ExternBlock(ExternBlock),
1316 ExternCrate(ExternCrate),
1317 Fn(Fn),
1318 Impl(Impl),
2711 MacroCall(MacroCall), 1319 MacroCall(MacroCall),
2712 BoxExpr(BoxExpr), 1320 Module(Module),
1321 Static(Static),
1322 Struct(Struct),
1323 Trait(Trait),
1324 TypeAlias(TypeAlias),
1325 Union(Union),
1326 Use(Use),
1327}
1328impl ast::AttrsOwner for Item {}
1329#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1330pub enum Stmt {
1331 ExprStmt(ExprStmt),
1332 Item(Item),
1333 LetStmt(LetStmt),
2713} 1334}
2714impl ast::AttrsOwner for Expr {}
2715/// Any kind of pattern
2716#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1335#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2717pub enum Pat { 1336pub enum Pat {
1337 IdentPat(IdentPat),
1338 BoxPat(BoxPat),
1339 RestPat(RestPat),
1340 LiteralPat(LiteralPat),
1341 MacroPat(MacroPat),
2718 OrPat(OrPat), 1342 OrPat(OrPat),
2719 ParenPat(ParenPat), 1343 ParenPat(ParenPat),
2720 RefPat(RefPat),
2721 BoxPat(BoxPat),
2722 BindPat(BindPat),
2723 PlaceholderPat(PlaceholderPat),
2724 DotDotPat(DotDotPat),
2725 PathPat(PathPat), 1344 PathPat(PathPat),
1345 WildcardPat(WildcardPat),
1346 RangePat(RangePat),
2726 RecordPat(RecordPat), 1347 RecordPat(RecordPat),
2727 TupleStructPat(TupleStructPat), 1348 RefPat(RefPat),
2728 TuplePat(TuplePat),
2729 SlicePat(SlicePat), 1349 SlicePat(SlicePat),
2730 RangePat(RangePat), 1350 TuplePat(TuplePat),
2731 LiteralPat(LiteralPat), 1351 TupleStructPat(TupleStructPat),
2732 MacroPat(MacroPat),
2733} 1352}
2734/// Any kind of pattern that appears directly inside of the curly
2735/// braces of a record pattern
2736#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1353#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2737pub enum RecordInnerPat { 1354pub enum FieldList {
2738 RecordFieldPat(RecordFieldPat), 1355 RecordFieldList(RecordFieldList),
2739 BindPat(BindPat), 1356 TupleFieldList(TupleFieldList),
2740} 1357}
2741/// Any kind of input to an attribute
2742#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1358#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2743pub enum AttrInput { 1359pub enum AdtDef {
2744 Literal(Literal), 1360 Enum(Enum),
2745 TokenTree(TokenTree), 1361 Struct(Struct),
1362 Union(Union),
2746} 1363}
2747/// Any kind of statement 1364impl ast::AttrsOwner for AdtDef {}
2748/// Note: there are no empty statements, these are just represented as 1365impl ast::GenericParamsOwner for AdtDef {}
2749/// bare semicolons without a dedicated statement ast node. 1366impl ast::NameOwner for AdtDef {}
1367impl ast::VisibilityOwner for AdtDef {}
2750#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1368#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2751pub enum Stmt { 1369pub enum AssocItem {
2752 LetStmt(LetStmt), 1370 Const(Const),
2753 ExprStmt(ExprStmt), 1371 Fn(Fn),
1372 MacroCall(MacroCall),
1373 TypeAlias(TypeAlias),
2754} 1374}
2755/// Any kind of fields list (record or tuple field lists) 1375impl ast::AttrsOwner for AssocItem {}
1376impl ast::NameOwner for AssocItem {}
2756#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1377#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2757pub enum FieldDefList { 1378pub enum ExternItem {
2758 RecordFieldDefList(RecordFieldDefList), 1379 Fn(Fn),
2759 TupleFieldDefList(TupleFieldDefList), 1380 MacroCall(MacroCall),
1381 Static(Static),
2760} 1382}
2761impl AstNode for SourceFile { 1383impl ast::AttrsOwner for ExternItem {}
2762 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } 1384impl ast::NameOwner for ExternItem {}
2763 fn cast(syntax: SyntaxNode) -> Option<Self> { 1385#[derive(Debug, Clone, PartialEq, Eq, Hash)]
2764 if Self::can_cast(syntax.kind()) { 1386pub enum GenericParam {
2765 Some(Self { syntax }) 1387 ConstParam(ConstParam),
2766 } else { 1388 LifetimeParam(LifetimeParam),
2767 None 1389 TypeParam(TypeParam),
2768 }
2769 }
2770 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2771} 1390}
2772impl AstNode for FnDef { 1391impl ast::AttrsOwner for GenericParam {}
2773 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF } 1392impl AstNode for Name {
1393 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
2774 fn cast(syntax: SyntaxNode) -> Option<Self> { 1394 fn cast(syntax: SyntaxNode) -> Option<Self> {
2775 if Self::can_cast(syntax.kind()) { 1395 if Self::can_cast(syntax.kind()) {
2776 Some(Self { syntax }) 1396 Some(Self { syntax })
@@ -2780,8 +1400,8 @@ impl AstNode for FnDef {
2780 } 1400 }
2781 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1401 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2782} 1402}
2783impl AstNode for RetType { 1403impl AstNode for NameRef {
2784 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } 1404 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF }
2785 fn cast(syntax: SyntaxNode) -> Option<Self> { 1405 fn cast(syntax: SyntaxNode) -> Option<Self> {
2786 if Self::can_cast(syntax.kind()) { 1406 if Self::can_cast(syntax.kind()) {
2787 Some(Self { syntax }) 1407 Some(Self { syntax })
@@ -2791,8 +1411,8 @@ impl AstNode for RetType {
2791 } 1411 }
2792 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1412 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2793} 1413}
2794impl AstNode for StructDef { 1414impl AstNode for Path {
2795 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } 1415 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH }
2796 fn cast(syntax: SyntaxNode) -> Option<Self> { 1416 fn cast(syntax: SyntaxNode) -> Option<Self> {
2797 if Self::can_cast(syntax.kind()) { 1417 if Self::can_cast(syntax.kind()) {
2798 Some(Self { syntax }) 1418 Some(Self { syntax })
@@ -2802,8 +1422,8 @@ impl AstNode for StructDef {
2802 } 1422 }
2803 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1423 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2804} 1424}
2805impl AstNode for UnionDef { 1425impl AstNode for PathSegment {
2806 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } 1426 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT }
2807 fn cast(syntax: SyntaxNode) -> Option<Self> { 1427 fn cast(syntax: SyntaxNode) -> Option<Self> {
2808 if Self::can_cast(syntax.kind()) { 1428 if Self::can_cast(syntax.kind()) {
2809 Some(Self { syntax }) 1429 Some(Self { syntax })
@@ -2813,8 +1433,8 @@ impl AstNode for UnionDef {
2813 } 1433 }
2814 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1434 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2815} 1435}
2816impl AstNode for RecordFieldDefList { 1436impl AstNode for GenericArgList {
2817 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } 1437 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST }
2818 fn cast(syntax: SyntaxNode) -> Option<Self> { 1438 fn cast(syntax: SyntaxNode) -> Option<Self> {
2819 if Self::can_cast(syntax.kind()) { 1439 if Self::can_cast(syntax.kind()) {
2820 Some(Self { syntax }) 1440 Some(Self { syntax })
@@ -2824,8 +1444,8 @@ impl AstNode for RecordFieldDefList {
2824 } 1444 }
2825 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1445 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2826} 1446}
2827impl AstNode for RecordFieldDef { 1447impl AstNode for ParamList {
2828 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } 1448 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
2829 fn cast(syntax: SyntaxNode) -> Option<Self> { 1449 fn cast(syntax: SyntaxNode) -> Option<Self> {
2830 if Self::can_cast(syntax.kind()) { 1450 if Self::can_cast(syntax.kind()) {
2831 Some(Self { syntax }) 1451 Some(Self { syntax })
@@ -2835,8 +1455,8 @@ impl AstNode for RecordFieldDef {
2835 } 1455 }
2836 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1456 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2837} 1457}
2838impl AstNode for TupleFieldDefList { 1458impl AstNode for RetType {
2839 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } 1459 fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE }
2840 fn cast(syntax: SyntaxNode) -> Option<Self> { 1460 fn cast(syntax: SyntaxNode) -> Option<Self> {
2841 if Self::can_cast(syntax.kind()) { 1461 if Self::can_cast(syntax.kind()) {
2842 Some(Self { syntax }) 1462 Some(Self { syntax })
@@ -2846,8 +1466,8 @@ impl AstNode for TupleFieldDefList {
2846 } 1466 }
2847 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1467 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2848} 1468}
2849impl AstNode for TupleFieldDef { 1469impl AstNode for PathType {
2850 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } 1470 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE }
2851 fn cast(syntax: SyntaxNode) -> Option<Self> { 1471 fn cast(syntax: SyntaxNode) -> Option<Self> {
2852 if Self::can_cast(syntax.kind()) { 1472 if Self::can_cast(syntax.kind()) {
2853 Some(Self { syntax }) 1473 Some(Self { syntax })
@@ -2857,8 +1477,8 @@ impl AstNode for TupleFieldDef {
2857 } 1477 }
2858 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1478 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2859} 1479}
2860impl AstNode for EnumDef { 1480impl AstNode for TypeArg {
2861 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } 1481 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG }
2862 fn cast(syntax: SyntaxNode) -> Option<Self> { 1482 fn cast(syntax: SyntaxNode) -> Option<Self> {
2863 if Self::can_cast(syntax.kind()) { 1483 if Self::can_cast(syntax.kind()) {
2864 Some(Self { syntax }) 1484 Some(Self { syntax })
@@ -2868,8 +1488,8 @@ impl AstNode for EnumDef {
2868 } 1488 }
2869 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1489 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2870} 1490}
2871impl AstNode for EnumVariantList { 1491impl AstNode for AssocTypeArg {
2872 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } 1492 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG }
2873 fn cast(syntax: SyntaxNode) -> Option<Self> { 1493 fn cast(syntax: SyntaxNode) -> Option<Self> {
2874 if Self::can_cast(syntax.kind()) { 1494 if Self::can_cast(syntax.kind()) {
2875 Some(Self { syntax }) 1495 Some(Self { syntax })
@@ -2879,8 +1499,8 @@ impl AstNode for EnumVariantList {
2879 } 1499 }
2880 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1500 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2881} 1501}
2882impl AstNode for EnumVariant { 1502impl AstNode for LifetimeArg {
2883 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } 1503 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG }
2884 fn cast(syntax: SyntaxNode) -> Option<Self> { 1504 fn cast(syntax: SyntaxNode) -> Option<Self> {
2885 if Self::can_cast(syntax.kind()) { 1505 if Self::can_cast(syntax.kind()) {
2886 Some(Self { syntax }) 1506 Some(Self { syntax })
@@ -2890,8 +1510,8 @@ impl AstNode for EnumVariant {
2890 } 1510 }
2891 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1511 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2892} 1512}
2893impl AstNode for TraitDef { 1513impl AstNode for ConstArg {
2894 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } 1514 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG }
2895 fn cast(syntax: SyntaxNode) -> Option<Self> { 1515 fn cast(syntax: SyntaxNode) -> Option<Self> {
2896 if Self::can_cast(syntax.kind()) { 1516 if Self::can_cast(syntax.kind()) {
2897 Some(Self { syntax }) 1517 Some(Self { syntax })
@@ -2901,8 +1521,8 @@ impl AstNode for TraitDef {
2901 } 1521 }
2902 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1522 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2903} 1523}
2904impl AstNode for Module { 1524impl AstNode for TypeBoundList {
2905 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } 1525 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST }
2906 fn cast(syntax: SyntaxNode) -> Option<Self> { 1526 fn cast(syntax: SyntaxNode) -> Option<Self> {
2907 if Self::can_cast(syntax.kind()) { 1527 if Self::can_cast(syntax.kind()) {
2908 Some(Self { syntax }) 1528 Some(Self { syntax })
@@ -2912,8 +1532,8 @@ impl AstNode for Module {
2912 } 1532 }
2913 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1533 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2914} 1534}
2915impl AstNode for ItemList { 1535impl AstNode for MacroCall {
2916 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } 1536 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL }
2917 fn cast(syntax: SyntaxNode) -> Option<Self> { 1537 fn cast(syntax: SyntaxNode) -> Option<Self> {
2918 if Self::can_cast(syntax.kind()) { 1538 if Self::can_cast(syntax.kind()) {
2919 Some(Self { syntax }) 1539 Some(Self { syntax })
@@ -2923,8 +1543,8 @@ impl AstNode for ItemList {
2923 } 1543 }
2924 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1544 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2925} 1545}
2926impl AstNode for ConstDef { 1546impl AstNode for Attr {
2927 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } 1547 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR }
2928 fn cast(syntax: SyntaxNode) -> Option<Self> { 1548 fn cast(syntax: SyntaxNode) -> Option<Self> {
2929 if Self::can_cast(syntax.kind()) { 1549 if Self::can_cast(syntax.kind()) {
2930 Some(Self { syntax }) 1550 Some(Self { syntax })
@@ -2934,8 +1554,8 @@ impl AstNode for ConstDef {
2934 } 1554 }
2935 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1555 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2936} 1556}
2937impl AstNode for StaticDef { 1557impl AstNode for TokenTree {
2938 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } 1558 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE }
2939 fn cast(syntax: SyntaxNode) -> Option<Self> { 1559 fn cast(syntax: SyntaxNode) -> Option<Self> {
2940 if Self::can_cast(syntax.kind()) { 1560 if Self::can_cast(syntax.kind()) {
2941 Some(Self { syntax }) 1561 Some(Self { syntax })
@@ -2945,8 +1565,8 @@ impl AstNode for StaticDef {
2945 } 1565 }
2946 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1566 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2947} 1567}
2948impl AstNode for TypeAliasDef { 1568impl AstNode for MacroItems {
2949 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } 1569 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS }
2950 fn cast(syntax: SyntaxNode) -> Option<Self> { 1570 fn cast(syntax: SyntaxNode) -> Option<Self> {
2951 if Self::can_cast(syntax.kind()) { 1571 if Self::can_cast(syntax.kind()) {
2952 Some(Self { syntax }) 1572 Some(Self { syntax })
@@ -2956,8 +1576,8 @@ impl AstNode for TypeAliasDef {
2956 } 1576 }
2957 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1577 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2958} 1578}
2959impl AstNode for ImplDef { 1579impl AstNode for MacroStmts {
2960 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } 1580 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS }
2961 fn cast(syntax: SyntaxNode) -> Option<Self> { 1581 fn cast(syntax: SyntaxNode) -> Option<Self> {
2962 if Self::can_cast(syntax.kind()) { 1582 if Self::can_cast(syntax.kind()) {
2963 Some(Self { syntax }) 1583 Some(Self { syntax })
@@ -2967,8 +1587,8 @@ impl AstNode for ImplDef {
2967 } 1587 }
2968 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1588 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2969} 1589}
2970impl AstNode for ParenType { 1590impl AstNode for SourceFile {
2971 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } 1591 fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE }
2972 fn cast(syntax: SyntaxNode) -> Option<Self> { 1592 fn cast(syntax: SyntaxNode) -> Option<Self> {
2973 if Self::can_cast(syntax.kind()) { 1593 if Self::can_cast(syntax.kind()) {
2974 Some(Self { syntax }) 1594 Some(Self { syntax })
@@ -2978,8 +1598,8 @@ impl AstNode for ParenType {
2978 } 1598 }
2979 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1599 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2980} 1600}
2981impl AstNode for TupleType { 1601impl AstNode for Const {
2982 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } 1602 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST }
2983 fn cast(syntax: SyntaxNode) -> Option<Self> { 1603 fn cast(syntax: SyntaxNode) -> Option<Self> {
2984 if Self::can_cast(syntax.kind()) { 1604 if Self::can_cast(syntax.kind()) {
2985 Some(Self { syntax }) 1605 Some(Self { syntax })
@@ -2989,8 +1609,8 @@ impl AstNode for TupleType {
2989 } 1609 }
2990 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1610 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2991} 1611}
2992impl AstNode for NeverType { 1612impl AstNode for Enum {
2993 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } 1613 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM }
2994 fn cast(syntax: SyntaxNode) -> Option<Self> { 1614 fn cast(syntax: SyntaxNode) -> Option<Self> {
2995 if Self::can_cast(syntax.kind()) { 1615 if Self::can_cast(syntax.kind()) {
2996 Some(Self { syntax }) 1616 Some(Self { syntax })
@@ -3000,8 +1620,8 @@ impl AstNode for NeverType {
3000 } 1620 }
3001 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1621 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3002} 1622}
3003impl AstNode for PathType { 1623impl AstNode for ExternBlock {
3004 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } 1624 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK }
3005 fn cast(syntax: SyntaxNode) -> Option<Self> { 1625 fn cast(syntax: SyntaxNode) -> Option<Self> {
3006 if Self::can_cast(syntax.kind()) { 1626 if Self::can_cast(syntax.kind()) {
3007 Some(Self { syntax }) 1627 Some(Self { syntax })
@@ -3011,8 +1631,8 @@ impl AstNode for PathType {
3011 } 1631 }
3012 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1632 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3013} 1633}
3014impl AstNode for PointerType { 1634impl AstNode for ExternCrate {
3015 fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } 1635 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE }
3016 fn cast(syntax: SyntaxNode) -> Option<Self> { 1636 fn cast(syntax: SyntaxNode) -> Option<Self> {
3017 if Self::can_cast(syntax.kind()) { 1637 if Self::can_cast(syntax.kind()) {
3018 Some(Self { syntax }) 1638 Some(Self { syntax })
@@ -3022,8 +1642,8 @@ impl AstNode for PointerType {
3022 } 1642 }
3023 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1643 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3024} 1644}
3025impl AstNode for ArrayType { 1645impl AstNode for Fn {
3026 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } 1646 fn can_cast(kind: SyntaxKind) -> bool { kind == FN }
3027 fn cast(syntax: SyntaxNode) -> Option<Self> { 1647 fn cast(syntax: SyntaxNode) -> Option<Self> {
3028 if Self::can_cast(syntax.kind()) { 1648 if Self::can_cast(syntax.kind()) {
3029 Some(Self { syntax }) 1649 Some(Self { syntax })
@@ -3033,8 +1653,8 @@ impl AstNode for ArrayType {
3033 } 1653 }
3034 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1654 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3035} 1655}
3036impl AstNode for SliceType { 1656impl AstNode for Impl {
3037 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } 1657 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL }
3038 fn cast(syntax: SyntaxNode) -> Option<Self> { 1658 fn cast(syntax: SyntaxNode) -> Option<Self> {
3039 if Self::can_cast(syntax.kind()) { 1659 if Self::can_cast(syntax.kind()) {
3040 Some(Self { syntax }) 1660 Some(Self { syntax })
@@ -3044,8 +1664,8 @@ impl AstNode for SliceType {
3044 } 1664 }
3045 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1665 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3046} 1666}
3047impl AstNode for ReferenceType { 1667impl AstNode for Module {
3048 fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } 1668 fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE }
3049 fn cast(syntax: SyntaxNode) -> Option<Self> { 1669 fn cast(syntax: SyntaxNode) -> Option<Self> {
3050 if Self::can_cast(syntax.kind()) { 1670 if Self::can_cast(syntax.kind()) {
3051 Some(Self { syntax }) 1671 Some(Self { syntax })
@@ -3055,8 +1675,8 @@ impl AstNode for ReferenceType {
3055 } 1675 }
3056 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1676 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3057} 1677}
3058impl AstNode for PlaceholderType { 1678impl AstNode for Static {
3059 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_TYPE } 1679 fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC }
3060 fn cast(syntax: SyntaxNode) -> Option<Self> { 1680 fn cast(syntax: SyntaxNode) -> Option<Self> {
3061 if Self::can_cast(syntax.kind()) { 1681 if Self::can_cast(syntax.kind()) {
3062 Some(Self { syntax }) 1682 Some(Self { syntax })
@@ -3066,8 +1686,8 @@ impl AstNode for PlaceholderType {
3066 } 1686 }
3067 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1687 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3068} 1688}
3069impl AstNode for FnPointerType { 1689impl AstNode for Struct {
3070 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } 1690 fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT }
3071 fn cast(syntax: SyntaxNode) -> Option<Self> { 1691 fn cast(syntax: SyntaxNode) -> Option<Self> {
3072 if Self::can_cast(syntax.kind()) { 1692 if Self::can_cast(syntax.kind()) {
3073 Some(Self { syntax }) 1693 Some(Self { syntax })
@@ -3077,8 +1697,8 @@ impl AstNode for FnPointerType {
3077 } 1697 }
3078 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1698 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3079} 1699}
3080impl AstNode for ForType { 1700impl AstNode for Trait {
3081 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } 1701 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT }
3082 fn cast(syntax: SyntaxNode) -> Option<Self> { 1702 fn cast(syntax: SyntaxNode) -> Option<Self> {
3083 if Self::can_cast(syntax.kind()) { 1703 if Self::can_cast(syntax.kind()) {
3084 Some(Self { syntax }) 1704 Some(Self { syntax })
@@ -3088,8 +1708,8 @@ impl AstNode for ForType {
3088 } 1708 }
3089 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1709 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3090} 1710}
3091impl AstNode for ImplTraitType { 1711impl AstNode for TypeAlias {
3092 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } 1712 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS }
3093 fn cast(syntax: SyntaxNode) -> Option<Self> { 1713 fn cast(syntax: SyntaxNode) -> Option<Self> {
3094 if Self::can_cast(syntax.kind()) { 1714 if Self::can_cast(syntax.kind()) {
3095 Some(Self { syntax }) 1715 Some(Self { syntax })
@@ -3099,8 +1719,8 @@ impl AstNode for ImplTraitType {
3099 } 1719 }
3100 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1720 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3101} 1721}
3102impl AstNode for DynTraitType { 1722impl AstNode for Union {
3103 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } 1723 fn can_cast(kind: SyntaxKind) -> bool { kind == UNION }
3104 fn cast(syntax: SyntaxNode) -> Option<Self> { 1724 fn cast(syntax: SyntaxNode) -> Option<Self> {
3105 if Self::can_cast(syntax.kind()) { 1725 if Self::can_cast(syntax.kind()) {
3106 Some(Self { syntax }) 1726 Some(Self { syntax })
@@ -3110,8 +1730,8 @@ impl AstNode for DynTraitType {
3110 } 1730 }
3111 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1731 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3112} 1732}
3113impl AstNode for TupleExpr { 1733impl AstNode for Use {
3114 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } 1734 fn can_cast(kind: SyntaxKind) -> bool { kind == USE }
3115 fn cast(syntax: SyntaxNode) -> Option<Self> { 1735 fn cast(syntax: SyntaxNode) -> Option<Self> {
3116 if Self::can_cast(syntax.kind()) { 1736 if Self::can_cast(syntax.kind()) {
3117 Some(Self { syntax }) 1737 Some(Self { syntax })
@@ -3121,8 +1741,8 @@ impl AstNode for TupleExpr {
3121 } 1741 }
3122 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1742 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3123} 1743}
3124impl AstNode for ArrayExpr { 1744impl AstNode for Visibility {
3125 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } 1745 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY }
3126 fn cast(syntax: SyntaxNode) -> Option<Self> { 1746 fn cast(syntax: SyntaxNode) -> Option<Self> {
3127 if Self::can_cast(syntax.kind()) { 1747 if Self::can_cast(syntax.kind()) {
3128 Some(Self { syntax }) 1748 Some(Self { syntax })
@@ -3132,8 +1752,8 @@ impl AstNode for ArrayExpr {
3132 } 1752 }
3133 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1753 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3134} 1754}
3135impl AstNode for ParenExpr { 1755impl AstNode for ItemList {
3136 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } 1756 fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
3137 fn cast(syntax: SyntaxNode) -> Option<Self> { 1757 fn cast(syntax: SyntaxNode) -> Option<Self> {
3138 if Self::can_cast(syntax.kind()) { 1758 if Self::can_cast(syntax.kind()) {
3139 Some(Self { syntax }) 1759 Some(Self { syntax })
@@ -3143,8 +1763,8 @@ impl AstNode for ParenExpr {
3143 } 1763 }
3144 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1764 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3145} 1765}
3146impl AstNode for PathExpr { 1766impl AstNode for Rename {
3147 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } 1767 fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME }
3148 fn cast(syntax: SyntaxNode) -> Option<Self> { 1768 fn cast(syntax: SyntaxNode) -> Option<Self> {
3149 if Self::can_cast(syntax.kind()) { 1769 if Self::can_cast(syntax.kind()) {
3150 Some(Self { syntax }) 1770 Some(Self { syntax })
@@ -3154,8 +1774,8 @@ impl AstNode for PathExpr {
3154 } 1774 }
3155 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1775 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3156} 1776}
3157impl AstNode for LambdaExpr { 1777impl AstNode for UseTree {
3158 fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } 1778 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE }
3159 fn cast(syntax: SyntaxNode) -> Option<Self> { 1779 fn cast(syntax: SyntaxNode) -> Option<Self> {
3160 if Self::can_cast(syntax.kind()) { 1780 if Self::can_cast(syntax.kind()) {
3161 Some(Self { syntax }) 1781 Some(Self { syntax })
@@ -3165,8 +1785,8 @@ impl AstNode for LambdaExpr {
3165 } 1785 }
3166 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1786 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3167} 1787}
3168impl AstNode for IfExpr { 1788impl AstNode for UseTreeList {
3169 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } 1789 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST }
3170 fn cast(syntax: SyntaxNode) -> Option<Self> { 1790 fn cast(syntax: SyntaxNode) -> Option<Self> {
3171 if Self::can_cast(syntax.kind()) { 1791 if Self::can_cast(syntax.kind()) {
3172 Some(Self { syntax }) 1792 Some(Self { syntax })
@@ -3176,8 +1796,8 @@ impl AstNode for IfExpr {
3176 } 1796 }
3177 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1797 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3178} 1798}
3179impl AstNode for LoopExpr { 1799impl AstNode for Abi {
3180 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } 1800 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
3181 fn cast(syntax: SyntaxNode) -> Option<Self> { 1801 fn cast(syntax: SyntaxNode) -> Option<Self> {
3182 if Self::can_cast(syntax.kind()) { 1802 if Self::can_cast(syntax.kind()) {
3183 Some(Self { syntax }) 1803 Some(Self { syntax })
@@ -3187,8 +1807,8 @@ impl AstNode for LoopExpr {
3187 } 1807 }
3188 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1808 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3189} 1809}
3190impl AstNode for EffectExpr { 1810impl AstNode for GenericParamList {
3191 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } 1811 fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST }
3192 fn cast(syntax: SyntaxNode) -> Option<Self> { 1812 fn cast(syntax: SyntaxNode) -> Option<Self> {
3193 if Self::can_cast(syntax.kind()) { 1813 if Self::can_cast(syntax.kind()) {
3194 Some(Self { syntax }) 1814 Some(Self { syntax })
@@ -3198,8 +1818,8 @@ impl AstNode for EffectExpr {
3198 } 1818 }
3199 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1819 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3200} 1820}
3201impl AstNode for ForExpr { 1821impl AstNode for WhereClause {
3202 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } 1822 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE }
3203 fn cast(syntax: SyntaxNode) -> Option<Self> { 1823 fn cast(syntax: SyntaxNode) -> Option<Self> {
3204 if Self::can_cast(syntax.kind()) { 1824 if Self::can_cast(syntax.kind()) {
3205 Some(Self { syntax }) 1825 Some(Self { syntax })
@@ -3209,8 +1829,8 @@ impl AstNode for ForExpr {
3209 } 1829 }
3210 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1830 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3211} 1831}
3212impl AstNode for WhileExpr { 1832impl AstNode for BlockExpr {
3213 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } 1833 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR }
3214 fn cast(syntax: SyntaxNode) -> Option<Self> { 1834 fn cast(syntax: SyntaxNode) -> Option<Self> {
3215 if Self::can_cast(syntax.kind()) { 1835 if Self::can_cast(syntax.kind()) {
3216 Some(Self { syntax }) 1836 Some(Self { syntax })
@@ -3220,8 +1840,8 @@ impl AstNode for WhileExpr {
3220 } 1840 }
3221 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1841 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3222} 1842}
3223impl AstNode for ContinueExpr { 1843impl AstNode for SelfParam {
3224 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } 1844 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM }
3225 fn cast(syntax: SyntaxNode) -> Option<Self> { 1845 fn cast(syntax: SyntaxNode) -> Option<Self> {
3226 if Self::can_cast(syntax.kind()) { 1846 if Self::can_cast(syntax.kind()) {
3227 Some(Self { syntax }) 1847 Some(Self { syntax })
@@ -3231,8 +1851,8 @@ impl AstNode for ContinueExpr {
3231 } 1851 }
3232 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1852 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3233} 1853}
3234impl AstNode for BreakExpr { 1854impl AstNode for Param {
3235 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } 1855 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM }
3236 fn cast(syntax: SyntaxNode) -> Option<Self> { 1856 fn cast(syntax: SyntaxNode) -> Option<Self> {
3237 if Self::can_cast(syntax.kind()) { 1857 if Self::can_cast(syntax.kind()) {
3238 Some(Self { syntax }) 1858 Some(Self { syntax })
@@ -3242,8 +1862,8 @@ impl AstNode for BreakExpr {
3242 } 1862 }
3243 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1863 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3244} 1864}
3245impl AstNode for Label { 1865impl AstNode for RecordFieldList {
3246 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } 1866 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST }
3247 fn cast(syntax: SyntaxNode) -> Option<Self> { 1867 fn cast(syntax: SyntaxNode) -> Option<Self> {
3248 if Self::can_cast(syntax.kind()) { 1868 if Self::can_cast(syntax.kind()) {
3249 Some(Self { syntax }) 1869 Some(Self { syntax })
@@ -3253,8 +1873,8 @@ impl AstNode for Label {
3253 } 1873 }
3254 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1874 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3255} 1875}
3256impl AstNode for BlockExpr { 1876impl AstNode for TupleFieldList {
3257 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } 1877 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST }
3258 fn cast(syntax: SyntaxNode) -> Option<Self> { 1878 fn cast(syntax: SyntaxNode) -> Option<Self> {
3259 if Self::can_cast(syntax.kind()) { 1879 if Self::can_cast(syntax.kind()) {
3260 Some(Self { syntax }) 1880 Some(Self { syntax })
@@ -3264,8 +1884,8 @@ impl AstNode for BlockExpr {
3264 } 1884 }
3265 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1885 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3266} 1886}
3267impl AstNode for ReturnExpr { 1887impl AstNode for RecordField {
3268 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } 1888 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD }
3269 fn cast(syntax: SyntaxNode) -> Option<Self> { 1889 fn cast(syntax: SyntaxNode) -> Option<Self> {
3270 if Self::can_cast(syntax.kind()) { 1890 if Self::can_cast(syntax.kind()) {
3271 Some(Self { syntax }) 1891 Some(Self { syntax })
@@ -3275,8 +1895,8 @@ impl AstNode for ReturnExpr {
3275 } 1895 }
3276 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1896 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3277} 1897}
3278impl AstNode for CallExpr { 1898impl AstNode for TupleField {
3279 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } 1899 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD }
3280 fn cast(syntax: SyntaxNode) -> Option<Self> { 1900 fn cast(syntax: SyntaxNode) -> Option<Self> {
3281 if Self::can_cast(syntax.kind()) { 1901 if Self::can_cast(syntax.kind()) {
3282 Some(Self { syntax }) 1902 Some(Self { syntax })
@@ -3286,8 +1906,8 @@ impl AstNode for CallExpr {
3286 } 1906 }
3287 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1907 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3288} 1908}
3289impl AstNode for MethodCallExpr { 1909impl AstNode for VariantList {
3290 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } 1910 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
3291 fn cast(syntax: SyntaxNode) -> Option<Self> { 1911 fn cast(syntax: SyntaxNode) -> Option<Self> {
3292 if Self::can_cast(syntax.kind()) { 1912 if Self::can_cast(syntax.kind()) {
3293 Some(Self { syntax }) 1913 Some(Self { syntax })
@@ -3297,8 +1917,8 @@ impl AstNode for MethodCallExpr {
3297 } 1917 }
3298 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1918 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3299} 1919}
3300impl AstNode for IndexExpr { 1920impl AstNode for Variant {
3301 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } 1921 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
3302 fn cast(syntax: SyntaxNode) -> Option<Self> { 1922 fn cast(syntax: SyntaxNode) -> Option<Self> {
3303 if Self::can_cast(syntax.kind()) { 1923 if Self::can_cast(syntax.kind()) {
3304 Some(Self { syntax }) 1924 Some(Self { syntax })
@@ -3308,8 +1928,8 @@ impl AstNode for IndexExpr {
3308 } 1928 }
3309 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1929 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3310} 1930}
3311impl AstNode for FieldExpr { 1931impl AstNode for AssocItemList {
3312 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } 1932 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
3313 fn cast(syntax: SyntaxNode) -> Option<Self> { 1933 fn cast(syntax: SyntaxNode) -> Option<Self> {
3314 if Self::can_cast(syntax.kind()) { 1934 if Self::can_cast(syntax.kind()) {
3315 Some(Self { syntax }) 1935 Some(Self { syntax })
@@ -3319,8 +1939,8 @@ impl AstNode for FieldExpr {
3319 } 1939 }
3320 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1940 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3321} 1941}
3322impl AstNode for AwaitExpr { 1942impl AstNode for ExternItemList {
3323 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } 1943 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST }
3324 fn cast(syntax: SyntaxNode) -> Option<Self> { 1944 fn cast(syntax: SyntaxNode) -> Option<Self> {
3325 if Self::can_cast(syntax.kind()) { 1945 if Self::can_cast(syntax.kind()) {
3326 Some(Self { syntax }) 1946 Some(Self { syntax })
@@ -3330,8 +1950,8 @@ impl AstNode for AwaitExpr {
3330 } 1950 }
3331 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1951 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3332} 1952}
3333impl AstNode for TryExpr { 1953impl AstNode for ConstParam {
3334 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } 1954 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM }
3335 fn cast(syntax: SyntaxNode) -> Option<Self> { 1955 fn cast(syntax: SyntaxNode) -> Option<Self> {
3336 if Self::can_cast(syntax.kind()) { 1956 if Self::can_cast(syntax.kind()) {
3337 Some(Self { syntax }) 1957 Some(Self { syntax })
@@ -3341,8 +1961,8 @@ impl AstNode for TryExpr {
3341 } 1961 }
3342 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1962 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3343} 1963}
3344impl AstNode for CastExpr { 1964impl AstNode for LifetimeParam {
3345 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } 1965 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM }
3346 fn cast(syntax: SyntaxNode) -> Option<Self> { 1966 fn cast(syntax: SyntaxNode) -> Option<Self> {
3347 if Self::can_cast(syntax.kind()) { 1967 if Self::can_cast(syntax.kind()) {
3348 Some(Self { syntax }) 1968 Some(Self { syntax })
@@ -3352,8 +1972,8 @@ impl AstNode for CastExpr {
3352 } 1972 }
3353 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1973 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3354} 1974}
3355impl AstNode for RefExpr { 1975impl AstNode for TypeParam {
3356 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } 1976 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM }
3357 fn cast(syntax: SyntaxNode) -> Option<Self> { 1977 fn cast(syntax: SyntaxNode) -> Option<Self> {
3358 if Self::can_cast(syntax.kind()) { 1978 if Self::can_cast(syntax.kind()) {
3359 Some(Self { syntax }) 1979 Some(Self { syntax })
@@ -3363,8 +1983,8 @@ impl AstNode for RefExpr {
3363 } 1983 }
3364 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1984 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3365} 1985}
3366impl AstNode for PrefixExpr { 1986impl AstNode for WherePred {
3367 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } 1987 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED }
3368 fn cast(syntax: SyntaxNode) -> Option<Self> { 1988 fn cast(syntax: SyntaxNode) -> Option<Self> {
3369 if Self::can_cast(syntax.kind()) { 1989 if Self::can_cast(syntax.kind()) {
3370 Some(Self { syntax }) 1990 Some(Self { syntax })
@@ -3374,8 +1994,8 @@ impl AstNode for PrefixExpr {
3374 } 1994 }
3375 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1995 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3376} 1996}
3377impl AstNode for BoxExpr { 1997impl AstNode for Literal {
3378 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } 1998 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL }
3379 fn cast(syntax: SyntaxNode) -> Option<Self> { 1999 fn cast(syntax: SyntaxNode) -> Option<Self> {
3380 if Self::can_cast(syntax.kind()) { 2000 if Self::can_cast(syntax.kind()) {
3381 Some(Self { syntax }) 2001 Some(Self { syntax })
@@ -3385,8 +2005,8 @@ impl AstNode for BoxExpr {
3385 } 2005 }
3386 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2006 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3387} 2007}
3388impl AstNode for RangeExpr { 2008impl AstNode for ExprStmt {
3389 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } 2009 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT }
3390 fn cast(syntax: SyntaxNode) -> Option<Self> { 2010 fn cast(syntax: SyntaxNode) -> Option<Self> {
3391 if Self::can_cast(syntax.kind()) { 2011 if Self::can_cast(syntax.kind()) {
3392 Some(Self { syntax }) 2012 Some(Self { syntax })
@@ -3396,8 +2016,8 @@ impl AstNode for RangeExpr {
3396 } 2016 }
3397 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2017 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3398} 2018}
3399impl AstNode for BinExpr { 2019impl AstNode for LetStmt {
3400 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } 2020 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT }
3401 fn cast(syntax: SyntaxNode) -> Option<Self> { 2021 fn cast(syntax: SyntaxNode) -> Option<Self> {
3402 if Self::can_cast(syntax.kind()) { 2022 if Self::can_cast(syntax.kind()) {
3403 Some(Self { syntax }) 2023 Some(Self { syntax })
@@ -3407,8 +2027,8 @@ impl AstNode for BinExpr {
3407 } 2027 }
3408 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2028 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3409} 2029}
3410impl AstNode for Literal { 2030impl AstNode for ArrayExpr {
3411 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } 2031 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR }
3412 fn cast(syntax: SyntaxNode) -> Option<Self> { 2032 fn cast(syntax: SyntaxNode) -> Option<Self> {
3413 if Self::can_cast(syntax.kind()) { 2033 if Self::can_cast(syntax.kind()) {
3414 Some(Self { syntax }) 2034 Some(Self { syntax })
@@ -3418,8 +2038,8 @@ impl AstNode for Literal {
3418 } 2038 }
3419 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2039 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3420} 2040}
3421impl AstNode for MatchExpr { 2041impl AstNode for AwaitExpr {
3422 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } 2042 fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR }
3423 fn cast(syntax: SyntaxNode) -> Option<Self> { 2043 fn cast(syntax: SyntaxNode) -> Option<Self> {
3424 if Self::can_cast(syntax.kind()) { 2044 if Self::can_cast(syntax.kind()) {
3425 Some(Self { syntax }) 2045 Some(Self { syntax })
@@ -3429,8 +2049,8 @@ impl AstNode for MatchExpr {
3429 } 2049 }
3430 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2050 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3431} 2051}
3432impl AstNode for MatchArmList { 2052impl AstNode for BinExpr {
3433 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } 2053 fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR }
3434 fn cast(syntax: SyntaxNode) -> Option<Self> { 2054 fn cast(syntax: SyntaxNode) -> Option<Self> {
3435 if Self::can_cast(syntax.kind()) { 2055 if Self::can_cast(syntax.kind()) {
3436 Some(Self { syntax }) 2056 Some(Self { syntax })
@@ -3440,8 +2060,8 @@ impl AstNode for MatchArmList {
3440 } 2060 }
3441 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2061 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3442} 2062}
3443impl AstNode for MatchArm { 2063impl AstNode for BoxExpr {
3444 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } 2064 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR }
3445 fn cast(syntax: SyntaxNode) -> Option<Self> { 2065 fn cast(syntax: SyntaxNode) -> Option<Self> {
3446 if Self::can_cast(syntax.kind()) { 2066 if Self::can_cast(syntax.kind()) {
3447 Some(Self { syntax }) 2067 Some(Self { syntax })
@@ -3451,8 +2071,8 @@ impl AstNode for MatchArm {
3451 } 2071 }
3452 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2072 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3453} 2073}
3454impl AstNode for MatchGuard { 2074impl AstNode for BreakExpr {
3455 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } 2075 fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR }
3456 fn cast(syntax: SyntaxNode) -> Option<Self> { 2076 fn cast(syntax: SyntaxNode) -> Option<Self> {
3457 if Self::can_cast(syntax.kind()) { 2077 if Self::can_cast(syntax.kind()) {
3458 Some(Self { syntax }) 2078 Some(Self { syntax })
@@ -3462,8 +2082,8 @@ impl AstNode for MatchGuard {
3462 } 2082 }
3463 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2083 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3464} 2084}
3465impl AstNode for RecordLit { 2085impl AstNode for CallExpr {
3466 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT } 2086 fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR }
3467 fn cast(syntax: SyntaxNode) -> Option<Self> { 2087 fn cast(syntax: SyntaxNode) -> Option<Self> {
3468 if Self::can_cast(syntax.kind()) { 2088 if Self::can_cast(syntax.kind()) {
3469 Some(Self { syntax }) 2089 Some(Self { syntax })
@@ -3473,8 +2093,8 @@ impl AstNode for RecordLit {
3473 } 2093 }
3474 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2094 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3475} 2095}
3476impl AstNode for RecordFieldList { 2096impl AstNode for CastExpr {
3477 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } 2097 fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR }
3478 fn cast(syntax: SyntaxNode) -> Option<Self> { 2098 fn cast(syntax: SyntaxNode) -> Option<Self> {
3479 if Self::can_cast(syntax.kind()) { 2099 if Self::can_cast(syntax.kind()) {
3480 Some(Self { syntax }) 2100 Some(Self { syntax })
@@ -3484,8 +2104,8 @@ impl AstNode for RecordFieldList {
3484 } 2104 }
3485 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2105 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3486} 2106}
3487impl AstNode for RecordField { 2107impl AstNode for ClosureExpr {
3488 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } 2108 fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR }
3489 fn cast(syntax: SyntaxNode) -> Option<Self> { 2109 fn cast(syntax: SyntaxNode) -> Option<Self> {
3490 if Self::can_cast(syntax.kind()) { 2110 if Self::can_cast(syntax.kind()) {
3491 Some(Self { syntax }) 2111 Some(Self { syntax })
@@ -3495,8 +2115,8 @@ impl AstNode for RecordField {
3495 } 2115 }
3496 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2116 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3497} 2117}
3498impl AstNode for OrPat { 2118impl AstNode for ContinueExpr {
3499 fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } 2119 fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR }
3500 fn cast(syntax: SyntaxNode) -> Option<Self> { 2120 fn cast(syntax: SyntaxNode) -> Option<Self> {
3501 if Self::can_cast(syntax.kind()) { 2121 if Self::can_cast(syntax.kind()) {
3502 Some(Self { syntax }) 2122 Some(Self { syntax })
@@ -3506,8 +2126,8 @@ impl AstNode for OrPat {
3506 } 2126 }
3507 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2127 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3508} 2128}
3509impl AstNode for ParenPat { 2129impl AstNode for EffectExpr {
3510 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } 2130 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
3511 fn cast(syntax: SyntaxNode) -> Option<Self> { 2131 fn cast(syntax: SyntaxNode) -> Option<Self> {
3512 if Self::can_cast(syntax.kind()) { 2132 if Self::can_cast(syntax.kind()) {
3513 Some(Self { syntax }) 2133 Some(Self { syntax })
@@ -3517,8 +2137,8 @@ impl AstNode for ParenPat {
3517 } 2137 }
3518 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2138 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3519} 2139}
3520impl AstNode for RefPat { 2140impl AstNode for FieldExpr {
3521 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } 2141 fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR }
3522 fn cast(syntax: SyntaxNode) -> Option<Self> { 2142 fn cast(syntax: SyntaxNode) -> Option<Self> {
3523 if Self::can_cast(syntax.kind()) { 2143 if Self::can_cast(syntax.kind()) {
3524 Some(Self { syntax }) 2144 Some(Self { syntax })
@@ -3528,8 +2148,8 @@ impl AstNode for RefPat {
3528 } 2148 }
3529 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2149 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3530} 2150}
3531impl AstNode for BoxPat { 2151impl AstNode for ForExpr {
3532 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } 2152 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR }
3533 fn cast(syntax: SyntaxNode) -> Option<Self> { 2153 fn cast(syntax: SyntaxNode) -> Option<Self> {
3534 if Self::can_cast(syntax.kind()) { 2154 if Self::can_cast(syntax.kind()) {
3535 Some(Self { syntax }) 2155 Some(Self { syntax })
@@ -3539,8 +2159,8 @@ impl AstNode for BoxPat {
3539 } 2159 }
3540 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2160 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3541} 2161}
3542impl AstNode for BindPat { 2162impl AstNode for IfExpr {
3543 fn can_cast(kind: SyntaxKind) -> bool { kind == BIND_PAT } 2163 fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR }
3544 fn cast(syntax: SyntaxNode) -> Option<Self> { 2164 fn cast(syntax: SyntaxNode) -> Option<Self> {
3545 if Self::can_cast(syntax.kind()) { 2165 if Self::can_cast(syntax.kind()) {
3546 Some(Self { syntax }) 2166 Some(Self { syntax })
@@ -3550,8 +2170,8 @@ impl AstNode for BindPat {
3550 } 2170 }
3551 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2171 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3552} 2172}
3553impl AstNode for PlaceholderPat { 2173impl AstNode for IndexExpr {
3554 fn can_cast(kind: SyntaxKind) -> bool { kind == PLACEHOLDER_PAT } 2174 fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR }
3555 fn cast(syntax: SyntaxNode) -> Option<Self> { 2175 fn cast(syntax: SyntaxNode) -> Option<Self> {
3556 if Self::can_cast(syntax.kind()) { 2176 if Self::can_cast(syntax.kind()) {
3557 Some(Self { syntax }) 2177 Some(Self { syntax })
@@ -3561,8 +2181,8 @@ impl AstNode for PlaceholderPat {
3561 } 2181 }
3562 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2182 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3563} 2183}
3564impl AstNode for DotDotPat { 2184impl AstNode for LoopExpr {
3565 fn can_cast(kind: SyntaxKind) -> bool { kind == DOT_DOT_PAT } 2185 fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR }
3566 fn cast(syntax: SyntaxNode) -> Option<Self> { 2186 fn cast(syntax: SyntaxNode) -> Option<Self> {
3567 if Self::can_cast(syntax.kind()) { 2187 if Self::can_cast(syntax.kind()) {
3568 Some(Self { syntax }) 2188 Some(Self { syntax })
@@ -3572,8 +2192,8 @@ impl AstNode for DotDotPat {
3572 } 2192 }
3573 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2193 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3574} 2194}
3575impl AstNode for PathPat { 2195impl AstNode for MatchExpr {
3576 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } 2196 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR }
3577 fn cast(syntax: SyntaxNode) -> Option<Self> { 2197 fn cast(syntax: SyntaxNode) -> Option<Self> {
3578 if Self::can_cast(syntax.kind()) { 2198 if Self::can_cast(syntax.kind()) {
3579 Some(Self { syntax }) 2199 Some(Self { syntax })
@@ -3583,8 +2203,8 @@ impl AstNode for PathPat {
3583 } 2203 }
3584 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2204 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3585} 2205}
3586impl AstNode for SlicePat { 2206impl AstNode for MethodCallExpr {
3587 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } 2207 fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR }
3588 fn cast(syntax: SyntaxNode) -> Option<Self> { 2208 fn cast(syntax: SyntaxNode) -> Option<Self> {
3589 if Self::can_cast(syntax.kind()) { 2209 if Self::can_cast(syntax.kind()) {
3590 Some(Self { syntax }) 2210 Some(Self { syntax })
@@ -3594,8 +2214,8 @@ impl AstNode for SlicePat {
3594 } 2214 }
3595 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2215 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3596} 2216}
3597impl AstNode for RangePat { 2217impl AstNode for ParenExpr {
3598 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } 2218 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR }
3599 fn cast(syntax: SyntaxNode) -> Option<Self> { 2219 fn cast(syntax: SyntaxNode) -> Option<Self> {
3600 if Self::can_cast(syntax.kind()) { 2220 if Self::can_cast(syntax.kind()) {
3601 Some(Self { syntax }) 2221 Some(Self { syntax })
@@ -3605,8 +2225,8 @@ impl AstNode for RangePat {
3605 } 2225 }
3606 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2226 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3607} 2227}
3608impl AstNode for LiteralPat { 2228impl AstNode for PathExpr {
3609 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } 2229 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR }
3610 fn cast(syntax: SyntaxNode) -> Option<Self> { 2230 fn cast(syntax: SyntaxNode) -> Option<Self> {
3611 if Self::can_cast(syntax.kind()) { 2231 if Self::can_cast(syntax.kind()) {
3612 Some(Self { syntax }) 2232 Some(Self { syntax })
@@ -3616,8 +2236,8 @@ impl AstNode for LiteralPat {
3616 } 2236 }
3617 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2237 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3618} 2238}
3619impl AstNode for MacroPat { 2239impl AstNode for PrefixExpr {
3620 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } 2240 fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR }
3621 fn cast(syntax: SyntaxNode) -> Option<Self> { 2241 fn cast(syntax: SyntaxNode) -> Option<Self> {
3622 if Self::can_cast(syntax.kind()) { 2242 if Self::can_cast(syntax.kind()) {
3623 Some(Self { syntax }) 2243 Some(Self { syntax })
@@ -3627,8 +2247,8 @@ impl AstNode for MacroPat {
3627 } 2247 }
3628 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2248 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3629} 2249}
3630impl AstNode for RecordPat { 2250impl AstNode for RangeExpr {
3631 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } 2251 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR }
3632 fn cast(syntax: SyntaxNode) -> Option<Self> { 2252 fn cast(syntax: SyntaxNode) -> Option<Self> {
3633 if Self::can_cast(syntax.kind()) { 2253 if Self::can_cast(syntax.kind()) {
3634 Some(Self { syntax }) 2254 Some(Self { syntax })
@@ -3638,8 +2258,8 @@ impl AstNode for RecordPat {
3638 } 2258 }
3639 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2259 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3640} 2260}
3641impl AstNode for RecordFieldPatList { 2261impl AstNode for RecordExpr {
3642 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT_LIST } 2262 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR }
3643 fn cast(syntax: SyntaxNode) -> Option<Self> { 2263 fn cast(syntax: SyntaxNode) -> Option<Self> {
3644 if Self::can_cast(syntax.kind()) { 2264 if Self::can_cast(syntax.kind()) {
3645 Some(Self { syntax }) 2265 Some(Self { syntax })
@@ -3649,8 +2269,8 @@ impl AstNode for RecordFieldPatList {
3649 } 2269 }
3650 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2270 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3651} 2271}
3652impl AstNode for RecordFieldPat { 2272impl AstNode for RefExpr {
3653 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_PAT } 2273 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR }
3654 fn cast(syntax: SyntaxNode) -> Option<Self> { 2274 fn cast(syntax: SyntaxNode) -> Option<Self> {
3655 if Self::can_cast(syntax.kind()) { 2275 if Self::can_cast(syntax.kind()) {
3656 Some(Self { syntax }) 2276 Some(Self { syntax })
@@ -3660,8 +2280,8 @@ impl AstNode for RecordFieldPat {
3660 } 2280 }
3661 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2281 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3662} 2282}
3663impl AstNode for TupleStructPat { 2283impl AstNode for ReturnExpr {
3664 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } 2284 fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR }
3665 fn cast(syntax: SyntaxNode) -> Option<Self> { 2285 fn cast(syntax: SyntaxNode) -> Option<Self> {
3666 if Self::can_cast(syntax.kind()) { 2286 if Self::can_cast(syntax.kind()) {
3667 Some(Self { syntax }) 2287 Some(Self { syntax })
@@ -3671,8 +2291,8 @@ impl AstNode for TupleStructPat {
3671 } 2291 }
3672 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2292 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3673} 2293}
3674impl AstNode for TuplePat { 2294impl AstNode for TryExpr {
3675 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } 2295 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR }
3676 fn cast(syntax: SyntaxNode) -> Option<Self> { 2296 fn cast(syntax: SyntaxNode) -> Option<Self> {
3677 if Self::can_cast(syntax.kind()) { 2297 if Self::can_cast(syntax.kind()) {
3678 Some(Self { syntax }) 2298 Some(Self { syntax })
@@ -3682,8 +2302,8 @@ impl AstNode for TuplePat {
3682 } 2302 }
3683 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2303 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3684} 2304}
3685impl AstNode for Visibility { 2305impl AstNode for TupleExpr {
3686 fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } 2306 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR }
3687 fn cast(syntax: SyntaxNode) -> Option<Self> { 2307 fn cast(syntax: SyntaxNode) -> Option<Self> {
3688 if Self::can_cast(syntax.kind()) { 2308 if Self::can_cast(syntax.kind()) {
3689 Some(Self { syntax }) 2309 Some(Self { syntax })
@@ -3693,8 +2313,8 @@ impl AstNode for Visibility {
3693 } 2313 }
3694 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2314 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3695} 2315}
3696impl AstNode for Name { 2316impl AstNode for WhileExpr {
3697 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } 2317 fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR }
3698 fn cast(syntax: SyntaxNode) -> Option<Self> { 2318 fn cast(syntax: SyntaxNode) -> Option<Self> {
3699 if Self::can_cast(syntax.kind()) { 2319 if Self::can_cast(syntax.kind()) {
3700 Some(Self { syntax }) 2320 Some(Self { syntax })
@@ -3704,8 +2324,8 @@ impl AstNode for Name {
3704 } 2324 }
3705 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2325 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3706} 2326}
3707impl AstNode for NameRef { 2327impl AstNode for Label {
3708 fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } 2328 fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL }
3709 fn cast(syntax: SyntaxNode) -> Option<Self> { 2329 fn cast(syntax: SyntaxNode) -> Option<Self> {
3710 if Self::can_cast(syntax.kind()) { 2330 if Self::can_cast(syntax.kind()) {
3711 Some(Self { syntax }) 2331 Some(Self { syntax })
@@ -3715,8 +2335,8 @@ impl AstNode for NameRef {
3715 } 2335 }
3716 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2336 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3717} 2337}
3718impl AstNode for MacroCall { 2338impl AstNode for RecordExprFieldList {
3719 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } 2339 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST }
3720 fn cast(syntax: SyntaxNode) -> Option<Self> { 2340 fn cast(syntax: SyntaxNode) -> Option<Self> {
3721 if Self::can_cast(syntax.kind()) { 2341 if Self::can_cast(syntax.kind()) {
3722 Some(Self { syntax }) 2342 Some(Self { syntax })
@@ -3726,8 +2346,8 @@ impl AstNode for MacroCall {
3726 } 2346 }
3727 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2347 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3728} 2348}
3729impl AstNode for Attr { 2349impl AstNode for RecordExprField {
3730 fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } 2350 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD }
3731 fn cast(syntax: SyntaxNode) -> Option<Self> { 2351 fn cast(syntax: SyntaxNode) -> Option<Self> {
3732 if Self::can_cast(syntax.kind()) { 2352 if Self::can_cast(syntax.kind()) {
3733 Some(Self { syntax }) 2353 Some(Self { syntax })
@@ -3737,8 +2357,8 @@ impl AstNode for Attr {
3737 } 2357 }
3738 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2358 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3739} 2359}
3740impl AstNode for TokenTree { 2360impl AstNode for ArgList {
3741 fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } 2361 fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST }
3742 fn cast(syntax: SyntaxNode) -> Option<Self> { 2362 fn cast(syntax: SyntaxNode) -> Option<Self> {
3743 if Self::can_cast(syntax.kind()) { 2363 if Self::can_cast(syntax.kind()) {
3744 Some(Self { syntax }) 2364 Some(Self { syntax })
@@ -3748,8 +2368,8 @@ impl AstNode for TokenTree {
3748 } 2368 }
3749 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2369 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3750} 2370}
3751impl AstNode for TypeParamList { 2371impl AstNode for Condition {
3752 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } 2372 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION }
3753 fn cast(syntax: SyntaxNode) -> Option<Self> { 2373 fn cast(syntax: SyntaxNode) -> Option<Self> {
3754 if Self::can_cast(syntax.kind()) { 2374 if Self::can_cast(syntax.kind()) {
3755 Some(Self { syntax }) 2375 Some(Self { syntax })
@@ -3759,8 +2379,8 @@ impl AstNode for TypeParamList {
3759 } 2379 }
3760 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2380 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3761} 2381}
3762impl AstNode for TypeParam { 2382impl AstNode for MatchArmList {
3763 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } 2383 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST }
3764 fn cast(syntax: SyntaxNode) -> Option<Self> { 2384 fn cast(syntax: SyntaxNode) -> Option<Self> {
3765 if Self::can_cast(syntax.kind()) { 2385 if Self::can_cast(syntax.kind()) {
3766 Some(Self { syntax }) 2386 Some(Self { syntax })
@@ -3770,8 +2390,8 @@ impl AstNode for TypeParam {
3770 } 2390 }
3771 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2391 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3772} 2392}
3773impl AstNode for ConstParam { 2393impl AstNode for MatchArm {
3774 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } 2394 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM }
3775 fn cast(syntax: SyntaxNode) -> Option<Self> { 2395 fn cast(syntax: SyntaxNode) -> Option<Self> {
3776 if Self::can_cast(syntax.kind()) { 2396 if Self::can_cast(syntax.kind()) {
3777 Some(Self { syntax }) 2397 Some(Self { syntax })
@@ -3781,8 +2401,8 @@ impl AstNode for ConstParam {
3781 } 2401 }
3782 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2402 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3783} 2403}
3784impl AstNode for LifetimeParam { 2404impl AstNode for MatchGuard {
3785 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } 2405 fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD }
3786 fn cast(syntax: SyntaxNode) -> Option<Self> { 2406 fn cast(syntax: SyntaxNode) -> Option<Self> {
3787 if Self::can_cast(syntax.kind()) { 2407 if Self::can_cast(syntax.kind()) {
3788 Some(Self { syntax }) 2408 Some(Self { syntax })
@@ -3792,8 +2412,8 @@ impl AstNode for LifetimeParam {
3792 } 2412 }
3793 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2413 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3794} 2414}
3795impl AstNode for TypeBound { 2415impl AstNode for ArrayType {
3796 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } 2416 fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE }
3797 fn cast(syntax: SyntaxNode) -> Option<Self> { 2417 fn cast(syntax: SyntaxNode) -> Option<Self> {
3798 if Self::can_cast(syntax.kind()) { 2418 if Self::can_cast(syntax.kind()) {
3799 Some(Self { syntax }) 2419 Some(Self { syntax })
@@ -3803,8 +2423,8 @@ impl AstNode for TypeBound {
3803 } 2423 }
3804 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2424 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3805} 2425}
3806impl AstNode for TypeBoundList { 2426impl AstNode for DynTraitType {
3807 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } 2427 fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE }
3808 fn cast(syntax: SyntaxNode) -> Option<Self> { 2428 fn cast(syntax: SyntaxNode) -> Option<Self> {
3809 if Self::can_cast(syntax.kind()) { 2429 if Self::can_cast(syntax.kind()) {
3810 Some(Self { syntax }) 2430 Some(Self { syntax })
@@ -3814,8 +2434,8 @@ impl AstNode for TypeBoundList {
3814 } 2434 }
3815 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2435 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3816} 2436}
3817impl AstNode for WherePred { 2437impl AstNode for FnPtrType {
3818 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } 2438 fn can_cast(kind: SyntaxKind) -> bool { kind == FN_PTR_TYPE }
3819 fn cast(syntax: SyntaxNode) -> Option<Self> { 2439 fn cast(syntax: SyntaxNode) -> Option<Self> {
3820 if Self::can_cast(syntax.kind()) { 2440 if Self::can_cast(syntax.kind()) {
3821 Some(Self { syntax }) 2441 Some(Self { syntax })
@@ -3825,8 +2445,8 @@ impl AstNode for WherePred {
3825 } 2445 }
3826 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2446 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3827} 2447}
3828impl AstNode for WhereClause { 2448impl AstNode for ForType {
3829 fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } 2449 fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE }
3830 fn cast(syntax: SyntaxNode) -> Option<Self> { 2450 fn cast(syntax: SyntaxNode) -> Option<Self> {
3831 if Self::can_cast(syntax.kind()) { 2451 if Self::can_cast(syntax.kind()) {
3832 Some(Self { syntax }) 2452 Some(Self { syntax })
@@ -3836,8 +2456,8 @@ impl AstNode for WhereClause {
3836 } 2456 }
3837 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2457 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3838} 2458}
3839impl AstNode for Abi { 2459impl AstNode for ImplTraitType {
3840 fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } 2460 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE }
3841 fn cast(syntax: SyntaxNode) -> Option<Self> { 2461 fn cast(syntax: SyntaxNode) -> Option<Self> {
3842 if Self::can_cast(syntax.kind()) { 2462 if Self::can_cast(syntax.kind()) {
3843 Some(Self { syntax }) 2463 Some(Self { syntax })
@@ -3847,8 +2467,8 @@ impl AstNode for Abi {
3847 } 2467 }
3848 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2468 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3849} 2469}
3850impl AstNode for ExprStmt { 2470impl AstNode for InferType {
3851 fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } 2471 fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE }
3852 fn cast(syntax: SyntaxNode) -> Option<Self> { 2472 fn cast(syntax: SyntaxNode) -> Option<Self> {
3853 if Self::can_cast(syntax.kind()) { 2473 if Self::can_cast(syntax.kind()) {
3854 Some(Self { syntax }) 2474 Some(Self { syntax })
@@ -3858,8 +2478,8 @@ impl AstNode for ExprStmt {
3858 } 2478 }
3859 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2479 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3860} 2480}
3861impl AstNode for LetStmt { 2481impl AstNode for NeverType {
3862 fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } 2482 fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE }
3863 fn cast(syntax: SyntaxNode) -> Option<Self> { 2483 fn cast(syntax: SyntaxNode) -> Option<Self> {
3864 if Self::can_cast(syntax.kind()) { 2484 if Self::can_cast(syntax.kind()) {
3865 Some(Self { syntax }) 2485 Some(Self { syntax })
@@ -3869,8 +2489,8 @@ impl AstNode for LetStmt {
3869 } 2489 }
3870 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2490 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3871} 2491}
3872impl AstNode for Condition { 2492impl AstNode for ParenType {
3873 fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } 2493 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE }
3874 fn cast(syntax: SyntaxNode) -> Option<Self> { 2494 fn cast(syntax: SyntaxNode) -> Option<Self> {
3875 if Self::can_cast(syntax.kind()) { 2495 if Self::can_cast(syntax.kind()) {
3876 Some(Self { syntax }) 2496 Some(Self { syntax })
@@ -3880,8 +2500,8 @@ impl AstNode for Condition {
3880 } 2500 }
3881 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2501 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3882} 2502}
3883impl AstNode for ParamList { 2503impl AstNode for PtrType {
3884 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } 2504 fn can_cast(kind: SyntaxKind) -> bool { kind == PTR_TYPE }
3885 fn cast(syntax: SyntaxNode) -> Option<Self> { 2505 fn cast(syntax: SyntaxNode) -> Option<Self> {
3886 if Self::can_cast(syntax.kind()) { 2506 if Self::can_cast(syntax.kind()) {
3887 Some(Self { syntax }) 2507 Some(Self { syntax })
@@ -3891,8 +2511,8 @@ impl AstNode for ParamList {
3891 } 2511 }
3892 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2512 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3893} 2513}
3894impl AstNode for SelfParam { 2514impl AstNode for RefType {
3895 fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } 2515 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_TYPE }
3896 fn cast(syntax: SyntaxNode) -> Option<Self> { 2516 fn cast(syntax: SyntaxNode) -> Option<Self> {
3897 if Self::can_cast(syntax.kind()) { 2517 if Self::can_cast(syntax.kind()) {
3898 Some(Self { syntax }) 2518 Some(Self { syntax })
@@ -3902,8 +2522,8 @@ impl AstNode for SelfParam {
3902 } 2522 }
3903 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2523 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3904} 2524}
3905impl AstNode for Param { 2525impl AstNode for SliceType {
3906 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } 2526 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE }
3907 fn cast(syntax: SyntaxNode) -> Option<Self> { 2527 fn cast(syntax: SyntaxNode) -> Option<Self> {
3908 if Self::can_cast(syntax.kind()) { 2528 if Self::can_cast(syntax.kind()) {
3909 Some(Self { syntax }) 2529 Some(Self { syntax })
@@ -3913,8 +2533,8 @@ impl AstNode for Param {
3913 } 2533 }
3914 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2534 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3915} 2535}
3916impl AstNode for UseItem { 2536impl AstNode for TupleType {
3917 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } 2537 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE }
3918 fn cast(syntax: SyntaxNode) -> Option<Self> { 2538 fn cast(syntax: SyntaxNode) -> Option<Self> {
3919 if Self::can_cast(syntax.kind()) { 2539 if Self::can_cast(syntax.kind()) {
3920 Some(Self { syntax }) 2540 Some(Self { syntax })
@@ -3924,8 +2544,8 @@ impl AstNode for UseItem {
3924 } 2544 }
3925 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2545 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3926} 2546}
3927impl AstNode for UseTree { 2547impl AstNode for TypeBound {
3928 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } 2548 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND }
3929 fn cast(syntax: SyntaxNode) -> Option<Self> { 2549 fn cast(syntax: SyntaxNode) -> Option<Self> {
3930 if Self::can_cast(syntax.kind()) { 2550 if Self::can_cast(syntax.kind()) {
3931 Some(Self { syntax }) 2551 Some(Self { syntax })
@@ -3935,8 +2555,8 @@ impl AstNode for UseTree {
3935 } 2555 }
3936 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2556 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3937} 2557}
3938impl AstNode for Alias { 2558impl AstNode for IdentPat {
3939 fn can_cast(kind: SyntaxKind) -> bool { kind == ALIAS } 2559 fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT_PAT }
3940 fn cast(syntax: SyntaxNode) -> Option<Self> { 2560 fn cast(syntax: SyntaxNode) -> Option<Self> {
3941 if Self::can_cast(syntax.kind()) { 2561 if Self::can_cast(syntax.kind()) {
3942 Some(Self { syntax }) 2562 Some(Self { syntax })
@@ -3946,8 +2566,8 @@ impl AstNode for Alias {
3946 } 2566 }
3947 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2567 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3948} 2568}
3949impl AstNode for UseTreeList { 2569impl AstNode for BoxPat {
3950 fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } 2570 fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT }
3951 fn cast(syntax: SyntaxNode) -> Option<Self> { 2571 fn cast(syntax: SyntaxNode) -> Option<Self> {
3952 if Self::can_cast(syntax.kind()) { 2572 if Self::can_cast(syntax.kind()) {
3953 Some(Self { syntax }) 2573 Some(Self { syntax })
@@ -3957,8 +2577,8 @@ impl AstNode for UseTreeList {
3957 } 2577 }
3958 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2578 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3959} 2579}
3960impl AstNode for ExternCrateItem { 2580impl AstNode for RestPat {
3961 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } 2581 fn can_cast(kind: SyntaxKind) -> bool { kind == REST_PAT }
3962 fn cast(syntax: SyntaxNode) -> Option<Self> { 2582 fn cast(syntax: SyntaxNode) -> Option<Self> {
3963 if Self::can_cast(syntax.kind()) { 2583 if Self::can_cast(syntax.kind()) {
3964 Some(Self { syntax }) 2584 Some(Self { syntax })
@@ -3968,8 +2588,8 @@ impl AstNode for ExternCrateItem {
3968 } 2588 }
3969 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2589 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3970} 2590}
3971impl AstNode for ArgList { 2591impl AstNode for LiteralPat {
3972 fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } 2592 fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT }
3973 fn cast(syntax: SyntaxNode) -> Option<Self> { 2593 fn cast(syntax: SyntaxNode) -> Option<Self> {
3974 if Self::can_cast(syntax.kind()) { 2594 if Self::can_cast(syntax.kind()) {
3975 Some(Self { syntax }) 2595 Some(Self { syntax })
@@ -3979,8 +2599,8 @@ impl AstNode for ArgList {
3979 } 2599 }
3980 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2600 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3981} 2601}
3982impl AstNode for Path { 2602impl AstNode for MacroPat {
3983 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } 2603 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT }
3984 fn cast(syntax: SyntaxNode) -> Option<Self> { 2604 fn cast(syntax: SyntaxNode) -> Option<Self> {
3985 if Self::can_cast(syntax.kind()) { 2605 if Self::can_cast(syntax.kind()) {
3986 Some(Self { syntax }) 2606 Some(Self { syntax })
@@ -3990,8 +2610,8 @@ impl AstNode for Path {
3990 } 2610 }
3991 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2611 fn syntax(&self) -> &SyntaxNode { &self.syntax }
3992} 2612}
3993impl AstNode for PathSegment { 2613impl AstNode for OrPat {
3994 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } 2614 fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT }
3995 fn cast(syntax: SyntaxNode) -> Option<Self> { 2615 fn cast(syntax: SyntaxNode) -> Option<Self> {
3996 if Self::can_cast(syntax.kind()) { 2616 if Self::can_cast(syntax.kind()) {
3997 Some(Self { syntax }) 2617 Some(Self { syntax })
@@ -4001,8 +2621,8 @@ impl AstNode for PathSegment {
4001 } 2621 }
4002 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2622 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4003} 2623}
4004impl AstNode for TypeArgList { 2624impl AstNode for ParenPat {
4005 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } 2625 fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT }
4006 fn cast(syntax: SyntaxNode) -> Option<Self> { 2626 fn cast(syntax: SyntaxNode) -> Option<Self> {
4007 if Self::can_cast(syntax.kind()) { 2627 if Self::can_cast(syntax.kind()) {
4008 Some(Self { syntax }) 2628 Some(Self { syntax })
@@ -4012,8 +2632,8 @@ impl AstNode for TypeArgList {
4012 } 2632 }
4013 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2633 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4014} 2634}
4015impl AstNode for TypeArg { 2635impl AstNode for PathPat {
4016 fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } 2636 fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT }
4017 fn cast(syntax: SyntaxNode) -> Option<Self> { 2637 fn cast(syntax: SyntaxNode) -> Option<Self> {
4018 if Self::can_cast(syntax.kind()) { 2638 if Self::can_cast(syntax.kind()) {
4019 Some(Self { syntax }) 2639 Some(Self { syntax })
@@ -4023,8 +2643,8 @@ impl AstNode for TypeArg {
4023 } 2643 }
4024 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2644 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4025} 2645}
4026impl AstNode for AssocTypeArg { 2646impl AstNode for WildcardPat {
4027 fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } 2647 fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT }
4028 fn cast(syntax: SyntaxNode) -> Option<Self> { 2648 fn cast(syntax: SyntaxNode) -> Option<Self> {
4029 if Self::can_cast(syntax.kind()) { 2649 if Self::can_cast(syntax.kind()) {
4030 Some(Self { syntax }) 2650 Some(Self { syntax })
@@ -4034,8 +2654,8 @@ impl AstNode for AssocTypeArg {
4034 } 2654 }
4035 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2655 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4036} 2656}
4037impl AstNode for LifetimeArg { 2657impl AstNode for RangePat {
4038 fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } 2658 fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT }
4039 fn cast(syntax: SyntaxNode) -> Option<Self> { 2659 fn cast(syntax: SyntaxNode) -> Option<Self> {
4040 if Self::can_cast(syntax.kind()) { 2660 if Self::can_cast(syntax.kind()) {
4041 Some(Self { syntax }) 2661 Some(Self { syntax })
@@ -4045,8 +2665,8 @@ impl AstNode for LifetimeArg {
4045 } 2665 }
4046 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2666 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4047} 2667}
4048impl AstNode for ConstArg { 2668impl AstNode for RecordPat {
4049 fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } 2669 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT }
4050 fn cast(syntax: SyntaxNode) -> Option<Self> { 2670 fn cast(syntax: SyntaxNode) -> Option<Self> {
4051 if Self::can_cast(syntax.kind()) { 2671 if Self::can_cast(syntax.kind()) {
4052 Some(Self { syntax }) 2672 Some(Self { syntax })
@@ -4056,8 +2676,8 @@ impl AstNode for ConstArg {
4056 } 2676 }
4057 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2677 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4058} 2678}
4059impl AstNode for MacroItems { 2679impl AstNode for RefPat {
4060 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } 2680 fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT }
4061 fn cast(syntax: SyntaxNode) -> Option<Self> { 2681 fn cast(syntax: SyntaxNode) -> Option<Self> {
4062 if Self::can_cast(syntax.kind()) { 2682 if Self::can_cast(syntax.kind()) {
4063 Some(Self { syntax }) 2683 Some(Self { syntax })
@@ -4067,8 +2687,8 @@ impl AstNode for MacroItems {
4067 } 2687 }
4068 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2688 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4069} 2689}
4070impl AstNode for MacroStmts { 2690impl AstNode for SlicePat {
4071 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } 2691 fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT }
4072 fn cast(syntax: SyntaxNode) -> Option<Self> { 2692 fn cast(syntax: SyntaxNode) -> Option<Self> {
4073 if Self::can_cast(syntax.kind()) { 2693 if Self::can_cast(syntax.kind()) {
4074 Some(Self { syntax }) 2694 Some(Self { syntax })
@@ -4078,8 +2698,8 @@ impl AstNode for MacroStmts {
4078 } 2698 }
4079 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2699 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4080} 2700}
4081impl AstNode for ExternItemList { 2701impl AstNode for TuplePat {
4082 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } 2702 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT }
4083 fn cast(syntax: SyntaxNode) -> Option<Self> { 2703 fn cast(syntax: SyntaxNode) -> Option<Self> {
4084 if Self::can_cast(syntax.kind()) { 2704 if Self::can_cast(syntax.kind()) {
4085 Some(Self { syntax }) 2705 Some(Self { syntax })
@@ -4089,8 +2709,8 @@ impl AstNode for ExternItemList {
4089 } 2709 }
4090 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2710 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4091} 2711}
4092impl AstNode for ExternBlock { 2712impl AstNode for TupleStructPat {
4093 fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } 2713 fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT }
4094 fn cast(syntax: SyntaxNode) -> Option<Self> { 2714 fn cast(syntax: SyntaxNode) -> Option<Self> {
4095 if Self::can_cast(syntax.kind()) { 2715 if Self::can_cast(syntax.kind()) {
4096 Some(Self { syntax }) 2716 Some(Self { syntax })
@@ -4100,8 +2720,8 @@ impl AstNode for ExternBlock {
4100 } 2720 }
4101 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2721 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4102} 2722}
4103impl AstNode for MetaItem { 2723impl AstNode for RecordPatFieldList {
4104 fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM } 2724 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST }
4105 fn cast(syntax: SyntaxNode) -> Option<Self> { 2725 fn cast(syntax: SyntaxNode) -> Option<Self> {
4106 if Self::can_cast(syntax.kind()) { 2726 if Self::can_cast(syntax.kind()) {
4107 Some(Self { syntax }) 2727 Some(Self { syntax })
@@ -4111,8 +2731,8 @@ impl AstNode for MetaItem {
4111 } 2731 }
4112 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2732 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4113} 2733}
4114impl AstNode for MacroDef { 2734impl AstNode for RecordPatField {
4115 fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } 2735 fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD }
4116 fn cast(syntax: SyntaxNode) -> Option<Self> { 2736 fn cast(syntax: SyntaxNode) -> Option<Self> {
4117 if Self::can_cast(syntax.kind()) { 2737 if Self::can_cast(syntax.kind()) {
4118 Some(Self { syntax }) 2738 Some(Self { syntax })
@@ -4122,420 +2742,194 @@ impl AstNode for MacroDef {
4122 } 2742 }
4123 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2743 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4124} 2744}
4125impl From<StructDef> for NominalDef { 2745impl From<TypeArg> for GenericArg {
4126 fn from(node: StructDef) -> NominalDef { NominalDef::StructDef(node) } 2746 fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
4127}
4128impl From<EnumDef> for NominalDef {
4129 fn from(node: EnumDef) -> NominalDef { NominalDef::EnumDef(node) }
4130}
4131impl From<UnionDef> for NominalDef {
4132 fn from(node: UnionDef) -> NominalDef { NominalDef::UnionDef(node) }
4133}
4134impl AstNode for NominalDef {
4135 fn can_cast(kind: SyntaxKind) -> bool {
4136 match kind {
4137 STRUCT_DEF | ENUM_DEF | UNION_DEF => true,
4138 _ => false,
4139 }
4140 }
4141 fn cast(syntax: SyntaxNode) -> Option<Self> {
4142 let res = match syntax.kind() {
4143 STRUCT_DEF => NominalDef::StructDef(StructDef { syntax }),
4144 ENUM_DEF => NominalDef::EnumDef(EnumDef { syntax }),
4145 UNION_DEF => NominalDef::UnionDef(UnionDef { syntax }),
4146 _ => return None,
4147 };
4148 Some(res)
4149 }
4150 fn syntax(&self) -> &SyntaxNode {
4151 match self {
4152 NominalDef::StructDef(it) => &it.syntax,
4153 NominalDef::EnumDef(it) => &it.syntax,
4154 NominalDef::UnionDef(it) => &it.syntax,
4155 }
4156 }
4157}
4158impl From<LifetimeParam> for GenericParam {
4159 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
4160}
4161impl From<TypeParam> for GenericParam {
4162 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
4163}
4164impl From<ConstParam> for GenericParam {
4165 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
4166} 2747}
4167impl AstNode for GenericParam { 2748impl From<AssocTypeArg> for GenericArg {
4168 fn can_cast(kind: SyntaxKind) -> bool { 2749 fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
4169 match kind {
4170 LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true,
4171 _ => false,
4172 }
4173 }
4174 fn cast(syntax: SyntaxNode) -> Option<Self> {
4175 let res = match syntax.kind() {
4176 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
4177 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
4178 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
4179 _ => return None,
4180 };
4181 Some(res)
4182 }
4183 fn syntax(&self) -> &SyntaxNode {
4184 match self {
4185 GenericParam::LifetimeParam(it) => &it.syntax,
4186 GenericParam::TypeParam(it) => &it.syntax,
4187 GenericParam::ConstParam(it) => &it.syntax,
4188 }
4189 }
4190} 2750}
4191impl From<LifetimeArg> for GenericArg { 2751impl From<LifetimeArg> for GenericArg {
4192 fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } 2752 fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) }
4193} 2753}
4194impl From<TypeArg> for GenericArg {
4195 fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) }
4196}
4197impl From<ConstArg> for GenericArg { 2754impl From<ConstArg> for GenericArg {
4198 fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) } 2755 fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) }
4199} 2756}
4200impl From<AssocTypeArg> for GenericArg {
4201 fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) }
4202}
4203impl AstNode for GenericArg { 2757impl AstNode for GenericArg {
4204 fn can_cast(kind: SyntaxKind) -> bool { 2758 fn can_cast(kind: SyntaxKind) -> bool {
4205 match kind { 2759 match kind {
4206 LIFETIME_ARG | TYPE_ARG | CONST_ARG | ASSOC_TYPE_ARG => true, 2760 TYPE_ARG | ASSOC_TYPE_ARG | LIFETIME_ARG | CONST_ARG => true,
4207 _ => false, 2761 _ => false,
4208 } 2762 }
4209 } 2763 }
4210 fn cast(syntax: SyntaxNode) -> Option<Self> { 2764 fn cast(syntax: SyntaxNode) -> Option<Self> {
4211 let res = match syntax.kind() { 2765 let res = match syntax.kind() {
4212 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
4213 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }), 2766 TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }),
4214 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
4215 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }), 2767 ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }),
2768 LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }),
2769 CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }),
4216 _ => return None, 2770 _ => return None,
4217 }; 2771 };
4218 Some(res) 2772 Some(res)
4219 } 2773 }
4220 fn syntax(&self) -> &SyntaxNode { 2774 fn syntax(&self) -> &SyntaxNode {
4221 match self { 2775 match self {
4222 GenericArg::LifetimeArg(it) => &it.syntax,
4223 GenericArg::TypeArg(it) => &it.syntax, 2776 GenericArg::TypeArg(it) => &it.syntax,
4224 GenericArg::ConstArg(it) => &it.syntax,
4225 GenericArg::AssocTypeArg(it) => &it.syntax, 2777 GenericArg::AssocTypeArg(it) => &it.syntax,
2778 GenericArg::LifetimeArg(it) => &it.syntax,
2779 GenericArg::ConstArg(it) => &it.syntax,
4226 } 2780 }
4227 } 2781 }
4228} 2782}
4229impl From<ParenType> for TypeRef { 2783impl From<ArrayType> for Type {
4230 fn from(node: ParenType) -> TypeRef { TypeRef::ParenType(node) } 2784 fn from(node: ArrayType) -> Type { Type::ArrayType(node) }
4231}
4232impl From<TupleType> for TypeRef {
4233 fn from(node: TupleType) -> TypeRef { TypeRef::TupleType(node) }
4234}
4235impl From<NeverType> for TypeRef {
4236 fn from(node: NeverType) -> TypeRef { TypeRef::NeverType(node) }
4237}
4238impl From<PathType> for TypeRef {
4239 fn from(node: PathType) -> TypeRef { TypeRef::PathType(node) }
4240}
4241impl From<PointerType> for TypeRef {
4242 fn from(node: PointerType) -> TypeRef { TypeRef::PointerType(node) }
4243}
4244impl From<ArrayType> for TypeRef {
4245 fn from(node: ArrayType) -> TypeRef { TypeRef::ArrayType(node) }
4246}
4247impl From<SliceType> for TypeRef {
4248 fn from(node: SliceType) -> TypeRef { TypeRef::SliceType(node) }
4249}
4250impl From<ReferenceType> for TypeRef {
4251 fn from(node: ReferenceType) -> TypeRef { TypeRef::ReferenceType(node) }
4252}
4253impl From<PlaceholderType> for TypeRef {
4254 fn from(node: PlaceholderType) -> TypeRef { TypeRef::PlaceholderType(node) }
4255}
4256impl From<FnPointerType> for TypeRef {
4257 fn from(node: FnPointerType) -> TypeRef { TypeRef::FnPointerType(node) }
4258}
4259impl From<ForType> for TypeRef {
4260 fn from(node: ForType) -> TypeRef { TypeRef::ForType(node) }
4261}
4262impl From<ImplTraitType> for TypeRef {
4263 fn from(node: ImplTraitType) -> TypeRef { TypeRef::ImplTraitType(node) }
4264}
4265impl From<DynTraitType> for TypeRef {
4266 fn from(node: DynTraitType) -> TypeRef { TypeRef::DynTraitType(node) }
4267}
4268impl AstNode for TypeRef {
4269 fn can_cast(kind: SyntaxKind) -> bool {
4270 match kind {
4271 PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE
4272 | SLICE_TYPE | REFERENCE_TYPE | PLACEHOLDER_TYPE | FN_POINTER_TYPE | FOR_TYPE
4273 | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true,
4274 _ => false,
4275 }
4276 }
4277 fn cast(syntax: SyntaxNode) -> Option<Self> {
4278 let res = match syntax.kind() {
4279 PAREN_TYPE => TypeRef::ParenType(ParenType { syntax }),
4280 TUPLE_TYPE => TypeRef::TupleType(TupleType { syntax }),
4281 NEVER_TYPE => TypeRef::NeverType(NeverType { syntax }),
4282 PATH_TYPE => TypeRef::PathType(PathType { syntax }),
4283 POINTER_TYPE => TypeRef::PointerType(PointerType { syntax }),
4284 ARRAY_TYPE => TypeRef::ArrayType(ArrayType { syntax }),
4285 SLICE_TYPE => TypeRef::SliceType(SliceType { syntax }),
4286 REFERENCE_TYPE => TypeRef::ReferenceType(ReferenceType { syntax }),
4287 PLACEHOLDER_TYPE => TypeRef::PlaceholderType(PlaceholderType { syntax }),
4288 FN_POINTER_TYPE => TypeRef::FnPointerType(FnPointerType { syntax }),
4289 FOR_TYPE => TypeRef::ForType(ForType { syntax }),
4290 IMPL_TRAIT_TYPE => TypeRef::ImplTraitType(ImplTraitType { syntax }),
4291 DYN_TRAIT_TYPE => TypeRef::DynTraitType(DynTraitType { syntax }),
4292 _ => return None,
4293 };
4294 Some(res)
4295 }
4296 fn syntax(&self) -> &SyntaxNode {
4297 match self {
4298 TypeRef::ParenType(it) => &it.syntax,
4299 TypeRef::TupleType(it) => &it.syntax,
4300 TypeRef::NeverType(it) => &it.syntax,
4301 TypeRef::PathType(it) => &it.syntax,
4302 TypeRef::PointerType(it) => &it.syntax,
4303 TypeRef::ArrayType(it) => &it.syntax,
4304 TypeRef::SliceType(it) => &it.syntax,
4305 TypeRef::ReferenceType(it) => &it.syntax,
4306 TypeRef::PlaceholderType(it) => &it.syntax,
4307 TypeRef::FnPointerType(it) => &it.syntax,
4308 TypeRef::ForType(it) => &it.syntax,
4309 TypeRef::ImplTraitType(it) => &it.syntax,
4310 TypeRef::DynTraitType(it) => &it.syntax,
4311 }
4312 }
4313}
4314impl From<StructDef> for ModuleItem {
4315 fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) }
4316}
4317impl From<UnionDef> for ModuleItem {
4318 fn from(node: UnionDef) -> ModuleItem { ModuleItem::UnionDef(node) }
4319} 2785}
4320impl From<EnumDef> for ModuleItem { 2786impl From<DynTraitType> for Type {
4321 fn from(node: EnumDef) -> ModuleItem { ModuleItem::EnumDef(node) } 2787 fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) }
4322} 2788}
4323impl From<FnDef> for ModuleItem { 2789impl From<FnPtrType> for Type {
4324 fn from(node: FnDef) -> ModuleItem { ModuleItem::FnDef(node) } 2790 fn from(node: FnPtrType) -> Type { Type::FnPtrType(node) }
4325} 2791}
4326impl From<TraitDef> for ModuleItem { 2792impl From<ForType> for Type {
4327 fn from(node: TraitDef) -> ModuleItem { ModuleItem::TraitDef(node) } 2793 fn from(node: ForType) -> Type { Type::ForType(node) }
4328} 2794}
4329impl From<TypeAliasDef> for ModuleItem { 2795impl From<ImplTraitType> for Type {
4330 fn from(node: TypeAliasDef) -> ModuleItem { ModuleItem::TypeAliasDef(node) } 2796 fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) }
4331} 2797}
4332impl From<ImplDef> for ModuleItem { 2798impl From<InferType> for Type {
4333 fn from(node: ImplDef) -> ModuleItem { ModuleItem::ImplDef(node) } 2799 fn from(node: InferType) -> Type { Type::InferType(node) }
4334} 2800}
4335impl From<UseItem> for ModuleItem { 2801impl From<NeverType> for Type {
4336 fn from(node: UseItem) -> ModuleItem { ModuleItem::UseItem(node) } 2802 fn from(node: NeverType) -> Type { Type::NeverType(node) }
4337} 2803}
4338impl From<ExternCrateItem> for ModuleItem { 2804impl From<ParenType> for Type {
4339 fn from(node: ExternCrateItem) -> ModuleItem { ModuleItem::ExternCrateItem(node) } 2805 fn from(node: ParenType) -> Type { Type::ParenType(node) }
4340} 2806}
4341impl From<ConstDef> for ModuleItem { 2807impl From<PathType> for Type {
4342 fn from(node: ConstDef) -> ModuleItem { ModuleItem::ConstDef(node) } 2808 fn from(node: PathType) -> Type { Type::PathType(node) }
4343} 2809}
4344impl From<StaticDef> for ModuleItem { 2810impl From<PtrType> for Type {
4345 fn from(node: StaticDef) -> ModuleItem { ModuleItem::StaticDef(node) } 2811 fn from(node: PtrType) -> Type { Type::PtrType(node) }
4346} 2812}
4347impl From<Module> for ModuleItem { 2813impl From<RefType> for Type {
4348 fn from(node: Module) -> ModuleItem { ModuleItem::Module(node) } 2814 fn from(node: RefType) -> Type { Type::RefType(node) }
4349} 2815}
4350impl From<MacroCall> for ModuleItem { 2816impl From<SliceType> for Type {
4351 fn from(node: MacroCall) -> ModuleItem { ModuleItem::MacroCall(node) } 2817 fn from(node: SliceType) -> Type { Type::SliceType(node) }
4352} 2818}
4353impl From<ExternBlock> for ModuleItem { 2819impl From<TupleType> for Type {
4354 fn from(node: ExternBlock) -> ModuleItem { ModuleItem::ExternBlock(node) } 2820 fn from(node: TupleType) -> Type { Type::TupleType(node) }
4355} 2821}
4356impl AstNode for ModuleItem { 2822impl AstNode for Type {
4357 fn can_cast(kind: SyntaxKind) -> bool { 2823 fn can_cast(kind: SyntaxKind) -> bool {
4358 match kind { 2824 match kind {
4359 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF 2825 ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE
4360 | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL 2826 | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE | SLICE_TYPE
4361 | EXTERN_BLOCK => true, 2827 | TUPLE_TYPE => true,
4362 _ => false, 2828 _ => false,
4363 } 2829 }
4364 } 2830 }
4365 fn cast(syntax: SyntaxNode) -> Option<Self> { 2831 fn cast(syntax: SyntaxNode) -> Option<Self> {
4366 let res = match syntax.kind() { 2832 let res = match syntax.kind() {
4367 STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }), 2833 ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }),
4368 UNION_DEF => ModuleItem::UnionDef(UnionDef { syntax }), 2834 DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }),
4369 ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }), 2835 FN_PTR_TYPE => Type::FnPtrType(FnPtrType { syntax }),
4370 FN_DEF => ModuleItem::FnDef(FnDef { syntax }), 2836 FOR_TYPE => Type::ForType(ForType { syntax }),
4371 TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }), 2837 IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }),
4372 TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }), 2838 INFER_TYPE => Type::InferType(InferType { syntax }),
4373 IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }), 2839 NEVER_TYPE => Type::NeverType(NeverType { syntax }),
4374 USE_ITEM => ModuleItem::UseItem(UseItem { syntax }), 2840 PAREN_TYPE => Type::ParenType(ParenType { syntax }),
4375 EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }), 2841 PATH_TYPE => Type::PathType(PathType { syntax }),
4376 CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }), 2842 PTR_TYPE => Type::PtrType(PtrType { syntax }),
4377 STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }), 2843 REF_TYPE => Type::RefType(RefType { syntax }),
4378 MODULE => ModuleItem::Module(Module { syntax }), 2844 SLICE_TYPE => Type::SliceType(SliceType { syntax }),
4379 MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }), 2845 TUPLE_TYPE => Type::TupleType(TupleType { syntax }),
4380 EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }),
4381 _ => return None, 2846 _ => return None,
4382 }; 2847 };
4383 Some(res) 2848 Some(res)
4384 } 2849 }
4385 fn syntax(&self) -> &SyntaxNode { 2850 fn syntax(&self) -> &SyntaxNode {
4386 match self { 2851 match self {
4387 ModuleItem::StructDef(it) => &it.syntax, 2852 Type::ArrayType(it) => &it.syntax,
4388 ModuleItem::UnionDef(it) => &it.syntax, 2853 Type::DynTraitType(it) => &it.syntax,
4389 ModuleItem::EnumDef(it) => &it.syntax, 2854 Type::FnPtrType(it) => &it.syntax,
4390 ModuleItem::FnDef(it) => &it.syntax, 2855 Type::ForType(it) => &it.syntax,
4391 ModuleItem::TraitDef(it) => &it.syntax, 2856 Type::ImplTraitType(it) => &it.syntax,
4392 ModuleItem::TypeAliasDef(it) => &it.syntax, 2857 Type::InferType(it) => &it.syntax,
4393 ModuleItem::ImplDef(it) => &it.syntax, 2858 Type::NeverType(it) => &it.syntax,
4394 ModuleItem::UseItem(it) => &it.syntax, 2859 Type::ParenType(it) => &it.syntax,
4395 ModuleItem::ExternCrateItem(it) => &it.syntax, 2860 Type::PathType(it) => &it.syntax,
4396 ModuleItem::ConstDef(it) => &it.syntax, 2861 Type::PtrType(it) => &it.syntax,
4397 ModuleItem::StaticDef(it) => &it.syntax, 2862 Type::RefType(it) => &it.syntax,
4398 ModuleItem::Module(it) => &it.syntax, 2863 Type::SliceType(it) => &it.syntax,
4399 ModuleItem::MacroCall(it) => &it.syntax, 2864 Type::TupleType(it) => &it.syntax,
4400 ModuleItem::ExternBlock(it) => &it.syntax,
4401 } 2865 }
4402 } 2866 }
4403} 2867}
4404impl From<FnDef> for AssocItem { 2868impl From<ArrayExpr> for Expr {
4405 fn from(node: FnDef) -> AssocItem { AssocItem::FnDef(node) } 2869 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) }
4406}
4407impl From<TypeAliasDef> for AssocItem {
4408 fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) }
4409}
4410impl From<ConstDef> for AssocItem {
4411 fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
4412} 2870}
4413impl AstNode for AssocItem { 2871impl From<AwaitExpr> for Expr {
4414 fn can_cast(kind: SyntaxKind) -> bool { 2872 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
4415 match kind {
4416 FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
4417 _ => false,
4418 }
4419 }
4420 fn cast(syntax: SyntaxNode) -> Option<Self> {
4421 let res = match syntax.kind() {
4422 FN_DEF => AssocItem::FnDef(FnDef { syntax }),
4423 TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
4424 CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
4425 _ => return None,
4426 };
4427 Some(res)
4428 }
4429 fn syntax(&self) -> &SyntaxNode {
4430 match self {
4431 AssocItem::FnDef(it) => &it.syntax,
4432 AssocItem::TypeAliasDef(it) => &it.syntax,
4433 AssocItem::ConstDef(it) => &it.syntax,
4434 }
4435 }
4436} 2873}
4437impl From<FnDef> for ExternItem { 2874impl From<BinExpr> for Expr {
4438 fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) } 2875 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) }
4439} 2876}
4440impl From<StaticDef> for ExternItem { 2877impl From<BlockExpr> for Expr {
4441 fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) } 2878 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) }
4442} 2879}
4443impl AstNode for ExternItem { 2880impl From<BoxExpr> for Expr {
4444 fn can_cast(kind: SyntaxKind) -> bool { 2881 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) }
4445 match kind {
4446 FN_DEF | STATIC_DEF => true,
4447 _ => false,
4448 }
4449 }
4450 fn cast(syntax: SyntaxNode) -> Option<Self> {
4451 let res = match syntax.kind() {
4452 FN_DEF => ExternItem::FnDef(FnDef { syntax }),
4453 STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }),
4454 _ => return None,
4455 };
4456 Some(res)
4457 }
4458 fn syntax(&self) -> &SyntaxNode {
4459 match self {
4460 ExternItem::FnDef(it) => &it.syntax,
4461 ExternItem::StaticDef(it) => &it.syntax,
4462 }
4463 }
4464} 2882}
4465impl From<TupleExpr> for Expr { 2883impl From<BreakExpr> for Expr {
4466 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } 2884 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) }
4467} 2885}
4468impl From<ArrayExpr> for Expr { 2886impl From<CallExpr> for Expr {
4469 fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } 2887 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
4470} 2888}
4471impl From<ParenExpr> for Expr { 2889impl From<CastExpr> for Expr {
4472 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) } 2890 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
4473} 2891}
4474impl From<PathExpr> for Expr { 2892impl From<ClosureExpr> for Expr {
4475 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) } 2893 fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) }
4476} 2894}
4477impl From<LambdaExpr> for Expr { 2895impl From<ContinueExpr> for Expr {
4478 fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) } 2896 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
4479} 2897}
4480impl From<IfExpr> for Expr { 2898impl From<EffectExpr> for Expr {
4481 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) } 2899 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
4482} 2900}
4483impl From<LoopExpr> for Expr { 2901impl From<FieldExpr> for Expr {
4484 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) } 2902 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) }
4485} 2903}
4486impl From<ForExpr> for Expr { 2904impl From<ForExpr> for Expr {
4487 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) } 2905 fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) }
4488} 2906}
4489impl From<WhileExpr> for Expr { 2907impl From<IfExpr> for Expr {
4490 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } 2908 fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) }
4491}
4492impl From<ContinueExpr> for Expr {
4493 fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) }
4494} 2909}
4495impl From<BreakExpr> for Expr { 2910impl From<IndexExpr> for Expr {
4496 fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) } 2911 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
4497} 2912}
4498impl From<Label> for Expr { 2913impl From<Literal> for Expr {
4499 fn from(node: Label) -> Expr { Expr::Label(node) } 2914 fn from(node: Literal) -> Expr { Expr::Literal(node) }
4500} 2915}
4501impl From<BlockExpr> for Expr { 2916impl From<LoopExpr> for Expr {
4502 fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) } 2917 fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) }
4503} 2918}
4504impl From<ReturnExpr> for Expr { 2919impl From<MacroCall> for Expr {
4505 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) } 2920 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) }
4506} 2921}
4507impl From<MatchExpr> for Expr { 2922impl From<MatchExpr> for Expr {
4508 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } 2923 fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) }
4509} 2924}
4510impl From<RecordLit> for Expr {
4511 fn from(node: RecordLit) -> Expr { Expr::RecordLit(node) }
4512}
4513impl From<CallExpr> for Expr {
4514 fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) }
4515}
4516impl From<IndexExpr> for Expr {
4517 fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) }
4518}
4519impl From<MethodCallExpr> for Expr { 2925impl From<MethodCallExpr> for Expr {
4520 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) } 2926 fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) }
4521} 2927}
4522impl From<FieldExpr> for Expr { 2928impl From<ParenExpr> for Expr {
4523 fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) } 2929 fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) }
4524}
4525impl From<AwaitExpr> for Expr {
4526 fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) }
4527}
4528impl From<TryExpr> for Expr {
4529 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
4530}
4531impl From<EffectExpr> for Expr {
4532 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
4533}
4534impl From<CastExpr> for Expr {
4535 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
4536} 2930}
4537impl From<RefExpr> for Expr { 2931impl From<PathExpr> for Expr {
4538 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) } 2932 fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) }
4539} 2933}
4540impl From<PrefixExpr> for Expr { 2934impl From<PrefixExpr> for Expr {
4541 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) } 2935 fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) }
@@ -4543,349 +2937,485 @@ impl From<PrefixExpr> for Expr {
4543impl From<RangeExpr> for Expr { 2937impl From<RangeExpr> for Expr {
4544 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) } 2938 fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) }
4545} 2939}
4546impl From<BinExpr> for Expr { 2940impl From<RecordExpr> for Expr {
4547 fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } 2941 fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) }
4548} 2942}
4549impl From<Literal> for Expr { 2943impl From<RefExpr> for Expr {
4550 fn from(node: Literal) -> Expr { Expr::Literal(node) } 2944 fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) }
4551} 2945}
4552impl From<MacroCall> for Expr { 2946impl From<ReturnExpr> for Expr {
4553 fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) } 2947 fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) }
4554} 2948}
4555impl From<BoxExpr> for Expr { 2949impl From<TryExpr> for Expr {
4556 fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) } 2950 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
2951}
2952impl From<TupleExpr> for Expr {
2953 fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) }
2954}
2955impl From<WhileExpr> for Expr {
2956 fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) }
4557} 2957}
4558impl AstNode for Expr { 2958impl AstNode for Expr {
4559 fn can_cast(kind: SyntaxKind) -> bool { 2959 fn can_cast(kind: SyntaxKind) -> bool {
4560 match kind { 2960 match kind {
4561 TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR 2961 ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR
4562 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL 2962 | CAST_EXPR | CLOSURE_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR
4563 | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR 2963 | IF_EXPR | INDEX_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR
4564 | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR 2964 | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR
4565 | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { 2965 | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true,
4566 true
4567 }
4568 _ => false, 2966 _ => false,
4569 } 2967 }
4570 } 2968 }
4571 fn cast(syntax: SyntaxNode) -> Option<Self> { 2969 fn cast(syntax: SyntaxNode) -> Option<Self> {
4572 let res = match syntax.kind() { 2970 let res = match syntax.kind() {
4573 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
4574 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), 2971 ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }),
4575 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }), 2972 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
4576 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }), 2973 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }),
4577 LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }),
4578 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
4579 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
4580 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
4581 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
4582 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
4583 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
4584 LABEL => Expr::Label(Label { syntax }),
4585 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), 2974 BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }),
4586 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), 2975 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }),
4587 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), 2976 BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }),
4588 RECORD_LIT => Expr::RecordLit(RecordLit { syntax }),
4589 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), 2977 CALL_EXPR => Expr::CallExpr(CallExpr { syntax }),
2978 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
2979 CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }),
2980 CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }),
2981 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
2982 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
2983 FOR_EXPR => Expr::ForExpr(ForExpr { syntax }),
2984 IF_EXPR => Expr::IfExpr(IfExpr { syntax }),
4590 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), 2985 INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }),
2986 LITERAL => Expr::Literal(Literal { syntax }),
2987 LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }),
2988 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }),
2989 MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }),
4591 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), 2990 METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }),
4592 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), 2991 PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }),
4593 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), 2992 PATH_EXPR => Expr::PathExpr(PathExpr { syntax }),
4594 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
4595 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
4596 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
4597 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
4598 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), 2993 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
4599 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }), 2994 RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }),
4600 BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), 2995 RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }),
4601 LITERAL => Expr::Literal(Literal { syntax }), 2996 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
4602 MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), 2997 RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }),
4603 BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }), 2998 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
2999 TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }),
3000 WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }),
4604 _ => return None, 3001 _ => return None,
4605 }; 3002 };
4606 Some(res) 3003 Some(res)
4607 } 3004 }
4608 fn syntax(&self) -> &SyntaxNode { 3005 fn syntax(&self) -> &SyntaxNode {
4609 match self { 3006 match self {
4610 Expr::TupleExpr(it) => &it.syntax,
4611 Expr::ArrayExpr(it) => &it.syntax, 3007 Expr::ArrayExpr(it) => &it.syntax,
4612 Expr::ParenExpr(it) => &it.syntax, 3008 Expr::AwaitExpr(it) => &it.syntax,
4613 Expr::PathExpr(it) => &it.syntax, 3009 Expr::BinExpr(it) => &it.syntax,
4614 Expr::LambdaExpr(it) => &it.syntax,
4615 Expr::IfExpr(it) => &it.syntax,
4616 Expr::LoopExpr(it) => &it.syntax,
4617 Expr::ForExpr(it) => &it.syntax,
4618 Expr::WhileExpr(it) => &it.syntax,
4619 Expr::ContinueExpr(it) => &it.syntax,
4620 Expr::BreakExpr(it) => &it.syntax,
4621 Expr::Label(it) => &it.syntax,
4622 Expr::BlockExpr(it) => &it.syntax, 3010 Expr::BlockExpr(it) => &it.syntax,
4623 Expr::ReturnExpr(it) => &it.syntax, 3011 Expr::BoxExpr(it) => &it.syntax,
4624 Expr::MatchExpr(it) => &it.syntax, 3012 Expr::BreakExpr(it) => &it.syntax,
4625 Expr::RecordLit(it) => &it.syntax,
4626 Expr::CallExpr(it) => &it.syntax, 3013 Expr::CallExpr(it) => &it.syntax,
3014 Expr::CastExpr(it) => &it.syntax,
3015 Expr::ClosureExpr(it) => &it.syntax,
3016 Expr::ContinueExpr(it) => &it.syntax,
3017 Expr::EffectExpr(it) => &it.syntax,
3018 Expr::FieldExpr(it) => &it.syntax,
3019 Expr::ForExpr(it) => &it.syntax,
3020 Expr::IfExpr(it) => &it.syntax,
4627 Expr::IndexExpr(it) => &it.syntax, 3021 Expr::IndexExpr(it) => &it.syntax,
3022 Expr::Literal(it) => &it.syntax,
3023 Expr::LoopExpr(it) => &it.syntax,
3024 Expr::MacroCall(it) => &it.syntax,
3025 Expr::MatchExpr(it) => &it.syntax,
4628 Expr::MethodCallExpr(it) => &it.syntax, 3026 Expr::MethodCallExpr(it) => &it.syntax,
4629 Expr::FieldExpr(it) => &it.syntax, 3027 Expr::ParenExpr(it) => &it.syntax,
4630 Expr::AwaitExpr(it) => &it.syntax, 3028 Expr::PathExpr(it) => &it.syntax,
4631 Expr::TryExpr(it) => &it.syntax,
4632 Expr::EffectExpr(it) => &it.syntax,
4633 Expr::CastExpr(it) => &it.syntax,
4634 Expr::RefExpr(it) => &it.syntax,
4635 Expr::PrefixExpr(it) => &it.syntax, 3029 Expr::PrefixExpr(it) => &it.syntax,
4636 Expr::RangeExpr(it) => &it.syntax, 3030 Expr::RangeExpr(it) => &it.syntax,
4637 Expr::BinExpr(it) => &it.syntax, 3031 Expr::RecordExpr(it) => &it.syntax,
4638 Expr::Literal(it) => &it.syntax, 3032 Expr::RefExpr(it) => &it.syntax,
4639 Expr::MacroCall(it) => &it.syntax, 3033 Expr::ReturnExpr(it) => &it.syntax,
4640 Expr::BoxExpr(it) => &it.syntax, 3034 Expr::TryExpr(it) => &it.syntax,
3035 Expr::TupleExpr(it) => &it.syntax,
3036 Expr::WhileExpr(it) => &it.syntax,
4641 } 3037 }
4642 } 3038 }
4643} 3039}
4644impl From<OrPat> for Pat { 3040impl From<Const> for Item {
4645 fn from(node: OrPat) -> Pat { Pat::OrPat(node) } 3041 fn from(node: Const) -> Item { Item::Const(node) }
4646} 3042}
4647impl From<ParenPat> for Pat { 3043impl From<Enum> for Item {
4648 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } 3044 fn from(node: Enum) -> Item { Item::Enum(node) }
4649} 3045}
4650impl From<RefPat> for Pat { 3046impl From<ExternBlock> for Item {
4651 fn from(node: RefPat) -> Pat { Pat::RefPat(node) } 3047 fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) }
3048}
3049impl From<ExternCrate> for Item {
3050 fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) }
3051}
3052impl From<Fn> for Item {
3053 fn from(node: Fn) -> Item { Item::Fn(node) }
3054}
3055impl From<Impl> for Item {
3056 fn from(node: Impl) -> Item { Item::Impl(node) }
3057}
3058impl From<MacroCall> for Item {
3059 fn from(node: MacroCall) -> Item { Item::MacroCall(node) }
3060}
3061impl From<Module> for Item {
3062 fn from(node: Module) -> Item { Item::Module(node) }
3063}
3064impl From<Static> for Item {
3065 fn from(node: Static) -> Item { Item::Static(node) }
3066}
3067impl From<Struct> for Item {
3068 fn from(node: Struct) -> Item { Item::Struct(node) }
3069}
3070impl From<Trait> for Item {
3071 fn from(node: Trait) -> Item { Item::Trait(node) }
3072}
3073impl From<TypeAlias> for Item {
3074 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
3075}
3076impl From<Union> for Item {
3077 fn from(node: Union) -> Item { Item::Union(node) }
3078}
3079impl From<Use> for Item {
3080 fn from(node: Use) -> Item { Item::Use(node) }
3081}
3082impl AstNode for Item {
3083 fn can_cast(kind: SyntaxKind) -> bool {
3084 match kind {
3085 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE
3086 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
3087 _ => false,
3088 }
3089 }
3090 fn cast(syntax: SyntaxNode) -> Option<Self> {
3091 let res = match syntax.kind() {
3092 CONST => Item::Const(Const { syntax }),
3093 ENUM => Item::Enum(Enum { syntax }),
3094 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
3095 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
3096 FN => Item::Fn(Fn { syntax }),
3097 IMPL => Item::Impl(Impl { syntax }),
3098 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
3099 MODULE => Item::Module(Module { syntax }),
3100 STATIC => Item::Static(Static { syntax }),
3101 STRUCT => Item::Struct(Struct { syntax }),
3102 TRAIT => Item::Trait(Trait { syntax }),
3103 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
3104 UNION => Item::Union(Union { syntax }),
3105 USE => Item::Use(Use { syntax }),
3106 _ => return None,
3107 };
3108 Some(res)
3109 }
3110 fn syntax(&self) -> &SyntaxNode {
3111 match self {
3112 Item::Const(it) => &it.syntax,
3113 Item::Enum(it) => &it.syntax,
3114 Item::ExternBlock(it) => &it.syntax,
3115 Item::ExternCrate(it) => &it.syntax,
3116 Item::Fn(it) => &it.syntax,
3117 Item::Impl(it) => &it.syntax,
3118 Item::MacroCall(it) => &it.syntax,
3119 Item::Module(it) => &it.syntax,
3120 Item::Static(it) => &it.syntax,
3121 Item::Struct(it) => &it.syntax,
3122 Item::Trait(it) => &it.syntax,
3123 Item::TypeAlias(it) => &it.syntax,
3124 Item::Union(it) => &it.syntax,
3125 Item::Use(it) => &it.syntax,
3126 }
3127 }
3128}
3129impl From<ExprStmt> for Stmt {
3130 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) }
3131}
3132impl From<Item> for Stmt {
3133 fn from(node: Item) -> Stmt { Stmt::Item(node) }
3134}
3135impl From<LetStmt> for Stmt {
3136 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) }
3137}
3138impl From<IdentPat> for Pat {
3139 fn from(node: IdentPat) -> Pat { Pat::IdentPat(node) }
4652} 3140}
4653impl From<BoxPat> for Pat { 3141impl From<BoxPat> for Pat {
4654 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } 3142 fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) }
4655} 3143}
4656impl From<BindPat> for Pat { 3144impl From<RestPat> for Pat {
4657 fn from(node: BindPat) -> Pat { Pat::BindPat(node) } 3145 fn from(node: RestPat) -> Pat { Pat::RestPat(node) }
4658} 3146}
4659impl From<PlaceholderPat> for Pat { 3147impl From<LiteralPat> for Pat {
4660 fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } 3148 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
4661} 3149}
4662impl From<DotDotPat> for Pat { 3150impl From<MacroPat> for Pat {
4663 fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } 3151 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) }
3152}
3153impl From<OrPat> for Pat {
3154 fn from(node: OrPat) -> Pat { Pat::OrPat(node) }
3155}
3156impl From<ParenPat> for Pat {
3157 fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) }
4664} 3158}
4665impl From<PathPat> for Pat { 3159impl From<PathPat> for Pat {
4666 fn from(node: PathPat) -> Pat { Pat::PathPat(node) } 3160 fn from(node: PathPat) -> Pat { Pat::PathPat(node) }
4667} 3161}
3162impl From<WildcardPat> for Pat {
3163 fn from(node: WildcardPat) -> Pat { Pat::WildcardPat(node) }
3164}
3165impl From<RangePat> for Pat {
3166 fn from(node: RangePat) -> Pat { Pat::RangePat(node) }
3167}
4668impl From<RecordPat> for Pat { 3168impl From<RecordPat> for Pat {
4669 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } 3169 fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) }
4670} 3170}
4671impl From<TupleStructPat> for Pat { 3171impl From<RefPat> for Pat {
4672 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } 3172 fn from(node: RefPat) -> Pat { Pat::RefPat(node) }
4673}
4674impl From<TuplePat> for Pat {
4675 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
4676} 3173}
4677impl From<SlicePat> for Pat { 3174impl From<SlicePat> for Pat {
4678 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } 3175 fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) }
4679} 3176}
4680impl From<RangePat> for Pat { 3177impl From<TuplePat> for Pat {
4681 fn from(node: RangePat) -> Pat { Pat::RangePat(node) } 3178 fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) }
4682}
4683impl From<LiteralPat> for Pat {
4684 fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) }
4685} 3179}
4686impl From<MacroPat> for Pat { 3180impl From<TupleStructPat> for Pat {
4687 fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } 3181 fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) }
4688} 3182}
4689impl AstNode for Pat { 3183impl AstNode for Pat {
4690 fn can_cast(kind: SyntaxKind) -> bool { 3184 fn can_cast(kind: SyntaxKind) -> bool {
4691 match kind { 3185 match kind {
4692 OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT 3186 IDENT_PAT | BOX_PAT | REST_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT
4693 | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT 3187 | PATH_PAT | WILDCARD_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT
4694 | LITERAL_PAT | MACRO_PAT => true, 3188 | TUPLE_PAT | TUPLE_STRUCT_PAT => true,
4695 _ => false, 3189 _ => false,
4696 } 3190 }
4697 } 3191 }
4698 fn cast(syntax: SyntaxNode) -> Option<Self> { 3192 fn cast(syntax: SyntaxNode) -> Option<Self> {
4699 let res = match syntax.kind() { 3193 let res = match syntax.kind() {
3194 IDENT_PAT => Pat::IdentPat(IdentPat { syntax }),
3195 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
3196 REST_PAT => Pat::RestPat(RestPat { syntax }),
3197 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }),
3198 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
4700 OR_PAT => Pat::OrPat(OrPat { syntax }), 3199 OR_PAT => Pat::OrPat(OrPat { syntax }),
4701 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), 3200 PAREN_PAT => Pat::ParenPat(ParenPat { syntax }),
4702 REF_PAT => Pat::RefPat(RefPat { syntax }),
4703 BOX_PAT => Pat::BoxPat(BoxPat { syntax }),
4704 BIND_PAT => Pat::BindPat(BindPat { syntax }),
4705 PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }),
4706 DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }),
4707 PATH_PAT => Pat::PathPat(PathPat { syntax }), 3201 PATH_PAT => Pat::PathPat(PathPat { syntax }),
3202 WILDCARD_PAT => Pat::WildcardPat(WildcardPat { syntax }),
3203 RANGE_PAT => Pat::RangePat(RangePat { syntax }),
4708 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), 3204 RECORD_PAT => Pat::RecordPat(RecordPat { syntax }),
4709 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), 3205 REF_PAT => Pat::RefPat(RefPat { syntax }),
4710 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
4711 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), 3206 SLICE_PAT => Pat::SlicePat(SlicePat { syntax }),
4712 RANGE_PAT => Pat::RangePat(RangePat { syntax }), 3207 TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }),
4713 LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), 3208 TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }),
4714 MACRO_PAT => Pat::MacroPat(MacroPat { syntax }),
4715 _ => return None, 3209 _ => return None,
4716 }; 3210 };
4717 Some(res) 3211 Some(res)
4718 } 3212 }
4719 fn syntax(&self) -> &SyntaxNode { 3213 fn syntax(&self) -> &SyntaxNode {
4720 match self { 3214 match self {
3215 Pat::IdentPat(it) => &it.syntax,
3216 Pat::BoxPat(it) => &it.syntax,
3217 Pat::RestPat(it) => &it.syntax,
3218 Pat::LiteralPat(it) => &it.syntax,
3219 Pat::MacroPat(it) => &it.syntax,
4721 Pat::OrPat(it) => &it.syntax, 3220 Pat::OrPat(it) => &it.syntax,
4722 Pat::ParenPat(it) => &it.syntax, 3221 Pat::ParenPat(it) => &it.syntax,
4723 Pat::RefPat(it) => &it.syntax,
4724 Pat::BoxPat(it) => &it.syntax,
4725 Pat::BindPat(it) => &it.syntax,
4726 Pat::PlaceholderPat(it) => &it.syntax,
4727 Pat::DotDotPat(it) => &it.syntax,
4728 Pat::PathPat(it) => &it.syntax, 3222 Pat::PathPat(it) => &it.syntax,
3223 Pat::WildcardPat(it) => &it.syntax,
3224 Pat::RangePat(it) => &it.syntax,
4729 Pat::RecordPat(it) => &it.syntax, 3225 Pat::RecordPat(it) => &it.syntax,
4730 Pat::TupleStructPat(it) => &it.syntax, 3226 Pat::RefPat(it) => &it.syntax,
4731 Pat::TuplePat(it) => &it.syntax,
4732 Pat::SlicePat(it) => &it.syntax, 3227 Pat::SlicePat(it) => &it.syntax,
4733 Pat::RangePat(it) => &it.syntax, 3228 Pat::TuplePat(it) => &it.syntax,
4734 Pat::LiteralPat(it) => &it.syntax, 3229 Pat::TupleStructPat(it) => &it.syntax,
4735 Pat::MacroPat(it) => &it.syntax,
4736 } 3230 }
4737 } 3231 }
4738} 3232}
4739impl From<RecordFieldPat> for RecordInnerPat { 3233impl From<RecordFieldList> for FieldList {
4740 fn from(node: RecordFieldPat) -> RecordInnerPat { RecordInnerPat::RecordFieldPat(node) } 3234 fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) }
4741} 3235}
4742impl From<BindPat> for RecordInnerPat { 3236impl From<TupleFieldList> for FieldList {
4743 fn from(node: BindPat) -> RecordInnerPat { RecordInnerPat::BindPat(node) } 3237 fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) }
4744} 3238}
4745impl AstNode for RecordInnerPat { 3239impl AstNode for FieldList {
4746 fn can_cast(kind: SyntaxKind) -> bool { 3240 fn can_cast(kind: SyntaxKind) -> bool {
4747 match kind { 3241 match kind {
4748 RECORD_FIELD_PAT | BIND_PAT => true, 3242 RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true,
4749 _ => false, 3243 _ => false,
4750 } 3244 }
4751 } 3245 }
4752 fn cast(syntax: SyntaxNode) -> Option<Self> { 3246 fn cast(syntax: SyntaxNode) -> Option<Self> {
4753 let res = match syntax.kind() { 3247 let res = match syntax.kind() {
4754 RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }), 3248 RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }),
4755 BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }), 3249 TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }),
4756 _ => return None, 3250 _ => return None,
4757 }; 3251 };
4758 Some(res) 3252 Some(res)
4759 } 3253 }
4760 fn syntax(&self) -> &SyntaxNode { 3254 fn syntax(&self) -> &SyntaxNode {
4761 match self { 3255 match self {
4762 RecordInnerPat::RecordFieldPat(it) => &it.syntax, 3256 FieldList::RecordFieldList(it) => &it.syntax,
4763 RecordInnerPat::BindPat(it) => &it.syntax, 3257 FieldList::TupleFieldList(it) => &it.syntax,
4764 } 3258 }
4765 } 3259 }
4766} 3260}
4767impl From<Literal> for AttrInput { 3261impl From<Enum> for AdtDef {
4768 fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } 3262 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) }
3263}
3264impl From<Struct> for AdtDef {
3265 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) }
4769} 3266}
4770impl From<TokenTree> for AttrInput { 3267impl From<Union> for AdtDef {
4771 fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) } 3268 fn from(node: Union) -> AdtDef { AdtDef::Union(node) }
4772} 3269}
4773impl AstNode for AttrInput { 3270impl AstNode for AdtDef {
4774 fn can_cast(kind: SyntaxKind) -> bool { 3271 fn can_cast(kind: SyntaxKind) -> bool {
4775 match kind { 3272 match kind {
4776 LITERAL | TOKEN_TREE => true, 3273 ENUM | STRUCT | UNION => true,
4777 _ => false, 3274 _ => false,
4778 } 3275 }
4779 } 3276 }
4780 fn cast(syntax: SyntaxNode) -> Option<Self> { 3277 fn cast(syntax: SyntaxNode) -> Option<Self> {
4781 let res = match syntax.kind() { 3278 let res = match syntax.kind() {
4782 LITERAL => AttrInput::Literal(Literal { syntax }), 3279 ENUM => AdtDef::Enum(Enum { syntax }),
4783 TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }), 3280 STRUCT => AdtDef::Struct(Struct { syntax }),
3281 UNION => AdtDef::Union(Union { syntax }),
4784 _ => return None, 3282 _ => return None,
4785 }; 3283 };
4786 Some(res) 3284 Some(res)
4787 } 3285 }
4788 fn syntax(&self) -> &SyntaxNode { 3286 fn syntax(&self) -> &SyntaxNode {
4789 match self { 3287 match self {
4790 AttrInput::Literal(it) => &it.syntax, 3288 AdtDef::Enum(it) => &it.syntax,
4791 AttrInput::TokenTree(it) => &it.syntax, 3289 AdtDef::Struct(it) => &it.syntax,
3290 AdtDef::Union(it) => &it.syntax,
4792 } 3291 }
4793 } 3292 }
4794} 3293}
4795impl From<LetStmt> for Stmt { 3294impl From<Const> for AssocItem {
4796 fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } 3295 fn from(node: Const) -> AssocItem { AssocItem::Const(node) }
4797} 3296}
4798impl From<ExprStmt> for Stmt { 3297impl From<Fn> for AssocItem {
4799 fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } 3298 fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) }
3299}
3300impl From<MacroCall> for AssocItem {
3301 fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) }
4800} 3302}
4801impl AstNode for Stmt { 3303impl From<TypeAlias> for AssocItem {
3304 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
3305}
3306impl AstNode for AssocItem {
4802 fn can_cast(kind: SyntaxKind) -> bool { 3307 fn can_cast(kind: SyntaxKind) -> bool {
4803 match kind { 3308 match kind {
4804 LET_STMT | EXPR_STMT => true, 3309 CONST | FN | MACRO_CALL | TYPE_ALIAS => true,
4805 _ => false, 3310 _ => false,
4806 } 3311 }
4807 } 3312 }
4808 fn cast(syntax: SyntaxNode) -> Option<Self> { 3313 fn cast(syntax: SyntaxNode) -> Option<Self> {
4809 let res = match syntax.kind() { 3314 let res = match syntax.kind() {
4810 LET_STMT => Stmt::LetStmt(LetStmt { syntax }), 3315 CONST => AssocItem::Const(Const { syntax }),
4811 EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), 3316 FN => AssocItem::Fn(Fn { syntax }),
3317 MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
3318 TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }),
4812 _ => return None, 3319 _ => return None,
4813 }; 3320 };
4814 Some(res) 3321 Some(res)
4815 } 3322 }
4816 fn syntax(&self) -> &SyntaxNode { 3323 fn syntax(&self) -> &SyntaxNode {
4817 match self { 3324 match self {
4818 Stmt::LetStmt(it) => &it.syntax, 3325 AssocItem::Const(it) => &it.syntax,
4819 Stmt::ExprStmt(it) => &it.syntax, 3326 AssocItem::Fn(it) => &it.syntax,
3327 AssocItem::MacroCall(it) => &it.syntax,
3328 AssocItem::TypeAlias(it) => &it.syntax,
4820 } 3329 }
4821 } 3330 }
4822} 3331}
4823impl From<RecordFieldDefList> for FieldDefList { 3332impl From<Fn> for ExternItem {
4824 fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } 3333 fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) }
4825} 3334}
4826impl From<TupleFieldDefList> for FieldDefList { 3335impl From<MacroCall> for ExternItem {
4827 fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) } 3336 fn from(node: MacroCall) -> ExternItem { ExternItem::MacroCall(node) }
4828} 3337}
4829impl AstNode for FieldDefList { 3338impl From<Static> for ExternItem {
3339 fn from(node: Static) -> ExternItem { ExternItem::Static(node) }
3340}
3341impl AstNode for ExternItem {
4830 fn can_cast(kind: SyntaxKind) -> bool { 3342 fn can_cast(kind: SyntaxKind) -> bool {
4831 match kind { 3343 match kind {
4832 RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, 3344 FN | MACRO_CALL | STATIC => true,
4833 _ => false, 3345 _ => false,
4834 } 3346 }
4835 } 3347 }
4836 fn cast(syntax: SyntaxNode) -> Option<Self> { 3348 fn cast(syntax: SyntaxNode) -> Option<Self> {
4837 let res = match syntax.kind() { 3349 let res = match syntax.kind() {
4838 RECORD_FIELD_DEF_LIST => { 3350 FN => ExternItem::Fn(Fn { syntax }),
4839 FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) 3351 MACRO_CALL => ExternItem::MacroCall(MacroCall { syntax }),
4840 } 3352 STATIC => ExternItem::Static(Static { syntax }),
4841 TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }),
4842 _ => return None, 3353 _ => return None,
4843 }; 3354 };
4844 Some(res) 3355 Some(res)
4845 } 3356 }
4846 fn syntax(&self) -> &SyntaxNode { 3357 fn syntax(&self) -> &SyntaxNode {
4847 match self { 3358 match self {
4848 FieldDefList::RecordFieldDefList(it) => &it.syntax, 3359 ExternItem::Fn(it) => &it.syntax,
4849 FieldDefList::TupleFieldDefList(it) => &it.syntax, 3360 ExternItem::MacroCall(it) => &it.syntax,
3361 ExternItem::Static(it) => &it.syntax,
4850 } 3362 }
4851 } 3363 }
4852} 3364}
4853impl std::fmt::Display for NominalDef { 3365impl From<ConstParam> for GenericParam {
4854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3366 fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) }
4855 std::fmt::Display::fmt(self.syntax(), f)
4856 }
4857} 3367}
4858impl std::fmt::Display for GenericParam { 3368impl From<LifetimeParam> for GenericParam {
4859 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3369 fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) }
4860 std::fmt::Display::fmt(self.syntax(), f)
4861 }
4862} 3370}
4863impl std::fmt::Display for GenericArg { 3371impl From<TypeParam> for GenericParam {
4864 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3372 fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) }
4865 std::fmt::Display::fmt(self.syntax(), f) 3373}
3374impl AstNode for GenericParam {
3375 fn can_cast(kind: SyntaxKind) -> bool {
3376 match kind {
3377 CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM => true,
3378 _ => false,
3379 }
3380 }
3381 fn cast(syntax: SyntaxNode) -> Option<Self> {
3382 let res = match syntax.kind() {
3383 CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }),
3384 LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }),
3385 TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }),
3386 _ => return None,
3387 };
3388 Some(res)
3389 }
3390 fn syntax(&self) -> &SyntaxNode {
3391 match self {
3392 GenericParam::ConstParam(it) => &it.syntax,
3393 GenericParam::LifetimeParam(it) => &it.syntax,
3394 GenericParam::TypeParam(it) => &it.syntax,
3395 }
4866 } 3396 }
4867} 3397}
4868impl std::fmt::Display for TypeRef { 3398impl std::fmt::Display for GenericArg {
4869 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3399 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4870 std::fmt::Display::fmt(self.syntax(), f) 3400 std::fmt::Display::fmt(self.syntax(), f)
4871 } 3401 }
4872} 3402}
4873impl std::fmt::Display for ModuleItem { 3403impl std::fmt::Display for Type {
4874 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3404 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4875 std::fmt::Display::fmt(self.syntax(), f) 3405 std::fmt::Display::fmt(self.syntax(), f)
4876 } 3406 }
4877} 3407}
4878impl std::fmt::Display for AssocItem { 3408impl std::fmt::Display for Expr {
4879 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3409 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4880 std::fmt::Display::fmt(self.syntax(), f) 3410 std::fmt::Display::fmt(self.syntax(), f)
4881 } 3411 }
4882} 3412}
4883impl std::fmt::Display for ExternItem { 3413impl std::fmt::Display for Item {
4884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3414 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4885 std::fmt::Display::fmt(self.syntax(), f) 3415 std::fmt::Display::fmt(self.syntax(), f)
4886 } 3416 }
4887} 3417}
4888impl std::fmt::Display for Expr { 3418impl std::fmt::Display for Stmt {
4889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3419 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4890 std::fmt::Display::fmt(self.syntax(), f) 3420 std::fmt::Display::fmt(self.syntax(), f)
4891 } 3421 }
@@ -4895,642 +3425,642 @@ impl std::fmt::Display for Pat {
4895 std::fmt::Display::fmt(self.syntax(), f) 3425 std::fmt::Display::fmt(self.syntax(), f)
4896 } 3426 }
4897} 3427}
4898impl std::fmt::Display for RecordInnerPat { 3428impl std::fmt::Display for FieldList {
4899 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3429 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4900 std::fmt::Display::fmt(self.syntax(), f) 3430 std::fmt::Display::fmt(self.syntax(), f)
4901 } 3431 }
4902} 3432}
4903impl std::fmt::Display for AttrInput { 3433impl std::fmt::Display for AdtDef {
4904 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3434 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4905 std::fmt::Display::fmt(self.syntax(), f) 3435 std::fmt::Display::fmt(self.syntax(), f)
4906 } 3436 }
4907} 3437}
4908impl std::fmt::Display for Stmt { 3438impl std::fmt::Display for AssocItem {
4909 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3439 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4910 std::fmt::Display::fmt(self.syntax(), f) 3440 std::fmt::Display::fmt(self.syntax(), f)
4911 } 3441 }
4912} 3442}
4913impl std::fmt::Display for FieldDefList { 3443impl std::fmt::Display for ExternItem {
4914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3444 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4915 std::fmt::Display::fmt(self.syntax(), f) 3445 std::fmt::Display::fmt(self.syntax(), f)
4916 } 3446 }
4917} 3447}
4918impl std::fmt::Display for SourceFile { 3448impl std::fmt::Display for GenericParam {
4919 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3449 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4920 std::fmt::Display::fmt(self.syntax(), f) 3450 std::fmt::Display::fmt(self.syntax(), f)
4921 } 3451 }
4922} 3452}
4923impl std::fmt::Display for FnDef { 3453impl std::fmt::Display for Name {
4924 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3454 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4925 std::fmt::Display::fmt(self.syntax(), f) 3455 std::fmt::Display::fmt(self.syntax(), f)
4926 } 3456 }
4927} 3457}
4928impl std::fmt::Display for RetType { 3458impl std::fmt::Display for NameRef {
4929 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3459 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4930 std::fmt::Display::fmt(self.syntax(), f) 3460 std::fmt::Display::fmt(self.syntax(), f)
4931 } 3461 }
4932} 3462}
4933impl std::fmt::Display for StructDef { 3463impl std::fmt::Display for Path {
4934 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4935 std::fmt::Display::fmt(self.syntax(), f) 3465 std::fmt::Display::fmt(self.syntax(), f)
4936 } 3466 }
4937} 3467}
4938impl std::fmt::Display for UnionDef { 3468impl std::fmt::Display for PathSegment {
4939 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4940 std::fmt::Display::fmt(self.syntax(), f) 3470 std::fmt::Display::fmt(self.syntax(), f)
4941 } 3471 }
4942} 3472}
4943impl std::fmt::Display for RecordFieldDefList { 3473impl std::fmt::Display for GenericArgList {
4944 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4945 std::fmt::Display::fmt(self.syntax(), f) 3475 std::fmt::Display::fmt(self.syntax(), f)
4946 } 3476 }
4947} 3477}
4948impl std::fmt::Display for RecordFieldDef { 3478impl std::fmt::Display for ParamList {
4949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3479 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4950 std::fmt::Display::fmt(self.syntax(), f) 3480 std::fmt::Display::fmt(self.syntax(), f)
4951 } 3481 }
4952} 3482}
4953impl std::fmt::Display for TupleFieldDefList { 3483impl std::fmt::Display for RetType {
4954 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3484 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4955 std::fmt::Display::fmt(self.syntax(), f) 3485 std::fmt::Display::fmt(self.syntax(), f)
4956 } 3486 }
4957} 3487}
4958impl std::fmt::Display for TupleFieldDef { 3488impl std::fmt::Display for PathType {
4959 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3489 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4960 std::fmt::Display::fmt(self.syntax(), f) 3490 std::fmt::Display::fmt(self.syntax(), f)
4961 } 3491 }
4962} 3492}
4963impl std::fmt::Display for EnumDef { 3493impl std::fmt::Display for TypeArg {
4964 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3494 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4965 std::fmt::Display::fmt(self.syntax(), f) 3495 std::fmt::Display::fmt(self.syntax(), f)
4966 } 3496 }
4967} 3497}
4968impl std::fmt::Display for EnumVariantList { 3498impl std::fmt::Display for AssocTypeArg {
4969 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3499 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4970 std::fmt::Display::fmt(self.syntax(), f) 3500 std::fmt::Display::fmt(self.syntax(), f)
4971 } 3501 }
4972} 3502}
4973impl std::fmt::Display for EnumVariant { 3503impl std::fmt::Display for LifetimeArg {
4974 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4975 std::fmt::Display::fmt(self.syntax(), f) 3505 std::fmt::Display::fmt(self.syntax(), f)
4976 } 3506 }
4977} 3507}
4978impl std::fmt::Display for TraitDef { 3508impl std::fmt::Display for ConstArg {
4979 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3509 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4980 std::fmt::Display::fmt(self.syntax(), f) 3510 std::fmt::Display::fmt(self.syntax(), f)
4981 } 3511 }
4982} 3512}
4983impl std::fmt::Display for Module { 3513impl std::fmt::Display for TypeBoundList {
4984 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4985 std::fmt::Display::fmt(self.syntax(), f) 3515 std::fmt::Display::fmt(self.syntax(), f)
4986 } 3516 }
4987} 3517}
4988impl std::fmt::Display for ItemList { 3518impl std::fmt::Display for MacroCall {
4989 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3519 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4990 std::fmt::Display::fmt(self.syntax(), f) 3520 std::fmt::Display::fmt(self.syntax(), f)
4991 } 3521 }
4992} 3522}
4993impl std::fmt::Display for ConstDef { 3523impl std::fmt::Display for Attr {
4994 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3524 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4995 std::fmt::Display::fmt(self.syntax(), f) 3525 std::fmt::Display::fmt(self.syntax(), f)
4996 } 3526 }
4997} 3527}
4998impl std::fmt::Display for StaticDef { 3528impl std::fmt::Display for TokenTree {
4999 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5000 std::fmt::Display::fmt(self.syntax(), f) 3530 std::fmt::Display::fmt(self.syntax(), f)
5001 } 3531 }
5002} 3532}
5003impl std::fmt::Display for TypeAliasDef { 3533impl std::fmt::Display for MacroItems {
5004 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3534 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5005 std::fmt::Display::fmt(self.syntax(), f) 3535 std::fmt::Display::fmt(self.syntax(), f)
5006 } 3536 }
5007} 3537}
5008impl std::fmt::Display for ImplDef { 3538impl std::fmt::Display for MacroStmts {
5009 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3539 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5010 std::fmt::Display::fmt(self.syntax(), f) 3540 std::fmt::Display::fmt(self.syntax(), f)
5011 } 3541 }
5012} 3542}
5013impl std::fmt::Display for ParenType { 3543impl std::fmt::Display for SourceFile {
5014 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3544 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5015 std::fmt::Display::fmt(self.syntax(), f) 3545 std::fmt::Display::fmt(self.syntax(), f)
5016 } 3546 }
5017} 3547}
5018impl std::fmt::Display for TupleType { 3548impl std::fmt::Display for Const {
5019 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3549 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5020 std::fmt::Display::fmt(self.syntax(), f) 3550 std::fmt::Display::fmt(self.syntax(), f)
5021 } 3551 }
5022} 3552}
5023impl std::fmt::Display for NeverType { 3553impl std::fmt::Display for Enum {
5024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3554 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5025 std::fmt::Display::fmt(self.syntax(), f) 3555 std::fmt::Display::fmt(self.syntax(), f)
5026 } 3556 }
5027} 3557}
5028impl std::fmt::Display for PathType { 3558impl std::fmt::Display for ExternBlock {
5029 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3559 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5030 std::fmt::Display::fmt(self.syntax(), f) 3560 std::fmt::Display::fmt(self.syntax(), f)
5031 } 3561 }
5032} 3562}
5033impl std::fmt::Display for PointerType { 3563impl std::fmt::Display for ExternCrate {
5034 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3564 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5035 std::fmt::Display::fmt(self.syntax(), f) 3565 std::fmt::Display::fmt(self.syntax(), f)
5036 } 3566 }
5037} 3567}
5038impl std::fmt::Display for ArrayType { 3568impl std::fmt::Display for Fn {
5039 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3569 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5040 std::fmt::Display::fmt(self.syntax(), f) 3570 std::fmt::Display::fmt(self.syntax(), f)
5041 } 3571 }
5042} 3572}
5043impl std::fmt::Display for SliceType { 3573impl std::fmt::Display for Impl {
5044 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3574 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5045 std::fmt::Display::fmt(self.syntax(), f) 3575 std::fmt::Display::fmt(self.syntax(), f)
5046 } 3576 }
5047} 3577}
5048impl std::fmt::Display for ReferenceType { 3578impl std::fmt::Display for Module {
5049 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3579 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5050 std::fmt::Display::fmt(self.syntax(), f) 3580 std::fmt::Display::fmt(self.syntax(), f)
5051 } 3581 }
5052} 3582}
5053impl std::fmt::Display for PlaceholderType { 3583impl std::fmt::Display for Static {
5054 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3584 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5055 std::fmt::Display::fmt(self.syntax(), f) 3585 std::fmt::Display::fmt(self.syntax(), f)
5056 } 3586 }
5057} 3587}
5058impl std::fmt::Display for FnPointerType { 3588impl std::fmt::Display for Struct {
5059 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3589 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5060 std::fmt::Display::fmt(self.syntax(), f) 3590 std::fmt::Display::fmt(self.syntax(), f)
5061 } 3591 }
5062} 3592}
5063impl std::fmt::Display for ForType { 3593impl std::fmt::Display for Trait {
5064 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3594 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5065 std::fmt::Display::fmt(self.syntax(), f) 3595 std::fmt::Display::fmt(self.syntax(), f)
5066 } 3596 }
5067} 3597}
5068impl std::fmt::Display for ImplTraitType { 3598impl std::fmt::Display for TypeAlias {
5069 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3599 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5070 std::fmt::Display::fmt(self.syntax(), f) 3600 std::fmt::Display::fmt(self.syntax(), f)
5071 } 3601 }
5072} 3602}
5073impl std::fmt::Display for DynTraitType { 3603impl std::fmt::Display for Union {
5074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3604 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5075 std::fmt::Display::fmt(self.syntax(), f) 3605 std::fmt::Display::fmt(self.syntax(), f)
5076 } 3606 }
5077} 3607}
5078impl std::fmt::Display for TupleExpr { 3608impl std::fmt::Display for Use {
5079 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3609 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5080 std::fmt::Display::fmt(self.syntax(), f) 3610 std::fmt::Display::fmt(self.syntax(), f)
5081 } 3611 }
5082} 3612}
5083impl std::fmt::Display for ArrayExpr { 3613impl std::fmt::Display for Visibility {
5084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3614 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5085 std::fmt::Display::fmt(self.syntax(), f) 3615 std::fmt::Display::fmt(self.syntax(), f)
5086 } 3616 }
5087} 3617}
5088impl std::fmt::Display for ParenExpr { 3618impl std::fmt::Display for ItemList {
5089 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3619 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5090 std::fmt::Display::fmt(self.syntax(), f) 3620 std::fmt::Display::fmt(self.syntax(), f)
5091 } 3621 }
5092} 3622}
5093impl std::fmt::Display for PathExpr { 3623impl std::fmt::Display for Rename {
5094 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3624 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5095 std::fmt::Display::fmt(self.syntax(), f) 3625 std::fmt::Display::fmt(self.syntax(), f)
5096 } 3626 }
5097} 3627}
5098impl std::fmt::Display for LambdaExpr { 3628impl std::fmt::Display for UseTree {
5099 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3629 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5100 std::fmt::Display::fmt(self.syntax(), f) 3630 std::fmt::Display::fmt(self.syntax(), f)
5101 } 3631 }
5102} 3632}
5103impl std::fmt::Display for IfExpr { 3633impl std::fmt::Display for UseTreeList {
5104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3634 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5105 std::fmt::Display::fmt(self.syntax(), f) 3635 std::fmt::Display::fmt(self.syntax(), f)
5106 } 3636 }
5107} 3637}
5108impl std::fmt::Display for LoopExpr { 3638impl std::fmt::Display for Abi {
5109 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3639 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5110 std::fmt::Display::fmt(self.syntax(), f) 3640 std::fmt::Display::fmt(self.syntax(), f)
5111 } 3641 }
5112} 3642}
5113impl std::fmt::Display for EffectExpr { 3643impl std::fmt::Display for GenericParamList {
5114 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5115 std::fmt::Display::fmt(self.syntax(), f) 3645 std::fmt::Display::fmt(self.syntax(), f)
5116 } 3646 }
5117} 3647}
5118impl std::fmt::Display for ForExpr { 3648impl std::fmt::Display for WhereClause {
5119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5120 std::fmt::Display::fmt(self.syntax(), f) 3650 std::fmt::Display::fmt(self.syntax(), f)
5121 } 3651 }
5122} 3652}
5123impl std::fmt::Display for WhileExpr { 3653impl std::fmt::Display for BlockExpr {
5124 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3654 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5125 std::fmt::Display::fmt(self.syntax(), f) 3655 std::fmt::Display::fmt(self.syntax(), f)
5126 } 3656 }
5127} 3657}
5128impl std::fmt::Display for ContinueExpr { 3658impl std::fmt::Display for SelfParam {
5129 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3659 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5130 std::fmt::Display::fmt(self.syntax(), f) 3660 std::fmt::Display::fmt(self.syntax(), f)
5131 } 3661 }
5132} 3662}
5133impl std::fmt::Display for BreakExpr { 3663impl std::fmt::Display for Param {
5134 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3664 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5135 std::fmt::Display::fmt(self.syntax(), f) 3665 std::fmt::Display::fmt(self.syntax(), f)
5136 } 3666 }
5137} 3667}
5138impl std::fmt::Display for Label { 3668impl std::fmt::Display for RecordFieldList {
5139 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3669 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5140 std::fmt::Display::fmt(self.syntax(), f) 3670 std::fmt::Display::fmt(self.syntax(), f)
5141 } 3671 }
5142} 3672}
5143impl std::fmt::Display for BlockExpr { 3673impl std::fmt::Display for TupleFieldList {
5144 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3674 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5145 std::fmt::Display::fmt(self.syntax(), f) 3675 std::fmt::Display::fmt(self.syntax(), f)
5146 } 3676 }
5147} 3677}
5148impl std::fmt::Display for ReturnExpr { 3678impl std::fmt::Display for RecordField {
5149 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3679 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5150 std::fmt::Display::fmt(self.syntax(), f) 3680 std::fmt::Display::fmt(self.syntax(), f)
5151 } 3681 }
5152} 3682}
5153impl std::fmt::Display for CallExpr { 3683impl std::fmt::Display for TupleField {
5154 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3684 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5155 std::fmt::Display::fmt(self.syntax(), f) 3685 std::fmt::Display::fmt(self.syntax(), f)
5156 } 3686 }
5157} 3687}
5158impl std::fmt::Display for MethodCallExpr { 3688impl std::fmt::Display for VariantList {
5159 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3689 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5160 std::fmt::Display::fmt(self.syntax(), f) 3690 std::fmt::Display::fmt(self.syntax(), f)
5161 } 3691 }
5162} 3692}
5163impl std::fmt::Display for IndexExpr { 3693impl std::fmt::Display for Variant {
5164 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3694 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5165 std::fmt::Display::fmt(self.syntax(), f) 3695 std::fmt::Display::fmt(self.syntax(), f)
5166 } 3696 }
5167} 3697}
5168impl std::fmt::Display for FieldExpr { 3698impl std::fmt::Display for AssocItemList {
5169 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3699 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5170 std::fmt::Display::fmt(self.syntax(), f) 3700 std::fmt::Display::fmt(self.syntax(), f)
5171 } 3701 }
5172} 3702}
5173impl std::fmt::Display for AwaitExpr { 3703impl std::fmt::Display for ExternItemList {
5174 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3704 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5175 std::fmt::Display::fmt(self.syntax(), f) 3705 std::fmt::Display::fmt(self.syntax(), f)
5176 } 3706 }
5177} 3707}
5178impl std::fmt::Display for TryExpr { 3708impl std::fmt::Display for ConstParam {
5179 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3709 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5180 std::fmt::Display::fmt(self.syntax(), f) 3710 std::fmt::Display::fmt(self.syntax(), f)
5181 } 3711 }
5182} 3712}
5183impl std::fmt::Display for CastExpr { 3713impl std::fmt::Display for LifetimeParam {
5184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3714 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5185 std::fmt::Display::fmt(self.syntax(), f) 3715 std::fmt::Display::fmt(self.syntax(), f)
5186 } 3716 }
5187} 3717}
5188impl std::fmt::Display for RefExpr { 3718impl std::fmt::Display for TypeParam {
5189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3719 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5190 std::fmt::Display::fmt(self.syntax(), f) 3720 std::fmt::Display::fmt(self.syntax(), f)
5191 } 3721 }
5192} 3722}
5193impl std::fmt::Display for PrefixExpr { 3723impl std::fmt::Display for WherePred {
5194 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3724 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5195 std::fmt::Display::fmt(self.syntax(), f) 3725 std::fmt::Display::fmt(self.syntax(), f)
5196 } 3726 }
5197} 3727}
5198impl std::fmt::Display for BoxExpr { 3728impl std::fmt::Display for Literal {
5199 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3729 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5200 std::fmt::Display::fmt(self.syntax(), f) 3730 std::fmt::Display::fmt(self.syntax(), f)
5201 } 3731 }
5202} 3732}
5203impl std::fmt::Display for RangeExpr { 3733impl std::fmt::Display for ExprStmt {
5204 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3734 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5205 std::fmt::Display::fmt(self.syntax(), f) 3735 std::fmt::Display::fmt(self.syntax(), f)
5206 } 3736 }
5207} 3737}
5208impl std::fmt::Display for BinExpr { 3738impl std::fmt::Display for LetStmt {
5209 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3739 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5210 std::fmt::Display::fmt(self.syntax(), f) 3740 std::fmt::Display::fmt(self.syntax(), f)
5211 } 3741 }
5212} 3742}
5213impl std::fmt::Display for Literal { 3743impl std::fmt::Display for ArrayExpr {
5214 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3744 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5215 std::fmt::Display::fmt(self.syntax(), f) 3745 std::fmt::Display::fmt(self.syntax(), f)
5216 } 3746 }
5217} 3747}
5218impl std::fmt::Display for MatchExpr { 3748impl std::fmt::Display for AwaitExpr {
5219 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3749 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5220 std::fmt::Display::fmt(self.syntax(), f) 3750 std::fmt::Display::fmt(self.syntax(), f)
5221 } 3751 }
5222} 3752}
5223impl std::fmt::Display for MatchArmList { 3753impl std::fmt::Display for BinExpr {
5224 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3754 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5225 std::fmt::Display::fmt(self.syntax(), f) 3755 std::fmt::Display::fmt(self.syntax(), f)
5226 } 3756 }
5227} 3757}
5228impl std::fmt::Display for MatchArm { 3758impl std::fmt::Display for BoxExpr {
5229 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3759 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5230 std::fmt::Display::fmt(self.syntax(), f) 3760 std::fmt::Display::fmt(self.syntax(), f)
5231 } 3761 }
5232} 3762}
5233impl std::fmt::Display for MatchGuard { 3763impl std::fmt::Display for BreakExpr {
5234 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3764 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5235 std::fmt::Display::fmt(self.syntax(), f) 3765 std::fmt::Display::fmt(self.syntax(), f)
5236 } 3766 }
5237} 3767}
5238impl std::fmt::Display for RecordLit { 3768impl std::fmt::Display for CallExpr {
5239 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3769 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5240 std::fmt::Display::fmt(self.syntax(), f) 3770 std::fmt::Display::fmt(self.syntax(), f)
5241 } 3771 }
5242} 3772}
5243impl std::fmt::Display for RecordFieldList { 3773impl std::fmt::Display for CastExpr {
5244 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3774 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5245 std::fmt::Display::fmt(self.syntax(), f) 3775 std::fmt::Display::fmt(self.syntax(), f)
5246 } 3776 }
5247} 3777}
5248impl std::fmt::Display for RecordField { 3778impl std::fmt::Display for ClosureExpr {
5249 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3779 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5250 std::fmt::Display::fmt(self.syntax(), f) 3780 std::fmt::Display::fmt(self.syntax(), f)
5251 } 3781 }
5252} 3782}
5253impl std::fmt::Display for OrPat { 3783impl std::fmt::Display for ContinueExpr {
5254 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3784 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5255 std::fmt::Display::fmt(self.syntax(), f) 3785 std::fmt::Display::fmt(self.syntax(), f)
5256 } 3786 }
5257} 3787}
5258impl std::fmt::Display for ParenPat { 3788impl std::fmt::Display for EffectExpr {
5259 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3789 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5260 std::fmt::Display::fmt(self.syntax(), f) 3790 std::fmt::Display::fmt(self.syntax(), f)
5261 } 3791 }
5262} 3792}
5263impl std::fmt::Display for RefPat { 3793impl std::fmt::Display for FieldExpr {
5264 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3794 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5265 std::fmt::Display::fmt(self.syntax(), f) 3795 std::fmt::Display::fmt(self.syntax(), f)
5266 } 3796 }
5267} 3797}
5268impl std::fmt::Display for BoxPat { 3798impl std::fmt::Display for ForExpr {
5269 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3799 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5270 std::fmt::Display::fmt(self.syntax(), f) 3800 std::fmt::Display::fmt(self.syntax(), f)
5271 } 3801 }
5272} 3802}
5273impl std::fmt::Display for BindPat { 3803impl std::fmt::Display for IfExpr {
5274 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3804 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5275 std::fmt::Display::fmt(self.syntax(), f) 3805 std::fmt::Display::fmt(self.syntax(), f)
5276 } 3806 }
5277} 3807}
5278impl std::fmt::Display for PlaceholderPat { 3808impl std::fmt::Display for IndexExpr {
5279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3809 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5280 std::fmt::Display::fmt(self.syntax(), f) 3810 std::fmt::Display::fmt(self.syntax(), f)
5281 } 3811 }
5282} 3812}
5283impl std::fmt::Display for DotDotPat { 3813impl std::fmt::Display for LoopExpr {
5284 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3814 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5285 std::fmt::Display::fmt(self.syntax(), f) 3815 std::fmt::Display::fmt(self.syntax(), f)
5286 } 3816 }
5287} 3817}
5288impl std::fmt::Display for PathPat { 3818impl std::fmt::Display for MatchExpr {
5289 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3819 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5290 std::fmt::Display::fmt(self.syntax(), f) 3820 std::fmt::Display::fmt(self.syntax(), f)
5291 } 3821 }
5292} 3822}
5293impl std::fmt::Display for SlicePat { 3823impl std::fmt::Display for MethodCallExpr {
5294 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3824 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5295 std::fmt::Display::fmt(self.syntax(), f) 3825 std::fmt::Display::fmt(self.syntax(), f)
5296 } 3826 }
5297} 3827}
5298impl std::fmt::Display for RangePat { 3828impl std::fmt::Display for ParenExpr {
5299 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3829 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5300 std::fmt::Display::fmt(self.syntax(), f) 3830 std::fmt::Display::fmt(self.syntax(), f)
5301 } 3831 }
5302} 3832}
5303impl std::fmt::Display for LiteralPat { 3833impl std::fmt::Display for PathExpr {
5304 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3834 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5305 std::fmt::Display::fmt(self.syntax(), f) 3835 std::fmt::Display::fmt(self.syntax(), f)
5306 } 3836 }
5307} 3837}
5308impl std::fmt::Display for MacroPat { 3838impl std::fmt::Display for PrefixExpr {
5309 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3839 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5310 std::fmt::Display::fmt(self.syntax(), f) 3840 std::fmt::Display::fmt(self.syntax(), f)
5311 } 3841 }
5312} 3842}
5313impl std::fmt::Display for RecordPat { 3843impl std::fmt::Display for RangeExpr {
5314 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3844 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5315 std::fmt::Display::fmt(self.syntax(), f) 3845 std::fmt::Display::fmt(self.syntax(), f)
5316 } 3846 }
5317} 3847}
5318impl std::fmt::Display for RecordFieldPatList { 3848impl std::fmt::Display for RecordExpr {
5319 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3849 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5320 std::fmt::Display::fmt(self.syntax(), f) 3850 std::fmt::Display::fmt(self.syntax(), f)
5321 } 3851 }
5322} 3852}
5323impl std::fmt::Display for RecordFieldPat { 3853impl std::fmt::Display for RefExpr {
5324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5325 std::fmt::Display::fmt(self.syntax(), f) 3855 std::fmt::Display::fmt(self.syntax(), f)
5326 } 3856 }
5327} 3857}
5328impl std::fmt::Display for TupleStructPat { 3858impl std::fmt::Display for ReturnExpr {
5329 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3859 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5330 std::fmt::Display::fmt(self.syntax(), f) 3860 std::fmt::Display::fmt(self.syntax(), f)
5331 } 3861 }
5332} 3862}
5333impl std::fmt::Display for TuplePat { 3863impl std::fmt::Display for TryExpr {
5334 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3864 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5335 std::fmt::Display::fmt(self.syntax(), f) 3865 std::fmt::Display::fmt(self.syntax(), f)
5336 } 3866 }
5337} 3867}
5338impl std::fmt::Display for Visibility { 3868impl std::fmt::Display for TupleExpr {
5339 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3869 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5340 std::fmt::Display::fmt(self.syntax(), f) 3870 std::fmt::Display::fmt(self.syntax(), f)
5341 } 3871 }
5342} 3872}
5343impl std::fmt::Display for Name { 3873impl std::fmt::Display for WhileExpr {
5344 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3874 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5345 std::fmt::Display::fmt(self.syntax(), f) 3875 std::fmt::Display::fmt(self.syntax(), f)
5346 } 3876 }
5347} 3877}
5348impl std::fmt::Display for NameRef { 3878impl std::fmt::Display for Label {
5349 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3879 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5350 std::fmt::Display::fmt(self.syntax(), f) 3880 std::fmt::Display::fmt(self.syntax(), f)
5351 } 3881 }
5352} 3882}
5353impl std::fmt::Display for MacroCall { 3883impl std::fmt::Display for RecordExprFieldList {
5354 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5355 std::fmt::Display::fmt(self.syntax(), f) 3885 std::fmt::Display::fmt(self.syntax(), f)
5356 } 3886 }
5357} 3887}
5358impl std::fmt::Display for Attr { 3888impl std::fmt::Display for RecordExprField {
5359 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3889 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5360 std::fmt::Display::fmt(self.syntax(), f) 3890 std::fmt::Display::fmt(self.syntax(), f)
5361 } 3891 }
5362} 3892}
5363impl std::fmt::Display for TokenTree { 3893impl std::fmt::Display for ArgList {
5364 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3894 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5365 std::fmt::Display::fmt(self.syntax(), f) 3895 std::fmt::Display::fmt(self.syntax(), f)
5366 } 3896 }
5367} 3897}
5368impl std::fmt::Display for TypeParamList { 3898impl std::fmt::Display for Condition {
5369 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3899 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5370 std::fmt::Display::fmt(self.syntax(), f) 3900 std::fmt::Display::fmt(self.syntax(), f)
5371 } 3901 }
5372} 3902}
5373impl std::fmt::Display for TypeParam { 3903impl std::fmt::Display for MatchArmList {
5374 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3904 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5375 std::fmt::Display::fmt(self.syntax(), f) 3905 std::fmt::Display::fmt(self.syntax(), f)
5376 } 3906 }
5377} 3907}
5378impl std::fmt::Display for ConstParam { 3908impl std::fmt::Display for MatchArm {
5379 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3909 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5380 std::fmt::Display::fmt(self.syntax(), f) 3910 std::fmt::Display::fmt(self.syntax(), f)
5381 } 3911 }
5382} 3912}
5383impl std::fmt::Display for LifetimeParam { 3913impl std::fmt::Display for MatchGuard {
5384 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3914 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5385 std::fmt::Display::fmt(self.syntax(), f) 3915 std::fmt::Display::fmt(self.syntax(), f)
5386 } 3916 }
5387} 3917}
5388impl std::fmt::Display for TypeBound { 3918impl std::fmt::Display for ArrayType {
5389 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3919 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5390 std::fmt::Display::fmt(self.syntax(), f) 3920 std::fmt::Display::fmt(self.syntax(), f)
5391 } 3921 }
5392} 3922}
5393impl std::fmt::Display for TypeBoundList { 3923impl std::fmt::Display for DynTraitType {
5394 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3924 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5395 std::fmt::Display::fmt(self.syntax(), f) 3925 std::fmt::Display::fmt(self.syntax(), f)
5396 } 3926 }
5397} 3927}
5398impl std::fmt::Display for WherePred { 3928impl std::fmt::Display for FnPtrType {
5399 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3929 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5400 std::fmt::Display::fmt(self.syntax(), f) 3930 std::fmt::Display::fmt(self.syntax(), f)
5401 } 3931 }
5402} 3932}
5403impl std::fmt::Display for WhereClause { 3933impl std::fmt::Display for ForType {
5404 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3934 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5405 std::fmt::Display::fmt(self.syntax(), f) 3935 std::fmt::Display::fmt(self.syntax(), f)
5406 } 3936 }
5407} 3937}
5408impl std::fmt::Display for Abi { 3938impl std::fmt::Display for ImplTraitType {
5409 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3939 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5410 std::fmt::Display::fmt(self.syntax(), f) 3940 std::fmt::Display::fmt(self.syntax(), f)
5411 } 3941 }
5412} 3942}
5413impl std::fmt::Display for ExprStmt { 3943impl std::fmt::Display for InferType {
5414 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3944 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5415 std::fmt::Display::fmt(self.syntax(), f) 3945 std::fmt::Display::fmt(self.syntax(), f)
5416 } 3946 }
5417} 3947}
5418impl std::fmt::Display for LetStmt { 3948impl std::fmt::Display for NeverType {
5419 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3949 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5420 std::fmt::Display::fmt(self.syntax(), f) 3950 std::fmt::Display::fmt(self.syntax(), f)
5421 } 3951 }
5422} 3952}
5423impl std::fmt::Display for Condition { 3953impl std::fmt::Display for ParenType {
5424 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3954 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5425 std::fmt::Display::fmt(self.syntax(), f) 3955 std::fmt::Display::fmt(self.syntax(), f)
5426 } 3956 }
5427} 3957}
5428impl std::fmt::Display for ParamList { 3958impl std::fmt::Display for PtrType {
5429 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3959 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5430 std::fmt::Display::fmt(self.syntax(), f) 3960 std::fmt::Display::fmt(self.syntax(), f)
5431 } 3961 }
5432} 3962}
5433impl std::fmt::Display for SelfParam { 3963impl std::fmt::Display for RefType {
5434 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3964 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5435 std::fmt::Display::fmt(self.syntax(), f) 3965 std::fmt::Display::fmt(self.syntax(), f)
5436 } 3966 }
5437} 3967}
5438impl std::fmt::Display for Param { 3968impl std::fmt::Display for SliceType {
5439 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3969 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5440 std::fmt::Display::fmt(self.syntax(), f) 3970 std::fmt::Display::fmt(self.syntax(), f)
5441 } 3971 }
5442} 3972}
5443impl std::fmt::Display for UseItem { 3973impl std::fmt::Display for TupleType {
5444 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3974 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5445 std::fmt::Display::fmt(self.syntax(), f) 3975 std::fmt::Display::fmt(self.syntax(), f)
5446 } 3976 }
5447} 3977}
5448impl std::fmt::Display for UseTree { 3978impl std::fmt::Display for TypeBound {
5449 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3979 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5450 std::fmt::Display::fmt(self.syntax(), f) 3980 std::fmt::Display::fmt(self.syntax(), f)
5451 } 3981 }
5452} 3982}
5453impl std::fmt::Display for Alias { 3983impl std::fmt::Display for IdentPat {
5454 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3984 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5455 std::fmt::Display::fmt(self.syntax(), f) 3985 std::fmt::Display::fmt(self.syntax(), f)
5456 } 3986 }
5457} 3987}
5458impl std::fmt::Display for UseTreeList { 3988impl std::fmt::Display for BoxPat {
5459 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3989 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5460 std::fmt::Display::fmt(self.syntax(), f) 3990 std::fmt::Display::fmt(self.syntax(), f)
5461 } 3991 }
5462} 3992}
5463impl std::fmt::Display for ExternCrateItem { 3993impl std::fmt::Display for RestPat {
5464 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3994 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5465 std::fmt::Display::fmt(self.syntax(), f) 3995 std::fmt::Display::fmt(self.syntax(), f)
5466 } 3996 }
5467} 3997}
5468impl std::fmt::Display for ArgList { 3998impl std::fmt::Display for LiteralPat {
5469 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3999 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5470 std::fmt::Display::fmt(self.syntax(), f) 4000 std::fmt::Display::fmt(self.syntax(), f)
5471 } 4001 }
5472} 4002}
5473impl std::fmt::Display for Path { 4003impl std::fmt::Display for MacroPat {
5474 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4004 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5475 std::fmt::Display::fmt(self.syntax(), f) 4005 std::fmt::Display::fmt(self.syntax(), f)
5476 } 4006 }
5477} 4007}
5478impl std::fmt::Display for PathSegment { 4008impl std::fmt::Display for OrPat {
5479 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4009 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5480 std::fmt::Display::fmt(self.syntax(), f) 4010 std::fmt::Display::fmt(self.syntax(), f)
5481 } 4011 }
5482} 4012}
5483impl std::fmt::Display for TypeArgList { 4013impl std::fmt::Display for ParenPat {
5484 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4014 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5485 std::fmt::Display::fmt(self.syntax(), f) 4015 std::fmt::Display::fmt(self.syntax(), f)
5486 } 4016 }
5487} 4017}
5488impl std::fmt::Display for TypeArg { 4018impl std::fmt::Display for PathPat {
5489 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4019 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5490 std::fmt::Display::fmt(self.syntax(), f) 4020 std::fmt::Display::fmt(self.syntax(), f)
5491 } 4021 }
5492} 4022}
5493impl std::fmt::Display for AssocTypeArg { 4023impl std::fmt::Display for WildcardPat {
5494 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5495 std::fmt::Display::fmt(self.syntax(), f) 4025 std::fmt::Display::fmt(self.syntax(), f)
5496 } 4026 }
5497} 4027}
5498impl std::fmt::Display for LifetimeArg { 4028impl std::fmt::Display for RangePat {
5499 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4029 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5500 std::fmt::Display::fmt(self.syntax(), f) 4030 std::fmt::Display::fmt(self.syntax(), f)
5501 } 4031 }
5502} 4032}
5503impl std::fmt::Display for ConstArg { 4033impl std::fmt::Display for RecordPat {
5504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4034 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5505 std::fmt::Display::fmt(self.syntax(), f) 4035 std::fmt::Display::fmt(self.syntax(), f)
5506 } 4036 }
5507} 4037}
5508impl std::fmt::Display for MacroItems { 4038impl std::fmt::Display for RefPat {
5509 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4039 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5510 std::fmt::Display::fmt(self.syntax(), f) 4040 std::fmt::Display::fmt(self.syntax(), f)
5511 } 4041 }
5512} 4042}
5513impl std::fmt::Display for MacroStmts { 4043impl std::fmt::Display for SlicePat {
5514 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4044 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5515 std::fmt::Display::fmt(self.syntax(), f) 4045 std::fmt::Display::fmt(self.syntax(), f)
5516 } 4046 }
5517} 4047}
5518impl std::fmt::Display for ExternItemList { 4048impl std::fmt::Display for TuplePat {
5519 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4049 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5520 std::fmt::Display::fmt(self.syntax(), f) 4050 std::fmt::Display::fmt(self.syntax(), f)
5521 } 4051 }
5522} 4052}
5523impl std::fmt::Display for ExternBlock { 4053impl std::fmt::Display for TupleStructPat {
5524 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4054 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5525 std::fmt::Display::fmt(self.syntax(), f) 4055 std::fmt::Display::fmt(self.syntax(), f)
5526 } 4056 }
5527} 4057}
5528impl std::fmt::Display for MetaItem { 4058impl std::fmt::Display for RecordPatFieldList {
5529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4059 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5530 std::fmt::Display::fmt(self.syntax(), f) 4060 std::fmt::Display::fmt(self.syntax(), f)
5531 } 4061 }
5532} 4062}
5533impl std::fmt::Display for MacroDef { 4063impl std::fmt::Display for RecordPatField {
5534 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 4064 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
5535 std::fmt::Display::fmt(self.syntax(), f) 4065 std::fmt::Display::fmt(self.syntax(), f)
5536 } 4066 }