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