From d6dc1bf05ebcc250eaabacf99328d81c70c5a750 Mon Sep 17 00:00:00 2001 From: Lukas Wirth <lukastw97@gmail.com> Date: Fri, 21 Mar 2025 10:26:36 +0100 Subject: [PATCH 1/3] refactor: Reduce codegen burden for `SyntaxKind` --- .../ide/src/syntax_highlighting/highlight.rs | 2 +- crates/parser/src/lib.rs | 2 + crates/parser/src/syntax_kind/generated.rs | 59 +++++++++---------- xtask/src/codegen.rs | 2 +- xtask/src/codegen/grammar.rs | 37 +++++++++++- xtask/src/codegen/grammar/ast_src.rs | 12 +++- 6 files changed, 76 insertions(+), 38 deletions(-) diff --git a/crates/ide/src/syntax_highlighting/highlight.rs b/crates/ide/src/syntax_highlighting/highlight.rs index fb25f0015585..0d3d99994f60 100644 --- a/crates/ide/src/syntax_highlighting/highlight.rs +++ b/crates/ide/src/syntax_highlighting/highlight.rs @@ -852,7 +852,7 @@ fn highlight_name_ref_by_syntax( } } ASSOC_TYPE_ARG => SymbolKind::TypeAlias.into(), - USE_BOUND_GENERIC_ARG => SymbolKind::TypeParam.into(), + USE_BOUND_GENERIC_ARGS => SymbolKind::TypeParam.into(), _ => default.into(), } } diff --git a/crates/parser/src/lib.rs b/crates/parser/src/lib.rs index 398ad7cf66ce..7963f00bb25c 100644 --- a/crates/parser/src/lib.rs +++ b/crates/parser/src/lib.rs @@ -35,6 +35,8 @@ mod shortcuts; mod syntax_kind; mod token_set; +pub use T_ as T; + #[cfg(test)] mod tests; diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs index 1ff0bbea8b1d..8836bddc9bb7 100644 --- a/crates/parser/src/syntax_kind/generated.rs +++ b/crates/parser/src/syntax_kind/generated.rs @@ -3,7 +3,7 @@ #![allow(bad_style, missing_docs, unreachable_pub)] use crate::Edition; #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."] -#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +#[derive(Debug)] #[repr(u16)] pub enum SyntaxKind { #[doc(hidden)] @@ -156,7 +156,6 @@ pub enum SyntaxKind { SHEBANG, WHITESPACE, ABI, - ADT, ARG_LIST, ARRAY_EXPR, ARRAY_TYPE, @@ -165,16 +164,13 @@ pub enum SyntaxKind { ASM_DIR_SPEC, ASM_EXPR, ASM_LABEL, - ASM_OPERAND, ASM_OPERAND_EXPR, ASM_OPERAND_NAMED, ASM_OPTION, ASM_OPTIONS, - ASM_PIECE, ASM_REG_OPERAND, ASM_REG_SPEC, ASM_SYM, - ASSOC_ITEM, ASSOC_ITEM_LIST, ASSOC_TYPE_ARG, ATTR, @@ -195,23 +191,18 @@ pub enum SyntaxKind { CONTINUE_EXPR, DYN_TRAIT_TYPE, ENUM, - EXPR, EXPR_STMT, EXTERN_BLOCK, EXTERN_CRATE, - EXTERN_ITEM, EXTERN_ITEM_LIST, FIELD_EXPR, - FIELD_LIST, FN, FN_PTR_TYPE, FORMAT_ARGS_ARG, FORMAT_ARGS_EXPR, FOR_EXPR, FOR_TYPE, - GENERIC_ARG, GENERIC_ARG_LIST, - GENERIC_PARAM, GENERIC_PARAM_LIST, IDENT_PAT, IF_EXPR, @@ -219,7 +210,6 @@ pub enum SyntaxKind { IMPL_TRAIT_TYPE, INDEX_EXPR, INFER_TYPE, - ITEM, ITEM_LIST, LABEL, LET_ELSE, @@ -257,7 +247,6 @@ pub enum SyntaxKind { PAREN_EXPR, PAREN_PAT, PAREN_TYPE, - PAT, PATH, PATH_EXPR, PATH_PAT, @@ -288,7 +277,6 @@ pub enum SyntaxKind { SLICE_TYPE, SOURCE_FILE, STATIC, - STMT, STMT_LIST, STRUCT, TOKEN_TREE, @@ -301,7 +289,6 @@ pub enum SyntaxKind { TUPLE_PAT, TUPLE_STRUCT_PAT, TUPLE_TYPE, - TYPE, TYPE_ALIAS, TYPE_ARG, TYPE_BOUND, @@ -310,12 +297,10 @@ pub enum SyntaxKind { UNDERSCORE_EXPR, UNION, USE, - USE_BOUND_GENERIC_ARG, USE_BOUND_GENERIC_ARGS, USE_TREE, USE_TREE_LIST, VARIANT, - VARIANT_DEF, VARIANT_LIST, VISIBILITY, WHERE_CLAUSE, @@ -343,7 +328,6 @@ impl SyntaxKind { | INT_NUMBER | STRING | ABI - | ADT | ARG_LIST | ARRAY_EXPR | ARRAY_TYPE @@ -352,16 +336,13 @@ impl SyntaxKind { | ASM_DIR_SPEC | ASM_EXPR | ASM_LABEL - | ASM_OPERAND | ASM_OPERAND_EXPR | ASM_OPERAND_NAMED | ASM_OPTION | ASM_OPTIONS - | ASM_PIECE | ASM_REG_OPERAND | ASM_REG_SPEC | ASM_SYM - | ASSOC_ITEM | ASSOC_ITEM_LIST | ASSOC_TYPE_ARG | ATTR @@ -382,23 +363,18 @@ impl SyntaxKind { | CONTINUE_EXPR | DYN_TRAIT_TYPE | ENUM - | EXPR | EXPR_STMT | EXTERN_BLOCK | EXTERN_CRATE - | EXTERN_ITEM | EXTERN_ITEM_LIST | FIELD_EXPR - | FIELD_LIST | FN | FN_PTR_TYPE | FORMAT_ARGS_ARG | FORMAT_ARGS_EXPR | FOR_EXPR | FOR_TYPE - | GENERIC_ARG | GENERIC_ARG_LIST - | GENERIC_PARAM | GENERIC_PARAM_LIST | IDENT_PAT | IF_EXPR @@ -406,7 +382,6 @@ impl SyntaxKind { | IMPL_TRAIT_TYPE | INDEX_EXPR | INFER_TYPE - | ITEM | ITEM_LIST | LABEL | LET_ELSE @@ -444,7 +419,6 @@ impl SyntaxKind { | PAREN_EXPR | PAREN_PAT | PAREN_TYPE - | PAT | PATH | PATH_EXPR | PATH_PAT @@ -475,7 +449,6 @@ impl SyntaxKind { | SLICE_TYPE | SOURCE_FILE | STATIC - | STMT | STMT_LIST | STRUCT | TOKEN_TREE @@ -488,7 +461,6 @@ impl SyntaxKind { | TUPLE_PAT | TUPLE_STRUCT_PAT | TUPLE_TYPE - | TYPE | TYPE_ALIAS | TYPE_ARG | TYPE_BOUND @@ -497,12 +469,10 @@ impl SyntaxKind { | UNDERSCORE_EXPR | UNION | USE - | USE_BOUND_GENERIC_ARG | USE_BOUND_GENERIC_ARGS | USE_TREE | USE_TREE_LIST | VARIANT - | VARIANT_DEF | VARIANT_LIST | VISIBILITY | WHERE_CLAUSE @@ -1024,4 +994,29 @@ impl SyntaxKind { } } #[macro_export] -macro_rules ! T { [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [Self] => { $ crate :: SyntaxKind :: SELF_TYPE_KW } ; [abstract] => { $ crate :: SyntaxKind :: ABSTRACT_KW } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [become] => { $ crate :: SyntaxKind :: BECOME_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [do] => { $ crate :: SyntaxKind :: DO_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [final] => { $ crate :: SyntaxKind :: FINAL_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [override] => { $ crate :: SyntaxKind :: OVERRIDE_KW } ; [priv] => { $ crate :: SyntaxKind :: PRIV_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [typeof] => { $ crate :: SyntaxKind :: TYPEOF_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [unsized] => { $ crate :: SyntaxKind :: UNSIZED_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [virtual] => { $ crate :: SyntaxKind :: VIRTUAL_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [yield] => { $ crate :: SyntaxKind :: YIELD_KW } ; [asm] => { $ crate :: SyntaxKind :: ASM_KW } ; [att_syntax] => { $ crate :: SyntaxKind :: ATT_SYNTAX_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [builtin] => { $ crate :: SyntaxKind :: BUILTIN_KW } ; [clobber_abi] => { $ crate :: SyntaxKind :: CLOBBER_ABI_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW } ; [inlateout] => { $ crate :: SyntaxKind :: INLATEOUT_KW } ; [inout] => { $ crate :: SyntaxKind :: INOUT_KW } ; [label] => { $ crate :: SyntaxKind :: LABEL_KW } ; [lateout] => { $ crate :: SyntaxKind :: LATEOUT_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [may_unwind] => { $ crate :: SyntaxKind :: MAY_UNWIND_KW } ; [nomem] => { $ crate :: SyntaxKind :: NOMEM_KW } ; [noreturn] => { $ crate :: SyntaxKind :: NORETURN_KW } ; [nostack] => { $ crate :: SyntaxKind :: NOSTACK_KW } ; [offset_of] => { $ crate :: SyntaxKind :: OFFSET_OF_KW } ; [options] => { $ crate :: SyntaxKind :: OPTIONS_KW } ; [out] => { $ crate :: SyntaxKind :: OUT_KW } ; [preserves_flags] => { $ crate :: SyntaxKind :: PRESERVES_FLAGS_KW } ; [pure] => { $ crate :: SyntaxKind :: PURE_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [readonly] => { $ crate :: SyntaxKind :: READONLY_KW } ; [safe] => { $ crate :: SyntaxKind :: SAFE_KW } ; [sym] => { $ crate :: SyntaxKind :: SYM_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [yeet] => { $ crate :: SyntaxKind :: YEET_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [gen] => { $ crate :: SyntaxKind :: GEN_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [lifetime_ident] => { $ crate :: SyntaxKind :: LIFETIME_IDENT } ; [int_number] => { $ crate :: SyntaxKind :: INT_NUMBER } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [string] => { $ crate :: SyntaxKind :: STRING } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; } +macro_rules ! T_ { [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [Self] => { $ crate :: SyntaxKind :: SELF_TYPE_KW } ; [abstract] => { $ crate :: SyntaxKind :: ABSTRACT_KW } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [become] => { $ crate :: SyntaxKind :: BECOME_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [do] => { $ crate :: SyntaxKind :: DO_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [final] => { $ crate :: SyntaxKind :: FINAL_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [override] => { $ crate :: SyntaxKind :: OVERRIDE_KW } ; [priv] => { $ crate :: SyntaxKind :: PRIV_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [typeof] => { $ crate :: SyntaxKind :: TYPEOF_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [unsized] => { $ crate :: SyntaxKind :: UNSIZED_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [virtual] => { $ crate :: SyntaxKind :: VIRTUAL_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [yield] => { $ crate :: SyntaxKind :: YIELD_KW } ; [asm] => { $ crate :: SyntaxKind :: ASM_KW } ; [att_syntax] => { $ crate :: SyntaxKind :: ATT_SYNTAX_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [builtin] => { $ crate :: SyntaxKind :: BUILTIN_KW } ; [clobber_abi] => { $ crate :: SyntaxKind :: CLOBBER_ABI_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW } ; [inlateout] => { $ crate :: SyntaxKind :: INLATEOUT_KW } ; [inout] => { $ crate :: SyntaxKind :: INOUT_KW } ; [label] => { $ crate :: SyntaxKind :: LABEL_KW } ; [lateout] => { $ crate :: SyntaxKind :: LATEOUT_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [may_unwind] => { $ crate :: SyntaxKind :: MAY_UNWIND_KW } ; [nomem] => { $ crate :: SyntaxKind :: NOMEM_KW } ; [noreturn] => { $ crate :: SyntaxKind :: NORETURN_KW } ; [nostack] => { $ crate :: SyntaxKind :: NOSTACK_KW } ; [offset_of] => { $ crate :: SyntaxKind :: OFFSET_OF_KW } ; [options] => { $ crate :: SyntaxKind :: OPTIONS_KW } ; [out] => { $ crate :: SyntaxKind :: OUT_KW } ; [preserves_flags] => { $ crate :: SyntaxKind :: PRESERVES_FLAGS_KW } ; [pure] => { $ crate :: SyntaxKind :: PURE_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [readonly] => { $ crate :: SyntaxKind :: READONLY_KW } ; [safe] => { $ crate :: SyntaxKind :: SAFE_KW } ; [sym] => { $ crate :: SyntaxKind :: SYM_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [yeet] => { $ crate :: SyntaxKind :: YEET_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [gen] => { $ crate :: SyntaxKind :: GEN_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [lifetime_ident] => { $ crate :: SyntaxKind :: LIFETIME_IDENT } ; [int_number] => { $ crate :: SyntaxKind :: INT_NUMBER } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [string] => { $ crate :: SyntaxKind :: STRING } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; } +impl ::core::marker::Copy for SyntaxKind {} +impl ::core::clone::Clone for SyntaxKind { + #[inline] + fn clone(&self) -> Self { *self } +} +impl ::core::cmp::PartialEq for SyntaxKind { + #[inline] + fn eq(&self, other: &Self) -> bool { (*self as u16) == (*other as u16) } +} +impl ::core::cmp::Eq for SyntaxKind {} +impl ::core::cmp::PartialOrd for SyntaxKind { + #[inline] + fn partial_cmp(&self, other: &Self) -> core::option::Option<core::cmp::Ordering> { + (*self as u16).partial_cmp(&(*other as u16)) + } +} +impl ::core::cmp::Ord for SyntaxKind { + #[inline] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { (*self as u16).cmp(&(*other as u16)) } +} +impl ::core::hash::Hash for SyntaxKind { + fn hash<H: ::core::hash::Hasher>(&self, state: &mut H) { + ::core::mem::discriminant(self).hash(state); + } +} diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs index 2aff97b6a4e8..bba7ad73f389 100644 --- a/xtask/src/codegen.rs +++ b/xtask/src/codegen.rs @@ -21,7 +21,7 @@ impl flags::Codegen { pub(crate) fn run(self, _sh: &Shell) -> anyhow::Result<()> { match self.codegen_type.unwrap_or_default() { flags::CodegenType::All => { - diagnostics_docs::generate(self.check); + grammar::generate(self.check); assists_doc_tests::generate(self.check); parser_inline_tests::generate(self.check); feature_docs::generate(self.check) diff --git a/xtask/src/codegen/grammar.rs b/xtask/src/codegen/grammar.rs index 839a6f202872..e9f38715852c 100644 --- a/xtask/src/codegen/grammar.rs +++ b/xtask/src/codegen/grammar.rs @@ -476,7 +476,6 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String { let tokens = grammar.tokens.iter().map(|name| format_ident!("{}", name)).collect::<Vec<_>>(); - // FIXME: This generates enum kinds? let nodes = grammar.nodes.iter().map(|name| format_ident!("{}", name)).collect::<Vec<_>>(); let ast = quote! { @@ -484,7 +483,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String { use crate::Edition; /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`. - #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] + #[derive(Debug)] #[repr(u16)] pub enum SyntaxKind { // Technical SyntaxKinds: they appear temporally during parsing, @@ -585,7 +584,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String { } #[macro_export] - macro_rules! T { + macro_rules! T_ { #([#punctuation_values] => { $crate::SyntaxKind::#punctuation };)* #([#strict_keywords_tokens] => { $crate::SyntaxKind::#strict_keywords_variants };)* #([#contextual_keywords_tokens] => { $crate::SyntaxKind::#contextual_keywords_variants };)* @@ -596,6 +595,38 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String { [string] => { $crate::SyntaxKind::STRING }; [shebang] => { $crate::SyntaxKind::SHEBANG }; } + + impl ::core::marker::Copy for SyntaxKind {} + impl ::core::clone::Clone for SyntaxKind { + #[inline] + fn clone(&self) -> Self { + *self + } + } + impl ::core::cmp::PartialEq for SyntaxKind { + #[inline] + fn eq(&self, other: &Self) -> bool { + (*self as u16) == (*other as u16) + } + } + impl ::core::cmp::Eq for SyntaxKind {} + impl ::core::cmp::PartialOrd for SyntaxKind { + #[inline] + fn partial_cmp(&self, other: &Self) -> core::option::Option<core::cmp::Ordering> { + (*self as u16).partial_cmp(&(*other as u16)) + } + } + impl ::core::cmp::Ord for SyntaxKind { + #[inline] + fn cmp(&self, other: &Self) -> core::cmp::Ordering { + (*self as u16).cmp(&(*other as u16)) + } + } + impl ::core::hash::Hash for SyntaxKind { + fn hash<H: ::core::hash::Hasher>(&self, state: &mut H) { + ::core::mem::discriminant(self).hash(state); + } + } }; add_preamble(crate::flags::CodegenType::Grammar, reformat(ast.to_string())) diff --git a/xtask/src/codegen/grammar/ast_src.rs b/xtask/src/codegen/grammar/ast_src.rs index 9269d1542353..d8cbf894520a 100644 --- a/xtask/src/codegen/grammar/ast_src.rs +++ b/xtask/src/codegen/grammar/ast_src.rs @@ -12,6 +12,7 @@ pub(crate) struct KindsSrc { pub(crate) literals: &'static [&'static str], pub(crate) tokens: &'static [&'static str], pub(crate) nodes: &'static [&'static str], + pub(crate) _enums: &'static [&'static str], pub(crate) edition_dependent_keywords: &'static [(&'static str, Edition)], } @@ -206,13 +207,21 @@ pub(crate) fn generate_kind_src( let nodes = nodes .iter() .map(|it| &it.name) - .chain(enums.iter().map(|it| &it.name)) .map(|it| to_upper_snake_case(it)) .map(String::leak) .map(|it| &*it) .collect(); let nodes = Vec::leak(nodes); nodes.sort(); + let enums = enums + .iter() + .map(|it| &it.name) + .map(|it| to_upper_snake_case(it)) + .map(String::leak) + .map(|it| &*it) + .collect(); + let enums = Vec::leak(enums); + enums.sort(); let keywords = Vec::leak(keywords); let contextual_keywords = Vec::leak(contextual_keywords); let edition_dependent_keywords = Vec::leak(edition_dependent_keywords); @@ -224,6 +233,7 @@ pub(crate) fn generate_kind_src( KindsSrc { punct: PUNCT, nodes, + _enums: enums, keywords, contextual_keywords, edition_dependent_keywords, From d31301cbe7dcf7d6e3ca9150f081237041064c6c Mon Sep 17 00:00:00 2001 From: Lukas Wirth <lukastw97@gmail.com> Date: Fri, 21 Mar 2025 10:54:38 +0100 Subject: [PATCH 2/3] refactor: Reduce codegen burden for `SyntaxNode` and `SyntaxToken` --- crates/parser/src/syntax_kind/generated.rs | 2 +- crates/syntax/src/ast/generated/nodes.rs | 2937 +++++++++++++++++--- crates/syntax/src/ast/generated/tokens.rs | 171 +- xtask/src/codegen/grammar.rs | 91 +- 4 files changed, 2771 insertions(+), 430 deletions(-) diff --git a/crates/parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs index 8836bddc9bb7..e6f93a1fbda5 100644 --- a/crates/parser/src/syntax_kind/generated.rs +++ b/crates/parser/src/syntax_kind/generated.rs @@ -1008,7 +1008,7 @@ impl ::core::cmp::Eq for SyntaxKind {} impl ::core::cmp::PartialOrd for SyntaxKind { #[inline] fn partial_cmp(&self, other: &Self) -> core::option::Option<core::cmp::Ordering> { - (*self as u16).partial_cmp(&(*other as u16)) + Some(self.cmp(other)) } } impl ::core::cmp::Ord for SyntaxKind { diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index ebee5e9af2c4..638b9615ea33 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs @@ -6,8 +6,7 @@ use crate::{ SyntaxKind::{self, *}, SyntaxNode, SyntaxToken, T, }; - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +use std::{fmt, hash}; pub struct Abi { pub(crate) syntax: SyntaxNode, } @@ -17,8 +16,6 @@ impl Abi { #[inline] pub fn string_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![string]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ArgList { pub(crate) syntax: SyntaxNode, } @@ -28,8 +25,6 @@ impl ArgList { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ArrayExpr { pub(crate) syntax: SyntaxNode, } @@ -46,8 +41,6 @@ impl ArrayExpr { #[inline] pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ArrayType { pub(crate) syntax: SyntaxNode, } @@ -63,8 +56,6 @@ impl ArrayType { #[inline] pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmClobberAbi { pub(crate) syntax: SyntaxNode, } @@ -80,8 +71,6 @@ impl AsmClobberAbi { #[inline] pub fn string_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![string]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmConst { pub(crate) syntax: SyntaxNode, } @@ -91,8 +80,6 @@ impl AsmConst { #[inline] pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmDirSpec { pub(crate) syntax: SyntaxNode, } @@ -110,8 +97,6 @@ impl AsmDirSpec { #[inline] pub fn out_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![out]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmExpr { pub(crate) syntax: SyntaxNode, } @@ -134,8 +119,6 @@ impl AsmExpr { #[inline] pub fn builtin_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![builtin]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmLabel { pub(crate) syntax: SyntaxNode, } @@ -145,8 +128,6 @@ impl AsmLabel { #[inline] pub fn label_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![label]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmOperandExpr { pub(crate) syntax: SyntaxNode, } @@ -158,8 +139,6 @@ impl AsmOperandExpr { #[inline] pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmOperandNamed { pub(crate) syntax: SyntaxNode, } @@ -170,8 +149,6 @@ impl AsmOperandNamed { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmOption { pub(crate) syntax: SyntaxNode, } @@ -205,8 +182,6 @@ impl AsmOption { support::token(&self.syntax, T![readonly]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmOptions { pub(crate) syntax: SyntaxNode, } @@ -222,8 +197,6 @@ impl AsmOptions { #[inline] pub fn options_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![options]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmRegOperand { pub(crate) syntax: SyntaxNode, } @@ -239,8 +212,6 @@ impl AsmRegOperand { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmRegSpec { pub(crate) syntax: SyntaxNode, } @@ -250,8 +221,6 @@ impl AsmRegSpec { #[inline] pub fn string_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![string]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AsmSym { pub(crate) syntax: SyntaxNode, } @@ -261,8 +230,6 @@ impl AsmSym { #[inline] pub fn sym_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![sym]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AssocItemList { pub(crate) syntax: SyntaxNode, } @@ -275,8 +242,6 @@ impl AssocItemList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AssocTypeArg { pub(crate) syntax: SyntaxNode, } @@ -298,8 +263,6 @@ impl AssocTypeArg { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Attr { pub(crate) syntax: SyntaxNode, } @@ -315,8 +278,6 @@ impl Attr { #[inline] pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AwaitExpr { pub(crate) syntax: SyntaxNode, } @@ -329,8 +290,6 @@ impl AwaitExpr { #[inline] pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BecomeExpr { pub(crate) syntax: SyntaxNode, } @@ -341,15 +300,11 @@ impl BecomeExpr { #[inline] pub fn become_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![become]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BinExpr { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for BinExpr {} impl BinExpr {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BlockExpr { pub(crate) syntax: SyntaxNode, } @@ -372,8 +327,6 @@ impl BlockExpr { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BoxPat { pub(crate) syntax: SyntaxNode, } @@ -383,8 +336,6 @@ impl BoxPat { #[inline] pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BreakExpr { pub(crate) syntax: SyntaxNode, } @@ -397,8 +348,6 @@ impl BreakExpr { #[inline] pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CallExpr { pub(crate) syntax: SyntaxNode, } @@ -408,8 +357,6 @@ impl CallExpr { #[inline] pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CastExpr { pub(crate) syntax: SyntaxNode, } @@ -422,8 +369,6 @@ impl CastExpr { #[inline] pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ClosureBinder { pub(crate) syntax: SyntaxNode, } @@ -433,8 +378,6 @@ impl ClosureBinder { #[inline] pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ClosureExpr { pub(crate) syntax: SyntaxNode, } @@ -457,8 +400,6 @@ impl ClosureExpr { #[inline] pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Const { pub(crate) syntax: SyntaxNode, } @@ -482,8 +423,6 @@ impl Const { #[inline] pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ConstArg { pub(crate) syntax: SyntaxNode, } @@ -491,8 +430,6 @@ impl ConstArg { #[inline] pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ConstBlockPat { pub(crate) syntax: SyntaxNode, } @@ -502,8 +439,6 @@ impl ConstBlockPat { #[inline] pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ConstParam { pub(crate) syntax: SyntaxNode, } @@ -521,8 +456,6 @@ impl ConstParam { #[inline] pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ContinueExpr { pub(crate) syntax: SyntaxNode, } @@ -535,8 +468,6 @@ impl ContinueExpr { support::token(&self.syntax, T![continue]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct DynTraitType { pub(crate) syntax: SyntaxNode, } @@ -546,8 +477,6 @@ impl DynTraitType { #[inline] pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Enum { pub(crate) syntax: SyntaxNode, } @@ -562,8 +491,6 @@ impl Enum { #[inline] pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExprStmt { pub(crate) syntax: SyntaxNode, } @@ -573,8 +500,6 @@ impl ExprStmt { #[inline] 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, } @@ -588,8 +513,6 @@ impl ExternBlock { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExternCrate { pub(crate) syntax: SyntaxNode, } @@ -608,8 +531,6 @@ impl ExternCrate { #[inline] pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ExternItemList { pub(crate) syntax: SyntaxNode, } @@ -622,8 +543,6 @@ impl ExternItemList { #[inline] 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, } @@ -636,8 +555,6 @@ impl FieldExpr { #[inline] pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Fn { pub(crate) syntax: SyntaxNode, } @@ -670,8 +587,6 @@ impl Fn { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct FnPtrType { pub(crate) syntax: SyntaxNode, } @@ -691,8 +606,6 @@ impl FnPtrType { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ForExpr { pub(crate) syntax: SyntaxNode, } @@ -705,8 +618,6 @@ impl ForExpr { #[inline] pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ForType { pub(crate) syntax: SyntaxNode, } @@ -718,8 +629,6 @@ impl ForType { #[inline] pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct FormatArgsArg { pub(crate) syntax: SyntaxNode, } @@ -730,8 +639,6 @@ impl FormatArgsArg { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct FormatArgsExpr { pub(crate) syntax: SyntaxNode, } @@ -754,8 +661,6 @@ impl FormatArgsExpr { support::token(&self.syntax, T![format_args]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct GenericArgList { pub(crate) syntax: SyntaxNode, } @@ -769,8 +674,6 @@ impl GenericArgList { #[inline] pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct GenericParamList { pub(crate) syntax: SyntaxNode, } @@ -782,8 +685,6 @@ impl GenericParamList { #[inline] pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct IdentPat { pub(crate) syntax: SyntaxNode, } @@ -799,8 +700,6 @@ impl IdentPat { #[inline] pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct IfExpr { pub(crate) syntax: SyntaxNode, } @@ -811,8 +710,6 @@ impl IfExpr { #[inline] pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Impl { pub(crate) syntax: SyntaxNode, } @@ -836,8 +733,6 @@ impl Impl { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ImplTraitType { pub(crate) syntax: SyntaxNode, } @@ -847,8 +742,6 @@ impl ImplTraitType { #[inline] pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct IndexExpr { pub(crate) syntax: SyntaxNode, } @@ -859,8 +752,6 @@ impl IndexExpr { #[inline] pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct InferType { pub(crate) syntax: SyntaxNode, } @@ -868,8 +759,6 @@ impl InferType { #[inline] pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ItemList { pub(crate) syntax: SyntaxNode, } @@ -881,8 +770,6 @@ impl ItemList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Label { pub(crate) syntax: SyntaxNode, } @@ -892,8 +779,6 @@ impl Label { #[inline] pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LetElse { pub(crate) syntax: SyntaxNode, } @@ -903,8 +788,6 @@ impl LetElse { #[inline] pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LetExpr { pub(crate) syntax: SyntaxNode, } @@ -919,8 +802,6 @@ impl LetExpr { #[inline] pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LetStmt { pub(crate) syntax: SyntaxNode, } @@ -943,8 +824,6 @@ impl LetStmt { #[inline] pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Lifetime { pub(crate) syntax: SyntaxNode, } @@ -954,8 +833,6 @@ impl Lifetime { support::token(&self.syntax, T![lifetime_ident]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LifetimeArg { pub(crate) syntax: SyntaxNode, } @@ -963,8 +840,6 @@ impl LifetimeArg { #[inline] pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LifetimeParam { pub(crate) syntax: SyntaxNode, } @@ -974,15 +849,11 @@ impl LifetimeParam { #[inline] pub fn lifetime(&self) -> Option<Lifetime> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Literal { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for Literal {} impl Literal {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LiteralPat { pub(crate) syntax: SyntaxNode, } @@ -992,8 +863,6 @@ impl LiteralPat { #[inline] pub fn minus_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![-]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct LoopExpr { pub(crate) syntax: SyntaxNode, } @@ -1003,8 +872,6 @@ impl LoopExpr { #[inline] pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroCall { pub(crate) syntax: SyntaxNode, } @@ -1020,8 +887,6 @@ impl MacroCall { #[inline] pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroDef { pub(crate) syntax: SyntaxNode, } @@ -1033,8 +898,6 @@ impl MacroDef { #[inline] pub fn macro_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![macro]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroExpr { pub(crate) syntax: SyntaxNode, } @@ -1042,15 +905,11 @@ impl MacroExpr { #[inline] pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroItems { pub(crate) syntax: SyntaxNode, } impl ast::HasModuleItem for MacroItems {} impl MacroItems {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroPat { pub(crate) syntax: SyntaxNode, } @@ -1058,8 +917,6 @@ impl MacroPat { #[inline] pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroRules { pub(crate) syntax: SyntaxNode, } @@ -1077,8 +934,6 @@ impl MacroRules { support::token(&self.syntax, T![macro_rules]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroStmts { pub(crate) syntax: SyntaxNode, } @@ -1088,8 +943,6 @@ impl MacroStmts { #[inline] pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MacroType { pub(crate) syntax: SyntaxNode, } @@ -1097,8 +950,6 @@ impl MacroType { #[inline] pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MatchArm { pub(crate) syntax: SyntaxNode, } @@ -1115,8 +966,6 @@ impl MatchArm { #[inline] pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MatchArmList { pub(crate) syntax: SyntaxNode, } @@ -1129,8 +978,6 @@ impl MatchArmList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MatchExpr { pub(crate) syntax: SyntaxNode, } @@ -1143,8 +990,6 @@ impl MatchExpr { #[inline] pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MatchGuard { pub(crate) syntax: SyntaxNode, } @@ -1152,8 +997,6 @@ impl MatchGuard { #[inline] pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Meta { pub(crate) syntax: SyntaxNode, } @@ -1173,8 +1016,6 @@ impl Meta { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct MethodCallExpr { pub(crate) syntax: SyntaxNode, } @@ -1189,8 +1030,6 @@ impl MethodCallExpr { #[inline] pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Module { pub(crate) syntax: SyntaxNode, } @@ -1206,8 +1045,6 @@ impl Module { #[inline] pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Name { pub(crate) syntax: SyntaxNode, } @@ -1217,8 +1054,6 @@ impl Name { #[inline] pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct NameRef { pub(crate) syntax: SyntaxNode, } @@ -1238,8 +1073,6 @@ impl NameRef { #[inline] pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct NeverType { pub(crate) syntax: SyntaxNode, } @@ -1247,8 +1080,6 @@ impl NeverType { #[inline] pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct OffsetOfExpr { pub(crate) syntax: SyntaxNode, } @@ -1273,8 +1104,6 @@ impl OffsetOfExpr { support::token(&self.syntax, T![offset_of]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct OrPat { pub(crate) syntax: SyntaxNode, } @@ -1284,8 +1113,6 @@ impl OrPat { #[inline] pub fn pipe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![|]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Param { pub(crate) syntax: SyntaxNode, } @@ -1300,8 +1127,6 @@ impl Param { #[inline] pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParamList { pub(crate) syntax: SyntaxNode, } @@ -1319,8 +1144,6 @@ impl ParamList { #[inline] pub fn pipe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![|]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenExpr { pub(crate) syntax: SyntaxNode, } @@ -1333,8 +1156,6 @@ impl ParenExpr { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenPat { pub(crate) syntax: SyntaxNode, } @@ -1346,8 +1167,6 @@ impl ParenPat { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenType { pub(crate) syntax: SyntaxNode, } @@ -1359,8 +1178,6 @@ impl ParenType { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenthesizedArgList { pub(crate) syntax: SyntaxNode, } @@ -1374,8 +1191,6 @@ impl ParenthesizedArgList { #[inline] pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Path { pub(crate) syntax: SyntaxNode, } @@ -1387,8 +1202,6 @@ impl Path { #[inline] pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathExpr { pub(crate) syntax: SyntaxNode, } @@ -1397,8 +1210,6 @@ impl PathExpr { #[inline] pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathPat { pub(crate) syntax: SyntaxNode, } @@ -1406,8 +1217,6 @@ impl PathPat { #[inline] pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathSegment { pub(crate) syntax: SyntaxNode, } @@ -1436,8 +1245,6 @@ impl PathSegment { #[inline] pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PathType { pub(crate) syntax: SyntaxNode, } @@ -1445,8 +1252,6 @@ impl PathType { #[inline] pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PrefixExpr { pub(crate) syntax: SyntaxNode, } @@ -1455,8 +1260,6 @@ impl PrefixExpr { #[inline] pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct PtrType { pub(crate) syntax: SyntaxNode, } @@ -1470,21 +1273,15 @@ impl PtrType { #[inline] pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RangeExpr { pub(crate) syntax: SyntaxNode, } impl ast::HasAttrs for RangeExpr {} impl RangeExpr {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RangePat { pub(crate) syntax: SyntaxNode, } impl RangePat {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordExpr { pub(crate) syntax: SyntaxNode, } @@ -1496,8 +1293,6 @@ impl RecordExpr { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordExprField { pub(crate) syntax: SyntaxNode, } @@ -1510,8 +1305,6 @@ impl RecordExprField { #[inline] pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordExprFieldList { pub(crate) syntax: SyntaxNode, } @@ -1528,8 +1321,6 @@ impl RecordExprFieldList { #[inline] pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordField { pub(crate) syntax: SyntaxNode, } @@ -1547,8 +1338,6 @@ impl RecordField { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordFieldList { pub(crate) syntax: SyntaxNode, } @@ -1560,8 +1349,6 @@ impl RecordFieldList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordPat { pub(crate) syntax: SyntaxNode, } @@ -1573,8 +1360,6 @@ impl RecordPat { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordPatField { pub(crate) syntax: SyntaxNode, } @@ -1587,8 +1372,6 @@ impl RecordPatField { #[inline] pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordPatFieldList { pub(crate) syntax: SyntaxNode, } @@ -1602,8 +1385,6 @@ impl RecordPatFieldList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RefExpr { pub(crate) syntax: SyntaxNode, } @@ -1620,8 +1401,6 @@ impl RefExpr { #[inline] pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RefPat { pub(crate) syntax: SyntaxNode, } @@ -1633,8 +1412,6 @@ impl RefPat { #[inline] pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RefType { pub(crate) syntax: SyntaxNode, } @@ -1648,8 +1425,6 @@ impl RefType { #[inline] pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Rename { pub(crate) syntax: SyntaxNode, } @@ -1660,8 +1435,6 @@ impl Rename { #[inline] pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RestPat { pub(crate) syntax: SyntaxNode, } @@ -1670,8 +1443,6 @@ impl RestPat { #[inline] pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RetType { pub(crate) syntax: SyntaxNode, } @@ -1681,8 +1452,6 @@ impl RetType { #[inline] pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ReturnExpr { pub(crate) syntax: SyntaxNode, } @@ -1693,8 +1462,6 @@ impl ReturnExpr { #[inline] pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ReturnTypeSyntax { pub(crate) syntax: SyntaxNode, } @@ -1706,8 +1473,6 @@ impl ReturnTypeSyntax { #[inline] pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SelfParam { pub(crate) syntax: SyntaxNode, } @@ -1725,8 +1490,6 @@ impl SelfParam { #[inline] pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SlicePat { pub(crate) syntax: SyntaxNode, } @@ -1738,8 +1501,6 @@ impl SlicePat { #[inline] pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SliceType { pub(crate) syntax: SyntaxNode, } @@ -1751,8 +1512,6 @@ impl SliceType { #[inline] pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SourceFile { pub(crate) syntax: SyntaxNode, } @@ -1763,8 +1522,6 @@ impl SourceFile { #[inline] pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Static { pub(crate) syntax: SyntaxNode, } @@ -1790,8 +1547,6 @@ impl Static { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct StmtList { pub(crate) syntax: SyntaxNode, } @@ -1806,8 +1561,6 @@ impl StmtList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Struct { pub(crate) syntax: SyntaxNode, } @@ -1824,8 +1577,6 @@ impl Struct { #[inline] pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TokenTree { pub(crate) syntax: SyntaxNode, } @@ -1843,8 +1594,6 @@ impl TokenTree { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Trait { pub(crate) syntax: SyntaxNode, } @@ -1864,8 +1613,6 @@ impl Trait { #[inline] pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TraitAlias { pub(crate) syntax: SyntaxNode, } @@ -1884,8 +1631,6 @@ impl TraitAlias { #[inline] pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TryExpr { pub(crate) syntax: SyntaxNode, } @@ -1896,8 +1641,6 @@ impl TryExpr { #[inline] pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleExpr { pub(crate) syntax: SyntaxNode, } @@ -1910,8 +1653,6 @@ impl TupleExpr { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleField { pub(crate) syntax: SyntaxNode, } @@ -1922,8 +1663,6 @@ impl TupleField { #[inline] pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleFieldList { pub(crate) syntax: SyntaxNode, } @@ -1935,8 +1674,6 @@ impl TupleFieldList { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TuplePat { pub(crate) syntax: SyntaxNode, } @@ -1948,8 +1685,6 @@ impl TuplePat { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleStructPat { pub(crate) syntax: SyntaxNode, } @@ -1963,8 +1698,6 @@ impl TupleStructPat { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TupleType { pub(crate) syntax: SyntaxNode, } @@ -1976,8 +1709,6 @@ impl TupleType { #[inline] pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeAlias { pub(crate) syntax: SyntaxNode, } @@ -1999,8 +1730,6 @@ impl TypeAlias { #[inline] pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeArg { pub(crate) syntax: SyntaxNode, } @@ -2008,8 +1737,6 @@ impl TypeArg { #[inline] pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeBound { pub(crate) syntax: SyntaxNode, } @@ -2033,8 +1760,6 @@ impl TypeBound { #[inline] pub fn tilde_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![~]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeBoundList { pub(crate) syntax: SyntaxNode, } @@ -2042,8 +1767,6 @@ impl TypeBoundList { #[inline] pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeParam { pub(crate) syntax: SyntaxNode, } @@ -2056,8 +1779,6 @@ impl TypeParam { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UnderscoreExpr { pub(crate) syntax: SyntaxNode, } @@ -2066,8 +1787,6 @@ impl UnderscoreExpr { #[inline] pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Union { pub(crate) syntax: SyntaxNode, } @@ -2082,8 +1801,6 @@ impl Union { #[inline] pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Use { pub(crate) syntax: SyntaxNode, } @@ -2098,8 +1815,6 @@ impl Use { #[inline] pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UseBoundGenericArgs { pub(crate) syntax: SyntaxNode, } @@ -2113,8 +1828,6 @@ impl UseBoundGenericArgs { #[inline] pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UseTree { pub(crate) syntax: SyntaxNode, } @@ -2130,8 +1843,6 @@ impl UseTree { #[inline] pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct UseTreeList { pub(crate) syntax: SyntaxNode, } @@ -2143,8 +1854,6 @@ impl UseTreeList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Variant { pub(crate) syntax: SyntaxNode, } @@ -2160,8 +1869,6 @@ impl Variant { #[inline] pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct VariantList { pub(crate) syntax: SyntaxNode, } @@ -2173,8 +1880,6 @@ impl VariantList { #[inline] pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Visibility { pub(crate) syntax: SyntaxNode, } @@ -2190,8 +1895,6 @@ impl Visibility { #[inline] pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WhereClause { pub(crate) syntax: SyntaxNode, } @@ -2201,8 +1904,6 @@ impl WhereClause { #[inline] pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WherePred { pub(crate) syntax: SyntaxNode, } @@ -2217,8 +1918,6 @@ impl WherePred { #[inline] pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WhileExpr { pub(crate) syntax: SyntaxNode, } @@ -2227,8 +1926,6 @@ impl WhileExpr { #[inline] pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct WildcardPat { pub(crate) syntax: SyntaxNode, } @@ -2236,8 +1933,6 @@ impl WildcardPat { #[inline] pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct YeetExpr { pub(crate) syntax: SyntaxNode, } @@ -2250,8 +1945,6 @@ impl YeetExpr { #[inline] pub fn yeet_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![yeet]) } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct YieldExpr { pub(crate) syntax: SyntaxNode, } @@ -2456,66 +2149,96 @@ impl ast::HasAttrs for VariantDef {} impl ast::HasDocComments for VariantDef {} impl ast::HasName for VariantDef {} impl ast::HasVisibility for VariantDef {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AnyHasArgList { pub(crate) syntax: SyntaxNode, } -impl ast::HasArgList for AnyHasArgList {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasArgList { + #[inline] + pub fn new<T: ast::HasArgList>(node: T) -> AnyHasArgList { + AnyHasArgList { syntax: node.syntax().clone() } + } +} pub struct AnyHasAttrs { pub(crate) syntax: SyntaxNode, } -impl ast::HasAttrs for AnyHasAttrs {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasAttrs { + #[inline] + pub fn new<T: ast::HasAttrs>(node: T) -> AnyHasAttrs { + AnyHasAttrs { syntax: node.syntax().clone() } + } +} pub struct AnyHasDocComments { pub(crate) syntax: SyntaxNode, } -impl ast::HasDocComments for AnyHasDocComments {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasDocComments { + #[inline] + pub fn new<T: ast::HasDocComments>(node: T) -> AnyHasDocComments { + AnyHasDocComments { syntax: node.syntax().clone() } + } +} pub struct AnyHasGenericArgs { pub(crate) syntax: SyntaxNode, } -impl ast::HasGenericArgs for AnyHasGenericArgs {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasGenericArgs { + #[inline] + pub fn new<T: ast::HasGenericArgs>(node: T) -> AnyHasGenericArgs { + AnyHasGenericArgs { syntax: node.syntax().clone() } + } +} pub struct AnyHasGenericParams { pub(crate) syntax: SyntaxNode, } -impl ast::HasGenericParams for AnyHasGenericParams {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasGenericParams { + #[inline] + pub fn new<T: ast::HasGenericParams>(node: T) -> AnyHasGenericParams { + AnyHasGenericParams { syntax: node.syntax().clone() } + } +} pub struct AnyHasLoopBody { pub(crate) syntax: SyntaxNode, } -impl ast::HasLoopBody for AnyHasLoopBody {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasLoopBody { + #[inline] + pub fn new<T: ast::HasLoopBody>(node: T) -> AnyHasLoopBody { + AnyHasLoopBody { syntax: node.syntax().clone() } + } +} pub struct AnyHasModuleItem { pub(crate) syntax: SyntaxNode, } -impl ast::HasModuleItem for AnyHasModuleItem {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasModuleItem { + #[inline] + pub fn new<T: ast::HasModuleItem>(node: T) -> AnyHasModuleItem { + AnyHasModuleItem { syntax: node.syntax().clone() } + } +} pub struct AnyHasName { pub(crate) syntax: SyntaxNode, } -impl ast::HasName for AnyHasName {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasName { + #[inline] + pub fn new<T: ast::HasName>(node: T) -> AnyHasName { + AnyHasName { syntax: node.syntax().clone() } + } +} pub struct AnyHasTypeBounds { pub(crate) syntax: SyntaxNode, } -impl ast::HasTypeBounds for AnyHasTypeBounds {} - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl AnyHasTypeBounds { + #[inline] + pub fn new<T: ast::HasTypeBounds>(node: T) -> AnyHasTypeBounds { + AnyHasTypeBounds { syntax: node.syntax().clone() } + } +} pub struct AnyHasVisibility { pub(crate) syntax: SyntaxNode, } -impl ast::HasVisibility for AnyHasVisibility {} +impl AnyHasVisibility { + #[inline] + pub fn new<T: ast::HasVisibility>(node: T) -> AnyHasVisibility { + AnyHasVisibility { syntax: node.syntax().clone() } + } +} impl AstNode for Abi { #[inline] fn kind() -> SyntaxKind @@ -2537,6 +2260,21 @@ impl AstNode for Abi { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Abi { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Abi {} +impl PartialEq for Abi { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Abi { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Abi { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Abi").field("syntax", &self.syntax).finish() + } +} impl AstNode for ArgList { #[inline] fn kind() -> SyntaxKind @@ -2558,6 +2296,21 @@ impl AstNode for ArgList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ArgList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ArgList {} +impl PartialEq for ArgList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ArgList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ArgList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ArgList").field("syntax", &self.syntax).finish() + } +} impl AstNode for ArrayExpr { #[inline] fn kind() -> SyntaxKind @@ -2579,6 +2332,21 @@ impl AstNode for ArrayExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ArrayExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ArrayExpr {} +impl PartialEq for ArrayExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ArrayExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ArrayExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ArrayExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for ArrayType { #[inline] fn kind() -> SyntaxKind @@ -2600,6 +2368,21 @@ impl AstNode for ArrayType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ArrayType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ArrayType {} +impl PartialEq for ArrayType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ArrayType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ArrayType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ArrayType").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmClobberAbi { #[inline] fn kind() -> SyntaxKind @@ -2621,6 +2404,21 @@ impl AstNode for AsmClobberAbi { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmClobberAbi { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmClobberAbi {} +impl PartialEq for AsmClobberAbi { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmClobberAbi { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmClobberAbi { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmClobberAbi").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmConst { #[inline] fn kind() -> SyntaxKind @@ -2642,6 +2440,21 @@ impl AstNode for AsmConst { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmConst { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmConst {} +impl PartialEq for AsmConst { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmConst { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmConst { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmConst").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmDirSpec { #[inline] fn kind() -> SyntaxKind @@ -2663,6 +2476,21 @@ impl AstNode for AsmDirSpec { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmDirSpec { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmDirSpec {} +impl PartialEq for AsmDirSpec { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmDirSpec { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmDirSpec { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmDirSpec").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmExpr { #[inline] fn kind() -> SyntaxKind @@ -2684,6 +2512,21 @@ impl AstNode for AsmExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmExpr {} +impl PartialEq for AsmExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmLabel { #[inline] fn kind() -> SyntaxKind @@ -2705,6 +2548,21 @@ impl AstNode for AsmLabel { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmLabel { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmLabel {} +impl PartialEq for AsmLabel { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmLabel { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmLabel { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmLabel").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmOperandExpr { #[inline] fn kind() -> SyntaxKind @@ -2726,6 +2584,21 @@ impl AstNode for AsmOperandExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmOperandExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmOperandExpr {} +impl PartialEq for AsmOperandExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmOperandExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmOperandExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmOperandExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmOperandNamed { #[inline] fn kind() -> SyntaxKind @@ -2747,6 +2620,21 @@ impl AstNode for AsmOperandNamed { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmOperandNamed { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmOperandNamed {} +impl PartialEq for AsmOperandNamed { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmOperandNamed { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmOperandNamed { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmOperandNamed").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmOption { #[inline] fn kind() -> SyntaxKind @@ -2768,6 +2656,21 @@ impl AstNode for AsmOption { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmOption { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmOption {} +impl PartialEq for AsmOption { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmOption { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmOption { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmOption").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmOptions { #[inline] fn kind() -> SyntaxKind @@ -2789,6 +2692,21 @@ impl AstNode for AsmOptions { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmOptions { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmOptions {} +impl PartialEq for AsmOptions { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmOptions { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmOptions { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmOptions").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmRegOperand { #[inline] fn kind() -> SyntaxKind @@ -2810,6 +2728,21 @@ impl AstNode for AsmRegOperand { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmRegOperand { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmRegOperand {} +impl PartialEq for AsmRegOperand { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmRegOperand { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmRegOperand { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmRegOperand").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmRegSpec { #[inline] fn kind() -> SyntaxKind @@ -2831,6 +2764,21 @@ impl AstNode for AsmRegSpec { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmRegSpec { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmRegSpec {} +impl PartialEq for AsmRegSpec { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmRegSpec { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmRegSpec { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmRegSpec").field("syntax", &self.syntax).finish() + } +} impl AstNode for AsmSym { #[inline] fn kind() -> SyntaxKind @@ -2852,6 +2800,21 @@ impl AstNode for AsmSym { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AsmSym { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AsmSym {} +impl PartialEq for AsmSym { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AsmSym { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AsmSym { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AsmSym").field("syntax", &self.syntax).finish() + } +} impl AstNode for AssocItemList { #[inline] fn kind() -> SyntaxKind @@ -2873,6 +2836,21 @@ impl AstNode for AssocItemList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AssocItemList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AssocItemList {} +impl PartialEq for AssocItemList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AssocItemList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AssocItemList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AssocItemList").field("syntax", &self.syntax).finish() + } +} impl AstNode for AssocTypeArg { #[inline] fn kind() -> SyntaxKind @@ -2894,6 +2872,21 @@ impl AstNode for AssocTypeArg { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AssocTypeArg { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AssocTypeArg {} +impl PartialEq for AssocTypeArg { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AssocTypeArg { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AssocTypeArg { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AssocTypeArg").field("syntax", &self.syntax).finish() + } +} impl AstNode for Attr { #[inline] fn kind() -> SyntaxKind @@ -2915,6 +2908,21 @@ impl AstNode for Attr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Attr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Attr {} +impl PartialEq for Attr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Attr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Attr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Attr").field("syntax", &self.syntax).finish() + } +} impl AstNode for AwaitExpr { #[inline] fn kind() -> SyntaxKind @@ -2936,6 +2944,21 @@ impl AstNode for AwaitExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AwaitExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AwaitExpr {} +impl PartialEq for AwaitExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AwaitExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AwaitExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AwaitExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for BecomeExpr { #[inline] fn kind() -> SyntaxKind @@ -2957,6 +2980,21 @@ impl AstNode for BecomeExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for BecomeExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for BecomeExpr {} +impl PartialEq for BecomeExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for BecomeExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for BecomeExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("BecomeExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for BinExpr { #[inline] fn kind() -> SyntaxKind @@ -2978,6 +3016,21 @@ impl AstNode for BinExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for BinExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for BinExpr {} +impl PartialEq for BinExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for BinExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for BinExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("BinExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for BlockExpr { #[inline] fn kind() -> SyntaxKind @@ -2999,6 +3052,21 @@ impl AstNode for BlockExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for BlockExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for BlockExpr {} +impl PartialEq for BlockExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for BlockExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for BlockExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("BlockExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for BoxPat { #[inline] fn kind() -> SyntaxKind @@ -3020,6 +3088,21 @@ impl AstNode for BoxPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for BoxPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for BoxPat {} +impl PartialEq for BoxPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for BoxPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for BoxPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("BoxPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for BreakExpr { #[inline] fn kind() -> SyntaxKind @@ -3041,6 +3124,21 @@ impl AstNode for BreakExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for BreakExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for BreakExpr {} +impl PartialEq for BreakExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for BreakExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for BreakExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("BreakExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for CallExpr { #[inline] fn kind() -> SyntaxKind @@ -3059,8 +3157,23 @@ impl AstNode for CallExpr { None } } - #[inline] - fn syntax(&self) -> &SyntaxNode { &self.syntax } + #[inline] + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} +impl hash::Hash for CallExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for CallExpr {} +impl PartialEq for CallExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for CallExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for CallExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("CallExpr").field("syntax", &self.syntax).finish() + } } impl AstNode for CastExpr { #[inline] @@ -3083,6 +3196,21 @@ impl AstNode for CastExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for CastExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for CastExpr {} +impl PartialEq for CastExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for CastExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for CastExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("CastExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for ClosureBinder { #[inline] fn kind() -> SyntaxKind @@ -3104,6 +3232,21 @@ impl AstNode for ClosureBinder { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ClosureBinder { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ClosureBinder {} +impl PartialEq for ClosureBinder { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ClosureBinder { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ClosureBinder { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ClosureBinder").field("syntax", &self.syntax).finish() + } +} impl AstNode for ClosureExpr { #[inline] fn kind() -> SyntaxKind @@ -3125,6 +3268,21 @@ impl AstNode for ClosureExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ClosureExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ClosureExpr {} +impl PartialEq for ClosureExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ClosureExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ClosureExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ClosureExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for Const { #[inline] fn kind() -> SyntaxKind @@ -3146,6 +3304,21 @@ impl AstNode for Const { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Const { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Const {} +impl PartialEq for Const { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Const { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Const { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Const").field("syntax", &self.syntax).finish() + } +} impl AstNode for ConstArg { #[inline] fn kind() -> SyntaxKind @@ -3167,6 +3340,21 @@ impl AstNode for ConstArg { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ConstArg { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ConstArg {} +impl PartialEq for ConstArg { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ConstArg { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ConstArg { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ConstArg").field("syntax", &self.syntax).finish() + } +} impl AstNode for ConstBlockPat { #[inline] fn kind() -> SyntaxKind @@ -3188,6 +3376,21 @@ impl AstNode for ConstBlockPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ConstBlockPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ConstBlockPat {} +impl PartialEq for ConstBlockPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ConstBlockPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ConstBlockPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ConstBlockPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for ConstParam { #[inline] fn kind() -> SyntaxKind @@ -3209,6 +3412,21 @@ impl AstNode for ConstParam { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ConstParam { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ConstParam {} +impl PartialEq for ConstParam { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ConstParam { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ConstParam { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ConstParam").field("syntax", &self.syntax).finish() + } +} impl AstNode for ContinueExpr { #[inline] fn kind() -> SyntaxKind @@ -3230,6 +3448,21 @@ impl AstNode for ContinueExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ContinueExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ContinueExpr {} +impl PartialEq for ContinueExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ContinueExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ContinueExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ContinueExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for DynTraitType { #[inline] fn kind() -> SyntaxKind @@ -3251,6 +3484,21 @@ impl AstNode for DynTraitType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for DynTraitType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for DynTraitType {} +impl PartialEq for DynTraitType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for DynTraitType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for DynTraitType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("DynTraitType").field("syntax", &self.syntax).finish() + } +} impl AstNode for Enum { #[inline] fn kind() -> SyntaxKind @@ -3272,6 +3520,21 @@ impl AstNode for Enum { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Enum { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Enum {} +impl PartialEq for Enum { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Enum { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Enum { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Enum").field("syntax", &self.syntax).finish() + } +} impl AstNode for ExprStmt { #[inline] fn kind() -> SyntaxKind @@ -3293,6 +3556,21 @@ impl AstNode for ExprStmt { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ExprStmt { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ExprStmt {} +impl PartialEq for ExprStmt { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ExprStmt { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ExprStmt { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ExprStmt").field("syntax", &self.syntax).finish() + } +} impl AstNode for ExternBlock { #[inline] fn kind() -> SyntaxKind @@ -3314,6 +3592,21 @@ impl AstNode for ExternBlock { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ExternBlock { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ExternBlock {} +impl PartialEq for ExternBlock { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ExternBlock { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ExternBlock { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ExternBlock").field("syntax", &self.syntax).finish() + } +} impl AstNode for ExternCrate { #[inline] fn kind() -> SyntaxKind @@ -3335,6 +3628,21 @@ impl AstNode for ExternCrate { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ExternCrate { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ExternCrate {} +impl PartialEq for ExternCrate { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ExternCrate { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ExternCrate { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ExternCrate").field("syntax", &self.syntax).finish() + } +} impl AstNode for ExternItemList { #[inline] fn kind() -> SyntaxKind @@ -3356,6 +3664,21 @@ impl AstNode for ExternItemList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ExternItemList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ExternItemList {} +impl PartialEq for ExternItemList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ExternItemList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ExternItemList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ExternItemList").field("syntax", &self.syntax).finish() + } +} impl AstNode for FieldExpr { #[inline] fn kind() -> SyntaxKind @@ -3377,6 +3700,21 @@ impl AstNode for FieldExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for FieldExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FieldExpr {} +impl PartialEq for FieldExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for FieldExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for FieldExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FieldExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for Fn { #[inline] fn kind() -> SyntaxKind @@ -3398,6 +3736,21 @@ impl AstNode for Fn { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Fn { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Fn {} +impl PartialEq for Fn { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Fn { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Fn { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Fn").field("syntax", &self.syntax).finish() + } +} impl AstNode for FnPtrType { #[inline] fn kind() -> SyntaxKind @@ -3419,6 +3772,21 @@ impl AstNode for FnPtrType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for FnPtrType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FnPtrType {} +impl PartialEq for FnPtrType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for FnPtrType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for FnPtrType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FnPtrType").field("syntax", &self.syntax).finish() + } +} impl AstNode for ForExpr { #[inline] fn kind() -> SyntaxKind @@ -3440,6 +3808,21 @@ impl AstNode for ForExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ForExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ForExpr {} +impl PartialEq for ForExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ForExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ForExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ForExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for ForType { #[inline] fn kind() -> SyntaxKind @@ -3461,6 +3844,21 @@ impl AstNode for ForType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ForType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ForType {} +impl PartialEq for ForType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ForType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ForType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ForType").field("syntax", &self.syntax).finish() + } +} impl AstNode for FormatArgsArg { #[inline] fn kind() -> SyntaxKind @@ -3482,6 +3880,21 @@ impl AstNode for FormatArgsArg { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for FormatArgsArg { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FormatArgsArg {} +impl PartialEq for FormatArgsArg { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for FormatArgsArg { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for FormatArgsArg { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FormatArgsArg").field("syntax", &self.syntax).finish() + } +} impl AstNode for FormatArgsExpr { #[inline] fn kind() -> SyntaxKind @@ -3503,6 +3916,21 @@ impl AstNode for FormatArgsExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for FormatArgsExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FormatArgsExpr {} +impl PartialEq for FormatArgsExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for FormatArgsExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for FormatArgsExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FormatArgsExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for GenericArgList { #[inline] fn kind() -> SyntaxKind @@ -3524,6 +3952,21 @@ impl AstNode for GenericArgList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for GenericArgList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for GenericArgList {} +impl PartialEq for GenericArgList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for GenericArgList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for GenericArgList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("GenericArgList").field("syntax", &self.syntax).finish() + } +} impl AstNode for GenericParamList { #[inline] fn kind() -> SyntaxKind @@ -3545,6 +3988,21 @@ impl AstNode for GenericParamList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for GenericParamList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for GenericParamList {} +impl PartialEq for GenericParamList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for GenericParamList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for GenericParamList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("GenericParamList").field("syntax", &self.syntax).finish() + } +} impl AstNode for IdentPat { #[inline] fn kind() -> SyntaxKind @@ -3566,6 +4024,21 @@ impl AstNode for IdentPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for IdentPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for IdentPat {} +impl PartialEq for IdentPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for IdentPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for IdentPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IdentPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for IfExpr { #[inline] fn kind() -> SyntaxKind @@ -3587,6 +4060,21 @@ impl AstNode for IfExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for IfExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for IfExpr {} +impl PartialEq for IfExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for IfExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for IfExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IfExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for Impl { #[inline] fn kind() -> SyntaxKind @@ -3608,6 +4096,21 @@ impl AstNode for Impl { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Impl { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Impl {} +impl PartialEq for Impl { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Impl { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Impl { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Impl").field("syntax", &self.syntax).finish() + } +} impl AstNode for ImplTraitType { #[inline] fn kind() -> SyntaxKind @@ -3629,6 +4132,21 @@ impl AstNode for ImplTraitType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ImplTraitType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ImplTraitType {} +impl PartialEq for ImplTraitType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ImplTraitType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ImplTraitType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ImplTraitType").field("syntax", &self.syntax).finish() + } +} impl AstNode for IndexExpr { #[inline] fn kind() -> SyntaxKind @@ -3650,6 +4168,21 @@ impl AstNode for IndexExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for IndexExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for IndexExpr {} +impl PartialEq for IndexExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for IndexExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for IndexExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IndexExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for InferType { #[inline] fn kind() -> SyntaxKind @@ -3671,6 +4204,21 @@ impl AstNode for InferType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for InferType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for InferType {} +impl PartialEq for InferType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for InferType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for InferType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("InferType").field("syntax", &self.syntax).finish() + } +} impl AstNode for ItemList { #[inline] fn kind() -> SyntaxKind @@ -3692,6 +4240,21 @@ impl AstNode for ItemList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ItemList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ItemList {} +impl PartialEq for ItemList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ItemList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ItemList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ItemList").field("syntax", &self.syntax).finish() + } +} impl AstNode for Label { #[inline] fn kind() -> SyntaxKind @@ -3713,6 +4276,21 @@ impl AstNode for Label { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Label { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Label {} +impl PartialEq for Label { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Label { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Label { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Label").field("syntax", &self.syntax).finish() + } +} impl AstNode for LetElse { #[inline] fn kind() -> SyntaxKind @@ -3734,6 +4312,21 @@ impl AstNode for LetElse { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LetElse { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LetElse {} +impl PartialEq for LetElse { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LetElse { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LetElse { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LetElse").field("syntax", &self.syntax).finish() + } +} impl AstNode for LetExpr { #[inline] fn kind() -> SyntaxKind @@ -3755,6 +4348,21 @@ impl AstNode for LetExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LetExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LetExpr {} +impl PartialEq for LetExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LetExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LetExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LetExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for LetStmt { #[inline] fn kind() -> SyntaxKind @@ -3776,6 +4384,21 @@ impl AstNode for LetStmt { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LetStmt { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LetStmt {} +impl PartialEq for LetStmt { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LetStmt { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LetStmt { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LetStmt").field("syntax", &self.syntax).finish() + } +} impl AstNode for Lifetime { #[inline] fn kind() -> SyntaxKind @@ -3797,6 +4420,21 @@ impl AstNode for Lifetime { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Lifetime { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Lifetime {} +impl PartialEq for Lifetime { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Lifetime { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Lifetime { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Lifetime").field("syntax", &self.syntax).finish() + } +} impl AstNode for LifetimeArg { #[inline] fn kind() -> SyntaxKind @@ -3818,6 +4456,21 @@ impl AstNode for LifetimeArg { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LifetimeArg { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LifetimeArg {} +impl PartialEq for LifetimeArg { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LifetimeArg { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LifetimeArg { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LifetimeArg").field("syntax", &self.syntax).finish() + } +} impl AstNode for LifetimeParam { #[inline] fn kind() -> SyntaxKind @@ -3839,6 +4492,21 @@ impl AstNode for LifetimeParam { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LifetimeParam { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LifetimeParam {} +impl PartialEq for LifetimeParam { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LifetimeParam { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LifetimeParam { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LifetimeParam").field("syntax", &self.syntax).finish() + } +} impl AstNode for Literal { #[inline] fn kind() -> SyntaxKind @@ -3860,6 +4528,21 @@ impl AstNode for Literal { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Literal { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Literal {} +impl PartialEq for Literal { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Literal { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Literal { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Literal").field("syntax", &self.syntax).finish() + } +} impl AstNode for LiteralPat { #[inline] fn kind() -> SyntaxKind @@ -3881,6 +4564,21 @@ impl AstNode for LiteralPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LiteralPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LiteralPat {} +impl PartialEq for LiteralPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LiteralPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LiteralPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LiteralPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for LoopExpr { #[inline] fn kind() -> SyntaxKind @@ -3902,6 +4600,21 @@ impl AstNode for LoopExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for LoopExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for LoopExpr {} +impl PartialEq for LoopExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for LoopExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for LoopExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("LoopExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroCall { #[inline] fn kind() -> SyntaxKind @@ -3923,6 +4636,21 @@ impl AstNode for MacroCall { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroCall { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroCall {} +impl PartialEq for MacroCall { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroCall { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroCall { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroCall").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroDef { #[inline] fn kind() -> SyntaxKind @@ -3944,6 +4672,21 @@ impl AstNode for MacroDef { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroDef { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroDef {} +impl PartialEq for MacroDef { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroDef { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroDef { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroDef").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroExpr { #[inline] fn kind() -> SyntaxKind @@ -3965,6 +4708,21 @@ impl AstNode for MacroExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroExpr {} +impl PartialEq for MacroExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroItems { #[inline] fn kind() -> SyntaxKind @@ -3986,6 +4744,21 @@ impl AstNode for MacroItems { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroItems { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroItems {} +impl PartialEq for MacroItems { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroItems { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroItems { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroItems").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroPat { #[inline] fn kind() -> SyntaxKind @@ -4007,6 +4780,21 @@ impl AstNode for MacroPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroPat {} +impl PartialEq for MacroPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroRules { #[inline] fn kind() -> SyntaxKind @@ -4028,6 +4816,21 @@ impl AstNode for MacroRules { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroRules { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroRules {} +impl PartialEq for MacroRules { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroRules { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroRules { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroRules").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroStmts { #[inline] fn kind() -> SyntaxKind @@ -4049,6 +4852,21 @@ impl AstNode for MacroStmts { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroStmts { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroStmts {} +impl PartialEq for MacroStmts { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroStmts { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroStmts { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroStmts").field("syntax", &self.syntax).finish() + } +} impl AstNode for MacroType { #[inline] fn kind() -> SyntaxKind @@ -4070,6 +4888,21 @@ impl AstNode for MacroType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MacroType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MacroType {} +impl PartialEq for MacroType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MacroType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MacroType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MacroType").field("syntax", &self.syntax).finish() + } +} impl AstNode for MatchArm { #[inline] fn kind() -> SyntaxKind @@ -4091,6 +4924,21 @@ impl AstNode for MatchArm { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MatchArm { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MatchArm {} +impl PartialEq for MatchArm { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MatchArm { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MatchArm { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MatchArm").field("syntax", &self.syntax).finish() + } +} impl AstNode for MatchArmList { #[inline] fn kind() -> SyntaxKind @@ -4109,8 +4957,23 @@ impl AstNode for MatchArmList { None } } - #[inline] - fn syntax(&self) -> &SyntaxNode { &self.syntax } + #[inline] + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} +impl hash::Hash for MatchArmList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MatchArmList {} +impl PartialEq for MatchArmList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MatchArmList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MatchArmList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MatchArmList").field("syntax", &self.syntax).finish() + } } impl AstNode for MatchExpr { #[inline] @@ -4133,6 +4996,21 @@ impl AstNode for MatchExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MatchExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MatchExpr {} +impl PartialEq for MatchExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MatchExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MatchExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MatchExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for MatchGuard { #[inline] fn kind() -> SyntaxKind @@ -4154,6 +5032,21 @@ impl AstNode for MatchGuard { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MatchGuard { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MatchGuard {} +impl PartialEq for MatchGuard { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MatchGuard { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MatchGuard { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MatchGuard").field("syntax", &self.syntax).finish() + } +} impl AstNode for Meta { #[inline] fn kind() -> SyntaxKind @@ -4175,6 +5068,21 @@ impl AstNode for Meta { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Meta { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Meta {} +impl PartialEq for Meta { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Meta { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Meta { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Meta").field("syntax", &self.syntax).finish() + } +} impl AstNode for MethodCallExpr { #[inline] fn kind() -> SyntaxKind @@ -4196,6 +5104,21 @@ impl AstNode for MethodCallExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for MethodCallExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for MethodCallExpr {} +impl PartialEq for MethodCallExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for MethodCallExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for MethodCallExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("MethodCallExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for Module { #[inline] fn kind() -> SyntaxKind @@ -4217,6 +5140,21 @@ impl AstNode for Module { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Module { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Module {} +impl PartialEq for Module { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Module { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Module { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Module").field("syntax", &self.syntax).finish() + } +} impl AstNode for Name { #[inline] fn kind() -> SyntaxKind @@ -4238,6 +5176,21 @@ impl AstNode for Name { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Name { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Name {} +impl PartialEq for Name { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Name { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Name").field("syntax", &self.syntax).finish() + } +} impl AstNode for NameRef { #[inline] fn kind() -> SyntaxKind @@ -4259,6 +5212,21 @@ impl AstNode for NameRef { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for NameRef { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for NameRef {} +impl PartialEq for NameRef { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for NameRef { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for NameRef { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("NameRef").field("syntax", &self.syntax).finish() + } +} impl AstNode for NeverType { #[inline] fn kind() -> SyntaxKind @@ -4280,6 +5248,21 @@ impl AstNode for NeverType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for NeverType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for NeverType {} +impl PartialEq for NeverType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for NeverType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for NeverType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("NeverType").field("syntax", &self.syntax).finish() + } +} impl AstNode for OffsetOfExpr { #[inline] fn kind() -> SyntaxKind @@ -4301,6 +5284,21 @@ impl AstNode for OffsetOfExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for OffsetOfExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for OffsetOfExpr {} +impl PartialEq for OffsetOfExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for OffsetOfExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for OffsetOfExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("OffsetOfExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for OrPat { #[inline] fn kind() -> SyntaxKind @@ -4322,6 +5320,21 @@ impl AstNode for OrPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for OrPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for OrPat {} +impl PartialEq for OrPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for OrPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for OrPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("OrPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for Param { #[inline] fn kind() -> SyntaxKind @@ -4343,6 +5356,21 @@ impl AstNode for Param { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Param { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Param {} +impl PartialEq for Param { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Param { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Param { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Param").field("syntax", &self.syntax).finish() + } +} impl AstNode for ParamList { #[inline] fn kind() -> SyntaxKind @@ -4364,6 +5392,21 @@ impl AstNode for ParamList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ParamList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ParamList {} +impl PartialEq for ParamList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ParamList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ParamList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ParamList").field("syntax", &self.syntax).finish() + } +} impl AstNode for ParenExpr { #[inline] fn kind() -> SyntaxKind @@ -4385,6 +5428,21 @@ impl AstNode for ParenExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ParenExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ParenExpr {} +impl PartialEq for ParenExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ParenExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ParenExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ParenExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for ParenPat { #[inline] fn kind() -> SyntaxKind @@ -4406,6 +5464,21 @@ impl AstNode for ParenPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ParenPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ParenPat {} +impl PartialEq for ParenPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ParenPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ParenPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ParenPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for ParenType { #[inline] fn kind() -> SyntaxKind @@ -4427,6 +5500,21 @@ impl AstNode for ParenType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ParenType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ParenType {} +impl PartialEq for ParenType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ParenType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ParenType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ParenType").field("syntax", &self.syntax).finish() + } +} impl AstNode for ParenthesizedArgList { #[inline] fn kind() -> SyntaxKind @@ -4448,6 +5536,21 @@ impl AstNode for ParenthesizedArgList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ParenthesizedArgList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ParenthesizedArgList {} +impl PartialEq for ParenthesizedArgList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ParenthesizedArgList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ParenthesizedArgList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ParenthesizedArgList").field("syntax", &self.syntax).finish() + } +} impl AstNode for Path { #[inline] fn kind() -> SyntaxKind @@ -4469,6 +5572,21 @@ impl AstNode for Path { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Path { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Path {} +impl PartialEq for Path { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Path { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Path { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Path").field("syntax", &self.syntax).finish() + } +} impl AstNode for PathExpr { #[inline] fn kind() -> SyntaxKind @@ -4490,6 +5608,21 @@ impl AstNode for PathExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PathExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PathExpr {} +impl PartialEq for PathExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PathExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PathExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PathExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for PathPat { #[inline] fn kind() -> SyntaxKind @@ -4511,6 +5644,21 @@ impl AstNode for PathPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PathPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PathPat {} +impl PartialEq for PathPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PathPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PathPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PathPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for PathSegment { #[inline] fn kind() -> SyntaxKind @@ -4532,6 +5680,21 @@ impl AstNode for PathSegment { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PathSegment { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PathSegment {} +impl PartialEq for PathSegment { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PathSegment { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PathSegment { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PathSegment").field("syntax", &self.syntax).finish() + } +} impl AstNode for PathType { #[inline] fn kind() -> SyntaxKind @@ -4553,6 +5716,21 @@ impl AstNode for PathType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PathType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PathType {} +impl PartialEq for PathType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PathType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PathType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PathType").field("syntax", &self.syntax).finish() + } +} impl AstNode for PrefixExpr { #[inline] fn kind() -> SyntaxKind @@ -4574,6 +5752,21 @@ impl AstNode for PrefixExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PrefixExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PrefixExpr {} +impl PartialEq for PrefixExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PrefixExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PrefixExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PrefixExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for PtrType { #[inline] fn kind() -> SyntaxKind @@ -4595,6 +5788,21 @@ impl AstNode for PtrType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for PtrType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for PtrType {} +impl PartialEq for PtrType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for PtrType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for PtrType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("PtrType").field("syntax", &self.syntax).finish() + } +} impl AstNode for RangeExpr { #[inline] fn kind() -> SyntaxKind @@ -4616,6 +5824,21 @@ impl AstNode for RangeExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RangeExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RangeExpr {} +impl PartialEq for RangeExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RangeExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RangeExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RangeExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for RangePat { #[inline] fn kind() -> SyntaxKind @@ -4637,6 +5860,21 @@ impl AstNode for RangePat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RangePat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RangePat {} +impl PartialEq for RangePat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RangePat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RangePat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RangePat").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordExpr { #[inline] fn kind() -> SyntaxKind @@ -4658,6 +5896,21 @@ impl AstNode for RecordExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordExpr {} +impl PartialEq for RecordExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordExprField { #[inline] fn kind() -> SyntaxKind @@ -4679,6 +5932,21 @@ impl AstNode for RecordExprField { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordExprField { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordExprField {} +impl PartialEq for RecordExprField { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordExprField { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordExprField { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordExprField").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordExprFieldList { #[inline] fn kind() -> SyntaxKind @@ -4700,6 +5968,21 @@ impl AstNode for RecordExprFieldList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordExprFieldList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordExprFieldList {} +impl PartialEq for RecordExprFieldList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordExprFieldList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordExprFieldList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordExprFieldList").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordField { #[inline] fn kind() -> SyntaxKind @@ -4721,6 +6004,21 @@ impl AstNode for RecordField { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordField { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordField {} +impl PartialEq for RecordField { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordField { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordField { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordField").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordFieldList { #[inline] fn kind() -> SyntaxKind @@ -4742,6 +6040,21 @@ impl AstNode for RecordFieldList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordFieldList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordFieldList {} +impl PartialEq for RecordFieldList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordFieldList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordFieldList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordFieldList").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordPat { #[inline] fn kind() -> SyntaxKind @@ -4763,6 +6076,21 @@ impl AstNode for RecordPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordPat {} +impl PartialEq for RecordPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordPatField { #[inline] fn kind() -> SyntaxKind @@ -4784,6 +6112,21 @@ impl AstNode for RecordPatField { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordPatField { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordPatField {} +impl PartialEq for RecordPatField { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordPatField { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordPatField { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordPatField").field("syntax", &self.syntax).finish() + } +} impl AstNode for RecordPatFieldList { #[inline] fn kind() -> SyntaxKind @@ -4805,6 +6148,21 @@ impl AstNode for RecordPatFieldList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RecordPatFieldList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RecordPatFieldList {} +impl PartialEq for RecordPatFieldList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RecordPatFieldList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RecordPatFieldList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RecordPatFieldList").field("syntax", &self.syntax).finish() + } +} impl AstNode for RefExpr { #[inline] fn kind() -> SyntaxKind @@ -4826,6 +6184,21 @@ impl AstNode for RefExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RefExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RefExpr {} +impl PartialEq for RefExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RefExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RefExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RefExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for RefPat { #[inline] fn kind() -> SyntaxKind @@ -4847,6 +6220,21 @@ impl AstNode for RefPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RefPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RefPat {} +impl PartialEq for RefPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RefPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RefPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RefPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for RefType { #[inline] fn kind() -> SyntaxKind @@ -4868,6 +6256,21 @@ impl AstNode for RefType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RefType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RefType {} +impl PartialEq for RefType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RefType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RefType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RefType").field("syntax", &self.syntax).finish() + } +} impl AstNode for Rename { #[inline] fn kind() -> SyntaxKind @@ -4889,6 +6292,21 @@ impl AstNode for Rename { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Rename { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Rename {} +impl PartialEq for Rename { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Rename { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Rename { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Rename").field("syntax", &self.syntax).finish() + } +} impl AstNode for RestPat { #[inline] fn kind() -> SyntaxKind @@ -4910,6 +6328,21 @@ impl AstNode for RestPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RestPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RestPat {} +impl PartialEq for RestPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RestPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RestPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RestPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for RetType { #[inline] fn kind() -> SyntaxKind @@ -4931,6 +6364,21 @@ impl AstNode for RetType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for RetType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for RetType {} +impl PartialEq for RetType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for RetType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for RetType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("RetType").field("syntax", &self.syntax).finish() + } +} impl AstNode for ReturnExpr { #[inline] fn kind() -> SyntaxKind @@ -4952,6 +6400,21 @@ impl AstNode for ReturnExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ReturnExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ReturnExpr {} +impl PartialEq for ReturnExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ReturnExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ReturnExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ReturnExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for ReturnTypeSyntax { #[inline] fn kind() -> SyntaxKind @@ -4973,6 +6436,21 @@ impl AstNode for ReturnTypeSyntax { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for ReturnTypeSyntax { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ReturnTypeSyntax {} +impl PartialEq for ReturnTypeSyntax { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for ReturnTypeSyntax { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for ReturnTypeSyntax { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ReturnTypeSyntax").field("syntax", &self.syntax).finish() + } +} impl AstNode for SelfParam { #[inline] fn kind() -> SyntaxKind @@ -4994,6 +6472,21 @@ impl AstNode for SelfParam { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for SelfParam { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for SelfParam {} +impl PartialEq for SelfParam { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for SelfParam { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for SelfParam { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("SelfParam").field("syntax", &self.syntax).finish() + } +} impl AstNode for SlicePat { #[inline] fn kind() -> SyntaxKind @@ -5015,6 +6508,21 @@ impl AstNode for SlicePat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for SlicePat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for SlicePat {} +impl PartialEq for SlicePat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for SlicePat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for SlicePat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("SlicePat").field("syntax", &self.syntax).finish() + } +} impl AstNode for SliceType { #[inline] fn kind() -> SyntaxKind @@ -5036,6 +6544,21 @@ impl AstNode for SliceType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for SliceType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for SliceType {} +impl PartialEq for SliceType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for SliceType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for SliceType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("SliceType").field("syntax", &self.syntax).finish() + } +} impl AstNode for SourceFile { #[inline] fn kind() -> SyntaxKind @@ -5057,6 +6580,21 @@ impl AstNode for SourceFile { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for SourceFile { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for SourceFile {} +impl PartialEq for SourceFile { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for SourceFile { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for SourceFile { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("SourceFile").field("syntax", &self.syntax).finish() + } +} impl AstNode for Static { #[inline] fn kind() -> SyntaxKind @@ -5078,6 +6616,21 @@ impl AstNode for Static { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Static { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Static {} +impl PartialEq for Static { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Static { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Static { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Static").field("syntax", &self.syntax).finish() + } +} impl AstNode for StmtList { #[inline] fn kind() -> SyntaxKind @@ -5099,6 +6652,21 @@ impl AstNode for StmtList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for StmtList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for StmtList {} +impl PartialEq for StmtList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for StmtList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for StmtList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("StmtList").field("syntax", &self.syntax).finish() + } +} impl AstNode for Struct { #[inline] fn kind() -> SyntaxKind @@ -5120,6 +6688,21 @@ impl AstNode for Struct { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Struct { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Struct {} +impl PartialEq for Struct { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Struct { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Struct { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Struct").field("syntax", &self.syntax).finish() + } +} impl AstNode for TokenTree { #[inline] fn kind() -> SyntaxKind @@ -5141,6 +6724,21 @@ impl AstNode for TokenTree { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TokenTree { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TokenTree {} +impl PartialEq for TokenTree { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TokenTree { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TokenTree { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TokenTree").field("syntax", &self.syntax).finish() + } +} impl AstNode for Trait { #[inline] fn kind() -> SyntaxKind @@ -5162,6 +6760,21 @@ impl AstNode for Trait { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Trait { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Trait {} +impl PartialEq for Trait { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Trait { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Trait { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Trait").field("syntax", &self.syntax).finish() + } +} impl AstNode for TraitAlias { #[inline] fn kind() -> SyntaxKind @@ -5183,6 +6796,21 @@ impl AstNode for TraitAlias { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TraitAlias { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TraitAlias {} +impl PartialEq for TraitAlias { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TraitAlias { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TraitAlias { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TraitAlias").field("syntax", &self.syntax).finish() + } +} impl AstNode for TryExpr { #[inline] fn kind() -> SyntaxKind @@ -5204,6 +6832,21 @@ impl AstNode for TryExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TryExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TryExpr {} +impl PartialEq for TryExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TryExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TryExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TryExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for TupleExpr { #[inline] fn kind() -> SyntaxKind @@ -5225,6 +6868,21 @@ impl AstNode for TupleExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TupleExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TupleExpr {} +impl PartialEq for TupleExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TupleExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TupleExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TupleExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for TupleField { #[inline] fn kind() -> SyntaxKind @@ -5246,6 +6904,21 @@ impl AstNode for TupleField { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TupleField { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TupleField {} +impl PartialEq for TupleField { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TupleField { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TupleField { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TupleField").field("syntax", &self.syntax).finish() + } +} impl AstNode for TupleFieldList { #[inline] fn kind() -> SyntaxKind @@ -5267,6 +6940,21 @@ impl AstNode for TupleFieldList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TupleFieldList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TupleFieldList {} +impl PartialEq for TupleFieldList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TupleFieldList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TupleFieldList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TupleFieldList").field("syntax", &self.syntax).finish() + } +} impl AstNode for TuplePat { #[inline] fn kind() -> SyntaxKind @@ -5288,6 +6976,21 @@ impl AstNode for TuplePat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TuplePat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TuplePat {} +impl PartialEq for TuplePat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TuplePat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TuplePat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TuplePat").field("syntax", &self.syntax).finish() + } +} impl AstNode for TupleStructPat { #[inline] fn kind() -> SyntaxKind @@ -5309,6 +7012,21 @@ impl AstNode for TupleStructPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TupleStructPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TupleStructPat {} +impl PartialEq for TupleStructPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TupleStructPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TupleStructPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TupleStructPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for TupleType { #[inline] fn kind() -> SyntaxKind @@ -5330,6 +7048,21 @@ impl AstNode for TupleType { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TupleType { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TupleType {} +impl PartialEq for TupleType { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TupleType { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TupleType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TupleType").field("syntax", &self.syntax).finish() + } +} impl AstNode for TypeAlias { #[inline] fn kind() -> SyntaxKind @@ -5351,6 +7084,21 @@ impl AstNode for TypeAlias { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TypeAlias { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TypeAlias {} +impl PartialEq for TypeAlias { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TypeAlias { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TypeAlias { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TypeAlias").field("syntax", &self.syntax).finish() + } +} impl AstNode for TypeArg { #[inline] fn kind() -> SyntaxKind @@ -5372,6 +7120,21 @@ impl AstNode for TypeArg { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TypeArg { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TypeArg {} +impl PartialEq for TypeArg { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TypeArg { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TypeArg { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TypeArg").field("syntax", &self.syntax).finish() + } +} impl AstNode for TypeBound { #[inline] fn kind() -> SyntaxKind @@ -5393,6 +7156,21 @@ impl AstNode for TypeBound { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TypeBound { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TypeBound {} +impl PartialEq for TypeBound { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TypeBound { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TypeBound { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TypeBound").field("syntax", &self.syntax).finish() + } +} impl AstNode for TypeBoundList { #[inline] fn kind() -> SyntaxKind @@ -5414,6 +7192,21 @@ impl AstNode for TypeBoundList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TypeBoundList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TypeBoundList {} +impl PartialEq for TypeBoundList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TypeBoundList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TypeBoundList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TypeBoundList").field("syntax", &self.syntax).finish() + } +} impl AstNode for TypeParam { #[inline] fn kind() -> SyntaxKind @@ -5435,6 +7228,21 @@ impl AstNode for TypeParam { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for TypeParam { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for TypeParam {} +impl PartialEq for TypeParam { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for TypeParam { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for TypeParam { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("TypeParam").field("syntax", &self.syntax).finish() + } +} impl AstNode for UnderscoreExpr { #[inline] fn kind() -> SyntaxKind @@ -5456,6 +7264,21 @@ impl AstNode for UnderscoreExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for UnderscoreExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for UnderscoreExpr {} +impl PartialEq for UnderscoreExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for UnderscoreExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for UnderscoreExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("UnderscoreExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for Union { #[inline] fn kind() -> SyntaxKind @@ -5477,6 +7300,21 @@ impl AstNode for Union { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Union { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Union {} +impl PartialEq for Union { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Union { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Union { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Union").field("syntax", &self.syntax).finish() + } +} impl AstNode for Use { #[inline] fn kind() -> SyntaxKind @@ -5498,6 +7336,21 @@ impl AstNode for Use { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Use { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Use {} +impl PartialEq for Use { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Use { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Use { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Use").field("syntax", &self.syntax).finish() + } +} impl AstNode for UseBoundGenericArgs { #[inline] fn kind() -> SyntaxKind @@ -5519,6 +7372,21 @@ impl AstNode for UseBoundGenericArgs { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for UseBoundGenericArgs { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for UseBoundGenericArgs {} +impl PartialEq for UseBoundGenericArgs { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for UseBoundGenericArgs { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for UseBoundGenericArgs { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("UseBoundGenericArgs").field("syntax", &self.syntax).finish() + } +} impl AstNode for UseTree { #[inline] fn kind() -> SyntaxKind @@ -5540,6 +7408,21 @@ impl AstNode for UseTree { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for UseTree { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for UseTree {} +impl PartialEq for UseTree { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for UseTree { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for UseTree { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("UseTree").field("syntax", &self.syntax).finish() + } +} impl AstNode for UseTreeList { #[inline] fn kind() -> SyntaxKind @@ -5561,6 +7444,21 @@ impl AstNode for UseTreeList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for UseTreeList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for UseTreeList {} +impl PartialEq for UseTreeList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for UseTreeList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for UseTreeList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("UseTreeList").field("syntax", &self.syntax).finish() + } +} impl AstNode for Variant { #[inline] fn kind() -> SyntaxKind @@ -5582,6 +7480,21 @@ impl AstNode for Variant { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Variant { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Variant {} +impl PartialEq for Variant { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Variant { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Variant { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Variant").field("syntax", &self.syntax).finish() + } +} impl AstNode for VariantList { #[inline] fn kind() -> SyntaxKind @@ -5603,6 +7516,21 @@ impl AstNode for VariantList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for VariantList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for VariantList {} +impl PartialEq for VariantList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for VariantList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for VariantList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("VariantList").field("syntax", &self.syntax).finish() + } +} impl AstNode for Visibility { #[inline] fn kind() -> SyntaxKind @@ -5624,6 +7552,21 @@ impl AstNode for Visibility { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for Visibility { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Visibility {} +impl PartialEq for Visibility { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for Visibility { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for Visibility { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Visibility").field("syntax", &self.syntax).finish() + } +} impl AstNode for WhereClause { #[inline] fn kind() -> SyntaxKind @@ -5645,6 +7588,21 @@ impl AstNode for WhereClause { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for WhereClause { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for WhereClause {} +impl PartialEq for WhereClause { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for WhereClause { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for WhereClause { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("WhereClause").field("syntax", &self.syntax).finish() + } +} impl AstNode for WherePred { #[inline] fn kind() -> SyntaxKind @@ -5666,6 +7624,21 @@ impl AstNode for WherePred { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for WherePred { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for WherePred {} +impl PartialEq for WherePred { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for WherePred { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for WherePred { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("WherePred").field("syntax", &self.syntax).finish() + } +} impl AstNode for WhileExpr { #[inline] fn kind() -> SyntaxKind @@ -5687,6 +7660,21 @@ impl AstNode for WhileExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for WhileExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for WhileExpr {} +impl PartialEq for WhileExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for WhileExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for WhileExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("WhileExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for WildcardPat { #[inline] fn kind() -> SyntaxKind @@ -5708,6 +7696,21 @@ impl AstNode for WildcardPat { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for WildcardPat { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for WildcardPat {} +impl PartialEq for WildcardPat { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for WildcardPat { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for WildcardPat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("WildcardPat").field("syntax", &self.syntax).finish() + } +} impl AstNode for YeetExpr { #[inline] fn kind() -> SyntaxKind @@ -5729,6 +7732,21 @@ impl AstNode for YeetExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for YeetExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for YeetExpr {} +impl PartialEq for YeetExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for YeetExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for YeetExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("YeetExpr").field("syntax", &self.syntax).finish() + } +} impl AstNode for YieldExpr { #[inline] fn kind() -> SyntaxKind @@ -5750,6 +7768,21 @@ impl AstNode for YieldExpr { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for YieldExpr { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for YieldExpr {} +impl PartialEq for YieldExpr { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for YieldExpr { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for YieldExpr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("YieldExpr").field("syntax", &self.syntax).finish() + } +} impl From<Enum> for Adt { #[inline] fn from(node: Enum) -> Adt { Adt::Enum(node) } @@ -6783,12 +8816,7 @@ impl AstNode for VariantDef { } } } -impl AnyHasArgList { - #[inline] - pub fn new<T: ast::HasArgList>(node: T) -> AnyHasArgList { - AnyHasArgList { syntax: node.syntax().clone() } - } -} +impl ast::HasArgList for AnyHasArgList {} impl AstNode for AnyHasArgList { #[inline] fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, CALL_EXPR | METHOD_CALL_EXPR) } @@ -6799,6 +8827,21 @@ impl AstNode for AnyHasArgList { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasArgList { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasArgList {} +impl PartialEq for AnyHasArgList { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasArgList { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasArgList { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasArgList").field("syntax", &self.syntax).finish() + } +} impl From<CallExpr> for AnyHasArgList { #[inline] fn from(node: CallExpr) -> AnyHasArgList { AnyHasArgList { syntax: node.syntax } } @@ -6807,12 +8850,7 @@ impl From<MethodCallExpr> for AnyHasArgList { #[inline] fn from(node: MethodCallExpr) -> AnyHasArgList { AnyHasArgList { syntax: node.syntax } } } -impl AnyHasAttrs { - #[inline] - pub fn new<T: ast::HasAttrs>(node: T) -> AnyHasAttrs { - AnyHasAttrs { syntax: node.syntax().clone() } - } -} +impl ast::HasAttrs for AnyHasAttrs {} impl AstNode for AnyHasAttrs { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -6899,6 +8937,21 @@ impl AstNode for AnyHasAttrs { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasAttrs { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasAttrs {} +impl PartialEq for AnyHasAttrs { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasAttrs { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasAttrs { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasAttrs").field("syntax", &self.syntax).finish() + } +} impl From<ArrayExpr> for AnyHasAttrs { #[inline] fn from(node: ArrayExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } } @@ -7187,12 +9240,7 @@ impl From<YieldExpr> for AnyHasAttrs { #[inline] fn from(node: YieldExpr) -> AnyHasAttrs { AnyHasAttrs { syntax: node.syntax } } } -impl AnyHasDocComments { - #[inline] - pub fn new<T: ast::HasDocComments>(node: T) -> AnyHasDocComments { - AnyHasDocComments { syntax: node.syntax().clone() } - } -} +impl ast::HasDocComments for AnyHasDocComments {} impl AstNode for AnyHasDocComments { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7228,6 +9276,21 @@ impl AstNode for AnyHasDocComments { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasDocComments { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasDocComments {} +impl PartialEq for AnyHasDocComments { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasDocComments { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasDocComments { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasDocComments").field("syntax", &self.syntax).finish() + } +} impl From<Const> for AnyHasDocComments { #[inline] fn from(node: Const) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } } @@ -7312,12 +9375,7 @@ impl From<Variant> for AnyHasDocComments { #[inline] fn from(node: Variant) -> AnyHasDocComments { AnyHasDocComments { syntax: node.syntax } } } -impl AnyHasGenericArgs { - #[inline] - pub fn new<T: ast::HasGenericArgs>(node: T) -> AnyHasGenericArgs { - AnyHasGenericArgs { syntax: node.syntax().clone() } - } -} +impl ast::HasGenericArgs for AnyHasGenericArgs {} impl AstNode for AnyHasGenericArgs { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7330,6 +9388,21 @@ impl AstNode for AnyHasGenericArgs { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasGenericArgs { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasGenericArgs {} +impl PartialEq for AnyHasGenericArgs { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasGenericArgs { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasGenericArgs { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasGenericArgs").field("syntax", &self.syntax).finish() + } +} impl From<AssocTypeArg> for AnyHasGenericArgs { #[inline] fn from(node: AssocTypeArg) -> AnyHasGenericArgs { AnyHasGenericArgs { syntax: node.syntax } } @@ -7342,12 +9415,7 @@ impl From<PathSegment> for AnyHasGenericArgs { #[inline] fn from(node: PathSegment) -> AnyHasGenericArgs { AnyHasGenericArgs { syntax: node.syntax } } } -impl AnyHasGenericParams { - #[inline] - pub fn new<T: ast::HasGenericParams>(node: T) -> AnyHasGenericParams { - AnyHasGenericParams { syntax: node.syntax().clone() } - } -} +impl ast::HasGenericParams for AnyHasGenericParams {} impl AstNode for AnyHasGenericParams { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7360,6 +9428,21 @@ impl AstNode for AnyHasGenericParams { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasGenericParams { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasGenericParams {} +impl PartialEq for AnyHasGenericParams { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasGenericParams { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasGenericParams { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasGenericParams").field("syntax", &self.syntax).finish() + } +} impl From<Enum> for AnyHasGenericParams { #[inline] fn from(node: Enum) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } } @@ -7392,12 +9475,7 @@ impl From<Union> for AnyHasGenericParams { #[inline] fn from(node: Union) -> AnyHasGenericParams { AnyHasGenericParams { syntax: node.syntax } } } -impl AnyHasLoopBody { - #[inline] - pub fn new<T: ast::HasLoopBody>(node: T) -> AnyHasLoopBody { - AnyHasLoopBody { syntax: node.syntax().clone() } - } -} +impl ast::HasLoopBody for AnyHasLoopBody {} impl AstNode for AnyHasLoopBody { #[inline] fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, FOR_EXPR | LOOP_EXPR | WHILE_EXPR) } @@ -7408,6 +9486,21 @@ impl AstNode for AnyHasLoopBody { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasLoopBody { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasLoopBody {} +impl PartialEq for AnyHasLoopBody { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasLoopBody { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasLoopBody { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasLoopBody").field("syntax", &self.syntax).finish() + } +} impl From<ForExpr> for AnyHasLoopBody { #[inline] fn from(node: ForExpr) -> AnyHasLoopBody { AnyHasLoopBody { syntax: node.syntax } } @@ -7420,12 +9513,7 @@ impl From<WhileExpr> for AnyHasLoopBody { #[inline] fn from(node: WhileExpr) -> AnyHasLoopBody { AnyHasLoopBody { syntax: node.syntax } } } -impl AnyHasModuleItem { - #[inline] - pub fn new<T: ast::HasModuleItem>(node: T) -> AnyHasModuleItem { - AnyHasModuleItem { syntax: node.syntax().clone() } - } -} +impl ast::HasModuleItem for AnyHasModuleItem {} impl AstNode for AnyHasModuleItem { #[inline] fn can_cast(kind: SyntaxKind) -> bool { matches!(kind, ITEM_LIST | MACRO_ITEMS | SOURCE_FILE) } @@ -7436,6 +9524,21 @@ impl AstNode for AnyHasModuleItem { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasModuleItem { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasModuleItem {} +impl PartialEq for AnyHasModuleItem { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasModuleItem { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasModuleItem { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasModuleItem").field("syntax", &self.syntax).finish() + } +} impl From<ItemList> for AnyHasModuleItem { #[inline] fn from(node: ItemList) -> AnyHasModuleItem { AnyHasModuleItem { syntax: node.syntax } } @@ -7448,12 +9551,7 @@ impl From<SourceFile> for AnyHasModuleItem { #[inline] fn from(node: SourceFile) -> AnyHasModuleItem { AnyHasModuleItem { syntax: node.syntax } } } -impl AnyHasName { - #[inline] - pub fn new<T: ast::HasName>(node: T) -> AnyHasName { - AnyHasName { syntax: node.syntax().clone() } - } -} +impl ast::HasName for AnyHasName {} impl AstNode for AnyHasName { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7489,6 +9587,21 @@ impl AstNode for AnyHasName { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasName { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasName {} +impl PartialEq for AnyHasName { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasName { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasName { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasName").field("syntax", &self.syntax).finish() + } +} impl From<AsmOperandNamed> for AnyHasName { #[inline] fn from(node: AsmOperandNamed) -> AnyHasName { AnyHasName { syntax: node.syntax } } @@ -7573,12 +9686,7 @@ impl From<Variant> for AnyHasName { #[inline] fn from(node: Variant) -> AnyHasName { AnyHasName { syntax: node.syntax } } } -impl AnyHasTypeBounds { - #[inline] - pub fn new<T: ast::HasTypeBounds>(node: T) -> AnyHasTypeBounds { - AnyHasTypeBounds { syntax: node.syntax().clone() } - } -} +impl ast::HasTypeBounds for AnyHasTypeBounds {} impl AstNode for AnyHasTypeBounds { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7594,6 +9702,21 @@ impl AstNode for AnyHasTypeBounds { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasTypeBounds { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasTypeBounds {} +impl PartialEq for AnyHasTypeBounds { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasTypeBounds { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasTypeBounds { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasTypeBounds").field("syntax", &self.syntax).finish() + } +} impl From<AssocTypeArg> for AnyHasTypeBounds { #[inline] fn from(node: AssocTypeArg) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } } @@ -7618,12 +9741,7 @@ impl From<WherePred> for AnyHasTypeBounds { #[inline] fn from(node: WherePred) -> AnyHasTypeBounds { AnyHasTypeBounds { syntax: node.syntax } } } -impl AnyHasVisibility { - #[inline] - pub fn new<T: ast::HasVisibility>(node: T) -> AnyHasVisibility { - AnyHasVisibility { syntax: node.syntax().clone() } - } -} +impl ast::HasVisibility for AnyHasVisibility {} impl AstNode for AnyHasVisibility { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -7656,6 +9774,21 @@ impl AstNode for AnyHasVisibility { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl hash::Hash for AnyHasVisibility { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for AnyHasVisibility {} +impl PartialEq for AnyHasVisibility { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} +impl Clone for AnyHasVisibility { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl fmt::Debug for AnyHasVisibility { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("AnyHasVisibility").field("syntax", &self.syntax).finish() + } +} impl From<Const> for AnyHasVisibility { #[inline] fn from(node: Const) -> AnyHasVisibility { AnyHasVisibility { syntax: node.syntax } } diff --git a/crates/syntax/src/ast/generated/tokens.rs b/crates/syntax/src/ast/generated/tokens.rs index df2e9619db1c..b2f56c0b1dbf 100644 --- a/crates/syntax/src/ast/generated/tokens.rs +++ b/crates/syntax/src/ast/generated/tokens.rs @@ -5,8 +5,7 @@ use crate::{ SyntaxKind::{self, *}, SyntaxToken, }; - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +use std::{fmt, hash}; pub struct Byte { pub(crate) syntax: SyntaxToken, } @@ -26,8 +25,21 @@ impl AstToken for Byte { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for Byte { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Byte").field("syntax", &self.syntax).finish() + } +} +impl Clone for Byte { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for Byte { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Byte {} +impl PartialEq for Byte { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct ByteString { pub(crate) syntax: SyntaxToken, } @@ -47,8 +59,21 @@ impl AstToken for ByteString { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for ByteString { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ByteString").field("syntax", &self.syntax).finish() + } +} +impl Clone for ByteString { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for ByteString { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for ByteString {} +impl PartialEq for ByteString { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct CString { pub(crate) syntax: SyntaxToken, } @@ -68,8 +93,21 @@ impl AstToken for CString { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for CString { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("CString").field("syntax", &self.syntax).finish() + } +} +impl Clone for CString { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for CString { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for CString {} +impl PartialEq for CString { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct Char { pub(crate) syntax: SyntaxToken, } @@ -89,8 +127,21 @@ impl AstToken for Char { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for Char { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Char").field("syntax", &self.syntax).finish() + } +} +impl Clone for Char { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for Char { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Char {} +impl PartialEq for Char { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct Comment { pub(crate) syntax: SyntaxToken, } @@ -110,8 +161,21 @@ impl AstToken for Comment { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for Comment { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Comment").field("syntax", &self.syntax).finish() + } +} +impl Clone for Comment { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for Comment { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Comment {} +impl PartialEq for Comment { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct FloatNumber { pub(crate) syntax: SyntaxToken, } @@ -131,8 +195,21 @@ impl AstToken for FloatNumber { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for FloatNumber { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FloatNumber").field("syntax", &self.syntax).finish() + } +} +impl Clone for FloatNumber { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for FloatNumber { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for FloatNumber {} +impl PartialEq for FloatNumber { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct Ident { pub(crate) syntax: SyntaxToken, } @@ -152,8 +229,21 @@ impl AstToken for Ident { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for Ident { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Ident").field("syntax", &self.syntax).finish() + } +} +impl Clone for Ident { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for Ident { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Ident {} +impl PartialEq for Ident { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct IntNumber { pub(crate) syntax: SyntaxToken, } @@ -173,8 +263,21 @@ impl AstToken for IntNumber { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for IntNumber { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("IntNumber").field("syntax", &self.syntax).finish() + } +} +impl Clone for IntNumber { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for IntNumber { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for IntNumber {} +impl PartialEq for IntNumber { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct String { pub(crate) syntax: SyntaxToken, } @@ -194,8 +297,21 @@ impl AstToken for String { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } - -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +impl fmt::Debug for String { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("String").field("syntax", &self.syntax).finish() + } +} +impl Clone for String { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for String { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for String {} +impl PartialEq for String { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} pub struct Whitespace { pub(crate) syntax: SyntaxToken, } @@ -215,3 +331,18 @@ impl AstToken for Whitespace { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } +impl fmt::Debug for Whitespace { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Whitespace").field("syntax", &self.syntax).finish() + } +} +impl Clone for Whitespace { + fn clone(&self) -> Self { Self { syntax: self.syntax.clone() } } +} +impl hash::Hash for Whitespace { + fn hash<H: hash::Hasher>(&self, state: &mut H) { self.syntax.hash(state); } +} +impl Eq for Whitespace {} +impl PartialEq for Whitespace { + fn eq(&self, other: &Self) -> bool { self.syntax == other.syntax } +} diff --git a/xtask/src/codegen/grammar.rs b/xtask/src/codegen/grammar.rs index e9f38715852c..bdba1b348d91 100644 --- a/xtask/src/codegen/grammar.rs +++ b/xtask/src/codegen/grammar.rs @@ -67,7 +67,6 @@ fn generate_tokens(grammar: &AstSrc) -> String { let name = format_ident!("{}", token); let kind = format_ident!("{}", to_upper_snake_case(token)); quote! { - #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct #name { pub(crate) syntax: SyntaxToken, } @@ -83,6 +82,29 @@ fn generate_tokens(grammar: &AstSrc) -> String { } fn syntax(&self) -> &SyntaxToken { &self.syntax } } + + impl fmt::Debug for #name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct(#token).field("syntax", &self.syntax).finish() + } + } + impl Clone for #name { + fn clone(&self) -> Self { + Self { syntax: self.syntax.clone() } + } + } + impl hash::Hash for #name { + fn hash<H: hash::Hasher>(&self, state: &mut H) { + self.syntax.hash(state); + } + } + + impl Eq for #name {} + impl PartialEq for #name { + fn eq(&self, other: &Self) -> bool { + self.syntax == other.syntax + } + } } }); @@ -90,7 +112,10 @@ fn generate_tokens(grammar: &AstSrc) -> String { crate::flags::CodegenType::Grammar, reformat( quote! { + use std::{fmt, hash}; + use crate::{SyntaxKind::{self, *}, SyntaxToken, ast::AstToken}; + #(#tokens)* } .to_string(), @@ -104,6 +129,7 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { .nodes .iter() .map(|node| { + let node_str_name = &node.name; let name = format_ident!("{}", node.name); let kind = format_ident!("{}", to_upper_snake_case(&node.name)); let traits = node @@ -149,7 +175,6 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { ( quote! { #[pretty_doc_comment_placeholder_workaround] - #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct #name { pub(crate) syntax: SyntaxNode, } @@ -180,6 +205,31 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { #[inline] fn syntax(&self) -> &SyntaxNode { &self.syntax } } + + impl hash::Hash for #name { + fn hash<H: hash::Hasher>(&self, state: &mut H) { + self.syntax.hash(state); + } + } + + impl Eq for #name {} + impl PartialEq for #name { + fn eq(&self, other: &Self) -> bool { + self.syntax == other.syntax + } + } + + impl Clone for #name { + fn clone(&self) -> Self { + Self { syntax: self.syntax.clone() } + } + } + + impl fmt::Debug for #name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct(#node_str_name).field("syntax", &self.syntax).finish() + } + } }, ) }) @@ -265,6 +315,7 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { .sorted_by_key(|(name, _)| *name) .map(|(trait_name, nodes)| { let name = format_ident!("Any{}", trait_name); + let node_str_name = name.to_string(); let trait_name = format_ident!("{}", trait_name); let kinds: Vec<_> = nodes .iter() @@ -274,13 +325,9 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { ( quote! { #[pretty_doc_comment_placeholder_workaround] - #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct #name { pub(crate) syntax: SyntaxNode, } - impl ast::#trait_name for #name {} - }, - quote! { impl #name { #[inline] pub fn new<T: ast::#trait_name>(node: T) -> #name { @@ -289,6 +336,9 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { } } } + }, + quote! { + impl ast::#trait_name for #name {} impl AstNode for #name { #[inline] fn can_cast(kind: SyntaxKind) -> bool { @@ -304,6 +354,31 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { } } + impl hash::Hash for #name { + fn hash<H: hash::Hasher>(&self, state: &mut H) { + self.syntax.hash(state); + } + } + + impl Eq for #name {} + impl PartialEq for #name { + fn eq(&self, other: &Self) -> bool { + self.syntax == other.syntax + } + } + + impl Clone for #name { + fn clone(&self) -> Self { + Self { syntax: self.syntax.clone() } + } + } + + impl fmt::Debug for #name { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct(#node_str_name).field("syntax", &self.syntax).finish() + } + } + #( impl From<#nodes> for #name { #[inline] @@ -346,6 +421,8 @@ fn generate_nodes(kinds: KindsSrc, grammar: &AstSrc) -> String { let ast = quote! { #![allow(non_snake_case)] + use std::{fmt, hash}; + use crate::{ SyntaxNode, SyntaxToken, SyntaxKind::{self, *}, ast::{self, AstNode, AstChildren, support}, @@ -613,7 +690,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String { impl ::core::cmp::PartialOrd for SyntaxKind { #[inline] fn partial_cmp(&self, other: &Self) -> core::option::Option<core::cmp::Ordering> { - (*self as u16).partial_cmp(&(*other as u16)) + Some(self.cmp(other)) } } impl ::core::cmp::Ord for SyntaxKind { From 3d9ac497aaab47efcaa2b518a0d18c99b1502a73 Mon Sep 17 00:00:00 2001 From: Lukas Wirth <lukastw97@gmail.com> Date: Fri, 21 Mar 2025 10:26:55 +0100 Subject: [PATCH 3/3] fix: Fix incorrect expansion of builtin `PartialOrd` derive --- .../hir-def/src/macro_expansion_tests/builtin_derive_macro.rs | 2 +- crates/hir-expand/src/builtin/derive_macro.rs | 2 +- crates/parser/src/syntax_kind.rs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs b/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs index c31d32213289..777953d3f212 100644 --- a/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs +++ b/crates/hir-def/src/macro_expansion_tests/builtin_derive_macro.rs @@ -336,7 +336,7 @@ enum Command { } impl <> $crate::cmp::PartialOrd for Command< > where { - fn partial_cmp(&self , other: &Self ) -> $crate::option::Option::Option<$crate::cmp::Ordering> { + fn partial_cmp(&self , other: &Self ) -> $crate::option::Option<$crate::cmp::Ordering> { match $crate::intrinsics::discriminant_value(self ).partial_cmp(&$crate::intrinsics::discriminant_value(other)) { $crate::option::Option::Some($crate::cmp::Ordering::Equal)=> { match (self , other) { diff --git a/crates/hir-expand/src/builtin/derive_macro.rs b/crates/hir-expand/src/builtin/derive_macro.rs index b6181e8ce8c9..2ad8cd8377d5 100644 --- a/crates/hir-expand/src/builtin/derive_macro.rs +++ b/crates/hir-expand/src/builtin/derive_macro.rs @@ -969,7 +969,7 @@ fn partial_ord_expand( span, ); quote! {span => - fn partial_cmp(&self, other: &Self) -> #krate::option::Option::Option<#krate::cmp::Ordering> { + fn partial_cmp(&self, other: &Self) -> #krate::option::Option<#krate::cmp::Ordering> { #body } } diff --git a/crates/parser/src/syntax_kind.rs b/crates/parser/src/syntax_kind.rs index 6a8cca9ccc79..7311947525ed 100644 --- a/crates/parser/src/syntax_kind.rs +++ b/crates/parser/src/syntax_kind.rs @@ -1,6 +1,7 @@ //! Defines [`SyntaxKind`] -- a fieldless enum of all possible syntactic //! constructs of the Rust language. +#[rustfmt::skip] mod generated; use crate::Edition;