diff options
| author | bors <bors@rust-lang.org> | 2024-03-18 09:14:08 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-03-18 09:14:08 +0000 |
| commit | 7c2bb75bc85d94d075e7f6ce8c1a9fdce2c77e45 (patch) | |
| tree | 5eee17375fac085c7d2cc8e49e3dc12ddfec1484 | |
| parent | f40c7d8a9ce0dd7529a776133ec8f0636403cfa5 (diff) | |
| parent | 4b679f90dd226daf68042d9e956a819a5d57f5ed (diff) | |
| download | rust-7c2bb75bc85d94d075e7f6ce8c1a9fdce2c77e45.tar.gz rust-7c2bb75bc85d94d075e7f6ce8c1a9fdce2c77e45.zip | |
Auto merge of #16860 - Veykril:macarons, r=Veykril
feat: Syntax highlighting improvements Specifically - Adds a new `constant` modifier, attached to keyword `const` (except for `*const ()` and `&raw const ()`), `const` items and `const` functions - Adds (or rather reveals) `associated` modifier for associated items - Fixes usage of the standard `static` modifier, now it acts like `associated` except being omitted for methods. - Splits `SymbolKind::Function` into `Function` and `Method`. We already split other things like that (notable self param from params), so the split makes sense in general as a lot special cases around it anyways.
39 files changed, 1984 insertions, 1783 deletions
diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs index 24a1f9492e2..a4f092cc498 100644 --- a/crates/ide-completion/src/completions/dot.rs +++ b/crates/ide-completion/src/completions/dot.rs @@ -961,11 +961,11 @@ struct Foo { field: i32 } impl Foo { fn foo(&self) { $0 } }"#, expect![[r#" fd self.field i32 + me self.foo() fn(&self) lc self &Foo sp Self Foo st Foo Foo bt u32 u32 - me self.foo() fn(&self) "#]], ); check( @@ -975,11 +975,11 @@ struct Foo(i32); impl Foo { fn foo(&mut self) { $0 } }"#, expect![[r#" fd self.0 i32 + me self.foo() fn(&mut self) lc self &mut Foo sp Self Foo st Foo Foo bt u32 u32 - me self.foo() fn(&mut self) "#]], ); } diff --git a/crates/ide-completion/src/completions/item_list/trait_impl.rs b/crates/ide-completion/src/completions/item_list/trait_impl.rs index 79467841502..c48672e80ac 100644 --- a/crates/ide-completion/src/completions/item_list/trait_impl.rs +++ b/crates/ide-completion/src/completions/item_list/trait_impl.rs @@ -186,11 +186,11 @@ fn add_function_impl( if func.assoc_fn_params(ctx.db).is_empty() { "" } else { ".." } ); - let completion_kind = if func.has_self_param(ctx.db) { - CompletionItemKind::Method + let completion_kind = CompletionItemKind::SymbolKind(if func.has_self_param(ctx.db) { + SymbolKind::Method } else { - CompletionItemKind::SymbolKind(SymbolKind::Function) - }; + SymbolKind::Function + }); let mut item = CompletionItem::new(completion_kind, replacement_range, label); item.lookup_by(format!("fn {}", fn_name.display(ctx.db))) diff --git a/crates/ide-completion/src/completions/keyword.rs b/crates/ide-completion/src/completions/keyword.rs index ed32a5db23e..1322c05e30e 100644 --- a/crates/ide-completion/src/completions/keyword.rs +++ b/crates/ide-completion/src/completions/keyword.rs @@ -75,8 +75,8 @@ impl Future for A {} fn foo(a: A) { a.$0 } "#, expect![[r#" - kw await expr.await me into_future() (as IntoFuture) fn(self) -> <Self as IntoFuture>::IntoFuture + kw await expr.await sn box Box::new(expr) sn call function(expr) sn dbg dbg!(expr) @@ -102,8 +102,8 @@ fn foo() { } "#, expect![[r#" - kw await expr.await me into_future() (use core::future::IntoFuture) fn(self) -> <Self as IntoFuture>::IntoFuture + kw await expr.await sn box Box::new(expr) sn call function(expr) sn dbg dbg!(expr) @@ -131,8 +131,8 @@ impl IntoFuture for A {} fn foo(a: A) { a.$0 } "#, expect![[r#" - kw await expr.await me into_future() (as IntoFuture) fn(self) -> <Self as IntoFuture>::IntoFuture + kw await expr.await sn box Box::new(expr) sn call function(expr) sn dbg dbg!(expr) diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs index 357060817c7..b9a2c383bdd 100644 --- a/crates/ide-completion/src/item.rs +++ b/crates/ide-completion/src/item.rs @@ -342,7 +342,6 @@ pub enum CompletionItemKind { BuiltinType, InferredType, Keyword, - Method, Snippet, UnresolvedReference, Expression, @@ -369,6 +368,7 @@ impl CompletionItemKind { SymbolKind::LifetimeParam => "lt", SymbolKind::Local => "lc", SymbolKind::Macro => "ma", + SymbolKind::Method => "me", SymbolKind::ProcMacro => "pm", SymbolKind::Module => "md", SymbolKind::SelfParam => "sp", @@ -388,7 +388,6 @@ impl CompletionItemKind { CompletionItemKind::BuiltinType => "bt", CompletionItemKind::InferredType => "it", CompletionItemKind::Keyword => "kw", - CompletionItemKind::Method => "me", CompletionItemKind::Snippet => "sn", CompletionItemKind::UnresolvedReference => "??", CompletionItemKind::Expression => "ex", diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs index e88b36c52d1..ca0424809ed 100644 --- a/crates/ide-completion/src/render.rs +++ b/crates/ide-completion/src/render.rs @@ -677,10 +677,11 @@ mod tests { #[track_caller] fn check_function_relevance(ra_fixture: &str, expect: Expect) { - let actual: Vec<_> = do_completion(ra_fixture, CompletionItemKind::Method) - .into_iter() - .map(|item| (item.detail.unwrap_or_default(), item.relevance.function)) - .collect(); + let actual: Vec<_> = + do_completion(ra_fixture, CompletionItemKind::SymbolKind(SymbolKind::Method)) + .into_iter() + .map(|item| (item.detail.unwrap_or_default(), item.relevance.function)) + .collect(); expect.assert_debug_eq(&actual); } @@ -1392,7 +1393,10 @@ impl S { /// Method docs fn bar(self) { self.$0 } }"#, - &[CompletionItemKind::Method, CompletionItemKind::SymbolKind(SymbolKind::Field)], + &[ + CompletionItemKind::SymbolKind(SymbolKind::Method), + CompletionItemKind::SymbolKind(SymbolKind::Field), + ], expect![[r#" [ CompletionItem { @@ -1400,7 +1404,9 @@ impl S { source_range: 94..94, delete: 94..94, insert: "bar()$0", - kind: Method, + kind: SymbolKind( + Method, + ), lookup: "bar", detail: "fn(self)", documentation: Documentation( @@ -1520,7 +1526,7 @@ impl S { } fn foo(s: S) { s.$0 } "#, - CompletionItemKind::Method, + CompletionItemKind::SymbolKind(SymbolKind::Method), expect![[r#" [ CompletionItem { @@ -1528,7 +1534,9 @@ fn foo(s: S) { s.$0 } source_range: 81..81, delete: 81..81, insert: "the_method()$0", - kind: Method, + kind: SymbolKind( + Method, + ), lookup: "the_method", detail: "fn(&self)", relevance: CompletionRelevance { @@ -2408,7 +2416,10 @@ impl Foo { fn baz(&self) -> u32 { 0 } } fn foo(f: Foo) { let _: &u32 = f.b$0 } "#, - &[CompletionItemKind::Method, CompletionItemKind::SymbolKind(SymbolKind::Field)], + &[ + CompletionItemKind::SymbolKind(SymbolKind::Method), + CompletionItemKind::SymbolKind(SymbolKind::Field), + ], expect![[r#" [ CompletionItem { @@ -2416,7 +2427,9 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 } source_range: 109..110, delete: 109..110, insert: "baz()$0", - kind: Method, + kind: SymbolKind( + Method, + ), lookup: "baz", detail: "fn(&self) -> u32", relevance: CompletionRelevance { @@ -2631,7 +2644,7 @@ fn main() { let _: bool = (9 > 2).not$0; } "#, - &[CompletionItemKind::Snippet, CompletionItemKind::Method], + &[CompletionItemKind::Snippet, CompletionItemKind::SymbolKind(SymbolKind::Method)], expect![[r#" sn not [snippet] me not() (use ops::Not) [type_could_unify+requires_import] @@ -2664,7 +2677,7 @@ fn main() { S.$0 } "#, - &[CompletionItemKind::Snippet, CompletionItemKind::Method], + &[CompletionItemKind::Snippet, CompletionItemKind::SymbolKind(SymbolKind::Method)], expect![[r#" me f() [] sn ref [] @@ -2907,7 +2920,7 @@ fn main() { } "#, &[ - CompletionItemKind::Method, + CompletionItemKind::SymbolKind(SymbolKind::Method), CompletionItemKind::SymbolKind(SymbolKind::Field), CompletionItemKind::SymbolKind(SymbolKind::Function), ], @@ -2918,7 +2931,9 @@ fn main() { source_range: 193..193, delete: 193..193, insert: "flush()$0", - kind: Method, + kind: SymbolKind( + Method, + ), lookup: "flush", detail: "fn(&self)", relevance: CompletionRelevance { @@ -2941,7 +2956,9 @@ fn main() { source_range: 193..193, delete: 193..193, insert: "write()$0", - kind: Method, + kind: SymbolKind( + Method, + ), lookup: "write", detail: "fn(&self)", relevance: CompletionRelevance { diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs index cf9fe1ab307..1634b0a9206 100644 --- a/crates/ide-completion/src/render/function.rs +++ b/crates/ide-completion/src/render/function.rs @@ -68,11 +68,11 @@ fn render( }; let has_self_param = func.self_param(db).is_some(); let mut item = CompletionItem::new( - if has_self_param { - CompletionItemKind::Method + CompletionItemKind::SymbolKind(if has_self_param { + SymbolKind::Method } else { - CompletionItemKind::SymbolKind(SymbolKind::Function) - }, + SymbolKind::Function + }), ctx.source_range(), call.clone(), ); diff --git a/crates/ide-completion/src/tests/expression.rs b/crates/ide-completion/src/tests/expression.rs index 7749fac40b9..a653314233d 100644 --- a/crates/ide-completion/src/tests/expression.rs +++ b/crates/ide-completion/src/tests/expression.rs @@ -127,6 +127,7 @@ impl Unit { en Enum Enum fn function() fn() fn local_func() fn() + me self.foo() fn(self) lc self Unit ma makro!(…) macro_rules! makro md module @@ -166,7 +167,6 @@ impl Unit { kw use kw while kw while let - me self.foo() fn(self) sn macro_rules sn pd sn ppd diff --git a/crates/ide-completion/src/tests/special.rs b/crates/ide-completion/src/tests/special.rs index ff32eccfbff..69d8fe91040 100644 --- a/crates/ide-completion/src/tests/special.rs +++ b/crates/ide-completion/src/tests/special.rs @@ -1,6 +1,7 @@ //! Tests that don't fit into a specific category. use expect_test::{expect, Expect}; +use ide_db::SymbolKind; use crate::{ tests::{ @@ -316,15 +317,15 @@ trait Sub: Super { fn foo<T: Sub>() { T::$0 } "#, expect![[r#" - ct C2 (as Sub) const C2: () - ct CONST (as Super) const CONST: u8 - fn func() (as Super) fn() - fn subfunc() (as Sub) fn() - ta SubTy (as Sub) type SubTy - ta Ty (as Super) type Ty - me method(…) (as Super) fn(&self) - me submethod(…) (as Sub) fn(&self) - "#]], + ct C2 (as Sub) const C2: () + ct CONST (as Super) const CONST: u8 + fn func() (as Super) fn() + fn subfunc() (as Sub) fn() + me method(…) (as Super) fn(&self) + me submethod(…) (as Sub) fn(&self) + ta SubTy (as Sub) type SubTy + ta Ty (as Super) type Ty + "#]], ); } @@ -356,15 +357,15 @@ impl<T> Sub for Wrap<T> { } "#, expect![[r#" - ct C2 (as Sub) const C2: () - ct CONST (as Super) const CONST: u8 - fn func() (as Super) fn() - fn subfunc() (as Sub) fn() - ta SubTy (as Sub) type SubTy - ta Ty (as Super) type Ty - me method(…) (as Super) fn(&self) - me submethod(…) (as Sub) fn(&self) - "#]], + ct C2 (as Sub) const C2: () + ct CONST (as Super) const CONST: u8 + fn func() (as Super) fn() + fn subfunc() (as Sub) fn() + me method(…) (as Super) fn(&self) + me submethod(…) (as Sub) fn(&self) + ta SubTy (as Sub) type SubTy + ta Ty (as Super) type Ty + "#]], ); } @@ -555,10 +556,10 @@ impl Foo { } "#, expect![[r#" - ev Bar Bar - ev Baz Baz - me foo(…) fn(self) - "#]], + me foo(…) fn(self) + ev Bar Bar + ev Baz Baz + "#]], ); } @@ -1399,7 +1400,7 @@ fn main() { bar.b$0 } "#, - CompletionItemKind::Method, + CompletionItemKind::SymbolKind(SymbolKind::Method), expect!("const fn(&'foo mut self, &Foo) -> !"), expect!("pub const fn baz<'foo>(&'foo mut self, x: &'foo Foo) -> !"), ); diff --git a/crates/ide-db/src/lib.rs b/crates/ide-db/src/lib.rs index 0d5a93f7b8e..357209ceb0b 100644 --- a/crates/ide-db/src/lib.rs +++ b/crates/ide-db/src/lib.rs @@ -346,6 +346,7 @@ pub enum SymbolKind { Enum, Field, Function, + Method, Impl, Label, LifetimeParam, diff --git a/crates/ide/src/file_structure.rs b/crates/ide/src/file_structure.rs index 0e790e14205..813691540f9 100644 --- a/crates/ide/src/file_structure.rs +++ b/crates/ide/src/file_structure.rs @@ -134,15 +134,22 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { if let Some(type_param_list) = it.generic_param_list() { collapse_ws(type_param_list.syntax(), &mut detail); } - if let Some(param_list) = it.param_list() { + let has_self_param = if let Some(param_list) = it.param_list() { collapse_ws(param_list.syntax(), &mut detail); - } + param_list.self_param().is_some() + } else { + false + }; if let Some(ret_type) = it.ret_type() { detail.push(' '); collapse_ws(ret_type.syntax(), &mut detail); } - decl_with_detail(&it, Some(detail), StructureNodeKind::SymbolKind(SymbolKind::Function)) + decl_with_detail(&it, Some(detail), StructureNodeKind::SymbolKind(if has_self_param { + SymbolKind::Method + } else { + SymbolKind::Function + })) }, ast::Struct(it) => decl(it, StructureNodeKind::SymbolKind(SymbolKind::Struct)), ast::Union(it) => decl(it, StructureNodeKind::SymbolKind(SymbolKind::Union)), diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index 96c7c475594..e7346cbb992 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -178,6 +178,23 @@ fn keyword( T![do] | T![yeet] if parent_matches::<ast::YeetExpr>(&token) => h | HlMod::ControlFlow, T![for] if parent_matches::<ast::ForExpr>(&token) => h | HlMod::ControlFlow, T![unsafe] => h | HlMod::Unsafe, + T![const] + if token.parent().map_or(false, |it| { + matches!( + it.kind(), + SyntaxKind::CONST + | SyntaxKind::FN + | SyntaxKind::IMPL + | SyntaxKind::BLOCK_EXPR + | SyntaxKind::CLOSURE_EXPR + | SyntaxKind::FN_PTR_TYPE + | SyntaxKind::TYPE_BOUND + | SyntaxKind::CONST_BLOCK_PAT + ) + }) => + { + h | HlMod::Const + } T![true] | T![false] => HlTag::BoolLiteral.into(), // crate is handled just as a token if it's in an `extern crate` T![crate] if parent_matches::<ast::ExternCrate>(&token) => h, @@ -377,14 +394,17 @@ pub(super) fn highlight_def( if let Some(item) = func.as_assoc_item(db) { h |= HlMod::Associated; match func.self_param(db) { - Some(sp) => match sp.access(db) { - hir::Access::Exclusive => { - h |= HlMod::Mutable; - h |= HlMod::Reference; + Some(sp) => { + h.tag = HlTag::Symbol(SymbolKind::Method); + match sp.access(db) { + hir::Access::Exclusive => { + h |= HlMod::Mutable; + h |= HlMod::Reference; + } + hir::Access::Shared => h |= HlMod::Reference, + hir::Access::Owned => h |= HlMod::Consuming, } - hir::Access::Shared => h |= HlMod::Reference, - hir::Access::Owned => h |= HlMod::Consuming, - }, + } None => h |= HlMod::Static, } @@ -406,6 +426,9 @@ pub(super) fn highlight_def( if func.is_async(db) { h |= HlMod::Async; } + if func.is_const(db) { + h |= HlMod::Const; + } h } @@ -420,10 +443,11 @@ pub(super) fn highlight_def( } Definition::Variant(_) => Highlight::new(HlTag::Symbol(SymbolKind::Variant)), Definition::Const(konst) => { - let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Const)); + let mut h = Highlight::new(HlTag::Symbol(SymbolKind::Const)) | HlMod::Const; if let Some(item) = konst.as_assoc_item(db) { h |= HlMod::Associated; + h |= HlMod::Static; match item.container(db) { hir::AssocItemContainer::Impl(i) => { if i.trait_(db).is_some() { @@ -445,6 +469,7 @@ pub(super) fn highlight_def( if let Some(item) = type_.as_assoc_item(db) { h |= HlMod::Associated; + h |= HlMod::Static; match item.container(db) { hir::AssocItemContainer::Impl(i) => { if i.trait_(db).is_some() { @@ -474,7 +499,7 @@ pub(super) fn highlight_def( Definition::GenericParam(it) => match it { hir::GenericParam::TypeParam(_) => Highlight::new(HlTag::Symbol(SymbolKind::TypeParam)), hir::GenericParam::ConstParam(_) => { - Highlight::new(HlTag::Symbol(SymbolKind::ConstParam)) + Highlight::new(HlTag::Symbol(SymbolKind::ConstParam)) | HlMod::Const } hir::GenericParam::LifetimeParam(_) => { Highlight::new(HlTag::Symbol(SymbolKind::LifetimeParam)) @@ -550,8 +575,7 @@ fn highlight_method_call( ) -> Option<Highlight> { let func = sema.resolve_method_call(method_call)?; - let mut h = SymbolKind::Function.into(); - h |= HlMod::Associated; + let mut h = SymbolKind::Method.into(); if func.is_unsafe_to_call(sema.db) || sema.is_unsafe_method_call(method_call) { h |= HlMod::Unsafe; @@ -647,7 +671,7 @@ fn highlight_name_ref_by_syntax( match parent.kind() { METHOD_CALL_EXPR => ast::MethodCallExpr::cast(parent) .and_then(|it| highlight_method_call(sema, krate, &it)) - .unwrap_or_else(|| SymbolKind::Function.into()), + .unwrap_or_else(|| SymbolKind::Method.into()), FIELD_EXPR => { let h = HlTag::Symbol(SymbolKind::Field); let is_union = ast::FieldExpr::cast(parent) diff --git a/crates/ide/src/syntax_highlighting/html.rs b/crates/ide/src/syntax_highlighting/html.rs index a6dca0541e5..e754b702dee 100644 --- a/crates/ide/src/syntax_highlighting/html.rs +++ b/crates/ide/src/syntax_highlighting/html.rs @@ -109,6 +109,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/tags.rs b/crates/ide/src/syntax_highlighting/tags.rs index 5163a0de417..5c7a463ccdc 100644 --- a/crates/ide/src/syntax_highlighting/tags.rs +++ b/crates/ide/src/syntax_highlighting/tags.rs @@ -46,7 +46,7 @@ pub enum HlTag { #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] #[repr(u8)] pub enum HlMod { - /// Used for items in traits and impls. + /// Used for associated items. Associated = 0, /// Used with keywords like `async` and `await`. Async, @@ -54,6 +54,8 @@ pub enum HlMod { Attribute, /// Callable item or value. Callable, + /// Constant operation. + Const, /// Value that is being consumed in a function call Consuming, /// Used with keywords like `if` and `break`. @@ -82,7 +84,7 @@ pub enum HlMod { Public, /// Immutable reference. Reference, - /// Used for associated functions. + /// Used for associated items, except Methods. (Some languages call these static members) Static, /// Used for items in traits and trait impls. Trait, @@ -147,6 +149,7 @@ impl HlTag { SymbolKind::LifetimeParam => "lifetime", SymbolKind::Local => "variable", SymbolKind::Macro => "macro", + SymbolKind::Method => "method", SymbolKind::ProcMacro => "proc_macro", SymbolKind::Module => "module", SymbolKind::SelfParam => "self_keyword", @@ -211,6 +214,7 @@ impl HlMod { HlMod::Async, HlMod::Attribute, HlMod::Callable, + HlMod::Const, HlMod::Consuming, HlMod::ControlFlow, HlMod::CrateRoot, @@ -237,6 +241,7 @@ impl HlMod { HlMod::Attribute => "attribute", HlMod::Callable => "callable", HlMod::Consuming => "consuming", + HlMod::Const => "const", HlMod::ControlFlow => "control", HlMod::CrateRoot => "crate_root", HlMod::DefaultLibrary => "default_library", diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html index 6994cb3d5c5..9c7f03fc158 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_assoc_functions.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -50,15 +51,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">impl</span> <span class="struct">foo</span> <span class="brace">{</span> <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public static">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> - <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public reference">is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> + <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="method associated declaration public reference">is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> <span class="keyword">trait</span> <span class="trait declaration">t</span> <span class="brace">{</span> <span class="keyword">fn</span> <span class="function associated declaration static trait">t_is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> - <span class="keyword">fn</span> <span class="function associated declaration reference trait">t_is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> + <span class="keyword">fn</span> <span class="method associated declaration reference trait">t_is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="trait">t</span> <span class="keyword">for</span> <span class="struct">foo</span> <span class="brace">{</span> <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public static trait">is_static</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> - <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public reference trait">is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> + <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="method associated declaration public reference trait">is_not_static</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span></code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_attributes.html b/crates/ide/src/syntax_highlighting/test_data/highlight_attributes.html index dc2d103b581..7f7b08010c2 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_attributes.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_attributes.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_block_mod_items.html b/crates/ide/src/syntax_highlighting/test_data/highlight_block_mod_items.html index 093cc2358a6..eed3968a906 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_block_mod_items.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_block_mod_items.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -58,7 +59,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="unresolved_reference">foo</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="none macro">Bar</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> <span class="keyword">fn</span> <span class="function declaration">func</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="keyword">mod</span> <span class="module declaration">inner</span> <span class="brace">{</span> - <span class="keyword">struct</span> <span class="struct declaration">Innerest</span><span class="angle"><</span><span class="keyword">const</span> <span class="const_param declaration">C</span><span class="colon">:</span> <span class="unresolved_reference">usize</span><span class="angle">></span> <span class="brace">{</span> <span class="field declaration">field</span><span class="colon">:</span> <span class="bracket">[</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="brace">{</span><span class="const_param">C</span><span class="brace">}</span><span class="bracket">]</span> <span class="brace">}</span> + <span class="keyword">struct</span> <span class="struct declaration">Innerest</span><span class="angle"><</span><span class="keyword">const</span> <span class="const_param const declaration">C</span><span class="colon">:</span> <span class="unresolved_reference">usize</span><span class="angle">></span> <span class="brace">{</span> <span class="field declaration">field</span><span class="colon">:</span> <span class="bracket">[</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="brace">{</span><span class="const_param const">C</span><span class="brace">}</span><span class="bracket">]</span> <span class="brace">}</span> <span class="brace">}</span> <span class="brace">}</span> <span class="brace">}</span> diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_const.html b/crates/ide/src/syntax_highlighting/test_data/highlight_const.html new file mode 100644 index 00000000000..cd6ffc2c3ae --- /dev/null +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_const.html @@ -0,0 +1,83 @@ + +<style> +body { margin: 0; } +pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padding: 0.4em; } + +.lifetime { color: #DFAF8F; font-style: italic; } +.label { color: #DFAF8F; font-style: italic; } +.comment { color: #7F9F7F; } +.documentation { color: #629755; } +.intra_doc_link { font-style: italic; } +.injected { opacity: 0.65 ; } +.struct, .enum { color: #7CB8BB; } +.enum_variant { color: #BDE0F3; } +.string_literal { color: #CC9393; } +.field { color: #94BFF3; } +.function { color: #93E0E3; } +.function.unsafe { color: #BC8383; } +.trait.unsafe { color: #BC8383; } +.operator.unsafe { color: #BC8383; } +.mutable.unsafe { color: #BC8383; text-decoration: underline; } +.keyword.unsafe { color: #BC8383; font-weight: bold; } +.macro.unsafe { color: #BC8383; } +.parameter { color: #94BFF3; } +.text { color: #DCDCCC; } +.type { color: #7CB8BB; } +.builtin_type { color: #8CD0D3; } +.type_param { color: #DFAF8F; } +.attribute { color: #94BFF3; } +.numeric_literal { color: #BFEBBF; } +.bool_literal { color: #BFE6EB; } +.macro { color: #94BFF3; } +.proc_macro { color: #94BFF3; text-decoration: underline; } +.derive { color: #94BFF3; font-style: italic; } +.module { color: #AFD8AF; } +.value_param { color: #DCDCCC; } +.variable { color: #DCDCCC; } +.format_specifier { color: #CC696B; } +.mutable { text-decoration: underline; } +.escape_sequence { color: #94BFF3; } +.keyword { color: #F0DFAF; font-weight: bold; } +.control { font-style: italic; } +.reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } + +.invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } +.unresolved_reference { color: #FC5555; text-decoration: wavy underline; } +</style> +<pre><code><span class="keyword">macro_rules</span><span class="macro_bang">!</span> <span class="macro declaration">id</span> <span class="brace">{</span> + <span class="parenthesis">(</span><span class="punctuation">$</span><span class="parenthesis">(</span><span class="punctuation">$</span>tt<span class="colon">:</span>tt<span class="parenthesis">)</span><span class="punctuation">*</span><span class="parenthesis">)</span> <span class="operator">=</span><span class="angle">></span> <span class="brace">{</span> + <span class="punctuation">$</span><span class="parenthesis">(</span><span class="punctuation">$</span>tt<span class="parenthesis">)</span><span class="punctuation">*</span> + <span class="brace">}</span><span class="semicolon">;</span> +<span class="brace">}</span> +<span class="keyword const">const</span> <span class="constant const declaration">CONST_ITEM</span><span class="colon">:</span> <span class="keyword">*</span><span class="keyword">const</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span> <span class="operator">&</span><span class="keyword">raw</span> <span class="keyword">const</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> +<span class="keyword const">const</span> <span class="keyword">fn</span> <span class="function const declaration">const_fn</span><span class="angle"><</span><span class="keyword">const</span> <span class="const_param const declaration">CONST_PARAM</span><span class="colon">:</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="angle">></span><span class="parenthesis">(</span><span class="keyword const">const</span> <span class="brace">{</span><span class="brace">}</span><span class="colon">:</span> <span class="keyword">const</span> <span class="keyword">fn</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span> <span class="keyword">where</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="colon">:</span> <span class="keyword const">const</span> <span class="trait">ConstTrait</span> <span class="brace">{</span> + <span class="constant const">CONST_ITEM</span><span class="semicolon">;</span> + <span class="const_param const">CONST_PARAM</span><span class="semicolon">;</span> + <span class="keyword const">const</span> <span class="brace">{</span> + <span class="keyword">const</span> <span class="punctuation">|</span><span class="punctuation">|</span> <span class="brace">{</span><span class="brace">}</span> + <span class="brace">}</span> + <span class="macro">id</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span> + <span class="constant const macro">CONST_ITEM</span><span class="semicolon macro">;</span> + <span class="const_param const macro">CONST_PARAM</span><span class="semicolon macro">;</span> + <span class="keyword const macro">const</span> <span class="brace macro">{</span> + <span class="keyword macro">const</span> <span class="punctuation macro">|</span><span class="punctuation macro">|</span> <span class="brace macro">{</span><span class="brace macro">}</span> + <span class="brace macro">}</span><span class="semicolon macro">;</span> + <span class="operator macro">&</span><span class="keyword macro">raw</span> <span class="keyword macro">const</span> <span class="parenthesis macro">(</span><span class="parenthesis macro">)</span><span class="semicolon macro">;</span> + <span class="keyword macro">const</span> + <span class="parenthesis macro">)</span><span class="semicolon">;</span> +<span class="brace">}</span> +<span class="keyword">trait</span> <span class="trait declaration">ConstTrait</span> <span class="brace">{</span> + <span class="keyword const">const</span> <span class="constant associated const declaration static trait">ASSOC_CONST</span><span class="colon">:</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="keyword const">const</span> <span class="keyword">fn</span> <span class="function associated const declaration static trait">assoc_const_fn</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> +<span class="brace">}</span> +<span class="keyword">impl</span> <span class="keyword const">const</span> <span class="trait">ConstTrait</span> <span class="keyword">for</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> + <span class="keyword const">const</span> <span class="constant associated const declaration static trait">ASSOC_CONST</span><span class="colon">:</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="keyword const">const</span> <span class="keyword">fn</span> <span class="function associated const declaration static trait">assoc_const_fn</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> +<span class="brace">}</span> + +<span class="keyword">macro_rules</span><span class="macro_bang">!</span> <span class="macro declaration">unsafe_deref</span> <span class="brace">{</span> + <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span><span class="angle">></span> <span class="brace">{</span> + <span class="punctuation">*</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="keyword">as</span> <span class="punctuation">*</span><span class="keyword">const</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span> + <span class="brace">}</span><span class="semicolon">;</span> +<span class="brace">}</span></code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_crate_root.html b/crates/ide/src/syntax_highlighting/test_data/highlight_crate_root.html index 154b823fffb..63e1560b921 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_crate_root.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_crate_root.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -47,7 +48,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <pre><code><span class="keyword">extern</span> <span class="keyword">crate</span> <span class="module crate_root library">foo</span><span class="semicolon">;</span> <span class="keyword">use</span> <span class="module crate_root default_library library">core</span><span class="operator">::</span><span class="module default_library library">iter</span><span class="semicolon">;</span> -<span class="keyword">pub</span> <span class="keyword">const</span> <span class="constant declaration public">NINETY_TWO</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">92</span><span class="semicolon">;</span> +<span class="keyword">pub</span> <span class="keyword const">const</span> <span class="constant const declaration public">NINETY_TWO</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">92</span><span class="semicolon">;</span> <span class="keyword">use</span> <span class="module crate_root library">foo</span> <span class="keyword">as</span> <span class="module crate_root declaration library">foooo</span><span class="semicolon">;</span> @@ -56,13 +57,13 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="brace">}</span> <span class="keyword">mod</span> <span class="module declaration">bar</span> <span class="brace">{</span> - <span class="keyword">pub</span><span class="parenthesis">(</span><span class="keyword control">in</span> <span class="keyword crate_root public">super</span><span class="parenthesis">)</span> <span class="keyword">const</span> <span class="constant declaration">FORTY_TWO</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">42</span><span class="semicolon">;</span> + <span class="keyword">pub</span><span class="parenthesis">(</span><span class="keyword control">in</span> <span class="keyword crate_root public">super</span><span class="parenthesis">)</span> <span class="keyword const">const</span> <span class="constant const declaration">FORTY_TWO</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">42</span><span class="semicolon">;</span> <span class="keyword">mod</span> <span class="module declaration">baz</span> <span class="brace">{</span> - <span class="keyword">use</span> <span class="keyword">super</span><span class="operator">::</span><span class="keyword crate_root public">super</span><span class="operator">::</span><span class="constant public">NINETY_TWO</span><span class="semicolon">;</span> + <span class="keyword">use</span> <span class="keyword">super</span><span class="operator">::</span><span class="keyword crate_root public">super</span><span class="operator">::</span><span class="constant const public">NINETY_TWO</span><span class="semicolon">;</span> <span class="keyword">use</span> <span class="keyword crate_root public">crate</span><span class="operator">::</span><span class="module crate_root library">foooo</span><span class="operator">::</span><span class="struct library">Point</span><span class="semicolon">;</span> - <span class="keyword">pub</span><span class="parenthesis">(</span><span class="keyword control">in</span> <span class="keyword">super</span><span class="operator">::</span><span class="keyword crate_root public">super</span><span class="parenthesis">)</span> <span class="keyword">const</span> <span class="constant declaration">TWENTY_NINE</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">29</span><span class="semicolon">;</span> + <span class="keyword">pub</span><span class="parenthesis">(</span><span class="keyword control">in</span> <span class="keyword">super</span><span class="operator">::</span><span class="keyword crate_root public">super</span><span class="parenthesis">)</span> <span class="keyword const">const</span> <span class="constant const declaration">TWENTY_NINE</span><span class="colon">:</span> <span class="builtin_type">u8</span> <span class="operator">=</span> <span class="numeric_literal">29</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="brace">}</span> </code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_default_library.html b/crates/ide/src/syntax_highlighting/test_data/highlight_default_library.html index 58613bf1510..366895ce7ec 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_default_library.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_default_library.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -48,5 +49,5 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="keyword">let</span> <span class="variable declaration">foo</span> <span class="operator">=</span> <span class="enum_variant default_library library">Some</span><span class="parenthesis">(</span><span class="numeric_literal">92</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="keyword">let</span> <span class="variable declaration">nums</span> <span class="operator">=</span> <span class="module default_library library">iter</span><span class="operator">::</span><span class="function default_library library">repeat</span><span class="parenthesis">(</span><span class="variable">foo</span><span class="operator">.</span><span class="function associated consuming default_library library">unwrap</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="keyword">let</span> <span class="variable declaration">nums</span> <span class="operator">=</span> <span class="module default_library library">iter</span><span class="operator">::</span><span class="function default_library library">repeat</span><span class="parenthesis">(</span><span class="variable">foo</span><span class="operator">.</span><span class="method consuming default_library library">unwrap</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="brace">}</span></code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html index 34274932afc..b2ca6e1ca4b 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_doctest.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -71,7 +72,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="comment">// KILLER WHALE</span> <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="string_literal injected"> Ishmael."</span><span class="semicolon injected">;</span> <span class="comment documentation">/// ```</span> - <span class="keyword">pub</span> <span class="keyword">const</span> <span class="constant associated declaration public">bar</span><span class="colon">:</span> <span class="builtin_type">bool</span> <span class="operator">=</span> <span class="bool_literal">true</span><span class="semicolon">;</span> + <span class="keyword">pub</span> <span class="keyword const">const</span> <span class="constant associated const declaration public static">bar</span><span class="colon">:</span> <span class="builtin_type">bool</span> <span class="operator">=</span> <span class="bool_literal">true</span><span class="semicolon">;</span> <span class="comment documentation">/// Constructs a new `Foo`.</span> <span class="comment documentation">///</span> @@ -81,7 +82,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="comment documentation">///</span><span class="comment documentation"> #</span><span class="none injected"> </span><span class="attribute_bracket attribute injected">#</span><span class="attribute_bracket attribute injected">!</span><span class="attribute_bracket attribute injected">[</span><span class="builtin_attr attribute injected library">allow</span><span class="parenthesis attribute injected">(</span><span class="none attribute injected">unused_mut</span><span class="parenthesis attribute injected">)</span><span class="attribute_bracket attribute injected">]</span> <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="keyword injected">mut</span><span class="none injected"> </span><span class="variable declaration injected mutable">foo</span><span class="colon injected">:</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> <span class="comment documentation">/// ```</span> - <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function associated declaration public static">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="struct">Foo</span> <span class="brace">{</span> + <span class="keyword">pub</span> <span class="keyword const">const</span> <span class="keyword">fn</span> <span class="function associated const declaration public static">new</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">bar</span><span class="colon">:</span> <span class="bool_literal">true</span> <span class="brace">}</span> <span class="brace">}</span> @@ -109,25 +110,25 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="comment documentation">/// ```</span> <span class="comment documentation">///</span> <span class="comment documentation">/// ```rust,no_run</span> - <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">foobar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="operator injected">.</span><span class="function injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> + <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">foobar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="operator injected">.</span><span class="method injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> <span class="comment documentation">/// ```</span> <span class="comment documentation">///</span> <span class="comment documentation">/// ~~~rust,no_run</span> <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="comment injected">// code block with tilde.</span> - <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">foobar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="operator injected">.</span><span class="function injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> + <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">foobar</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="struct injected">Foo</span><span class="operator injected">::</span><span class="function injected">new</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="operator injected">.</span><span class="method injected">bar</span><span class="parenthesis injected">(</span><span class="parenthesis injected">)</span><span class="semicolon injected">;</span> <span class="comment documentation">/// ~~~</span> <span class="comment documentation">///</span> <span class="comment documentation">/// ```</span> <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="comment injected">// functions</span> - <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">fn</span><span class="none injected"> </span><span class="function declaration injected">foo</span><span class="angle injected"><</span><span class="type_param declaration injected">T</span><span class="comma injected">,</span><span class="none injected"> </span><span class="keyword injected">const</span><span class="none injected"> </span><span class="const_param declaration injected">X</span><span class="colon injected">:</span><span class="none injected"> </span><span class="builtin_type injected">usize</span><span class="angle injected">></span><span class="parenthesis injected">(</span><span class="value_param declaration injected">arg</span><span class="colon injected">:</span><span class="none injected"> </span><span class="builtin_type injected">i32</span><span class="parenthesis injected">)</span><span class="none injected"> </span><span class="brace injected">{</span> - <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="none injected"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">x</span><span class="colon injected">:</span><span class="none injected"> </span><span class="type_param injected">T</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="const_param injected">X</span><span class="semicolon injected">;</span> + <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="keyword injected">fn</span><span class="none injected"> </span><span class="function declaration injected">foo</span><span class="angle injected"><</span><span class="type_param declaration injected">T</span><span class="comma injected">,</span><span class="none injected"> </span><span class="keyword injected">const</span><span class="none injected"> </span><span class="const_param const declaration injected">X</span><span class="colon injected">:</span><span class="none injected"> </span><span class="builtin_type injected">usize</span><span class="angle injected">></span><span class="parenthesis injected">(</span><span class="value_param declaration injected">arg</span><span class="colon injected">:</span><span class="none injected"> </span><span class="builtin_type injected">i32</span><span class="parenthesis injected">)</span><span class="none injected"> </span><span class="brace injected">{</span> + <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="none injected"> </span><span class="keyword injected">let</span><span class="none injected"> </span><span class="variable declaration injected">x</span><span class="colon injected">:</span><span class="none injected"> </span><span class="type_param injected">T</span><span class="none injected"> </span><span class="operator injected">=</span><span class="none injected"> </span><span class="const_param const injected">X</span><span class="semicolon injected">;</span> <span class="comment documentation">///</span><span class="comment documentation"> </span><span class="brace injected">}</span> <span class="comment documentation">/// ```</span> <span class="comment documentation">///</span> <span class="comment documentation">/// ```sh</span> <span class="comment documentation">/// echo 1</span> <span class="comment documentation">/// ```</span> - <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="function associated declaration public reference">foo</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> + <span class="keyword">pub</span> <span class="keyword">fn</span> <span class="method associated declaration public reference">foo</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> <span class="bool_literal">true</span> <span class="brace">}</span> <span class="brace">}</span> diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html b/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html index 729e4791f55..129b287e52f 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_extern_crate.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_general.html b/crates/ide/src/syntax_highlighting/test_data/highlight_general.html index 066fcfb1dfe..7ba1194d675 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_general.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_general.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -63,25 +64,25 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="brace">}</span> <span class="keyword">trait</span> <span class="trait declaration">Bar</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated declaration reference trait">bar</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span><span class="semicolon">;</span> + <span class="keyword">fn</span> <span class="method associated declaration reference trait">bar</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="trait">Bar</span> <span class="keyword">for</span> <span class="struct">Foo</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated declaration reference trait">bar</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated declaration reference trait">bar</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> <span class="self_keyword reference">self</span><span class="operator">.</span><span class="field">x</span> <span class="brace">}</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="struct">Foo</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated consuming declaration">baz</span><span class="parenthesis">(</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable">self</span><span class="comma">,</span> <span class="value_param declaration">f</span><span class="colon">:</span> <span class="struct">Foo</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> - <span class="value_param">f</span><span class="operator">.</span><span class="function associated consuming">baz</span><span class="parenthesis">(</span><span class="self_keyword consuming mutable">self</span><span class="parenthesis">)</span> + <span class="keyword">fn</span> <span class="method associated consuming declaration">baz</span><span class="parenthesis">(</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable">self</span><span class="comma">,</span> <span class="value_param declaration">f</span><span class="colon">:</span> <span class="struct">Foo</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> + <span class="value_param">f</span><span class="operator">.</span><span class="method consuming">baz</span><span class="parenthesis">(</span><span class="self_keyword consuming mutable">self</span><span class="parenthesis">)</span> <span class="brace">}</span> - <span class="keyword">fn</span> <span class="function associated declaration mutable reference">qux</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated declaration mutable reference">qux</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="self_keyword mutable reference">self</span><span class="operator">.</span><span class="field">x</span> <span class="operator">=</span> <span class="numeric_literal">0</span><span class="semicolon">;</span> <span class="brace">}</span> - <span class="keyword">fn</span> <span class="function associated declaration reference">quop</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated declaration reference">quop</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">i32</span> <span class="brace">{</span> <span class="self_keyword reference">self</span><span class="operator">.</span><span class="field">x</span> <span class="brace">}</span> <span class="brace">}</span> @@ -94,15 +95,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="brace">}</span> <span class="keyword">impl</span> <span class="struct">FooCopy</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated consuming declaration">baz</span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="comma">,</span> <span class="value_param declaration">f</span><span class="colon">:</span> <span class="struct">FooCopy</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">u32</span> <span class="brace">{</span> - <span class="value_param">f</span><span class="operator">.</span><span class="function associated">baz</span><span class="parenthesis">(</span><span class="self_keyword">self</span><span class="parenthesis">)</span> + <span class="keyword">fn</span> <span class="method associated consuming declaration">baz</span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="comma">,</span> <span class="value_param declaration">f</span><span class="colon">:</span> <span class="struct">FooCopy</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">u32</span> <span class="brace">{</span> + <span class="value_param">f</span><span class="operator">.</span><span class="method">baz</span><span class="parenthesis">(</span><span class="self_keyword">self</span><span class="parenthesis">)</span> <span class="brace">}</span> - <span class="keyword">fn</span> <span class="function associated declaration mutable reference">qux</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated declaration mutable reference">qux</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="keyword">mut</span> <span class="self_keyword declaration mutable reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="self_keyword mutable reference">self</span><span class="operator">.</span><span class="field">x</span> <span class="operator">=</span> <span class="numeric_literal">0</span><span class="semicolon">;</span> <span class="brace">}</span> - <span class="keyword">fn</span> <span class="function associated declaration reference">quop</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">u32</span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated declaration reference">quop</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">u32</span> <span class="brace">{</span> <span class="self_keyword reference">self</span><span class="operator">.</span><span class="field">x</span> <span class="brace">}</span> <span class="brace">}</span> @@ -119,9 +120,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword control">loop</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> -<span class="keyword">fn</span> <span class="function declaration">const_param</span><span class="angle"><</span><span class="keyword">const</span> <span class="const_param declaration">FOO</span><span class="colon">:</span> <span class="builtin_type">usize</span><span class="angle">></span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">usize</span> <span class="brace">{</span> - <span class="function">const_param</span><span class="operator">::</span><span class="angle"><</span><span class="brace">{</span> <span class="const_param">FOO</span> <span class="brace">}</span><span class="angle">></span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="const_param">FOO</span> +<span class="keyword">fn</span> <span class="function declaration">const_param</span><span class="angle"><</span><span class="keyword">const</span> <span class="const_param const declaration">FOO</span><span class="colon">:</span> <span class="builtin_type">usize</span><span class="angle">></span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">usize</span> <span class="brace">{</span> + <span class="function">const_param</span><span class="operator">::</span><span class="angle"><</span><span class="brace">{</span> <span class="const_param const">FOO</span> <span class="brace">}</span><span class="angle">></span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="const_param const">FOO</span> <span class="brace">}</span> <span class="keyword">use</span> <span class="module public">ops</span><span class="operator">::</span><span class="trait public">Fn</span><span class="semicolon">;</span> @@ -148,17 +149,17 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">foo</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="unresolved_reference">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="variable declaration">foo2</span> <span class="operator">=</span> <span class="struct">Foo</span> <span class="brace">{</span> <span class="field">x</span><span class="comma">,</span> <span class="unresolved_reference">y</span><span class="colon">:</span> <span class="variable mutable">x</span> <span class="brace">}</span><span class="semicolon">;</span> - <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated reference">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated mutable reference">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="variable mutable">foo</span><span class="operator">.</span><span class="function associated consuming">baz</span><span class="parenthesis">(</span><span class="variable consuming">foo2</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">foo</span><span class="operator">.</span><span class="method reference">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">foo</span><span class="operator">.</span><span class="method mutable reference">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">foo</span><span class="operator">.</span><span class="method consuming">baz</span><span class="parenthesis">(</span><span class="variable consuming">foo2</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">copy</span> <span class="operator">=</span> <span class="struct">FooCopy</span> <span class="brace">{</span> <span class="field">x</span> <span class="brace">}</span><span class="semicolon">;</span> - <span class="variable mutable">copy</span><span class="operator">.</span><span class="function associated reference">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="variable mutable">copy</span><span class="operator">.</span><span class="function associated mutable reference">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="variable mutable">copy</span><span class="operator">.</span><span class="function associated">baz</span><span class="parenthesis">(</span><span class="variable mutable">copy</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">copy</span><span class="operator">.</span><span class="method reference">quop</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">copy</span><span class="operator">.</span><span class="method mutable reference">qux</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable mutable">copy</span><span class="operator">.</span><span class="method">baz</span><span class="parenthesis">(</span><span class="variable mutable">copy</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="variable callable declaration">a</span> <span class="operator">=</span> <span class="punctuation">|</span><span class="value_param declaration">x</span><span class="punctuation">|</span> <span class="value_param">x</span><span class="semicolon">;</span> - <span class="keyword">let</span> <span class="variable callable declaration">bar</span> <span class="operator">=</span> <span class="struct">Foo</span><span class="operator">::</span><span class="function associated consuming">baz</span><span class="semicolon">;</span> + <span class="keyword">let</span> <span class="variable callable declaration">bar</span> <span class="operator">=</span> <span class="struct">Foo</span><span class="operator">::</span><span class="method associated consuming">baz</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="numeric_literal">-</span><span class="numeric_literal">42</span><span class="comma">,</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="variable declaration">baz</span> <span class="operator">=</span> <span class="operator">-</span><span class="variable">baz</span><span class="operator">.</span><span class="field">0</span><span class="semicolon">;</span> @@ -178,7 +179,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">use</span> <span class="enum">Option</span><span class="operator">::</span><span class="punctuation">*</span><span class="semicolon">;</span> <span class="keyword">impl</span><span class="angle"><</span><span class="type_param declaration">T</span><span class="angle">></span> <span class="enum">Option</span><span class="angle"><</span><span class="type_param">T</span><span class="angle">></span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated consuming declaration">and</span><span class="angle"><</span><span class="type_param declaration">U</span><span class="angle">></span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="comma">,</span> <span class="value_param declaration">other</span><span class="colon">:</span> <span class="enum">Option</span><span class="angle"><</span><span class="type_param">U</span><span class="angle">></span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="enum">Option</span><span class="angle"><</span><span class="parenthesis">(</span><span class="type_param">T</span><span class="comma">,</span> <span class="type_param">U</span><span class="parenthesis">)</span><span class="angle">></span> <span class="brace">{</span> + <span class="keyword">fn</span> <span class="method associated consuming declaration">and</span><span class="angle"><</span><span class="type_param declaration">U</span><span class="angle">></span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="comma">,</span> <span class="value_param declaration">other</span><span class="colon">:</span> <span class="enum">Option</span><span class="angle"><</span><span class="type_param">U</span><span class="angle">></span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="enum">Option</span><span class="angle"><</span><span class="parenthesis">(</span><span class="type_param">T</span><span class="comma">,</span> <span class="type_param">U</span><span class="parenthesis">)</span><span class="angle">></span> <span class="brace">{</span> <span class="keyword control">match</span> <span class="value_param">other</span> <span class="brace">{</span> <span class="enum_variant">None</span> <span class="operator">=></span> <span class="unresolved_reference">unimplemented</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="parenthesis macro">)</span><span class="comma">,</span> <span class="variable declaration">Nope</span> <span class="operator">=></span> <span class="variable">Nope</span><span class="comma">,</span> @@ -200,12 +201,12 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">fn</span> <span class="function declaration">use_foo_items</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="keyword">let</span> <span class="variable declaration">bob</span> <span class="operator">=</span> <span class="module crate_root library">foo</span><span class="operator">::</span><span class="struct library">Person</span> <span class="brace">{</span> <span class="field library">name</span><span class="colon">:</span> <span class="string_literal">"Bob"</span><span class="comma">,</span> - <span class="field library">age</span><span class="colon">:</span> <span class="module crate_root library">foo</span><span class="operator">::</span><span class="module library">consts</span><span class="operator">::</span><span class="constant library">NUMBER</span><span class="comma">,</span> + <span class="field library">age</span><span class="colon">:</span> <span class="module crate_root library">foo</span><span class="operator">::</span><span class="module library">consts</span><span class="operator">::</span><span class="constant const library">NUMBER</span><span class="comma">,</span> <span class="brace">}</span><span class="semicolon">;</span> <span class="keyword">let</span> <span class="variable declaration">control_flow</span> <span class="operator">=</span> <span class="module crate_root library">foo</span><span class="operator">::</span><span class="function library">identity</span><span class="parenthesis">(</span><span class="module crate_root library">foo</span><span class="operator">::</span><span class="enum library">ControlFlow</span><span class="operator">::</span><span class="enum_variant library">Continue</span><span class="parenthesis">)</span><span class="semicolon">;</span> - <span class="keyword control">if</span> <span class="variable">control_flow</span><span class="operator">.</span><span class="function associated consuming library">should_die</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> + <span class="keyword control">if</span> <span class="variable">control_flow</span><span class="operator">.</span><span class="method consuming library">should_die</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> <span class="module crate_root library">foo</span><span class="operator">::</span><span class="unresolved_reference">die</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="brace">}</span> @@ -213,23 +214,23 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">pub</span> <span class="keyword">enum</span> <span class="enum declaration public">Bool</span> <span class="brace">{</span> <span class="enum_variant declaration public">True</span><span class="comma">,</span> <span class="enum_variant declaration public">False</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="enum public">Bool</span> <span class="brace">{</span> - <span class="keyword">pub</span> <span class="keyword">const</span> <span class="keyword">fn</span> <span class="function associated consuming declaration public">to_primitive</span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> + <span class="keyword">pub</span> <span class="keyword const">const</span> <span class="keyword">fn</span> <span class="method associated const consuming declaration public">to_primitive</span><span class="parenthesis">(</span><span class="self_keyword declaration">self</span><span class="parenthesis">)</span> <span class="operator">-></span> <span class="builtin_type">bool</span> <span class="brace">{</span> <span class="bool_literal">true</span> <span class="brace">}</span> <span class="brace">}</span> -<span class="keyword">const</span> <span class="constant declaration">USAGE_OF_BOOL</span><span class="colon">:</span><span class="builtin_type">bool</span> <span class="operator">=</span> <span class="enum public">Bool</span><span class="operator">::</span><span class="enum_variant public">True</span><span class="operator">.</span><span class="function associated consuming public">to_primitive</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> +<span class="keyword const">const</span> <span class="constant const declaration">USAGE_OF_BOOL</span><span class="colon">:</span><span class="builtin_type">bool</span> <span class="operator">=</span> <span class="enum public">Bool</span><span class="operator">::</span><span class="enum_variant public">True</span><span class="operator">.</span><span class="method consuming public">to_primitive</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="keyword">trait</span> <span class="trait declaration">Baz</span> <span class="brace">{</span> - <span class="keyword">type</span> <span class="type_alias associated declaration trait">Qux</span><span class="semicolon">;</span> + <span class="keyword">type</span> <span class="type_alias associated declaration static trait">Qux</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="keyword">fn</span> <span class="function declaration">baz</span><span class="angle"><</span><span class="type_param declaration">T</span><span class="angle">></span><span class="parenthesis">(</span><span class="value_param declaration">t</span><span class="colon">:</span> <span class="type_param">T</span><span class="parenthesis">)</span> <span class="keyword">where</span> <span class="type_param">T</span><span class="colon">:</span> <span class="trait">Baz</span><span class="comma">,</span> - <span class="angle"><</span><span class="type_param">T</span> <span class="keyword">as</span> <span class="trait">Baz</span><span class="angle">></span><span class="operator">::</span><span class="type_alias associated trait">Qux</span><span class="colon">:</span> <span class="trait">Bar</span> <span class="brace">{</span><span class="brace">}</span> + <span class="angle"><</span><span class="type_param">T</span> <span class="keyword">as</span> <span class="trait">Baz</span><span class="angle">></span><span class="operator">::</span><span class="type_alias associated static trait">Qux</span><span class="colon">:</span> <span class="trait">Bar</span> <span class="brace">{</span><span class="brace">}</span> <span class="keyword">fn</span> <span class="function declaration">gp_shadows_trait</span><span class="angle"><</span><span class="type_param declaration">Baz</span><span class="colon">:</span> <span class="trait">Bar</span><span class="angle">></span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> - <span class="type_param">Baz</span><span class="operator">::</span><span class="function associated reference trait">bar</span><span class="semicolon">;</span> + <span class="type_param">Baz</span><span class="operator">::</span><span class="method associated reference trait">bar</span><span class="semicolon">;</span> <span class="brace">}</span> </code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html index 58a147dd80a..6c3fbcfcf41 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_injection.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_keywords.html b/crates/ide/src/syntax_highlighting/test_data/highlight_keywords.html index 22ae5c82a4b..7064a877070 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_keywords.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_keywords.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_lifetimes.html b/crates/ide/src/syntax_highlighting/test_data/highlight_lifetimes.html index af779996593..8428b815800 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_lifetimes.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_lifetimes.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_macros.html b/crates/ide/src/syntax_highlighting/test_data/highlight_macros.html index 32ac6a94d86..573b3d4bd52 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_macros.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_macros.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_inline.html b/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_inline.html index ef8a48ca1c1..947d1bf1e35 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_inline.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_inline.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_outline.html b/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_outline.html index a2ded15fd1b..0fe2b6f274d 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_outline.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_module_docs_outline.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_operators.html b/crates/ide/src/syntax_highlighting/test_data/highlight_operators.html index d123ee04976..c60b6ab27bb 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_operators.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_operators.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_rainbow.html b/crates/ide/src/syntax_highlighting/test_data/highlight_rainbow.html index 4429e5d933a..5d51b149789 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_rainbow.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_rainbow.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html index b6458fa7ca0..7a07d17b271 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_strings.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -171,9 +172,9 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword control macro">in</span><span class="parenthesis macro">(</span><span class="none macro">reg</span><span class="parenthesis macro">)</span> <span class="none macro">i</span><span class="comma macro">,</span> <span class="parenthesis macro">)</span><span class="semicolon">;</span> - <span class="keyword">const</span> <span class="constant declaration">CONSTANT</span><span class="colon">:</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="colon">:</span> + <span class="keyword const">const</span> <span class="constant const declaration">CONSTANT</span><span class="colon">:</span> <span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="colon">:</span> <span class="keyword">let</span> <span class="keyword">mut</span> <span class="variable declaration mutable">m</span> <span class="operator">=</span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="macro default_library library">format_args</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="macro default_library library macro">concat</span><span class="macro_bang macro">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"{}"</span><span class="parenthesis macro">)</span><span class="comma macro">,</span> <span class="string_literal macro">"{}"</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> - <span class="macro default_library library">format_args</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"</span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="variable reference">backslash</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="constant">CONSTANT</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="variable mutable">m</span><span class="format_specifier">}</span><span class="string_literal macro">"</span><span class="comma macro">,</span> <span class="variable macro reference">backslash</span><span class="comma macro">,</span> <span class="macro default_library library macro">format_args</span><span class="macro_bang macro">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"</span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro">"</span><span class="comma macro">,</span> <span class="numeric_literal macro">0</span><span class="parenthesis macro">)</span><span class="comma macro">,</span> <span class="unresolved_reference macro">foo</span><span class="comma macro">,</span> <span class="string_literal macro">"bar"</span><span class="comma macro">,</span> <span class="macro macro">toho</span><span class="macro_bang macro">!</span><span class="parenthesis macro">(</span><span class="parenthesis macro">)</span><span class="comma macro">,</span> <span class="variable macro reference">backslash</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> + <span class="macro default_library library">format_args</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"</span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="variable reference">backslash</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="constant const">CONSTANT</span><span class="format_specifier">}</span><span class="string_literal macro"> </span><span class="format_specifier">{</span><span class="variable mutable">m</span><span class="format_specifier">}</span><span class="string_literal macro">"</span><span class="comma macro">,</span> <span class="variable macro reference">backslash</span><span class="comma macro">,</span> <span class="macro default_library library macro">format_args</span><span class="macro_bang macro">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"</span><span class="format_specifier">{</span><span class="format_specifier">}</span><span class="string_literal macro">"</span><span class="comma macro">,</span> <span class="numeric_literal macro">0</span><span class="parenthesis macro">)</span><span class="comma macro">,</span> <span class="unresolved_reference macro">foo</span><span class="comma macro">,</span> <span class="string_literal macro">"bar"</span><span class="comma macro">,</span> <span class="macro macro">toho</span><span class="macro_bang macro">!</span><span class="parenthesis macro">(</span><span class="parenthesis macro">)</span><span class="comma macro">,</span> <span class="variable macro reference">backslash</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> <span class="macro">reuse_twice</span><span class="macro_bang">!</span><span class="parenthesis macro">(</span><span class="string_literal macro">"</span><span class="format_specifier">{</span><span class="variable reference">backslash</span><span class="format_specifier">}</span><span class="string_literal macro">"</span><span class="parenthesis macro">)</span><span class="semicolon">;</span> <span class="brace">}</span></code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html index 49b588baa58..15d6be6334c 100644 --- a/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html +++ b/crates/ide/src/syntax_highlighting/test_data/highlight_unsafe.html @@ -40,6 +40,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd .keyword { color: #F0DFAF; font-weight: bold; } .control { font-style: italic; } .reference { font-style: italic; font-weight: bold; } +.const { font-weight: bolder; } .invalid_escape_sequence { color: #FC5555; text-decoration: wavy underline; } .unresolved_reference { color: #FC5555; text-decoration: wavy underline; } @@ -65,7 +66,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">struct</span> <span class="struct declaration">Struct</span> <span class="brace">{</span> <span class="field declaration">field</span><span class="colon">:</span> <span class="builtin_type">i32</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="struct">Struct</span> <span class="brace">{</span> - <span class="keyword unsafe">unsafe</span> <span class="keyword">fn</span> <span class="function associated declaration reference unsafe">unsafe_method</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> + <span class="keyword unsafe">unsafe</span> <span class="keyword">fn</span> <span class="method associated declaration reference unsafe">unsafe_method</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> <span class="attribute_bracket attribute">#</span><span class="attribute_bracket attribute">[</span><span class="builtin_attr attribute library">repr</span><span class="parenthesis attribute">(</span><span class="none attribute">packed</span><span class="parenthesis attribute">)</span><span class="attribute_bracket attribute">]</span> @@ -80,11 +81,11 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">fn</span> <span class="function declaration">unsafe_trait_bound</span><span class="angle"><</span><span class="type_param declaration">T</span><span class="colon">:</span> <span class="trait">UnsafeTrait</span><span class="angle">></span><span class="parenthesis">(</span><span class="punctuation">_</span><span class="colon">:</span> <span class="type_param">T</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="keyword">trait</span> <span class="trait declaration">DoTheAutoref</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated declaration reference trait">calls_autoref</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="keyword">fn</span> <span class="method associated declaration reference trait">calls_autoref</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="keyword">impl</span> <span class="trait">DoTheAutoref</span> <span class="keyword">for</span> <span class="builtin_type">u16</span> <span class="brace">{</span> - <span class="keyword">fn</span> <span class="function associated declaration reference trait">calls_autoref</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> + <span class="keyword">fn</span> <span class="method associated declaration reference trait">calls_autoref</span><span class="parenthesis">(</span><span class="punctuation">&</span><span class="self_keyword declaration reference">self</span><span class="parenthesis">)</span> <span class="brace">{</span><span class="brace">}</span> <span class="brace">}</span> <span class="keyword">fn</span> <span class="function declaration">main</span><span class="parenthesis">(</span><span class="parenthesis">)</span> <span class="brace">{</span> @@ -106,7 +107,7 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="union">Union</span> <span class="brace">{</span> <span class="field unsafe">b</span><span class="colon">:</span> <span class="numeric_literal">0</span> <span class="brace">}</span> <span class="operator">=></span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="comma">,</span> <span class="union">Union</span> <span class="brace">{</span> <span class="field unsafe">a</span> <span class="brace">}</span> <span class="operator">=></span> <span class="parenthesis">(</span><span class="parenthesis">)</span><span class="comma">,</span> <span class="brace">}</span> - <span class="struct">Struct</span> <span class="brace">{</span> <span class="field">field</span><span class="colon">:</span> <span class="numeric_literal">0</span> <span class="brace">}</span><span class="operator">.</span><span class="function associated reference unsafe">unsafe_method</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="struct">Struct</span> <span class="brace">{</span> <span class="field">field</span><span class="colon">:</span> <span class="numeric_literal">0</span> <span class="brace">}</span><span class="operator">.</span><span class="method reference unsafe">unsafe_method</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="comment">// unsafe deref</span> <span class="operator unsafe">*</span><span class="variable">x</span><span class="semicolon">;</span> @@ -123,6 +124,6 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd <span class="keyword">let</span> <span class="struct">Packed</span> <span class="brace">{</span> <span class="field">a</span><span class="colon">:</span> <span class="keyword unsafe">ref</span> <span class="variable declaration reference">_a</span> <span class="brace">}</span> <span class="operator">=</span> <span class="variable">packed</span><span class="semicolon">;</span> <span class="comment">// unsafe auto ref of packed field</span> - <span class="variable">packed</span><span class="operator">.</span><span class="field">a</span><span class="operator">.</span><span class="function associated reference trait unsafe">calls_autoref</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> + <span class="variable">packed</span><span class="operator">.</span><span class="field">a</span><span class="operator">.</span><span class="method reference trait unsafe">calls_autoref</span><span class="parenthesis">(</span><span class="parenthesis">)</span><span class="semicolon">;</span> <span class="brace">}</span> <span class="brace">}</span></code></pre> \ No newline at end of file diff --git a/crates/ide/src/syntax_highlighting/tests.rs b/crates/ide/src/syntax_highlighting/tests.rs index 6fed7d783e8..f4a9623fc88 100644 --- a/crates/ide/src/syntax_highlighting/tests.rs +++ b/crates/ide/src/syntax_highlighting/tests.rs @@ -630,6 +630,52 @@ fn main() { } #[test] +fn test_const_highlighting() { + check_highlighting( + r#" +macro_rules! id { + ($($tt:tt)*) => { + $($tt)* + }; +} +const CONST_ITEM: *const () = &raw const (); +const fn const_fn<const CONST_PARAM: ()>(const {}: const fn()) where (): const ConstTrait { + CONST_ITEM; + CONST_PARAM; + const { + const || {} + } + id!( + CONST_ITEM; + CONST_PARAM; + const { + const || {} + }; + &raw const (); + const + ); +} +trait ConstTrait { + const ASSOC_CONST: () = (); + const fn assoc_const_fn() {} +} +impl const ConstTrait for () { + const ASSOC_CONST: () = (); + const fn assoc_const_fn() {} +} + +macro_rules! unsafe_deref { + () => { + *(&() as *const ()) + }; +} +"#, + expect_file!["./test_data/highlight_const.html"], + false, + ); +} + +#[test] fn test_highlight_doc_comment() { check_highlighting( r#" @@ -1173,7 +1219,9 @@ fn benchmark_syntax_highlighting_parser() { .highlight(HL_CONFIG, file_id) .unwrap() .iter() - .filter(|it| it.highlight.tag == HlTag::Symbol(SymbolKind::Function)) + .filter(|it| { + matches!(it.highlight.tag, HlTag::Symbol(SymbolKind::Function | SymbolKind::Method)) + }) .count() }; assert_eq!(hash, 1169); diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index 9d6eda3e5ec..d9e7c72dd36 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -1543,7 +1543,7 @@ pub(crate) fn handle_call_hierarchy_prepare( let RangeInfo { range: _, info: navs } = nav_info; let res = navs .into_iter() - .filter(|it| it.kind == Some(SymbolKind::Function)) + .filter(|it| matches!(it.kind, Some(SymbolKind::Function | SymbolKind::Method))) .map(|it| to_proto::call_hierarchy_item(&snap, it)) .collect::<Cancellable<Vec<_>>>()?; diff --git a/crates/rust-analyzer/src/lsp/semantic_tokens.rs b/crates/rust-analyzer/src/lsp/semantic_tokens.rs index c5081c4bea0..3e00222b752 100644 --- a/crates/rust-analyzer/src/lsp/semantic_tokens.rs +++ b/crates/rust-analyzer/src/lsp/semantic_tokens.rs @@ -127,13 +127,14 @@ macro_rules! define_semantic_token_modifiers { define_semantic_token_modifiers![ standard { + ASYNC, DOCUMENTATION, DECLARATION, STATIC, DEFAULT_LIBRARY, } custom { - (ASYNC, "async"), + (ASSOCIATED, "associated"), (ATTRIBUTE_MODIFIER, "attribute"), (CALLABLE, "callable"), (CONSTANT, "constant"), diff --git a/crates/rust-analyzer/src/lsp/to_proto.rs b/crates/rust-analyzer/src/lsp/to_proto.rs index dcff0ea7473..f840ca8f61e 100644 --- a/crates/rust-analyzer/src/lsp/to_proto.rs +++ b/crates/rust-analyzer/src/lsp/to_proto.rs @@ -52,6 +52,7 @@ pub(crate) fn range(line_index: &LineIndex, range: TextRange) -> lsp_types::Rang pub(crate) fn symbol_kind(symbol_kind: SymbolKind) -> lsp_types::SymbolKind { match symbol_kind { SymbolKind::Function => lsp_types::SymbolKind::FUNCTION, + SymbolKind::Method => lsp_types::SymbolKind::METHOD, SymbolKind::Struct => lsp_types::SymbolKind::STRUCT, SymbolKind::Enum => lsp_types::SymbolKind::ENUM, SymbolKind::Variant => lsp_types::SymbolKind::ENUM_MEMBER, @@ -122,12 +123,12 @@ pub(crate) fn completion_item_kind( CompletionItemKind::BuiltinType => lsp_types::CompletionItemKind::STRUCT, CompletionItemKind::InferredType => lsp_types::CompletionItemKind::SNIPPET, CompletionItemKind::Keyword => lsp_types::CompletionItemKind::KEYWORD, - CompletionItemKind::Method => lsp_types::CompletionItemKind::METHOD, CompletionItemKind::Snippet => lsp_types::CompletionItemKind::SNIPPET, CompletionItemKind::UnresolvedReference => lsp_types::CompletionItemKind::REFERENCE, CompletionItemKind::Expression => lsp_types::CompletionItemKind::SNIPPET, CompletionItemKind::SymbolKind(symbol) => match symbol { SymbolKind::Attribute => lsp_types::CompletionItemKind::FUNCTION, + SymbolKind::Method => lsp_types::CompletionItemKind::METHOD, SymbolKind::Const => lsp_types::CompletionItemKind::CONSTANT, SymbolKind::ConstParam => lsp_types::CompletionItemKind::TYPE_PARAMETER, SymbolKind::Derive => lsp_types::CompletionItemKind::FUNCTION, @@ -648,8 +649,7 @@ pub(crate) fn semantic_token_delta( fn semantic_token_type_and_modifiers( highlight: Highlight, ) -> (lsp_types::SemanticTokenType, semantic_tokens::ModifierSet) { - let mut mods = semantic_tokens::ModifierSet::default(); - let type_ = match highlight.tag { + let ty = match highlight.tag { HlTag::Symbol(symbol) => match symbol { SymbolKind::Attribute => semantic_tokens::DECORATOR, SymbolKind::Derive => semantic_tokens::DERIVE, @@ -665,22 +665,10 @@ fn semantic_token_type_and_modifiers( SymbolKind::SelfParam => semantic_tokens::SELF_KEYWORD, SymbolKind::SelfType => semantic_tokens::SELF_TYPE_KEYWORD, SymbolKind::Local => semantic_tokens::VARIABLE, - SymbolKind::Function => { - if highlight.mods.contains(HlMod::Associated) { - semantic_tokens::METHOD - } else { - semantic_tokens::FUNCTION - } - } - SymbolKind::Const => { - mods |= semantic_tokens::CONSTANT; - mods |= semantic_tokens::STATIC; - semantic_tokens::VARIABLE - } - SymbolKind::Static => { - mods |= semantic_tokens::STATIC; - semantic_tokens::VARIABLE - } + SymbolKind::Method => semantic_tokens::METHOD, + SymbolKind::Function => semantic_tokens::FUNCTION, + SymbolKind::Const => semantic_tokens::VARIABLE, + SymbolKind::Static => semantic_tokens::VARIABLE, SymbolKind::Struct => semantic_tokens::STRUCT, SymbolKind::Enum => semantic_tokens::ENUM, SymbolKind::Variant => semantic_tokens::ENUM_MEMBER, @@ -727,12 +715,14 @@ fn semantic_token_type_and_modifiers( }, }; + let mut mods = semantic_tokens::ModifierSet::default(); for modifier in highlight.mods.iter() { let modifier = match modifier { - HlMod::Associated => continue, + HlMod::Associated => semantic_tokens::ASSOCIATED, HlMod::Async => semantic_tokens::ASYNC, HlMod::Attribute => semantic_tokens::ATTRIBUTE_MODIFIER, HlMod::Callable => semantic_tokens::CALLABLE, + HlMod::Const => semantic_tokens::CONSTANT, HlMod::Consuming => semantic_tokens::CONSUMING, HlMod::ControlFlow => semantic_tokens::CONTROL_FLOW, HlMod::CrateRoot => semantic_tokens::CRATE_ROOT, @@ -754,7 +744,7 @@ fn semantic_token_type_and_modifiers( mods |= modifier; } - (type_, mods) + (ty, mods) } pub(crate) fn folding_range( diff --git a/crates/syntax/rust.ungram b/crates/syntax/rust.ungram index c3d8e97c436..e1765b25fd8 100644 --- a/crates/syntax/rust.ungram +++ b/crates/syntax/rust.ungram @@ -414,7 +414,7 @@ StmtList = '}' RefExpr = - Attr* '&' ('raw' | 'mut' | 'const') Expr + Attr* '&' (('raw' 'const'?)| ('raw'? 'mut') ) Expr TryExpr = Attr* Expr '?' diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 75971861aa8..e8801653660 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs @@ -8,247 +8,269 @@ use crate::{ }; #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Name { +pub struct Abi { pub(crate) syntax: SyntaxNode, } -impl Name { - pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } - pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } +impl Abi { + pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct NameRef { +pub struct ArgList { pub(crate) syntax: SyntaxNode, } -impl NameRef { - pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } - pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } - pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } - pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } - pub fn Self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![Self]) } +impl ArgList { + pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Lifetime { +pub struct ArrayExpr { pub(crate) syntax: SyntaxNode, } -impl Lifetime { - pub fn lifetime_ident_token(&self) -> Option<SyntaxToken> { - support::token(&self.syntax, T![lifetime_ident]) - } +impl ast::HasAttrs for ArrayExpr {} +impl ArrayExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Path { +pub struct ArrayType { pub(crate) syntax: SyntaxNode, } -impl Path { - pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } - pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } +impl ArrayType { + pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) } + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathSegment { +pub struct AsmExpr { pub(crate) syntax: SyntaxNode, } -impl PathSegment { - pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } - pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } - pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } - pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } - pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } - pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } - pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } +impl ast::HasAttrs for AsmExpr {} +impl AsmExpr { + pub fn asm_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![asm]) } + pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct GenericArgList { +pub struct AssocItemList { pub(crate) syntax: SyntaxNode, } -impl GenericArgList { - pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } - pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } - pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } - pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } +impl ast::HasAttrs for AssocItemList {} +impl AssocItemList { + pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParamList { +pub struct AssocTypeArg { pub(crate) syntax: SyntaxNode, } -impl ParamList { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } - pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } - pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } - pub fn pipe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![|]) } +impl ast::HasTypeBounds for AssocTypeArg {} +impl AssocTypeArg { + pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } + pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } + pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RetType { +pub struct Attr { pub(crate) syntax: SyntaxNode, } -impl RetType { - pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl Attr { + pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn meta(&self) -> Option<Meta> { support::child(&self.syntax) } + pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathType { +pub struct AwaitExpr { pub(crate) syntax: SyntaxNode, } -impl PathType { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } +impl ast::HasAttrs for AwaitExpr {} +impl AwaitExpr { + pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } + pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeArg { +pub struct BecomeExpr { pub(crate) syntax: SyntaxNode, } -impl TypeArg { - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl ast::HasAttrs for BecomeExpr {} +impl BecomeExpr { + pub fn become_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![become]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AssocTypeArg { +pub struct BinExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasTypeBounds for AssocTypeArg {} -impl AssocTypeArg { - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } - pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } - pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } - pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) } +impl ast::HasAttrs for BinExpr {} +impl BinExpr {} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct BlockExpr { + pub(crate) syntax: SyntaxNode, +} +impl ast::HasAttrs for BlockExpr {} +impl BlockExpr { + pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } + pub fn stmt_list(&self) -> Option<StmtList> { support::child(&self.syntax) } + pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } + pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LifetimeArg { +pub struct BoxPat { pub(crate) syntax: SyntaxNode, } -impl LifetimeArg { - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } +impl BoxPat { + pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstArg { +pub struct BreakExpr { pub(crate) syntax: SyntaxNode, } -impl ConstArg { +impl ast::HasAttrs for BreakExpr {} +impl BreakExpr { + pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeBoundList { +pub struct CallExpr { pub(crate) syntax: SyntaxNode, } -impl TypeBoundList { - pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } +impl ast::HasArgList for CallExpr {} +impl ast::HasAttrs for CallExpr {} +impl CallExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroCall { +pub struct CastExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MacroCall {} -impl ast::HasDocComments for MacroCall {} -impl MacroCall { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } - pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl ast::HasAttrs for CastExpr {} +impl CastExpr { + pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Attr { +pub struct ClosureExpr { pub(crate) syntax: SyntaxNode, } -impl Attr { - pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } - pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn meta(&self) -> Option<Meta> { support::child(&self.syntax) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl ast::HasAttrs for ClosureExpr {} +impl ClosureExpr { + pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } + pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } + pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } + pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } + pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } + pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } + pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TokenTree { +pub struct Const { pub(crate) syntax: SyntaxNode, } -impl TokenTree { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl ast::HasAttrs for Const {} +impl ast::HasDocComments for Const {} +impl ast::HasName for Const {} +impl ast::HasVisibility for Const {} +impl Const { + pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } + pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroItems { +pub struct ConstArg { pub(crate) syntax: SyntaxNode, } -impl ast::HasModuleItem for MacroItems {} -impl MacroItems {} +impl ConstArg { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroEagerInput { +pub struct ConstBlockPat { pub(crate) syntax: SyntaxNode, } -impl MacroEagerInput { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl ConstBlockPat { + pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroStmts { +pub struct ConstParam { pub(crate) syntax: SyntaxNode, } -impl MacroStmts { - pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasAttrs for ConstParam {} +impl ast::HasName for ConstParam {} +impl ConstParam { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn default_val(&self) -> Option<ConstArg> { support::child(&self.syntax) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SourceFile { +pub struct ContinueExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for SourceFile {} -impl ast::HasModuleItem for SourceFile {} -impl ast::HasDocComments for SourceFile {} -impl SourceFile { - pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } +impl ast::HasAttrs for ContinueExpr {} +impl ContinueExpr { + pub fn continue_token(&self) -> Option<SyntaxToken> { + support::token(&self.syntax, T![continue]) + } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Const { +pub struct DynTraitType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Const {} -impl ast::HasName for Const {} -impl ast::HasVisibility for Const {} -impl ast::HasDocComments for Const {} -impl Const { - pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl DynTraitType { + pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } + pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -256,25 +278,34 @@ pub struct Enum { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for Enum {} +impl ast::HasDocComments for Enum {} +impl ast::HasGenericParams for Enum {} impl ast::HasName for Enum {} impl ast::HasVisibility for Enum {} -impl ast::HasGenericParams for Enum {} -impl ast::HasDocComments for Enum {} impl Enum { pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ExprStmt { + pub(crate) syntax: SyntaxNode, +} +impl ExprStmt { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExternBlock { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for ExternBlock {} impl ast::HasDocComments for ExternBlock {} impl ExternBlock { - pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } + pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -282,784 +313,696 @@ pub struct ExternCrate { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for ExternCrate {} -impl ast::HasVisibility for ExternCrate {} impl ast::HasDocComments for ExternCrate {} +impl ast::HasVisibility for ExternCrate {} impl ExternCrate { - pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } + pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct ExternItemList { + pub(crate) syntax: SyntaxNode, +} +impl ast::HasAttrs for ExternItemList {} +impl ExternItemList { + pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct FieldExpr { + pub(crate) syntax: SyntaxNode, +} +impl ast::HasAttrs for FieldExpr {} +impl FieldExpr { + pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Fn { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for Fn {} +impl ast::HasDocComments for Fn {} +impl ast::HasGenericParams for Fn {} impl ast::HasName for Fn {} impl ast::HasVisibility for Fn {} -impl ast::HasGenericParams for Fn {} -impl ast::HasDocComments for Fn {} impl Fn { - pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } - pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } + pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } + pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } - pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Impl { - pub(crate) syntax: SyntaxNode, -} -impl ast::HasAttrs for Impl {} -impl ast::HasVisibility for Impl {} -impl ast::HasGenericParams for Impl {} -impl ast::HasDocComments for Impl {} -impl Impl { - pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } - pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } - pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } - pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroRules { +pub struct FnPtrType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MacroRules {} -impl ast::HasName for MacroRules {} -impl ast::HasVisibility for MacroRules {} -impl ast::HasDocComments for MacroRules {} -impl MacroRules { - pub fn macro_rules_token(&self) -> Option<SyntaxToken> { - support::token(&self.syntax, T![macro_rules]) - } - pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } - pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } +impl FnPtrType { + pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } + pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } + pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } + pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } + pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroDef { +pub struct ForExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MacroDef {} -impl ast::HasName for MacroDef {} -impl ast::HasVisibility for MacroDef {} -impl ast::HasDocComments for MacroDef {} -impl MacroDef { - pub fn macro_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![macro]) } - pub fn args(&self) -> Option<TokenTree> { support::child(&self.syntax) } - pub fn body(&self) -> Option<TokenTree> { support::child(&self.syntax) } +impl ast::HasAttrs for ForExpr {} +impl ForExpr { + pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } + pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Module { +pub struct ForType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Module {} -impl ast::HasName for Module {} -impl ast::HasVisibility for Module {} -impl ast::HasDocComments for Module {} -impl Module { - pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } - pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl ForType { + pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } + pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Static { +pub struct FormatArgsArg { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Static {} -impl ast::HasName for Static {} -impl ast::HasVisibility for Static {} -impl ast::HasDocComments for Static {} -impl Static { - pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl ast::HasName for FormatArgsArg {} +impl FormatArgsArg { pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Struct { +pub struct FormatArgsExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Struct {} -impl ast::HasName for Struct {} -impl ast::HasVisibility for Struct {} -impl ast::HasGenericParams for Struct {} -impl ast::HasDocComments for Struct {} -impl Struct { - pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } - pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } +impl ast::HasAttrs for FormatArgsExpr {} +impl FormatArgsExpr { + pub fn args(&self) -> AstChildren<FormatArgsArg> { support::children(&self.syntax) } + pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } + pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } + pub fn format_args_token(&self) -> Option<SyntaxToken> { + support::token(&self.syntax, T![format_args]) + } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } + pub fn template(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Trait { +pub struct GenericArgList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Trait {} -impl ast::HasName for Trait {} -impl ast::HasVisibility for Trait {} -impl ast::HasGenericParams for Trait {} -impl ast::HasTypeBounds for Trait {} -impl ast::HasDocComments for Trait {} -impl Trait { - pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } - pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } - pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } - pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } +impl GenericArgList { + pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } + pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } + pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } + pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TraitAlias { +pub struct GenericParamList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TraitAlias {} -impl ast::HasName for TraitAlias {} -impl ast::HasVisibility for TraitAlias {} -impl ast::HasGenericParams for TraitAlias {} -impl ast::HasDocComments for TraitAlias {} -impl TraitAlias { - pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl GenericParamList { + pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } + pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } + pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeAlias { +pub struct IdentPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TypeAlias {} -impl ast::HasName for TypeAlias {} -impl ast::HasVisibility for TypeAlias {} -impl ast::HasGenericParams for TypeAlias {} -impl ast::HasTypeBounds for TypeAlias {} -impl ast::HasDocComments for TypeAlias {} -impl TypeAlias { - pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } - pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl ast::HasAttrs for IdentPat {} +impl ast::HasName for IdentPat {} +impl IdentPat { + pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } + pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Union { +pub struct IfExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Union {} -impl ast::HasName for Union {} -impl ast::HasVisibility for Union {} -impl ast::HasGenericParams for Union {} -impl ast::HasDocComments for Union {} -impl Union { - pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } - pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } +impl ast::HasAttrs for IfExpr {} +impl IfExpr { + pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } + pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Use { +pub struct Impl { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Use {} -impl ast::HasVisibility for Use {} -impl ast::HasDocComments for Use {} -impl Use { - pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } - pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl ast::HasAttrs for Impl {} +impl ast::HasDocComments for Impl {} +impl ast::HasGenericParams for Impl {} +impl ast::HasVisibility for Impl {} +impl Impl { + pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } + pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } + pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } + pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } + pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Visibility { +pub struct ImplTraitType { pub(crate) syntax: SyntaxNode, } -impl Visibility { - pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl ImplTraitType { + pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } + pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ItemList { +pub struct IndexExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ItemList {} -impl ast::HasModuleItem for ItemList {} -impl ItemList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for IndexExpr {} +impl IndexExpr { + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Rename { +pub struct InferType { pub(crate) syntax: SyntaxNode, } -impl ast::HasName for Rename {} -impl Rename { - pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } +impl InferType { pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UseTree { - pub(crate) syntax: SyntaxNode, -} -impl UseTree { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } - pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } - pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } - pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UseTreeList { +pub struct ItemList { pub(crate) syntax: SyntaxNode, } -impl UseTreeList { +impl ast::HasAttrs for ItemList {} +impl ast::HasModuleItem for ItemList {} +impl ItemList { pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Abi { - pub(crate) syntax: SyntaxNode, -} -impl Abi { - pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct GenericParamList { +pub struct Label { pub(crate) syntax: SyntaxNode, } -impl GenericParamList { - pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } - pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } - pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } +impl Label { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WhereClause { +pub struct LetElse { pub(crate) syntax: SyntaxNode, } -impl WhereClause { - pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } - pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } +impl LetElse { + pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } + pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BlockExpr { +pub struct LetExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for BlockExpr {} -impl BlockExpr { - pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } - pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } - pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } - pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn stmt_list(&self) -> Option<StmtList> { support::child(&self.syntax) } +impl ast::HasAttrs for LetExpr {} +impl LetExpr { + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SelfParam { +pub struct LetStmt { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for SelfParam {} -impl ast::HasName for SelfParam {} -impl SelfParam { - pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } +impl ast::HasAttrs for LetStmt {} +impl LetStmt { pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn let_else(&self) -> Option<LetElse> { support::child(&self.syntax) } + pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Param { +pub struct Lifetime { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Param {} -impl Param { - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } +impl Lifetime { + pub fn lifetime_ident_token(&self) -> Option<SyntaxToken> { + support::token(&self.syntax, T![lifetime_ident]) + } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordFieldList { +pub struct LifetimeArg { pub(crate) syntax: SyntaxNode, } -impl RecordFieldList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl LifetimeArg { + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleFieldList { +pub struct LifetimeParam { pub(crate) syntax: SyntaxNode, } -impl TupleFieldList { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl ast::HasAttrs for LifetimeParam {} +impl ast::HasTypeBounds for LifetimeParam {} +impl LifetimeParam { + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordField { +pub struct Literal { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RecordField {} -impl ast::HasName for RecordField {} -impl ast::HasVisibility for RecordField {} -impl ast::HasDocComments for RecordField {} -impl RecordField { - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } -} +impl ast::HasAttrs for Literal {} +impl Literal {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleField { +pub struct LiteralPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TupleField {} -impl ast::HasVisibility for TupleField {} -impl ast::HasDocComments for TupleField {} -impl TupleField { - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl LiteralPat { + pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } + pub fn minus_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![-]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct VariantList { +pub struct LoopExpr { pub(crate) syntax: SyntaxNode, } -impl VariantList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for LoopExpr {} +impl ast::HasLoopBody for LoopExpr {} +impl LoopExpr { + pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Variant { +pub struct MacroCall { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Variant {} -impl ast::HasName for Variant {} -impl ast::HasVisibility for Variant {} -impl ast::HasDocComments for Variant {} -impl Variant { - pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasAttrs for MacroCall {} +impl ast::HasDocComments for MacroCall {} +impl MacroCall { + pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AssocItemList { +pub struct MacroDef { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for AssocItemList {} -impl AssocItemList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for MacroDef {} +impl ast::HasDocComments for MacroDef {} +impl ast::HasName for MacroDef {} +impl ast::HasVisibility for MacroDef {} +impl MacroDef { + pub fn args(&self) -> Option<TokenTree> { support::child(&self.syntax) } + pub fn body(&self) -> Option<TokenTree> { support::child(&self.syntax) } + pub fn macro_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![macro]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ExternItemList { +pub struct MacroEagerInput { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ExternItemList {} -impl ExternItemList { +impl MacroEagerInput { + pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstParam { +pub struct MacroExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ConstParam {} -impl ast::HasName for ConstParam {} -impl ConstParam { - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn default_val(&self) -> Option<ConstArg> { support::child(&self.syntax) } +impl MacroExpr { + pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LifetimeParam { +pub struct MacroItems { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for LifetimeParam {} -impl ast::HasTypeBounds for LifetimeParam {} -impl LifetimeParam { - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } -} +impl ast::HasModuleItem for MacroItems {} +impl MacroItems {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeParam { +pub struct MacroPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TypeParam {} -impl ast::HasName for TypeParam {} -impl ast::HasTypeBounds for TypeParam {} -impl TypeParam { - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } +impl MacroPat { + pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WherePred { +pub struct MacroRules { pub(crate) syntax: SyntaxNode, } -impl ast::HasTypeBounds for WherePred {} -impl WherePred { - pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } - pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl ast::HasAttrs for MacroRules {} +impl ast::HasDocComments for MacroRules {} +impl ast::HasName for MacroRules {} +impl ast::HasVisibility for MacroRules {} +impl MacroRules { + pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } + pub fn macro_rules_token(&self) -> Option<SyntaxToken> { + support::token(&self.syntax, T![macro_rules]) + } + pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Meta { +pub struct MacroStmts { pub(crate) syntax: SyntaxNode, } -impl Meta { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } +impl MacroStmts { pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } + pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ExprStmt { +pub struct MacroType { pub(crate) syntax: SyntaxNode, } -impl ExprStmt { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } +impl MacroType { + pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LetStmt { +pub struct MatchArm { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for LetStmt {} -impl LetStmt { - pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } +impl ast::HasAttrs for MatchArm {} +impl MatchArm { + pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } + pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn let_else(&self) -> Option<LetElse> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LetElse { +pub struct MatchArmList { pub(crate) syntax: SyntaxNode, } -impl LetElse { - pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } - pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } +impl ast::HasAttrs for MatchArmList {} +impl MatchArmList { + pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ArrayExpr { +pub struct MatchExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ArrayExpr {} -impl ArrayExpr { - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } +impl ast::HasAttrs for MatchExpr {} +impl MatchExpr { pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } + pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } + pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AsmExpr { +pub struct MatchGuard { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for AsmExpr {} -impl AsmExpr { - pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } - pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } - pub fn asm_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![asm]) } - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl MatchGuard { + pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct AwaitExpr { +pub struct Meta { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for AwaitExpr {} -impl AwaitExpr { +impl Meta { + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } - pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BinExpr { +pub struct MethodCallExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for BinExpr {} -impl BinExpr {} +impl ast::HasArgList for MethodCallExpr {} +impl ast::HasAttrs for MethodCallExpr {} +impl MethodCallExpr { + pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } + pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } + pub fn receiver(&self) -> Option<Expr> { support::child(&self.syntax) } +} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BreakExpr { +pub struct Module { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for BreakExpr {} -impl BreakExpr { - pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasAttrs for Module {} +impl ast::HasDocComments for Module {} +impl ast::HasName for Module {} +impl ast::HasVisibility for Module {} +impl Module { + pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } + pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct CallExpr { +pub struct Name { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for CallExpr {} -impl ast::HasArgList for CallExpr {} -impl CallExpr { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl Name { + pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } + pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct CastExpr { +pub struct NameRef { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for CastExpr {} -impl CastExpr { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl NameRef { + pub fn Self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![Self]) } + pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } + pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } + pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } + pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ClosureExpr { +pub struct NeverType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ClosureExpr {} -impl ClosureExpr { - pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } - pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } - pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } - pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } - pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } - pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } - pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } +impl NeverType { + pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ContinueExpr { +pub struct OffsetOfExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ContinueExpr {} -impl ContinueExpr { - pub fn continue_token(&self) -> Option<SyntaxToken> { - support::token(&self.syntax, T![continue]) +impl ast::HasAttrs for OffsetOfExpr {} +impl OffsetOfExpr { + pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } + pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } + pub fn fields(&self) -> AstChildren<NameRef> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn offset_of_token(&self) -> Option<SyntaxToken> { + support::token(&self.syntax, T![offset_of]) } - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } + pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FieldExpr { +pub struct OrPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for FieldExpr {} -impl FieldExpr { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } +impl OrPat { + pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ForExpr { +pub struct Param { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ForExpr {} -impl ForExpr { - pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } +impl ast::HasAttrs for Param {} +impl Param { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FormatArgsExpr { +pub struct ParamList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for FormatArgsExpr {} -impl FormatArgsExpr { - pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } - pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } - pub fn format_args_token(&self) -> Option<SyntaxToken> { - support::token(&self.syntax, T![format_args]) - } - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn template(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ParamList { pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } - pub fn args(&self) -> AstChildren<FormatArgsArg> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } + pub fn pipe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![|]) } pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } + pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IfExpr { +pub struct ParenExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for IfExpr {} -impl IfExpr { - pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } - pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } +impl ast::HasAttrs for ParenExpr {} +impl ParenExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IndexExpr { +pub struct ParenPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for IndexExpr {} -impl IndexExpr { - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl ParenPat { + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Literal { +pub struct ParenType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for Literal {} -impl Literal {} +impl ParenType { + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LoopExpr { +pub struct Path { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for LoopExpr {} -impl ast::HasLoopBody for LoopExpr {} -impl LoopExpr { - pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } +impl Path { + pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } + pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroExpr { +pub struct PathExpr { pub(crate) syntax: SyntaxNode, } -impl MacroExpr { - pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } +impl ast::HasAttrs for PathExpr {} +impl PathExpr { + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MatchExpr { +pub struct PathPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MatchExpr {} -impl MatchExpr { - pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } +impl PathPat { + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MethodCallExpr { +pub struct PathSegment { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MethodCallExpr {} -impl ast::HasArgList for MethodCallExpr {} -impl MethodCallExpr { - pub fn receiver(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } +impl PathSegment { + pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } + pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } pub fn generic_arg_list(&self) -> Option<GenericArgList> { support::child(&self.syntax) } + pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } + pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } + pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } + pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } + pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct OffsetOfExpr { +pub struct PathType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for OffsetOfExpr {} -impl OffsetOfExpr { - pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } - pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } - pub fn offset_of_token(&self) -> Option<SyntaxToken> { - support::token(&self.syntax, T![offset_of]) - } - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } - pub fn fields(&self) -> AstChildren<NameRef> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl PathType { + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenExpr { +pub struct PrefixExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ParenExpr {} -impl ParenExpr { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } +impl ast::HasAttrs for PrefixExpr {} +impl PrefixExpr { pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathExpr { +pub struct PtrType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for PathExpr {} -impl PathExpr { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } +impl PtrType { + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PrefixExpr { +pub struct RangeExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for PrefixExpr {} -impl PrefixExpr { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } -} +impl ast::HasAttrs for RangeExpr {} +impl RangeExpr {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RangeExpr { +pub struct RangePat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RangeExpr {} -impl RangeExpr {} +impl RangePat {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordExpr { @@ -1073,325 +1016,354 @@ impl RecordExpr { } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RefExpr { +pub struct RecordExprField { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RefExpr {} -impl RefExpr { - pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } - pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } +impl ast::HasAttrs for RecordExprField {} +impl RecordExprField { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ReturnExpr { +pub struct RecordExprFieldList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for ReturnExpr {} -impl ReturnExpr { - pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasAttrs for RecordExprFieldList {} +impl RecordExprFieldList { + pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } + pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BecomeExpr { +pub struct RecordField { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for BecomeExpr {} -impl BecomeExpr { - pub fn become_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![become]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasAttrs for RecordField {} +impl ast::HasDocComments for RecordField {} +impl ast::HasName for RecordField {} +impl ast::HasVisibility for RecordField {} +impl RecordField { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TryExpr { +pub struct RecordFieldList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TryExpr {} -impl TryExpr { - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } +impl RecordFieldList { + pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleExpr { +pub struct RecordPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for TupleExpr {} -impl TupleExpr { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl RecordPat { + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> { + support::child(&self.syntax) + } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WhileExpr { +pub struct RecordPatField { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for WhileExpr {} -impl WhileExpr { - pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } +impl ast::HasAttrs for RecordPatField {} +impl RecordPatField { + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } + pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct YieldExpr { +pub struct RecordPatFieldList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for YieldExpr {} -impl YieldExpr { - pub fn yield_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![yield]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl RecordPatFieldList { + pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn rest_pat(&self) -> Option<RestPat> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct YeetExpr { +pub struct RefExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for YeetExpr {} -impl YeetExpr { - pub fn do_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![do]) } - pub fn yeet_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![yeet]) } +impl ast::HasAttrs for RefExpr {} +impl RefExpr { + pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LetExpr { +pub struct RefPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for LetExpr {} -impl LetExpr { - pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } +impl RefPat { + pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UnderscoreExpr { +pub struct RefType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for UnderscoreExpr {} -impl UnderscoreExpr { - pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } +impl RefType { + pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FormatArgsArg { +pub struct Rename { pub(crate) syntax: SyntaxNode, } -impl ast::HasName for FormatArgsArg {} -impl FormatArgsArg { - pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } +impl ast::HasName for Rename {} +impl Rename { + pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } + pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct StmtList { +pub struct RestPat { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for StmtList {} -impl StmtList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } - pub fn tail_expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for RestPat {} +impl RestPat { + pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct Label { +pub struct RetType { pub(crate) syntax: SyntaxNode, } -impl Label { - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } +impl RetType { + pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordExprFieldList { +pub struct ReturnExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RecordExprFieldList {} -impl RecordExprFieldList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } - pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } - pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for ReturnExpr {} +impl ReturnExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordExprField { +pub struct SelfParam { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RecordExprField {} -impl RecordExprField { - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } +impl ast::HasAttrs for SelfParam {} +impl ast::HasName for SelfParam {} +impl SelfParam { + pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ArgList { +pub struct SlicePat { pub(crate) syntax: SyntaxNode, } -impl ArgList { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl SlicePat { + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MatchArmList { +pub struct SliceType { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MatchArmList {} -impl MatchArmList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl SliceType { + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MatchArm { +pub struct SourceFile { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for MatchArm {} -impl MatchArm { - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } - pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } - pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } - pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } +impl ast::HasAttrs for SourceFile {} +impl ast::HasDocComments for SourceFile {} +impl ast::HasModuleItem for SourceFile {} +impl SourceFile { + pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MatchGuard { +pub struct Static { pub(crate) syntax: SyntaxNode, } -impl MatchGuard { - pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } +impl ast::HasAttrs for Static {} +impl ast::HasDocComments for Static {} +impl ast::HasName for Static {} +impl ast::HasVisibility for Static {} +impl Static { + pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ArrayType { +pub struct StmtList { pub(crate) syntax: SyntaxNode, } -impl ArrayType { - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } - pub fn const_arg(&self) -> Option<ConstArg> { support::child(&self.syntax) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl ast::HasAttrs for StmtList {} +impl StmtList { + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } + pub fn tail_expr(&self) -> Option<Expr> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct DynTraitType { +pub struct Struct { pub(crate) syntax: SyntaxNode, } -impl DynTraitType { - pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } - pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } +impl ast::HasAttrs for Struct {} +impl ast::HasDocComments for Struct {} +impl ast::HasGenericParams for Struct {} +impl ast::HasName for Struct {} +impl ast::HasVisibility for Struct {} +impl Struct { + pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct FnPtrType { +pub struct TokenTree { pub(crate) syntax: SyntaxNode, } -impl FnPtrType { - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } - pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } - pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } - pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } - pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } - pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } +impl TokenTree { + pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ForType { +pub struct Trait { pub(crate) syntax: SyntaxNode, } -impl ForType { - pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } - pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl ast::HasAttrs for Trait {} +impl ast::HasDocComments for Trait {} +impl ast::HasGenericParams for Trait {} +impl ast::HasName for Trait {} +impl ast::HasTypeBounds for Trait {} +impl ast::HasVisibility for Trait {} +impl Trait { + pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } + pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } + pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } + pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ImplTraitType { +pub struct TraitAlias { pub(crate) syntax: SyntaxNode, } -impl ImplTraitType { - pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } +impl ast::HasAttrs for TraitAlias {} +impl ast::HasDocComments for TraitAlias {} +impl ast::HasGenericParams for TraitAlias {} +impl ast::HasName for TraitAlias {} +impl ast::HasVisibility for TraitAlias {} +impl TraitAlias { + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct InferType { +pub struct TryExpr { pub(crate) syntax: SyntaxNode, } -impl InferType { - pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } +impl ast::HasAttrs for TryExpr {} +impl TryExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroType { +pub struct TupleExpr { pub(crate) syntax: SyntaxNode, } -impl MacroType { - pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } +impl ast::HasAttrs for TupleExpr {} +impl TupleExpr { + pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct NeverType { +pub struct TupleField { pub(crate) syntax: SyntaxNode, } -impl NeverType { - pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } +impl ast::HasAttrs for TupleField {} +impl ast::HasDocComments for TupleField {} +impl ast::HasVisibility for TupleField {} +impl TupleField { + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenType { +pub struct TupleFieldList { pub(crate) syntax: SyntaxNode, } -impl ParenType { +impl TupleFieldList { + pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) } pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PtrType { - pub(crate) syntax: SyntaxNode, -} -impl PtrType { - pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RefType { +pub struct TuplePat { pub(crate) syntax: SyntaxNode, } -impl RefType { - pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } +impl TuplePat { + pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SliceType { +pub struct TupleStructPat { pub(crate) syntax: SyntaxNode, } -impl SliceType { - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl TupleStructPat { + pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -1399,226 +1371,251 @@ pub struct TupleType { pub(crate) syntax: SyntaxNode, } impl TupleType { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeBound { +pub struct TypeAlias { pub(crate) syntax: SyntaxNode, } -impl TypeBound { - pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } - pub fn tilde_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![~]) } - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } - pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } +impl ast::HasAttrs for TypeAlias {} +impl ast::HasDocComments for TypeAlias {} +impl ast::HasGenericParams for TypeAlias {} +impl ast::HasName for TypeAlias {} +impl ast::HasTypeBounds for TypeAlias {} +impl ast::HasVisibility for TypeAlias {} +impl TypeAlias { + pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } + pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct IdentPat { +pub struct TypeArg { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for IdentPat {} -impl ast::HasName for IdentPat {} -impl IdentPat { - pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } +impl TypeArg { + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct BoxPat { +pub struct TypeBound { pub(crate) syntax: SyntaxNode, } -impl BoxPat { - pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } +impl TypeBound { + pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } + pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } + pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } + pub fn tilde_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![~]) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RestPat { +pub struct TypeBoundList { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RestPat {} -impl RestPat { - pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } +impl TypeBoundList { + pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct LiteralPat { +pub struct TypeParam { pub(crate) syntax: SyntaxNode, } -impl LiteralPat { - pub fn minus_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![-]) } - pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } +impl ast::HasAttrs for TypeParam {} +impl ast::HasName for TypeParam {} +impl ast::HasTypeBounds for TypeParam {} +impl TypeParam { + pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct MacroPat { +pub struct UnderscoreExpr { pub(crate) syntax: SyntaxNode, } -impl MacroPat { - pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } +impl ast::HasAttrs for UnderscoreExpr {} +impl UnderscoreExpr { + pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct OrPat { +pub struct Union { pub(crate) syntax: SyntaxNode, } -impl OrPat { - pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } +impl ast::HasAttrs for Union {} +impl ast::HasDocComments for Union {} +impl ast::HasGenericParams for Union {} +impl ast::HasName for Union {} +impl ast::HasVisibility for Union {} +impl Union { + pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } + pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ParenPat { +pub struct Use { pub(crate) syntax: SyntaxNode, } -impl ParenPat { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl ast::HasAttrs for Use {} +impl ast::HasDocComments for Use {} +impl ast::HasVisibility for Use {} +impl Use { + pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } + pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } + pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct PathPat { +pub struct UseTree { pub(crate) syntax: SyntaxNode, } -impl PathPat { +impl UseTree { + pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn rename(&self) -> Option<Rename> { support::child(&self.syntax) } + pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } + pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct WildcardPat { +pub struct UseTreeList { pub(crate) syntax: SyntaxNode, } -impl WildcardPat { - pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } +impl UseTreeList { + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RangePat { +pub struct Variant { pub(crate) syntax: SyntaxNode, } -impl RangePat {} +impl ast::HasAttrs for Variant {} +impl ast::HasDocComments for Variant {} +impl ast::HasName for Variant {} +impl ast::HasVisibility for Variant {} +impl Variant { + pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } +} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordPat { +pub struct VariantList { pub(crate) syntax: SyntaxNode, } -impl RecordPat { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn record_pat_field_list(&self) -> Option<RecordPatFieldList> { - support::child(&self.syntax) - } +impl VariantList { + pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } + pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } + pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RefPat { +pub struct Visibility { pub(crate) syntax: SyntaxNode, } -impl RefPat { - pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } - pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } +impl Visibility { + pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } + pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } + pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } + pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } + pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct SlicePat { +pub struct WhereClause { pub(crate) syntax: SyntaxNode, } -impl SlicePat { - pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } - pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } - pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } +impl WhereClause { + pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } + pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TuplePat { +pub struct WherePred { pub(crate) syntax: SyntaxNode, } -impl TuplePat { - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl ast::HasTypeBounds for WherePred {} +impl WherePred { + pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } + pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } + pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } + pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TupleStructPat { +pub struct WhileExpr { pub(crate) syntax: SyntaxNode, } -impl TupleStructPat { - pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } - pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } - pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) } - pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } +impl ast::HasAttrs for WhileExpr {} +impl WhileExpr { + pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct ConstBlockPat { +pub struct WildcardPat { pub(crate) syntax: SyntaxNode, } -impl ConstBlockPat { - pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } - pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } +impl WildcardPat { + pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordPatFieldList { +pub struct YeetExpr { pub(crate) syntax: SyntaxNode, } -impl RecordPatFieldList { - pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } - pub fn fields(&self) -> AstChildren<RecordPatField> { support::children(&self.syntax) } - pub fn rest_pat(&self) -> Option<RestPat> { support::child(&self.syntax) } - pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } +impl ast::HasAttrs for YeetExpr {} +impl YeetExpr { + pub fn do_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![do]) } + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn yeet_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![yeet]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct RecordPatField { +pub struct YieldExpr { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for RecordPatField {} -impl RecordPatField { - pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } - pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } - pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } +impl ast::HasAttrs for YieldExpr {} +impl YieldExpr { + pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } + pub fn yield_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![yield]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Type { - ArrayType(ArrayType), - DynTraitType(DynTraitType), - FnPtrType(FnPtrType), - ForType(ForType), - ImplTraitType(ImplTraitType), - InferType(InferType), - MacroType(MacroType), - NeverType(NeverType), - ParenType(ParenType), - PathType(PathType), - PtrType(PtrType), - RefType(RefType), - SliceType(SliceType), - TupleType(TupleType), +pub enum Adt { + Enum(Enum), + Struct(Struct), + Union(Union), } +impl ast::HasAttrs for Adt {} +impl ast::HasDocComments for Adt {} +impl ast::HasGenericParams for Adt {} +impl ast::HasName for Adt {} +impl ast::HasVisibility for Adt {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum GenericArg { - TypeArg(TypeArg), - AssocTypeArg(AssocTypeArg), - LifetimeArg(LifetimeArg), - ConstArg(ConstArg), +pub enum AssocItem { + Const(Const), + Fn(Fn), + MacroCall(MacroCall), + TypeAlias(TypeAlias), } +impl ast::HasAttrs for AssocItem {} +impl ast::HasDocComments for AssocItem {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Expr { ArrayExpr(ArrayExpr), AsmExpr(AsmExpr), AwaitExpr(AwaitExpr), + BecomeExpr(BecomeExpr), BinExpr(BinExpr), BlockExpr(BlockExpr), BreakExpr(BreakExpr), @@ -1631,6 +1628,7 @@ pub enum Expr { FormatArgsExpr(FormatArgsExpr), IfExpr(IfExpr), IndexExpr(IndexExpr), + LetExpr(LetExpr), Literal(Literal), LoopExpr(LoopExpr), MacroExpr(MacroExpr), @@ -1644,17 +1642,47 @@ pub enum Expr { RecordExpr(RecordExpr), RefExpr(RefExpr), ReturnExpr(ReturnExpr), - BecomeExpr(BecomeExpr), TryExpr(TryExpr), TupleExpr(TupleExpr), + UnderscoreExpr(UnderscoreExpr), WhileExpr(WhileExpr), - YieldExpr(YieldExpr), YeetExpr(YeetExpr), - LetExpr(LetExpr), - UnderscoreExpr(UnderscoreExpr), + YieldExpr(YieldExpr), } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum ExternItem { + Fn(Fn), + MacroCall(MacroCall), + Static(Static), + TypeAlias(TypeAlias), +} +impl ast::HasAttrs for ExternItem {} +impl ast::HasDocComments for ExternItem {} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum FieldList { + RecordFieldList(RecordFieldList), + TupleFieldList(TupleFieldList), +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GenericArg { + AssocTypeArg(AssocTypeArg), + ConstArg(ConstArg), + LifetimeArg(LifetimeArg), + TypeArg(TypeArg), +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub enum GenericParam { + ConstParam(ConstParam), + LifetimeParam(LifetimeParam), + TypeParam(TypeParam), +} +impl ast::HasAttrs for GenericParam {} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Item { Const(Const), Enum(Enum), @@ -1663,8 +1691,8 @@ pub enum Item { Fn(Fn), Impl(Impl), MacroCall(MacroCall), - MacroRules(MacroRules), MacroDef(MacroDef), + MacroRules(MacroRules), Module(Module), Static(Static), Struct(Struct), @@ -1678,77 +1706,49 @@ impl ast::HasAttrs for Item {} impl ast::HasDocComments for Item {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Stmt { - ExprStmt(ExprStmt), - Item(Item), - LetStmt(LetStmt), -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Pat { - IdentPat(IdentPat), BoxPat(BoxPat), - RestPat(RestPat), + ConstBlockPat(ConstBlockPat), + IdentPat(IdentPat), LiteralPat(LiteralPat), MacroPat(MacroPat), OrPat(OrPat), ParenPat(ParenPat), PathPat(PathPat), - WildcardPat(WildcardPat), RangePat(RangePat), RecordPat(RecordPat), RefPat(RefPat), + RestPat(RestPat), SlicePat(SlicePat), TuplePat(TuplePat), TupleStructPat(TupleStructPat), - ConstBlockPat(ConstBlockPat), -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum FieldList { - RecordFieldList(RecordFieldList), - TupleFieldList(TupleFieldList), -} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum Adt { - Enum(Enum), - Struct(Struct), - Union(Union), -} -impl ast::HasAttrs for Adt {} -impl ast::HasDocComments for Adt {} -impl ast::HasGenericParams for Adt {} -impl ast::HasName for Adt {} -impl ast::HasVisibility for Adt {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum AssocItem { - Const(Const), - Fn(Fn), - MacroCall(MacroCall), - TypeAlias(TypeAlias), + WildcardPat(WildcardPat), } -impl ast::HasAttrs for AssocItem {} -impl ast::HasDocComments for AssocItem {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum ExternItem { - Fn(Fn), - MacroCall(MacroCall), - Static(Static), - TypeAlias(TypeAlias), +pub enum Stmt { + ExprStmt(ExprStmt), + Item(Item), + LetStmt(LetStmt), } -impl ast::HasAttrs for ExternItem {} -impl ast::HasDocComments for ExternItem {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum GenericParam { - ConstParam(ConstParam), - LifetimeParam(LifetimeParam), - TypeParam(TypeParam), +pub enum Type { + ArrayType(ArrayType), + DynTraitType(DynTraitType), + FnPtrType(FnPtrType), + ForType(ForType), + ImplTraitType(ImplTraitType), + InferType(InferType), + MacroType(MacroType), + NeverType(NeverType), + ParenType(ParenType), + PathType(PathType), + PtrType(PtrType), + RefType(RefType), + SliceType(SliceType), + TupleType(TupleType), } -impl ast::HasAttrs for GenericParam {} #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AnyHasArgList { @@ -1803,8 +1803,8 @@ pub struct AnyHasVisibility { pub(crate) syntax: SyntaxNode, } impl ast::HasVisibility for AnyHasVisibility {} -impl AstNode for Name { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } +impl AstNode for Abi { + fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1814,8 +1814,8 @@ impl AstNode for Name { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for NameRef { - fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } +impl AstNode for ArgList { + fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1825,8 +1825,8 @@ impl AstNode for NameRef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Lifetime { - fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME } +impl AstNode for ArrayExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1836,8 +1836,8 @@ impl AstNode for Lifetime { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Path { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } +impl AstNode for ArrayType { + fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1847,8 +1847,8 @@ impl AstNode for Path { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathSegment { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } +impl AstNode for AsmExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == ASM_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1858,8 +1858,8 @@ impl AstNode for PathSegment { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for GenericArgList { - fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST } +impl AstNode for AssocItemList { + fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1869,8 +1869,8 @@ impl AstNode for GenericArgList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } +impl AstNode for AssocTypeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1880,8 +1880,8 @@ impl AstNode for ParamList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RetType { - fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } +impl AstNode for Attr { + fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1891,8 +1891,8 @@ impl AstNode for RetType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathType { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } +impl AstNode for AwaitExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1902,8 +1902,8 @@ impl AstNode for PathType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } +impl AstNode for BecomeExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == BECOME_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1913,8 +1913,8 @@ impl AstNode for TypeArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for AssocTypeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_TYPE_ARG } +impl AstNode for BinExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1924,8 +1924,8 @@ impl AstNode for AssocTypeArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LifetimeArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } +impl AstNode for BlockExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1935,8 +1935,8 @@ impl AstNode for LifetimeArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ConstArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } +impl AstNode for BoxPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1946,8 +1946,8 @@ impl AstNode for ConstArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeBoundList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } +impl AstNode for BreakExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1957,8 +1957,8 @@ impl AstNode for TypeBoundList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroCall { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } +impl AstNode for CallExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1968,8 +1968,8 @@ impl AstNode for MacroCall { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Attr { - fn can_cast(kind: SyntaxKind) -> bool { kind == ATTR } +impl AstNode for CastExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1979,8 +1979,8 @@ impl AstNode for Attr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TokenTree { - fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } +impl AstNode for ClosureExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1990,8 +1990,8 @@ impl AstNode for TokenTree { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroItems { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } +impl AstNode for Const { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2001,8 +2001,8 @@ impl AstNode for MacroItems { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroEagerInput { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_EAGER_INPUT } +impl AstNode for ConstArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_ARG } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2012,8 +2012,8 @@ impl AstNode for MacroEagerInput { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroStmts { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } +impl AstNode for ConstBlockPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_BLOCK_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2023,8 +2023,8 @@ impl AstNode for MacroStmts { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SourceFile { - fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } +impl AstNode for ConstParam { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2034,8 +2034,8 @@ impl AstNode for SourceFile { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Const { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } +impl AstNode for ContinueExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2045,8 +2045,8 @@ impl AstNode for Const { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Enum { - fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } +impl AstNode for DynTraitType { + fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2056,8 +2056,8 @@ impl AstNode for Enum { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExternBlock { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } +impl AstNode for Enum { + fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2067,8 +2067,8 @@ impl AstNode for ExternBlock { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExternCrate { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } +impl AstNode for ExprStmt { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2078,8 +2078,8 @@ impl AstNode for ExternCrate { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Fn { - fn can_cast(kind: SyntaxKind) -> bool { kind == FN } +impl AstNode for ExternBlock { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2089,8 +2089,8 @@ impl AstNode for Fn { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Impl { - fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } +impl AstNode for ExternCrate { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2100,8 +2100,8 @@ impl AstNode for Impl { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroRules { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_RULES } +impl AstNode for ExternItemList { + fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2111,8 +2111,8 @@ impl AstNode for MacroRules { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } +impl AstNode for FieldExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2122,8 +2122,8 @@ impl AstNode for MacroDef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Module { - fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } +impl AstNode for Fn { + fn can_cast(kind: SyntaxKind) -> bool { kind == FN } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2133,8 +2133,8 @@ impl AstNode for Module { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Static { - fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } +impl AstNode for FnPtrType { + fn can_cast(kind: SyntaxKind) -> bool { kind == FN_PTR_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2144,8 +2144,8 @@ impl AstNode for Static { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Struct { - fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } +impl AstNode for ForExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2155,8 +2155,8 @@ impl AstNode for Struct { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Trait { - fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } +impl AstNode for ForType { + fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2166,8 +2166,8 @@ impl AstNode for Trait { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TraitAlias { - fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_ALIAS } +impl AstNode for FormatArgsArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == FORMAT_ARGS_ARG } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2177,8 +2177,8 @@ impl AstNode for TraitAlias { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeAlias { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } +impl AstNode for FormatArgsExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == FORMAT_ARGS_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2188,8 +2188,8 @@ impl AstNode for TypeAlias { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Union { - fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } +impl AstNode for GenericArgList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2199,8 +2199,8 @@ impl AstNode for Union { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Use { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE } +impl AstNode for GenericParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2210,8 +2210,8 @@ impl AstNode for Use { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Visibility { - fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } +impl AstNode for IdentPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2221,8 +2221,8 @@ impl AstNode for Visibility { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ItemList { - fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } +impl AstNode for IfExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2232,8 +2232,8 @@ impl AstNode for ItemList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Rename { - fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } +impl AstNode for Impl { + fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2243,8 +2243,8 @@ impl AstNode for Rename { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for UseTree { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } +impl AstNode for ImplTraitType { + fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2254,8 +2254,8 @@ impl AstNode for UseTree { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for UseTreeList { - fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } +impl AstNode for IndexExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2265,8 +2265,8 @@ impl AstNode for UseTreeList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Abi { - fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } +impl AstNode for InferType { + fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2276,8 +2276,8 @@ impl AstNode for Abi { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for GenericParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } +impl AstNode for ItemList { + fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2287,8 +2287,8 @@ impl AstNode for GenericParamList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for WhereClause { - fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } +impl AstNode for Label { + fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2298,8 +2298,8 @@ impl AstNode for WhereClause { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BlockExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } +impl AstNode for LetElse { + fn can_cast(kind: SyntaxKind) -> bool { kind == LET_ELSE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2309,8 +2309,8 @@ impl AstNode for BlockExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SelfParam { - fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } +impl AstNode for LetExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == LET_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2320,8 +2320,8 @@ impl AstNode for SelfParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Param { - fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } +impl AstNode for LetStmt { + fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2331,8 +2331,8 @@ impl AstNode for Param { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordFieldList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } +impl AstNode for Lifetime { + fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2342,8 +2342,8 @@ impl AstNode for RecordFieldList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleFieldList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } +impl AstNode for LifetimeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_ARG } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2353,8 +2353,8 @@ impl AstNode for TupleFieldList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordField { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } +impl AstNode for LifetimeParam { + fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2364,8 +2364,8 @@ impl AstNode for RecordField { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleField { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } +impl AstNode for Literal { + fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2375,8 +2375,8 @@ impl AstNode for TupleField { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for VariantList { - fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } +impl AstNode for LiteralPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2386,8 +2386,8 @@ impl AstNode for VariantList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Variant { - fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } +impl AstNode for LoopExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2397,8 +2397,8 @@ impl AstNode for Variant { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for AssocItemList { - fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } +impl AstNode for MacroCall { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2408,8 +2408,8 @@ impl AstNode for AssocItemList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExternItemList { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } +impl AstNode for MacroDef { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2419,8 +2419,8 @@ impl AstNode for ExternItemList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ConstParam { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } +impl AstNode for MacroEagerInput { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_EAGER_INPUT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2430,8 +2430,8 @@ impl AstNode for ConstParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LifetimeParam { - fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } +impl AstNode for MacroExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2441,8 +2441,8 @@ impl AstNode for LifetimeParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeParam { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } +impl AstNode for MacroItems { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_ITEMS } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2452,8 +2452,8 @@ impl AstNode for TypeParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for WherePred { - fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } +impl AstNode for MacroPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2463,8 +2463,8 @@ impl AstNode for WherePred { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Meta { - fn can_cast(kind: SyntaxKind) -> bool { kind == META } +impl AstNode for MacroRules { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_RULES } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2474,8 +2474,8 @@ impl AstNode for Meta { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ExprStmt { - fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } +impl AstNode for MacroStmts { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_STMTS } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2485,8 +2485,8 @@ impl AstNode for ExprStmt { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LetStmt { - fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } +impl AstNode for MacroType { + fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2496,8 +2496,8 @@ impl AstNode for LetStmt { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LetElse { - fn can_cast(kind: SyntaxKind) -> bool { kind == LET_ELSE } +impl AstNode for MatchArm { + fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2507,8 +2507,8 @@ impl AstNode for LetElse { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ArrayExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } +impl AstNode for MatchArmList { + fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2518,8 +2518,8 @@ impl AstNode for ArrayExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for AsmExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == ASM_EXPR } +impl AstNode for MatchExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2529,8 +2529,8 @@ impl AstNode for AsmExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for AwaitExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } +impl AstNode for MatchGuard { + fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2540,8 +2540,8 @@ impl AstNode for AwaitExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BinExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } +impl AstNode for Meta { + fn can_cast(kind: SyntaxKind) -> bool { kind == META } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2551,8 +2551,8 @@ impl AstNode for BinExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BreakExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } +impl AstNode for MethodCallExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2562,8 +2562,8 @@ impl AstNode for BreakExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for CallExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } +impl AstNode for Module { + fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2573,8 +2573,8 @@ impl AstNode for CallExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for CastExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } +impl AstNode for Name { + fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2584,8 +2584,8 @@ impl AstNode for CastExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ClosureExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } +impl AstNode for NameRef { + fn can_cast(kind: SyntaxKind) -> bool { kind == NAME_REF } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2595,8 +2595,8 @@ impl AstNode for ClosureExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ContinueExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } +impl AstNode for NeverType { + fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2606,8 +2606,8 @@ impl AstNode for ContinueExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for FieldExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } +impl AstNode for OffsetOfExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == OFFSET_OF_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2617,8 +2617,8 @@ impl AstNode for FieldExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ForExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } +impl AstNode for OrPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2628,8 +2628,8 @@ impl AstNode for ForExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for FormatArgsExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == FORMAT_ARGS_EXPR } +impl AstNode for Param { + fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2639,8 +2639,8 @@ impl AstNode for FormatArgsExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for IfExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } +impl AstNode for ParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2650,8 +2650,8 @@ impl AstNode for IfExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for IndexExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } +impl AstNode for ParenExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2661,8 +2661,8 @@ impl AstNode for IndexExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Literal { - fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } +impl AstNode for ParenPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2672,8 +2672,8 @@ impl AstNode for Literal { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LoopExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } +impl AstNode for ParenType { + fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2683,8 +2683,8 @@ impl AstNode for LoopExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_EXPR } +impl AstNode for Path { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2694,8 +2694,8 @@ impl AstNode for MacroExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MatchExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } +impl AstNode for PathExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2705,8 +2705,8 @@ impl AstNode for MatchExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MethodCallExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } +impl AstNode for PathPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2716,8 +2716,8 @@ impl AstNode for MethodCallExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for OffsetOfExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == OFFSET_OF_EXPR } +impl AstNode for PathSegment { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2727,8 +2727,8 @@ impl AstNode for OffsetOfExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ParenExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } +impl AstNode for PathType { + fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2738,8 +2738,8 @@ impl AstNode for ParenExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } +impl AstNode for PrefixExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2749,8 +2749,8 @@ impl AstNode for PathExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PrefixExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } +impl AstNode for PtrType { + fn can_cast(kind: SyntaxKind) -> bool { kind == PTR_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2771,8 +2771,8 @@ impl AstNode for RangeExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } +impl AstNode for RangePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2782,8 +2782,8 @@ impl AstNode for RecordExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RefExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } +impl AstNode for RecordExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2793,8 +2793,8 @@ impl AstNode for RefExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ReturnExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } +impl AstNode for RecordExprField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2804,8 +2804,8 @@ impl AstNode for ReturnExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BecomeExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == BECOME_EXPR } +impl AstNode for RecordExprFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2815,8 +2815,8 @@ impl AstNode for BecomeExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TryExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } +impl AstNode for RecordField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2826,8 +2826,8 @@ impl AstNode for TryExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } +impl AstNode for RecordFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2837,8 +2837,8 @@ impl AstNode for TupleExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for WhileExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } +impl AstNode for RecordPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2848,8 +2848,8 @@ impl AstNode for WhileExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for YieldExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == YIELD_EXPR } +impl AstNode for RecordPatField { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2859,8 +2859,8 @@ impl AstNode for YieldExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for YeetExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == YEET_EXPR } +impl AstNode for RecordPatFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2870,8 +2870,8 @@ impl AstNode for YeetExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LetExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == LET_EXPR } +impl AstNode for RefExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2881,8 +2881,8 @@ impl AstNode for LetExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for UnderscoreExpr { - fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE_EXPR } +impl AstNode for RefPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2892,8 +2892,8 @@ impl AstNode for UnderscoreExpr { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for FormatArgsArg { - fn can_cast(kind: SyntaxKind) -> bool { kind == FORMAT_ARGS_ARG } +impl AstNode for RefType { + fn can_cast(kind: SyntaxKind) -> bool { kind == REF_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2903,8 +2903,8 @@ impl AstNode for FormatArgsArg { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for StmtList { - fn can_cast(kind: SyntaxKind) -> bool { kind == STMT_LIST } +impl AstNode for Rename { + fn can_cast(kind: SyntaxKind) -> bool { kind == RENAME } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2914,8 +2914,8 @@ impl AstNode for StmtList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for Label { - fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } +impl AstNode for RestPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == REST_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2925,8 +2925,8 @@ impl AstNode for Label { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordExprFieldList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } +impl AstNode for RetType { + fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2936,8 +2936,8 @@ impl AstNode for RecordExprFieldList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordExprField { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } +impl AstNode for ReturnExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2947,8 +2947,8 @@ impl AstNode for RecordExprField { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ArgList { - fn can_cast(kind: SyntaxKind) -> bool { kind == ARG_LIST } +impl AstNode for SelfParam { + fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2958,8 +2958,8 @@ impl AstNode for ArgList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MatchArmList { - fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } +impl AstNode for SlicePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2969,8 +2969,8 @@ impl AstNode for MatchArmList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MatchArm { - fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } +impl AstNode for SliceType { + fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2980,8 +2980,8 @@ impl AstNode for MatchArm { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MatchGuard { - fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } +impl AstNode for SourceFile { + fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -2991,8 +2991,8 @@ impl AstNode for MatchGuard { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ArrayType { - fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } +impl AstNode for Static { + fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3002,8 +3002,8 @@ impl AstNode for ArrayType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for DynTraitType { - fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } +impl AstNode for StmtList { + fn can_cast(kind: SyntaxKind) -> bool { kind == STMT_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3013,8 +3013,8 @@ impl AstNode for DynTraitType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for FnPtrType { - fn can_cast(kind: SyntaxKind) -> bool { kind == FN_PTR_TYPE } +impl AstNode for Struct { + fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3024,8 +3024,8 @@ impl AstNode for FnPtrType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ForType { - fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } +impl AstNode for TokenTree { + fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3035,8 +3035,8 @@ impl AstNode for ForType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ImplTraitType { - fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } +impl AstNode for Trait { + fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3046,8 +3046,8 @@ impl AstNode for ImplTraitType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for InferType { - fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } +impl AstNode for TraitAlias { + fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_ALIAS } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3057,8 +3057,8 @@ impl AstNode for InferType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroType { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_TYPE } +impl AstNode for TryExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3068,8 +3068,8 @@ impl AstNode for MacroType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for NeverType { - fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } +impl AstNode for TupleExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3079,8 +3079,8 @@ impl AstNode for NeverType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ParenType { - fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } +impl AstNode for TupleField { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3090,8 +3090,8 @@ impl AstNode for ParenType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PtrType { - fn can_cast(kind: SyntaxKind) -> bool { kind == PTR_TYPE } +impl AstNode for TupleFieldList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3101,8 +3101,8 @@ impl AstNode for PtrType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RefType { - fn can_cast(kind: SyntaxKind) -> bool { kind == REF_TYPE } +impl AstNode for TuplePat { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3112,8 +3112,8 @@ impl AstNode for RefType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SliceType { - fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } +impl AstNode for TupleStructPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3134,8 +3134,8 @@ impl AstNode for TupleType { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeBound { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } +impl AstNode for TypeAlias { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3145,8 +3145,8 @@ impl AstNode for TypeBound { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for IdentPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT_PAT } +impl AstNode for TypeArg { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3156,8 +3156,8 @@ impl AstNode for IdentPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for BoxPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_PAT } +impl AstNode for TypeBound { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3167,8 +3167,8 @@ impl AstNode for BoxPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RestPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == REST_PAT } +impl AstNode for TypeBoundList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3178,8 +3178,8 @@ impl AstNode for RestPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for LiteralPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL_PAT } +impl AstNode for TypeParam { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3189,8 +3189,8 @@ impl AstNode for LiteralPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for MacroPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_PAT } +impl AstNode for UnderscoreExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3200,8 +3200,8 @@ impl AstNode for MacroPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for OrPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == OR_PAT } +impl AstNode for Union { + fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3211,8 +3211,8 @@ impl AstNode for OrPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ParenPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_PAT } +impl AstNode for Use { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3222,8 +3222,8 @@ impl AstNode for ParenPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for PathPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_PAT } +impl AstNode for UseTree { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3233,8 +3233,8 @@ impl AstNode for PathPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for WildcardPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT } +impl AstNode for UseTreeList { + fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3244,8 +3244,8 @@ impl AstNode for WildcardPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RangePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_PAT } +impl AstNode for Variant { + fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3255,8 +3255,8 @@ impl AstNode for RangePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } +impl AstNode for VariantList { + fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3266,8 +3266,8 @@ impl AstNode for RecordPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RefPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == REF_PAT } +impl AstNode for Visibility { + fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3277,8 +3277,8 @@ impl AstNode for RefPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for SlicePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_PAT } +impl AstNode for WhereClause { + fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3288,8 +3288,8 @@ impl AstNode for SlicePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TuplePat { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_PAT } +impl AstNode for WherePred { + fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_PRED } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3299,8 +3299,8 @@ impl AstNode for TuplePat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TupleStructPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_STRUCT_PAT } +impl AstNode for WhileExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3310,8 +3310,8 @@ impl AstNode for TupleStructPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for ConstBlockPat { - fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_BLOCK_PAT } +impl AstNode for WildcardPat { + fn can_cast(kind: SyntaxKind) -> bool { kind == WILDCARD_PAT } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3321,8 +3321,8 @@ impl AstNode for ConstBlockPat { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordPatFieldList { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD_LIST } +impl AstNode for YeetExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == YEET_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3332,8 +3332,8 @@ impl AstNode for RecordPatFieldList { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for RecordPatField { - fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT_FIELD } +impl AstNode for YieldExpr { + fn can_cast(kind: SyntaxKind) -> bool { kind == YIELD_EXPR } fn cast(syntax: SyntaxNode) -> Option<Self> { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3343,139 +3343,64 @@ impl AstNode for RecordPatField { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl From<ArrayType> for Type { - fn from(node: ArrayType) -> Type { Type::ArrayType(node) } -} -impl From<DynTraitType> for Type { - fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } -} -impl From<FnPtrType> for Type { - fn from(node: FnPtrType) -> Type { Type::FnPtrType(node) } -} -impl From<ForType> for Type { - fn from(node: ForType) -> Type { Type::ForType(node) } -} -impl From<ImplTraitType> for Type { - fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } -} -impl From<InferType> for Type { - fn from(node: InferType) -> Type { Type::InferType(node) } -} -impl From<MacroType> for Type { - fn from(node: MacroType) -> Type { Type::MacroType(node) } -} -impl From<NeverType> for Type { - fn from(node: NeverType) -> Type { Type::NeverType(node) } -} -impl From<ParenType> for Type { - fn from(node: ParenType) -> Type { Type::ParenType(node) } -} -impl From<PathType> for Type { - fn from(node: PathType) -> Type { Type::PathType(node) } -} -impl From<PtrType> for Type { - fn from(node: PtrType) -> Type { Type::PtrType(node) } -} -impl From<RefType> for Type { - fn from(node: RefType) -> Type { Type::RefType(node) } +impl From<Enum> for Adt { + fn from(node: Enum) -> Adt { Adt::Enum(node) } } -impl From<SliceType> for Type { - fn from(node: SliceType) -> Type { Type::SliceType(node) } +impl From<Struct> for Adt { + fn from(node: Struct) -> Adt { Adt::Struct(node) } } -impl From<TupleType> for Type { - fn from(node: TupleType) -> Type { Type::TupleType(node) } +impl From<Union> for Adt { + fn from(node: Union) -> Adt { Adt::Union(node) } } -impl AstNode for Type { - fn can_cast(kind: SyntaxKind) -> bool { - matches!( - kind, - ARRAY_TYPE - | DYN_TRAIT_TYPE - | FN_PTR_TYPE - | FOR_TYPE - | IMPL_TRAIT_TYPE - | INFER_TYPE - | MACRO_TYPE - | NEVER_TYPE - | PAREN_TYPE - | PATH_TYPE - | PTR_TYPE - | REF_TYPE - | SLICE_TYPE - | TUPLE_TYPE - ) - } +impl AstNode for Adt { + fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, ENUM | STRUCT | UNION) } fn cast(syntax: SyntaxNode) -> Option<Self> { let res = match syntax.kind() { - ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), - DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), - FN_PTR_TYPE => Type::FnPtrType(FnPtrType { syntax }), - FOR_TYPE => Type::ForType(ForType { syntax }), - IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), - INFER_TYPE => Type::InferType(InferType { syntax }), - MACRO_TYPE => Type::MacroType(MacroType { syntax }), - NEVER_TYPE => Type::NeverType(NeverType { syntax }), - PAREN_TYPE => Type::ParenType(ParenType { syntax }), - PATH_TYPE => Type::PathType(PathType { syntax }), - PTR_TYPE => Type::PtrType(PtrType { syntax }), - REF_TYPE => Type::RefType(RefType { syntax }), - SLICE_TYPE => Type::SliceType(SliceType { syntax }), - TUPLE_TYPE => Type::TupleType(TupleType { syntax }), + ENUM => Adt::Enum(Enum { syntax }), + STRUCT => Adt::Struct(Struct { syntax }), + UNION => Adt::Union(Union { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - Type::ArrayType(it) => &it.syntax, - Type::DynTraitType(it) => &it.syntax, - Type::FnPtrType(it) => &it.syntax, - Type::ForType(it) => &it.syntax, - Type::ImplTraitType(it) => &it.syntax, - Type::InferType(it) => &it.syntax, - Type::MacroType(it) => &it.syntax, - Type::NeverType(it) => &it.syntax, - Type::ParenType(it) => &it.syntax, - Type::PathType(it) => &it.syntax, - Type::PtrType(it) => &it.syntax, - Type::RefType(it) => &it.syntax, - Type::SliceType(it) => &it.syntax, - Type::TupleType(it) => &it.syntax, + Adt::Enum(it) => &it.syntax, + Adt::Struct(it) => &it.syntax, + Adt::Union(it) => &it.syntax, } } } -impl From<TypeArg> for GenericArg { - fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) } +impl From<Const> for AssocItem { + fn from(node: Const) -> AssocItem { AssocItem::Const(node) } } -impl From<AssocTypeArg> for GenericArg { - fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) } +impl From<Fn> for AssocItem { + fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } } -impl From<LifetimeArg> for GenericArg { - fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } +impl From<MacroCall> for AssocItem { + fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } } -impl From<ConstArg> for GenericArg { - fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) } +impl From<TypeAlias> for AssocItem { + fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } } -impl AstNode for GenericArg { - fn can_cast(kind: SyntaxKind) -> bool { - matches!(kind, TYPE_ARG | ASSOC_TYPE_ARG | LIFETIME_ARG | CONST_ARG) - } +impl AstNode for AssocItem { + fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, CONST | FN | MACRO_CALL | TYPE_ALIAS) } fn cast(syntax: SyntaxNode) -> Option<Self> { let res = match syntax.kind() { - TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }), - ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }), - LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }), - CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }), + CONST => AssocItem::Const(Const { syntax }), + FN => AssocItem::Fn(Fn { syntax }), + MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), + TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - GenericArg::TypeArg(it) => &it.syntax, - GenericArg::AssocTypeArg(it) => &it.syntax, - GenericArg::LifetimeArg(it) => &it.syntax, - GenericArg::ConstArg(it) => &it.syntax, + AssocItem::Const(it) => &it.syntax, + AssocItem::Fn(it) => &it.syntax, + AssocItem::MacroCall(it) => &it.syntax, + AssocItem::TypeAlias(it) => &it.syntax, } } } @@ -3488,6 +3413,9 @@ impl From<AsmExpr> for Expr { impl From<AwaitExpr> for Expr { fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) } } +impl From<BecomeExpr> for Expr { + fn from(node: BecomeExpr) -> Expr { Expr::BecomeExpr(node) } +} impl From<BinExpr> for Expr { fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } } @@ -3524,6 +3452,9 @@ impl From<IfExpr> for Expr { impl From<IndexExpr> for Expr { fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } } +impl From<LetExpr> for Expr { + fn from(node: LetExpr) -> Expr { Expr::LetExpr(node) } +} impl From<Literal> for Expr { fn from(node: Literal) -> Expr { Expr::Literal(node) } } @@ -3563,29 +3494,23 @@ impl From<RefExpr> for Expr { impl From<ReturnExpr> for Expr { fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) } } -impl From<BecomeExpr> for Expr { - fn from(node: BecomeExpr) -> Expr { Expr::BecomeExpr(node) } -} impl From<TryExpr> for Expr { fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } } impl From<TupleExpr> for Expr { fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } } +impl From<UnderscoreExpr> for Expr { + fn from(node: UnderscoreExpr) -> Expr { Expr::UnderscoreExpr(node) } +} impl From<WhileExpr> for Expr { fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } } -impl From<YieldExpr> for Expr { - fn from(node: YieldExpr) -> Expr { Expr::YieldExpr(node) } -} impl From<YeetExpr> for Expr { fn from(node: YeetExpr) -> Expr { Expr::YeetExpr(node) } } -impl From<LetExpr> for Expr { - fn from(node: LetExpr) -> Expr { Expr::LetExpr(node) } -} -impl From<UnderscoreExpr> for Expr { - fn from(node: UnderscoreExpr) -> Expr { Expr::UnderscoreExpr(node) } +impl From<YieldExpr> for Expr { + fn from(node: YieldExpr) -> Expr { Expr::YieldExpr(node) } } impl AstNode for Expr { fn can_cast(kind: SyntaxKind) -> bool { @@ -3594,6 +3519,7 @@ impl AstNode for Expr { ARRAY_EXPR | ASM_EXPR | AWAIT_EXPR + | BECOME_EXPR | BIN_EXPR | BLOCK_EXPR | BREAK_EXPR @@ -3606,6 +3532,7 @@ impl AstNode for Expr { | FORMAT_ARGS_EXPR | IF_EXPR | INDEX_EXPR + | LET_EXPR | LITERAL | LOOP_EXPR | MACRO_EXPR @@ -3619,14 +3546,12 @@ impl AstNode for Expr { | RECORD_EXPR | REF_EXPR | RETURN_EXPR - | BECOME_EXPR | TRY_EXPR | TUPLE_EXPR + | UNDERSCORE_EXPR | WHILE_EXPR - | YIELD_EXPR | YEET_EXPR - | LET_EXPR - | UNDERSCORE_EXPR + | YIELD_EXPR ) } fn cast(syntax: SyntaxNode) -> Option<Self> { @@ -3634,6 +3559,7 @@ impl AstNode for Expr { ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), ASM_EXPR => Expr::AsmExpr(AsmExpr { syntax }), AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), + BECOME_EXPR => Expr::BecomeExpr(BecomeExpr { syntax }), BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), @@ -3646,6 +3572,7 @@ impl AstNode for Expr { FORMAT_ARGS_EXPR => Expr::FormatArgsExpr(FormatArgsExpr { syntax }), IF_EXPR => Expr::IfExpr(IfExpr { syntax }), INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), + LET_EXPR => Expr::LetExpr(LetExpr { syntax }), LITERAL => Expr::Literal(Literal { syntax }), LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), MACRO_EXPR => Expr::MacroExpr(MacroExpr { syntax }), @@ -3659,14 +3586,12 @@ impl AstNode for Expr { RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), REF_EXPR => Expr::RefExpr(RefExpr { syntax }), RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), - BECOME_EXPR => Expr::BecomeExpr(BecomeExpr { syntax }), TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }), + UNDERSCORE_EXPR => Expr::UnderscoreExpr(UnderscoreExpr { syntax }), WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }), - YIELD_EXPR => Expr::YieldExpr(YieldExpr { syntax }), YEET_EXPR => Expr::YeetExpr(YeetExpr { syntax }), - LET_EXPR => Expr::LetExpr(LetExpr { syntax }), - UNDERSCORE_EXPR => Expr::UnderscoreExpr(UnderscoreExpr { syntax }), + YIELD_EXPR => Expr::YieldExpr(YieldExpr { syntax }), _ => return None, }; Some(res) @@ -3676,6 +3601,7 @@ impl AstNode for Expr { Expr::ArrayExpr(it) => &it.syntax, Expr::AsmExpr(it) => &it.syntax, Expr::AwaitExpr(it) => &it.syntax, + Expr::BecomeExpr(it) => &it.syntax, Expr::BinExpr(it) => &it.syntax, Expr::BlockExpr(it) => &it.syntax, Expr::BreakExpr(it) => &it.syntax, @@ -3688,6 +3614,7 @@ impl AstNode for Expr { Expr::FormatArgsExpr(it) => &it.syntax, Expr::IfExpr(it) => &it.syntax, Expr::IndexExpr(it) => &it.syntax, + Expr::LetExpr(it) => &it.syntax, Expr::Literal(it) => &it.syntax, Expr::LoopExpr(it) => &it.syntax, Expr::MacroExpr(it) => &it.syntax, @@ -3701,14 +3628,133 @@ impl AstNode for Expr { Expr::RecordExpr(it) => &it.syntax, Expr::RefExpr(it) => &it.syntax, Expr::ReturnExpr(it) => &it.syntax, - Expr::BecomeExpr(it) => &it.syntax, Expr::TryExpr(it) => &it.syntax, Expr::TupleExpr(it) => &it.syntax, + Expr::UnderscoreExpr(it) => &it.syntax, Expr::WhileExpr(it) => &it.syntax, - Expr::YieldExpr(it) => &it.syntax, Expr::YeetExpr(it) => &it.syntax, - Expr::LetExpr(it) => &it.syntax, - Expr::UnderscoreExpr(it) => &it.syntax, + Expr::YieldExpr(it) => &it.syntax, + } + } +} +impl From<Fn> for ExternItem { + fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } +} +impl From<MacroCall> for ExternItem { + fn from(node: MacroCall) -> ExternItem { ExternItem::MacroCall(node) } +} +impl From<Static> for ExternItem { + fn from(node: Static) -> ExternItem { ExternItem::Static(node) } +} +impl From<TypeAlias> for ExternItem { + fn from(node: TypeAlias) -> ExternItem { ExternItem::TypeAlias(node) } +} +impl AstNode for ExternItem { + fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, FN | MACRO_CALL | STATIC | TYPE_ALIAS) } + fn cast(syntax: SyntaxNode) -> Option<Self> { + let res = match syntax.kind() { + FN => ExternItem::Fn(Fn { syntax }), + MACRO_CALL => ExternItem::MacroCall(MacroCall { syntax }), + STATIC => ExternItem::Static(Static { syntax }), + TYPE_ALIAS => ExternItem::TypeAlias(TypeAlias { syntax }), + _ => return None, + }; + Some(res) + } + fn syntax(&self) -> &SyntaxNode { + match self { + ExternItem::Fn(it) => &it.syntax, + ExternItem::MacroCall(it) => &it.syntax, + ExternItem::Static(it) => &it.syntax, + ExternItem::TypeAlias(it) => &it.syntax, + } + } +} +impl From<RecordFieldList> for FieldList { + fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) } +} +impl From<TupleFieldList> for FieldList { + fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) } +} +impl AstNode for FieldList { + fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, RECORD_FIELD_LIST | TUPLE_FIELD_LIST) } + fn cast(syntax: SyntaxNode) -> Option<Self> { + let res = match syntax.kind() { + RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }), + TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }), + _ => return None, + }; + Some(res) + } + fn syntax(&self) -> &SyntaxNode { + match self { + FieldList::RecordFieldList(it) => &it.syntax, + FieldList::TupleFieldList(it) => &it.syntax, + } + } +} +impl From<AssocTypeArg> for GenericArg { + fn from(node: AssocTypeArg) -> GenericArg { GenericArg::AssocTypeArg(node) } +} +impl From<ConstArg> for GenericArg { + fn from(node: ConstArg) -> GenericArg { GenericArg::ConstArg(node) } +} +impl From<LifetimeArg> for GenericArg { + fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } +} +impl From<TypeArg> for GenericArg { + fn from(node: TypeArg) -> GenericArg { GenericArg::TypeArg(node) } +} +impl AstNode for GenericArg { + fn can_cast(kind: SyntaxKind) -> bool { + matches!(kind, ASSOC_TYPE_ARG | CONST_ARG | LIFETIME_ARG | TYPE_ARG) + } + fn cast(syntax: SyntaxNode) -> Option<Self> { + let res = match syntax.kind() { + ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }), + CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }), + LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }), + TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }), + _ => return None, + }; + Some(res) + } + fn syntax(&self) -> &SyntaxNode { + match self { + GenericArg::AssocTypeArg(it) => &it.syntax, + GenericArg::ConstArg(it) => &it.syntax, + GenericArg::LifetimeArg(it) => &it.syntax, + GenericArg::TypeArg(it) => &it.syntax, + } + } +} +impl From<ConstParam> for GenericParam { + fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } +} +impl From<LifetimeParam> for GenericParam { + fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } +} +impl From<TypeParam> for GenericParam { + fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } +} +impl AstNode for GenericParam { + fn can_cast(kind: SyntaxKind) -> bool { + matches!(kind, CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM) + } + fn cast(syntax: SyntaxNode) -> Option<Self> { + let res = match syntax.kind() { + CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), + LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), + TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), + _ => return None, + }; + Some(res) + } + fn syntax(&self) -> &SyntaxNode { + match self { + GenericParam::ConstParam(it) => &it.syntax, + GenericParam::LifetimeParam(it) => &it.syntax, + GenericParam::TypeParam(it) => &it.syntax, } } } @@ -3733,12 +3779,12 @@ impl From<Impl> for Item { impl From<MacroCall> for Item { fn from(node: MacroCall) -> Item { Item::MacroCall(node) } } -impl From<MacroRules> for Item { - fn from(node: MacroRules) -> Item { Item::MacroRules(node) } -} impl From<MacroDef> for Item { fn from(node: MacroDef) -> Item { Item::MacroDef(node) } } +impl From<MacroRules> for Item { + fn from(node: MacroRules) -> Item { Item::MacroRules(node) } +} impl From<Module> for Item { fn from(node: Module) -> Item { Item::Module(node) } } @@ -3774,8 +3820,8 @@ impl AstNode for Item { | FN | IMPL | MACRO_CALL - | MACRO_RULES | MACRO_DEF + | MACRO_RULES | MODULE | STATIC | STRUCT @@ -3795,8 +3841,8 @@ impl AstNode for Item { FN => Item::Fn(Fn { syntax }), IMPL => Item::Impl(Impl { syntax }), MACRO_CALL => Item::MacroCall(MacroCall { syntax }), - MACRO_RULES => Item::MacroRules(MacroRules { syntax }), MACRO_DEF => Item::MacroDef(MacroDef { syntax }), + MACRO_RULES => Item::MacroRules(MacroRules { syntax }), MODULE => Item::Module(Module { syntax }), STATIC => Item::Static(Static { syntax }), STRUCT => Item::Struct(Struct { syntax }), @@ -3818,8 +3864,8 @@ impl AstNode for Item { Item::Fn(it) => &it.syntax, Item::Impl(it) => &it.syntax, Item::MacroCall(it) => &it.syntax, - Item::MacroRules(it) => &it.syntax, Item::MacroDef(it) => &it.syntax, + Item::MacroRules(it) => &it.syntax, Item::Module(it) => &it.syntax, Item::Static(it) => &it.syntax, Item::Struct(it) => &it.syntax, @@ -3831,24 +3877,15 @@ impl AstNode for Item { } } } -impl From<ExprStmt> for Stmt { - fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } -} -impl From<Item> for Stmt { - fn from(node: Item) -> Stmt { Stmt::Item(node) } +impl From<BoxPat> for Pat { + fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } } -impl From<LetStmt> for Stmt { - fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } +impl From<ConstBlockPat> for Pat { + fn from(node: ConstBlockPat) -> Pat { Pat::ConstBlockPat(node) } } impl From<IdentPat> for Pat { fn from(node: IdentPat) -> Pat { Pat::IdentPat(node) } } -impl From<BoxPat> for Pat { - fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } -} -impl From<RestPat> for Pat { - fn from(node: RestPat) -> Pat { Pat::RestPat(node) } -} impl From<LiteralPat> for Pat { fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } } @@ -3864,9 +3901,6 @@ impl From<ParenPat> for Pat { impl From<PathPat> for Pat { fn from(node: PathPat) -> Pat { Pat::PathPat(node) } } -impl From<WildcardPat> for Pat { - fn from(node: WildcardPat) -> Pat { Pat::WildcardPat(node) } -} impl From<RangePat> for Pat { fn from(node: RangePat) -> Pat { Pat::RangePat(node) } } @@ -3876,6 +3910,9 @@ impl From<RecordPat> for Pat { impl From<RefPat> for Pat { fn from(node: RefPat) -> Pat { Pat::RefPat(node) } } +impl From<RestPat> for Pat { + fn from(node: RestPat) -> Pat { Pat::RestPat(node) } +} impl From<SlicePat> for Pat { fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } } @@ -3885,218 +3922,181 @@ impl From<TuplePat> for Pat { impl From<TupleStructPat> for Pat { fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } } -impl From<ConstBlockPat> for Pat { - fn from(node: ConstBlockPat) -> Pat { Pat::ConstBlockPat(node) } +impl From<WildcardPat> for Pat { + fn from(node: WildcardPat) -> Pat { Pat::WildcardPat(node) } } impl AstNode for Pat { fn can_cast(kind: SyntaxKind) -> bool { matches!( kind, - IDENT_PAT - | BOX_PAT - | REST_PAT + BOX_PAT + | CONST_BLOCK_PAT + | IDENT_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT | PATH_PAT - | WILDCARD_PAT | RANGE_PAT | RECORD_PAT | REF_PAT + | REST_PAT | SLICE_PAT | TUPLE_PAT | TUPLE_STRUCT_PAT - | CONST_BLOCK_PAT + | WILDCARD_PAT ) } fn cast(syntax: SyntaxNode) -> Option<Self> { let res = match syntax.kind() { - IDENT_PAT => Pat::IdentPat(IdentPat { syntax }), BOX_PAT => Pat::BoxPat(BoxPat { syntax }), - REST_PAT => Pat::RestPat(RestPat { syntax }), + CONST_BLOCK_PAT => Pat::ConstBlockPat(ConstBlockPat { syntax }), + IDENT_PAT => Pat::IdentPat(IdentPat { syntax }), LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), OR_PAT => Pat::OrPat(OrPat { syntax }), PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), PATH_PAT => Pat::PathPat(PathPat { syntax }), - WILDCARD_PAT => Pat::WildcardPat(WildcardPat { syntax }), RANGE_PAT => Pat::RangePat(RangePat { syntax }), RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), REF_PAT => Pat::RefPat(RefPat { syntax }), + REST_PAT => Pat::RestPat(RestPat { syntax }), SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), - CONST_BLOCK_PAT => Pat::ConstBlockPat(ConstBlockPat { syntax }), + WILDCARD_PAT => Pat::WildcardPat(WildcardPat { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - Pat::IdentPat(it) => &it.syntax, Pat::BoxPat(it) => &it.syntax, - Pat::RestPat(it) => &it.syntax, + Pat::ConstBlockPat(it) => &it.syntax, + Pat::IdentPat(it) => &it.syntax, Pat::LiteralPat(it) => &it.syntax, Pat::MacroPat(it) => &it.syntax, Pat::OrPat(it) => &it.syntax, Pat::ParenPat(it) => &it.syntax, Pat::PathPat(it) => &it.syntax, - Pat::WildcardPat(it) => &it.syntax, Pat::RangePat(it) => &it.syntax, Pat::RecordPat(it) => &it.syntax, Pat::RefPat(it) => &it.syntax, + Pat::RestPat(it) => &it.syntax, Pat::SlicePat(it) => &it.syntax, Pat::TuplePat(it) => &it.syntax, Pat::TupleStructPat(it) => &it.syntax, - Pat::ConstBlockPat(it) => &it.syntax, - } - } -} -impl From<RecordFieldList> for FieldList { - fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) } -} -impl From<TupleFieldList> for FieldList { - fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) } -} -impl AstNode for FieldList { - fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, RECORD_FIELD_LIST | TUPLE_FIELD_LIST) } - fn cast(syntax: SyntaxNode) -> Option<Self> { - let res = match syntax.kind() { - RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }), - TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxNode { - match self { - FieldList::RecordFieldList(it) => &it.syntax, - FieldList::TupleFieldList(it) => &it.syntax, + Pat::WildcardPat(it) => &it.syntax, } } } -impl From<Enum> for Adt { - fn from(node: Enum) -> Adt { Adt::Enum(node) } +impl From<ExprStmt> for Stmt { + fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } } -impl From<Struct> for Adt { - fn from(node: Struct) -> Adt { Adt::Struct(node) } +impl From<Item> for Stmt { + fn from(node: Item) -> Stmt { Stmt::Item(node) } } -impl From<Union> for Adt { - fn from(node: Union) -> Adt { Adt::Union(node) } +impl From<LetStmt> for Stmt { + fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } } -impl AstNode for Adt { - fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, ENUM | STRUCT | UNION) } - fn cast(syntax: SyntaxNode) -> Option<Self> { - let res = match syntax.kind() { - ENUM => Adt::Enum(Enum { syntax }), - STRUCT => Adt::Struct(Struct { syntax }), - UNION => Adt::Union(Union { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxNode { - match self { - Adt::Enum(it) => &it.syntax, - Adt::Struct(it) => &it.syntax, - Adt::Union(it) => &it.syntax, - } - } +impl From<ArrayType> for Type { + fn from(node: ArrayType) -> Type { Type::ArrayType(node) } } -impl From<Const> for AssocItem { - fn from(node: Const) -> AssocItem { AssocItem::Const(node) } +impl From<DynTraitType> for Type { + fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } } -impl From<Fn> for AssocItem { - fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } +impl From<FnPtrType> for Type { + fn from(node: FnPtrType) -> Type { Type::FnPtrType(node) } } -impl From<MacroCall> for AssocItem { - fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } +impl From<ForType> for Type { + fn from(node: ForType) -> Type { Type::ForType(node) } } -impl From<TypeAlias> for AssocItem { - fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } +impl From<ImplTraitType> for Type { + fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } } -impl AstNode for AssocItem { - fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, CONST | FN | MACRO_CALL | TYPE_ALIAS) } - fn cast(syntax: SyntaxNode) -> Option<Self> { - let res = match syntax.kind() { - CONST => AssocItem::Const(Const { syntax }), - FN => AssocItem::Fn(Fn { syntax }), - MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), - TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxNode { - match self { - AssocItem::Const(it) => &it.syntax, - AssocItem::Fn(it) => &it.syntax, - AssocItem::MacroCall(it) => &it.syntax, - AssocItem::TypeAlias(it) => &it.syntax, - } - } +impl From<InferType> for Type { + fn from(node: InferType) -> Type { Type::InferType(node) } } -impl From<Fn> for ExternItem { - fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } +impl From<MacroType> for Type { + fn from(node: MacroType) -> Type { Type::MacroType(node) } } -impl From<MacroCall> for ExternItem { - fn from(node: MacroCall) -> ExternItem { ExternItem::MacroCall(node) } +impl From<NeverType> for Type { + fn from(node: NeverType) -> Type { Type::NeverType(node) } } -impl From<Static> for ExternItem { - fn from(node: Static) -> ExternItem { ExternItem::Static(node) } +impl From<ParenType> for Type { + fn from(node: ParenType) -> Type { Type::ParenType(node) } } -impl From<TypeAlias> for ExternItem { - fn from(node: TypeAlias) -> ExternItem { ExternItem::TypeAlias(node) } +impl From<PathType> for Type { + fn from(node: PathType) -> Type { Type::PathType(node) } } -impl AstNode for ExternItem { - fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, FN | MACRO_CALL | STATIC | TYPE_ALIAS) } - fn cast(syntax: SyntaxNode) -> Option<Self> { - let res = match syntax.kind() { - FN => ExternItem::Fn(Fn { syntax }), - MACRO_CALL => ExternItem::MacroCall(MacroCall { syntax }), - STATIC => ExternItem::Static(Static { syntax }), - TYPE_ALIAS => ExternItem::TypeAlias(TypeAlias { syntax }), - _ => return None, - }; - Some(res) - } - fn syntax(&self) -> &SyntaxNode { - match self { - ExternItem::Fn(it) => &it.syntax, - ExternItem::MacroCall(it) => &it.syntax, - ExternItem::Static(it) => &it.syntax, - ExternItem::TypeAlias(it) => &it.syntax, - } - } +impl From<PtrType> for Type { + fn from(node: PtrType) -> Type { Type::PtrType(node) } } -impl From<ConstParam> for GenericParam { - fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } +impl From<RefType> for Type { + fn from(node: RefType) -> Type { Type::RefType(node) } } -impl From<LifetimeParam> for GenericParam { - fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } +impl From<SliceType> for Type { + fn from(node: SliceType) -> Type { Type::SliceType(node) } } -impl From<TypeParam> for GenericParam { - fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } +impl From<TupleType> for Type { + fn from(node: TupleType) -> Type { Type::TupleType(node) } } -impl AstNode for GenericParam { +impl AstNode for Type { fn can_cast(kind: SyntaxKind) -> bool { - matches!(kind, CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM) + matches!( + kind, + ARRAY_TYPE + | DYN_TRAIT_TYPE + | FN_PTR_TYPE + | FOR_TYPE + | IMPL_TRAIT_TYPE + | INFER_TYPE + | MACRO_TYPE + | NEVER_TYPE + | PAREN_TYPE + | PATH_TYPE + | PTR_TYPE + | REF_TYPE + | SLICE_TYPE + | TUPLE_TYPE + ) } fn cast(syntax: SyntaxNode) -> Option<Self> { let res = match syntax.kind() { - CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), - LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), - TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), + ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), + DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), + FN_PTR_TYPE => Type::FnPtrType(FnPtrType { syntax }), + FOR_TYPE => Type::ForType(ForType { syntax }), + IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), + INFER_TYPE => Type::InferType(InferType { syntax }), + MACRO_TYPE => Type::MacroType(MacroType { syntax }), + NEVER_TYPE => Type::NeverType(NeverType { syntax }), + PAREN_TYPE => Type::ParenType(ParenType { syntax }), + PATH_TYPE => Type::PathType(PathType { syntax }), + PTR_TYPE => Type::PtrType(PtrType { syntax }), + REF_TYPE => Type::RefType(RefType { syntax }), + SLICE_TYPE => Type::SliceType(SliceType { syntax }), + TUPLE_TYPE => Type::TupleType(TupleType { syntax }), _ => return None, }; Some(res) } fn syntax(&self) -> &SyntaxNode { match self { - GenericParam::ConstParam(it) => &it.syntax, - GenericParam::LifetimeParam(it) => &it.syntax, - GenericParam::TypeParam(it) => &it.syntax, + Type::ArrayType(it) => &it.syntax, + Type::DynTraitType(it) => &it.syntax, + Type::FnPtrType(it) => &it.syntax, + Type::ForType(it) => &it.syntax, + Type::ImplTraitType(it) => &it.syntax, + Type::InferType(it) => &it.syntax, + Type::MacroType(it) => &it.syntax, + Type::NeverType(it) => &it.syntax, + Type::ParenType(it) => &it.syntax, + Type::PathType(it) => &it.syntax, + Type::PtrType(it) => &it.syntax, + Type::RefType(it) => &it.syntax, + Type::SliceType(it) => &it.syntax, + Type::TupleType(it) => &it.syntax, } } } @@ -4371,757 +4371,757 @@ impl AstNode for AnyHasVisibility { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl std::fmt::Display for Type { +impl std::fmt::Display for Abi { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for GenericArg { +impl std::fmt::Display for Adt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Expr { +impl std::fmt::Display for ArgList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Item { +impl std::fmt::Display for ArrayExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Stmt { +impl std::fmt::Display for ArrayType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Pat { +impl std::fmt::Display for AsmExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FieldList { +impl std::fmt::Display for AssocItem { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Adt { +impl std::fmt::Display for AssocItemList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AssocItem { +impl std::fmt::Display for AssocTypeArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ExternItem { +impl std::fmt::Display for Attr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for GenericParam { +impl std::fmt::Display for AwaitExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Name { +impl std::fmt::Display for BecomeExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for NameRef { +impl std::fmt::Display for BinExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Lifetime { +impl std::fmt::Display for BlockExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Path { +impl std::fmt::Display for BoxPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathSegment { +impl std::fmt::Display for BreakExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for GenericArgList { +impl std::fmt::Display for CallExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParamList { +impl std::fmt::Display for CastExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RetType { +impl std::fmt::Display for ClosureExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathType { +impl std::fmt::Display for Const { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeArg { +impl std::fmt::Display for ConstArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AssocTypeArg { +impl std::fmt::Display for ConstBlockPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LifetimeArg { +impl std::fmt::Display for ConstParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ConstArg { +impl std::fmt::Display for ContinueExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeBoundList { +impl std::fmt::Display for DynTraitType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroCall { +impl std::fmt::Display for Enum { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Attr { +impl std::fmt::Display for Expr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TokenTree { +impl std::fmt::Display for ExprStmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroItems { +impl std::fmt::Display for ExternBlock { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroEagerInput { +impl std::fmt::Display for ExternCrate { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroStmts { +impl std::fmt::Display for ExternItem { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SourceFile { +impl std::fmt::Display for ExternItemList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Const { +impl std::fmt::Display for FieldExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Enum { +impl std::fmt::Display for FieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ExternBlock { +impl std::fmt::Display for Fn { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ExternCrate { +impl std::fmt::Display for FnPtrType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Fn { +impl std::fmt::Display for ForExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Impl { +impl std::fmt::Display for ForType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroRules { +impl std::fmt::Display for FormatArgsArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroDef { +impl std::fmt::Display for FormatArgsExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Module { +impl std::fmt::Display for GenericArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Static { +impl std::fmt::Display for GenericArgList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Struct { +impl std::fmt::Display for GenericParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Trait { +impl std::fmt::Display for GenericParamList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TraitAlias { +impl std::fmt::Display for IdentPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeAlias { +impl std::fmt::Display for IfExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Union { +impl std::fmt::Display for Impl { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Use { +impl std::fmt::Display for ImplTraitType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Visibility { +impl std::fmt::Display for IndexExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ItemList { +impl std::fmt::Display for InferType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Rename { +impl std::fmt::Display for Item { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for UseTree { +impl std::fmt::Display for ItemList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for UseTreeList { +impl std::fmt::Display for Label { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Abi { +impl std::fmt::Display for LetElse { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for GenericParamList { +impl std::fmt::Display for LetExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for WhereClause { +impl std::fmt::Display for LetStmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BlockExpr { +impl std::fmt::Display for Lifetime { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SelfParam { +impl std::fmt::Display for LifetimeArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Param { +impl std::fmt::Display for LifetimeParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordFieldList { +impl std::fmt::Display for Literal { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleFieldList { +impl std::fmt::Display for LiteralPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordField { +impl std::fmt::Display for LoopExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleField { +impl std::fmt::Display for MacroCall { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for VariantList { +impl std::fmt::Display for MacroDef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Variant { +impl std::fmt::Display for MacroEagerInput { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AssocItemList { +impl std::fmt::Display for MacroExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ExternItemList { +impl std::fmt::Display for MacroItems { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ConstParam { +impl std::fmt::Display for MacroPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LifetimeParam { +impl std::fmt::Display for MacroRules { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeParam { +impl std::fmt::Display for MacroStmts { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for WherePred { +impl std::fmt::Display for MacroType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Meta { +impl std::fmt::Display for MatchArm { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ExprStmt { +impl std::fmt::Display for MatchArmList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LetStmt { +impl std::fmt::Display for MatchExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LetElse { +impl std::fmt::Display for MatchGuard { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ArrayExpr { +impl std::fmt::Display for Meta { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AsmExpr { +impl std::fmt::Display for MethodCallExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for AwaitExpr { +impl std::fmt::Display for Module { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BinExpr { +impl std::fmt::Display for Name { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BreakExpr { +impl std::fmt::Display for NameRef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for CallExpr { +impl std::fmt::Display for NeverType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for CastExpr { +impl std::fmt::Display for OffsetOfExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ClosureExpr { +impl std::fmt::Display for OrPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ContinueExpr { +impl std::fmt::Display for Param { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FieldExpr { +impl std::fmt::Display for ParamList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ForExpr { +impl std::fmt::Display for ParenExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FormatArgsExpr { +impl std::fmt::Display for ParenPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for IfExpr { +impl std::fmt::Display for ParenType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for IndexExpr { +impl std::fmt::Display for Pat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Literal { +impl std::fmt::Display for Path { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LoopExpr { +impl std::fmt::Display for PathExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroExpr { +impl std::fmt::Display for PathPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MatchExpr { +impl std::fmt::Display for PathSegment { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MethodCallExpr { +impl std::fmt::Display for PathType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for OffsetOfExpr { +impl std::fmt::Display for PrefixExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParenExpr { +impl std::fmt::Display for PtrType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathExpr { +impl std::fmt::Display for RangeExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PrefixExpr { +impl std::fmt::Display for RangePat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RangeExpr { +impl std::fmt::Display for RecordExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordExpr { +impl std::fmt::Display for RecordExprField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RefExpr { +impl std::fmt::Display for RecordExprFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ReturnExpr { +impl std::fmt::Display for RecordField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BecomeExpr { +impl std::fmt::Display for RecordFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TryExpr { +impl std::fmt::Display for RecordPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleExpr { +impl std::fmt::Display for RecordPatField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for WhileExpr { +impl std::fmt::Display for RecordPatFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for YieldExpr { +impl std::fmt::Display for RefExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for YeetExpr { +impl std::fmt::Display for RefPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LetExpr { +impl std::fmt::Display for RefType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for UnderscoreExpr { +impl std::fmt::Display for Rename { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FormatArgsArg { +impl std::fmt::Display for RestPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for StmtList { +impl std::fmt::Display for RetType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for Label { +impl std::fmt::Display for ReturnExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordExprFieldList { +impl std::fmt::Display for SelfParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordExprField { +impl std::fmt::Display for SlicePat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ArgList { +impl std::fmt::Display for SliceType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MatchArmList { +impl std::fmt::Display for SourceFile { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MatchArm { +impl std::fmt::Display for Static { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MatchGuard { +impl std::fmt::Display for Stmt { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ArrayType { +impl std::fmt::Display for StmtList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for DynTraitType { +impl std::fmt::Display for Struct { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for FnPtrType { +impl std::fmt::Display for TokenTree { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ForType { +impl std::fmt::Display for Trait { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ImplTraitType { +impl std::fmt::Display for TraitAlias { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for InferType { +impl std::fmt::Display for TryExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroType { +impl std::fmt::Display for TupleExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for NeverType { +impl std::fmt::Display for TupleField { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParenType { +impl std::fmt::Display for TupleFieldList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PtrType { +impl std::fmt::Display for TuplePat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RefType { +impl std::fmt::Display for TupleStructPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SliceType { +impl std::fmt::Display for TupleType { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleType { +impl std::fmt::Display for Type { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeBound { +impl std::fmt::Display for TypeAlias { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for IdentPat { +impl std::fmt::Display for TypeArg { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for BoxPat { +impl std::fmt::Display for TypeBound { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RestPat { +impl std::fmt::Display for TypeBoundList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for LiteralPat { +impl std::fmt::Display for TypeParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for MacroPat { +impl std::fmt::Display for UnderscoreExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for OrPat { +impl std::fmt::Display for Union { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ParenPat { +impl std::fmt::Display for Use { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for PathPat { +impl std::fmt::Display for UseTree { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for WildcardPat { +impl std::fmt::Display for UseTreeList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RangePat { +impl std::fmt::Display for Variant { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordPat { +impl std::fmt::Display for VariantList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RefPat { +impl std::fmt::Display for Visibility { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for SlicePat { +impl std::fmt::Display for WhereClause { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TuplePat { +impl std::fmt::Display for WherePred { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TupleStructPat { +impl std::fmt::Display for WhileExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for ConstBlockPat { +impl std::fmt::Display for WildcardPat { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordPatFieldList { +impl std::fmt::Display for YeetExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for RecordPatField { +impl std::fmt::Display for YieldExpr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } diff --git a/crates/syntax/src/tests/sourcegen_ast.rs b/crates/syntax/src/tests/sourcegen_ast.rs index 2fd7a473498..1572bbe32c7 100644 --- a/crates/syntax/src/tests/sourcegen_ast.rs +++ b/crates/syntax/src/tests/sourcegen_ast.rs @@ -77,6 +77,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String { let (node_defs, node_boilerplate_impls): (Vec<_>, Vec<_>) = grammar .nodes .iter() + .sorted_by_key(|it| it.name.clone()) .map(|node| { let name = format_ident!("{}", node.name); let kind = format_ident!("{}", to_upper_snake_case(&node.name)); @@ -88,12 +89,13 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String { node.name != "ForExpr" && node.name != "WhileExpr" || trait_name.as_str() != "HasLoopBody" }) + .sorted() .map(|trait_name| { let trait_name = format_ident!("{}", trait_name); quote!(impl ast::#trait_name for #name {}) }); - let methods = node.fields.iter().map(|field| { + let methods = node.fields.iter().sorted_by_key(|it| it.method_name()).map(|field| { let method_name = field.method_name(); let ty = field.ty(); @@ -149,14 +151,16 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String { let (enum_defs, enum_boilerplate_impls): (Vec<_>, Vec<_>) = grammar .enums .iter() + .sorted_by_key(|it| it.name.clone()) .map(|en| { - let variants: Vec<_> = en.variants.iter().map(|var| format_ident!("{}", var)).collect(); + let variants: Vec<_> = + en.variants.iter().map(|var| format_ident!("{}", var)).sorted().collect(); let name = format_ident!("{}", en.name); let kinds: Vec<_> = variants .iter() .map(|name| format_ident!("{}", to_upper_snake_case(&name.to_string()))) .collect(); - let traits = en.traits.iter().map(|trait_name| { + let traits = en.traits.iter().sorted().map(|trait_name| { let trait_name = format_ident!("{}", trait_name); quote!(impl ast::#trait_name for #name {}) }); @@ -266,15 +270,17 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> String { let node_names = grammar.nodes.iter().map(|it| &it.name); let display_impls = - enum_names.chain(node_names.clone()).map(|it| format_ident!("{}", it)).map(|name| { - quote! { - impl std::fmt::Display for #name { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) + enum_names.chain(node_names.clone()).map(|it| format_ident!("{}", it)).sorted().map( + |name| { + quote! { + impl std::fmt::Display for #name { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } } } - } - }); + }, + ); let defined_nodes: FxHashSet<_> = node_names.collect(); |
