From 36d08b02c590512bbb0c4975aaf1bfbf1a4fb3af Mon Sep 17 00:00:00 2001 From: Haibo Huang Date: Tue, 8 Sep 2020 17:10:20 -0700 Subject: Upgrade rust/crates/syn to 1.0.40 Test: make Change-Id: I1cc16d202dd0622ab5c646fbcd80cc7bf436f258 --- .cargo_vcs_info.json | 2 +- Cargo.toml | 2 +- Cargo.toml.orig | 2 +- METADATA | 8 +- benches/rust.rs | 3 +- src/attr.rs | 41 +- src/buffer.rs | 19 +- src/error.rs | 9 +- src/expr.rs | 300 +---- src/ext.rs | 8 +- src/gen/clone.rs | 2051 +++++++++++++++++++++++++++++++ src/gen/debug.rs | 2857 ++++++++++++++++++++++++++++++++++++++++++++ src/gen/eq.rs | 1930 ++++++++++++++++++++++++++++++ src/gen/fold.rs | 268 ++--- src/gen/hash.rs | 2691 +++++++++++++++++++++++++++++++++++++++++ src/generics.rs | 89 +- src/item.rs | 306 +---- src/lib.rs | 23 +- src/lifetime.rs | 11 +- src/lit.rs | 156 ++- src/mac.rs | 32 +- src/macros.rs | 36 +- src/op.rs | 2 - src/parse.rs | 20 +- src/pat.rs | 112 +- src/punctuated.rs | 92 +- src/reserved.rs | 42 + src/token.rs | 33 +- src/ty.rs | 107 +- tests/common/eq.rs | 84 +- tests/repo/mod.rs | 7 +- tests/test_derive_input.rs | 4 +- tests/test_generics.rs | 2 +- tests/test_grouping.rs | 2 +- tests/test_lit.rs | 1 + tests/test_precedence.rs | 2 +- tests/test_round_trip.rs | 2 +- tests/test_shebang.rs | 2 +- tests/test_token_trees.rs | 2 +- 39 files changed, 10162 insertions(+), 1198 deletions(-) create mode 100644 src/gen/clone.rs create mode 100644 src/gen/debug.rs create mode 100644 src/gen/eq.rs create mode 100644 src/gen/hash.rs create mode 100644 src/reserved.rs diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json index 9bf65247..cf4bf5f3 100644 --- a/.cargo_vcs_info.json +++ b/.cargo_vcs_info.json @@ -1,5 +1,5 @@ { "git": { - "sha1": "81cabc50a95b9c5837b2d1b7b5ee107721d9eb49" + "sha1": "b66b940dbb15baa435a843d005221d87baca4cb4" } } diff --git a/Cargo.toml b/Cargo.toml index 8dce27e9..20277fc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "syn" -version = "1.0.38" +version = "1.0.40" authors = ["David Tolnay "] include = ["/benches/**", "/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"] description = "Parser for Rust source code" diff --git a/Cargo.toml.orig b/Cargo.toml.orig index c781560d..c61c5562 100644 --- a/Cargo.toml.orig +++ b/Cargo.toml.orig @@ -1,6 +1,6 @@ [package] name = "syn" -version = "1.0.38" # don't forget to update html_root_url and syn.json +version = "1.0.40" # don't forget to update html_root_url and syn.json authors = ["David Tolnay "] license = "MIT OR Apache-2.0" description = "Parser for Rust source code" diff --git a/METADATA b/METADATA index b838b040..3810dc69 100644 --- a/METADATA +++ b/METADATA @@ -7,13 +7,13 @@ third_party { } url { type: ARCHIVE - value: "https://static.crates.io/crates/syn/syn-1.0.38.crate" + value: "https://static.crates.io/crates/syn/syn-1.0.40.crate" } - version: "1.0.38" + version: "1.0.40" license_type: NOTICE last_upgrade_date { year: 2020 - month: 8 - day: 4 + month: 9 + day: 8 } } diff --git a/benches/rust.rs b/benches/rust.rs index ba9a3d4c..50e1a7f6 100644 --- a/benches/rust.rs +++ b/benches/rust.rs @@ -36,7 +36,6 @@ mod syn_parse { #[cfg(not(syn_only))] mod librustc_parse { - extern crate rustc_ast; extern crate rustc_data_structures; extern crate rustc_errors; extern crate rustc_parse; @@ -59,7 +58,7 @@ mod librustc_parse { } } - rustc_ast::with_session_globals(Edition::Edition2018, || { + rustc_span::with_session_globals(Edition::Edition2018, || { let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); let emitter = Box::new(SilentEmitter); let handler = Handler::with_emitter(false, None, emitter); diff --git a/src/attr.rs b/src/attr.rs index 2a4bced1..fa4f1cb2 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -9,10 +9,6 @@ use proc_macro2::TokenStream; use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result}; #[cfg(feature = "parsing")] use crate::punctuated::Pair; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; -#[cfg(feature = "extra-traits")] -use std::hash::{Hash, Hasher}; ast_struct! { /// An attribute like `#[repr(transparent)]`. @@ -139,8 +135,10 @@ ast_struct! { /// let attr: ItemMod = parse_quote! { /// #[doc = r" Single line doc comments"] /// #[doc = r" We write so many!"] - /// #[doc = r" Multi-line comments... - /// May span many lines"] + /// #[doc = r" + /// * Multi-line comments... + /// * May span many lines + /// "] /// mod example { /// #![doc = r" Of course, they can be inner too"] /// #![doc = r" And fit in a single line "] @@ -148,7 +146,7 @@ ast_struct! { /// }; /// assert_eq!(doc, attr); /// ``` - pub struct Attribute #manual_extra_traits { + pub struct Attribute { pub pound_token: Token![#], pub style: AttrStyle, pub bracket_token: token::Bracket, @@ -157,34 +155,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Attribute {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Attribute { - fn eq(&self, other: &Self) -> bool { - self.style == other.style - && self.pound_token == other.pound_token - && self.bracket_token == other.bracket_token - && self.path == other.path - && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens) - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Attribute { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - self.style.hash(state); - self.pound_token.hash(state); - self.bracket_token.hash(state); - self.path.hash(state); - TokenStreamHelper(&self.tokens).hash(state); - } -} - impl Attribute { /// Parses the content of the attribute, consisting of the path and tokens, /// as a [`Meta`] if possible. @@ -353,7 +323,6 @@ ast_enum! { /// - `#![feature(proc_macro)]` /// - `//! # Example` /// - `/*! Please file an issue */` - #[cfg_attr(feature = "clone-impls", derive(Copy))] pub enum AttrStyle { Outer, Inner(Token![!]), diff --git a/src/buffer.rs b/src/buffer.rs index 00aaa7de..a461cc49 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -134,7 +134,6 @@ impl TokenBuffer { /// stream, and have the same scope. /// /// *This type is available only if Syn is built with the `"parsing"` feature.* -#[derive(Copy, Clone, Eq, PartialEq)] pub struct Cursor<'a> { // The current entry which the `Cursor` is pointing at. ptr: *const Entry, @@ -365,6 +364,24 @@ impl<'a> Cursor<'a> { } } +impl<'a> Copy for Cursor<'a> {} + +impl<'a> Clone for Cursor<'a> { + fn clone(&self) -> Self { + *self + } +} + +impl<'a> Eq for Cursor<'a> {} + +impl<'a> PartialEq for Cursor<'a> { + fn eq(&self, other: &Self) -> bool { + let Cursor { ptr, scope, marker } = self; + let _ = marker; + *ptr == other.ptr && *scope == other.scope + } +} + pub(crate) fn same_scope(a: Cursor, b: Cursor) -> bool { a.scope == b.scope } diff --git a/src/error.rs b/src/error.rs index d155f984..dba34f92 100644 --- a/src/error.rs +++ b/src/error.rs @@ -81,7 +81,6 @@ pub type Result = std::result::Result; /// # } /// # } /// ``` -#[derive(Clone)] pub struct Error { messages: Vec, } @@ -288,6 +287,14 @@ impl Display for Error { } } +impl Clone for Error { + fn clone(&self) -> Self { + Error { + messages: self.messages.clone(), + } + } +} + impl Clone for ErrorMessage { fn clone(&self) -> Self { let start = self diff --git a/src/expr.rs b/src/expr.rs index 55a49058..2fe0e0b5 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1,7 +1,7 @@ use super::*; use crate::punctuated::Punctuated; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; +#[cfg(feature = "full")] +use crate::reserved::Reserved; use proc_macro2::{Span, TokenStream}; #[cfg(feature = "printing")] use quote::IdentFragment; @@ -86,7 +86,7 @@ ast_enum_of_structs! { /// A sign that you may not be choosing the right variable names is if you /// see names getting repeated in your code, like accessing /// `receiver.receiver` or `pat.pat` or `cond.cond`. - pub enum Expr #manual_extra_traits { + pub enum Expr { /// A slice literal expression: `[a, b, c, d]`. Array(ExprArray), @@ -720,232 +720,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Expr {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Expr { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (Expr::Array(this), Expr::Array(other)) => this == other, - (Expr::Assign(this), Expr::Assign(other)) => this == other, - (Expr::AssignOp(this), Expr::AssignOp(other)) => this == other, - (Expr::Async(this), Expr::Async(other)) => this == other, - (Expr::Await(this), Expr::Await(other)) => this == other, - (Expr::Binary(this), Expr::Binary(other)) => this == other, - (Expr::Block(this), Expr::Block(other)) => this == other, - (Expr::Box(this), Expr::Box(other)) => this == other, - (Expr::Break(this), Expr::Break(other)) => this == other, - (Expr::Call(this), Expr::Call(other)) => this == other, - (Expr::Cast(this), Expr::Cast(other)) => this == other, - (Expr::Closure(this), Expr::Closure(other)) => this == other, - (Expr::Continue(this), Expr::Continue(other)) => this == other, - (Expr::Field(this), Expr::Field(other)) => this == other, - (Expr::ForLoop(this), Expr::ForLoop(other)) => this == other, - (Expr::Group(this), Expr::Group(other)) => this == other, - (Expr::If(this), Expr::If(other)) => this == other, - (Expr::Index(this), Expr::Index(other)) => this == other, - (Expr::Let(this), Expr::Let(other)) => this == other, - (Expr::Lit(this), Expr::Lit(other)) => this == other, - (Expr::Loop(this), Expr::Loop(other)) => this == other, - (Expr::Macro(this), Expr::Macro(other)) => this == other, - (Expr::Match(this), Expr::Match(other)) => this == other, - (Expr::MethodCall(this), Expr::MethodCall(other)) => this == other, - (Expr::Paren(this), Expr::Paren(other)) => this == other, - (Expr::Path(this), Expr::Path(other)) => this == other, - (Expr::Range(this), Expr::Range(other)) => this == other, - (Expr::Reference(this), Expr::Reference(other)) => this == other, - (Expr::Repeat(this), Expr::Repeat(other)) => this == other, - (Expr::Return(this), Expr::Return(other)) => this == other, - (Expr::Struct(this), Expr::Struct(other)) => this == other, - (Expr::Try(this), Expr::Try(other)) => this == other, - (Expr::TryBlock(this), Expr::TryBlock(other)) => this == other, - (Expr::Tuple(this), Expr::Tuple(other)) => this == other, - (Expr::Type(this), Expr::Type(other)) => this == other, - (Expr::Unary(this), Expr::Unary(other)) => this == other, - (Expr::Unsafe(this), Expr::Unsafe(other)) => this == other, - (Expr::Verbatim(this), Expr::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - (Expr::While(this), Expr::While(other)) => this == other, - (Expr::Yield(this), Expr::Yield(other)) => this == other, - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Expr { - fn hash(&self, hash: &mut H) - where - H: Hasher, - { - match self { - Expr::Array(expr) => { - hash.write_u8(0); - expr.hash(hash); - } - Expr::Assign(expr) => { - hash.write_u8(1); - expr.hash(hash); - } - Expr::AssignOp(expr) => { - hash.write_u8(2); - expr.hash(hash); - } - Expr::Async(expr) => { - hash.write_u8(3); - expr.hash(hash); - } - Expr::Await(expr) => { - hash.write_u8(4); - expr.hash(hash); - } - Expr::Binary(expr) => { - hash.write_u8(5); - expr.hash(hash); - } - Expr::Block(expr) => { - hash.write_u8(6); - expr.hash(hash); - } - Expr::Box(expr) => { - hash.write_u8(7); - expr.hash(hash); - } - Expr::Break(expr) => { - hash.write_u8(8); - expr.hash(hash); - } - Expr::Call(expr) => { - hash.write_u8(9); - expr.hash(hash); - } - Expr::Cast(expr) => { - hash.write_u8(10); - expr.hash(hash); - } - Expr::Closure(expr) => { - hash.write_u8(11); - expr.hash(hash); - } - Expr::Continue(expr) => { - hash.write_u8(12); - expr.hash(hash); - } - Expr::Field(expr) => { - hash.write_u8(13); - expr.hash(hash); - } - Expr::ForLoop(expr) => { - hash.write_u8(14); - expr.hash(hash); - } - Expr::Group(expr) => { - hash.write_u8(15); - expr.hash(hash); - } - Expr::If(expr) => { - hash.write_u8(16); - expr.hash(hash); - } - Expr::Index(expr) => { - hash.write_u8(17); - expr.hash(hash); - } - Expr::Let(expr) => { - hash.write_u8(18); - expr.hash(hash); - } - Expr::Lit(expr) => { - hash.write_u8(19); - expr.hash(hash); - } - Expr::Loop(expr) => { - hash.write_u8(20); - expr.hash(hash); - } - Expr::Macro(expr) => { - hash.write_u8(21); - expr.hash(hash); - } - Expr::Match(expr) => { - hash.write_u8(22); - expr.hash(hash); - } - Expr::MethodCall(expr) => { - hash.write_u8(23); - expr.hash(hash); - } - Expr::Paren(expr) => { - hash.write_u8(24); - expr.hash(hash); - } - Expr::Path(expr) => { - hash.write_u8(25); - expr.hash(hash); - } - Expr::Range(expr) => { - hash.write_u8(26); - expr.hash(hash); - } - Expr::Reference(expr) => { - hash.write_u8(27); - expr.hash(hash); - } - Expr::Repeat(expr) => { - hash.write_u8(28); - expr.hash(hash); - } - Expr::Return(expr) => { - hash.write_u8(29); - expr.hash(hash); - } - Expr::Struct(expr) => { - hash.write_u8(30); - expr.hash(hash); - } - Expr::Try(expr) => { - hash.write_u8(31); - expr.hash(hash); - } - Expr::TryBlock(expr) => { - hash.write_u8(32); - expr.hash(hash); - } - Expr::Tuple(expr) => { - hash.write_u8(33); - expr.hash(hash); - } - Expr::Type(expr) => { - hash.write_u8(34); - expr.hash(hash); - } - Expr::Unary(expr) => { - hash.write_u8(35); - expr.hash(hash); - } - Expr::Unsafe(expr) => { - hash.write_u8(36); - expr.hash(hash); - } - Expr::Verbatim(expr) => { - hash.write_u8(37); - TokenStreamHelper(expr).hash(hash); - } - Expr::While(expr) => { - hash.write_u8(38); - expr.hash(hash); - } - Expr::Yield(expr) => { - hash.write_u8(39); - expr.hash(hash); - } - Expr::__Nonexhaustive => unreachable!(), - } - } -} - impl Expr { #[cfg(all(feature = "parsing", feature = "full"))] pub(crate) fn replace_attrs(&mut self, new: Vec) -> Vec { @@ -1001,8 +775,7 @@ ast_enum! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[derive(Eq, PartialEq, Hash)] - pub enum Member #manual_extra_traits { + pub enum Member { /// A named field like `self.x`. Named(Ident), /// An unnamed field like `self.0`. @@ -1010,6 +783,27 @@ ast_enum! { } } +impl Eq for Member {} + +impl PartialEq for Member { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Member::Named(this), Member::Named(other)) => this == other, + (Member::Unnamed(this), Member::Unnamed(other)) => this == other, + _ => false, + } + } +} + +impl Hash for Member { + fn hash(&self, state: &mut H) { + match self { + Member::Named(m) => m.hash(state), + Member::Unnamed(m) => m.hash(state), + } + } +} + #[cfg(feature = "printing")] impl IdentFragment for Member { fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { @@ -1032,7 +826,7 @@ ast_struct! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - pub struct Index #manual_extra_traits { + pub struct Index { pub index: u32, pub span: Span, } @@ -1073,14 +867,6 @@ impl IdentFragment for Index { } } -#[cfg(feature = "full")] -ast_struct! { - #[derive(Default)] - pub struct Reserved { - _private: (), - } -} - #[cfg(feature = "full")] ast_struct! { /// The `::<>` explicit type parameters passed to a method call: @@ -1179,7 +965,6 @@ ast_enum! { /// Limit types of a range, inclusive or exclusive. /// /// *This type is available only if Syn is built with the `"full"` feature.* - #[cfg_attr(feature = "clone-impls", derive(Copy))] pub enum RangeLimits { /// Inclusive at the beginning, exclusive at the end. HalfOpen(Token![..]), @@ -1212,6 +997,7 @@ pub(crate) mod parsing { use crate::parse::{Parse, ParseStream, Result}; use crate::path; + use std::cmp::Ordering; crate::custom_keyword!(raw); @@ -1220,10 +1006,8 @@ pub(crate) mod parsing { // // Struct literals are ambiguous in certain positions // https://github.com/rust-lang/rfcs/pull/92 - #[derive(Copy, Clone)] pub struct AllowStruct(bool); - #[derive(Copy, Clone, PartialEq, PartialOrd)] enum Precedence { Any, Assign, @@ -1364,6 +1148,36 @@ pub(crate) mod parsing { } } + impl Copy for AllowStruct {} + + impl Clone for AllowStruct { + fn clone(&self) -> Self { + *self + } + } + + impl Copy for Precedence {} + + impl Clone for Precedence { + fn clone(&self) -> Self { + *self + } + } + + impl PartialEq for Precedence { + fn eq(&self, other: &Self) -> bool { + *self as u8 == *other as u8 + } + } + + impl PartialOrd for Precedence { + fn partial_cmp(&self, other: &Self) -> Option { + let this = *self as u8; + let other = *other as u8; + Some(this.cmp(&other)) + } + } + #[cfg(feature = "full")] fn parse_expr( input: ParseStream, diff --git a/src/ext.rs b/src/ext.rs index b58baaaf..4f9bc145 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -129,7 +129,13 @@ mod private { impl Sealed for Ident {} - #[derive(Copy, Clone)] pub struct PeekFn; pub struct IdentAny; + + impl Copy for PeekFn {} + impl Clone for PeekFn { + fn clone(&self) -> Self { + *self + } + } } diff --git a/src/gen/clone.rs b/src/gen/clone.rs new file mode 100644 index 00000000..bea38870 --- /dev/null +++ b/src/gen/clone.rs @@ -0,0 +1,2051 @@ +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. + +#![allow(clippy::clone_on_copy, clippy::expl_impl_clone_on_copy)] +use crate::*; +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Abi { + fn clone(&self) -> Self { + Abi { + extern_token: self.extern_token.clone(), + name: self.name.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for AngleBracketedGenericArguments { + fn clone(&self) -> Self { + AngleBracketedGenericArguments { + colon2_token: self.colon2_token.clone(), + lt_token: self.lt_token.clone(), + args: self.args.clone(), + gt_token: self.gt_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Arm { + fn clone(&self) -> Self { + Arm { + attrs: self.attrs.clone(), + pat: self.pat.clone(), + guard: self.guard.clone(), + fat_arrow_token: self.fat_arrow_token.clone(), + body: self.body.clone(), + comma: self.comma.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Copy for AttrStyle {} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for AttrStyle { + fn clone(&self) -> Self { + *self + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Attribute { + fn clone(&self) -> Self { + Attribute { + pound_token: self.pound_token.clone(), + style: self.style.clone(), + bracket_token: self.bracket_token.clone(), + path: self.path.clone(), + tokens: self.tokens.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for BareFnArg { + fn clone(&self) -> Self { + BareFnArg { + attrs: self.attrs.clone(), + name: self.name.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Copy for BinOp {} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for BinOp { + fn clone(&self) -> Self { + *self + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Binding { + fn clone(&self) -> Self { + Binding { + ident: self.ident.clone(), + eq_token: self.eq_token.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Block { + fn clone(&self) -> Self { + Block { + brace_token: self.brace_token.clone(), + stmts: self.stmts.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for BoundLifetimes { + fn clone(&self) -> Self { + BoundLifetimes { + for_token: self.for_token.clone(), + lt_token: self.lt_token.clone(), + lifetimes: self.lifetimes.clone(), + gt_token: self.gt_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ConstParam { + fn clone(&self) -> Self { + ConstParam { + attrs: self.attrs.clone(), + const_token: self.const_token.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + eq_token: self.eq_token.clone(), + default: self.default.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Constraint { + fn clone(&self) -> Self { + Constraint { + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + } + } +} +#[cfg(feature = "derive")] +impl Clone for Data { + fn clone(&self) -> Self { + match self { + Data::Struct(v0) => Data::Struct(v0.clone()), + Data::Enum(v0) => Data::Enum(v0.clone()), + Data::Union(v0) => Data::Union(v0.clone()), + } + } +} +#[cfg(feature = "derive")] +impl Clone for DataEnum { + fn clone(&self) -> Self { + DataEnum { + enum_token: self.enum_token.clone(), + brace_token: self.brace_token.clone(), + variants: self.variants.clone(), + } + } +} +#[cfg(feature = "derive")] +impl Clone for DataStruct { + fn clone(&self) -> Self { + DataStruct { + struct_token: self.struct_token.clone(), + fields: self.fields.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "derive")] +impl Clone for DataUnion { + fn clone(&self) -> Self { + DataUnion { + union_token: self.union_token.clone(), + fields: self.fields.clone(), + } + } +} +#[cfg(feature = "derive")] +impl Clone for DeriveInput { + fn clone(&self) -> Self { + DeriveInput { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + data: self.data.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Expr { + fn clone(&self) -> Self { + match self { + #[cfg(feature = "full")] + Expr::Array(v0) => Expr::Array(v0.clone()), + #[cfg(feature = "full")] + Expr::Assign(v0) => Expr::Assign(v0.clone()), + #[cfg(feature = "full")] + Expr::AssignOp(v0) => Expr::AssignOp(v0.clone()), + #[cfg(feature = "full")] + Expr::Async(v0) => Expr::Async(v0.clone()), + #[cfg(feature = "full")] + Expr::Await(v0) => Expr::Await(v0.clone()), + Expr::Binary(v0) => Expr::Binary(v0.clone()), + #[cfg(feature = "full")] + Expr::Block(v0) => Expr::Block(v0.clone()), + #[cfg(feature = "full")] + Expr::Box(v0) => Expr::Box(v0.clone()), + #[cfg(feature = "full")] + Expr::Break(v0) => Expr::Break(v0.clone()), + Expr::Call(v0) => Expr::Call(v0.clone()), + Expr::Cast(v0) => Expr::Cast(v0.clone()), + #[cfg(feature = "full")] + Expr::Closure(v0) => Expr::Closure(v0.clone()), + #[cfg(feature = "full")] + Expr::Continue(v0) => Expr::Continue(v0.clone()), + Expr::Field(v0) => Expr::Field(v0.clone()), + #[cfg(feature = "full")] + Expr::ForLoop(v0) => Expr::ForLoop(v0.clone()), + #[cfg(feature = "full")] + Expr::Group(v0) => Expr::Group(v0.clone()), + #[cfg(feature = "full")] + Expr::If(v0) => Expr::If(v0.clone()), + Expr::Index(v0) => Expr::Index(v0.clone()), + #[cfg(feature = "full")] + Expr::Let(v0) => Expr::Let(v0.clone()), + Expr::Lit(v0) => Expr::Lit(v0.clone()), + #[cfg(feature = "full")] + Expr::Loop(v0) => Expr::Loop(v0.clone()), + #[cfg(feature = "full")] + Expr::Macro(v0) => Expr::Macro(v0.clone()), + #[cfg(feature = "full")] + Expr::Match(v0) => Expr::Match(v0.clone()), + #[cfg(feature = "full")] + Expr::MethodCall(v0) => Expr::MethodCall(v0.clone()), + Expr::Paren(v0) => Expr::Paren(v0.clone()), + Expr::Path(v0) => Expr::Path(v0.clone()), + #[cfg(feature = "full")] + Expr::Range(v0) => Expr::Range(v0.clone()), + #[cfg(feature = "full")] + Expr::Reference(v0) => Expr::Reference(v0.clone()), + #[cfg(feature = "full")] + Expr::Repeat(v0) => Expr::Repeat(v0.clone()), + #[cfg(feature = "full")] + Expr::Return(v0) => Expr::Return(v0.clone()), + #[cfg(feature = "full")] + Expr::Struct(v0) => Expr::Struct(v0.clone()), + #[cfg(feature = "full")] + Expr::Try(v0) => Expr::Try(v0.clone()), + #[cfg(feature = "full")] + Expr::TryBlock(v0) => Expr::TryBlock(v0.clone()), + #[cfg(feature = "full")] + Expr::Tuple(v0) => Expr::Tuple(v0.clone()), + #[cfg(feature = "full")] + Expr::Type(v0) => Expr::Type(v0.clone()), + Expr::Unary(v0) => Expr::Unary(v0.clone()), + #[cfg(feature = "full")] + Expr::Unsafe(v0) => Expr::Unsafe(v0.clone()), + Expr::Verbatim(v0) => Expr::Verbatim(v0.clone()), + #[cfg(feature = "full")] + Expr::While(v0) => Expr::While(v0.clone()), + #[cfg(feature = "full")] + Expr::Yield(v0) => Expr::Yield(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprArray { + fn clone(&self) -> Self { + ExprArray { + attrs: self.attrs.clone(), + bracket_token: self.bracket_token.clone(), + elems: self.elems.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprAssign { + fn clone(&self) -> Self { + ExprAssign { + attrs: self.attrs.clone(), + left: self.left.clone(), + eq_token: self.eq_token.clone(), + right: self.right.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprAssignOp { + fn clone(&self) -> Self { + ExprAssignOp { + attrs: self.attrs.clone(), + left: self.left.clone(), + op: self.op.clone(), + right: self.right.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprAsync { + fn clone(&self) -> Self { + ExprAsync { + attrs: self.attrs.clone(), + async_token: self.async_token.clone(), + capture: self.capture.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprAwait { + fn clone(&self) -> Self { + ExprAwait { + attrs: self.attrs.clone(), + base: self.base.clone(), + dot_token: self.dot_token.clone(), + await_token: self.await_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprBinary { + fn clone(&self) -> Self { + ExprBinary { + attrs: self.attrs.clone(), + left: self.left.clone(), + op: self.op.clone(), + right: self.right.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprBlock { + fn clone(&self) -> Self { + ExprBlock { + attrs: self.attrs.clone(), + label: self.label.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprBox { + fn clone(&self) -> Self { + ExprBox { + attrs: self.attrs.clone(), + box_token: self.box_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprBreak { + fn clone(&self) -> Self { + ExprBreak { + attrs: self.attrs.clone(), + break_token: self.break_token.clone(), + label: self.label.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprCall { + fn clone(&self) -> Self { + ExprCall { + attrs: self.attrs.clone(), + func: self.func.clone(), + paren_token: self.paren_token.clone(), + args: self.args.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprCast { + fn clone(&self) -> Self { + ExprCast { + attrs: self.attrs.clone(), + expr: self.expr.clone(), + as_token: self.as_token.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprClosure { + fn clone(&self) -> Self { + ExprClosure { + attrs: self.attrs.clone(), + asyncness: self.asyncness.clone(), + movability: self.movability.clone(), + capture: self.capture.clone(), + or1_token: self.or1_token.clone(), + inputs: self.inputs.clone(), + or2_token: self.or2_token.clone(), + output: self.output.clone(), + body: self.body.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprContinue { + fn clone(&self) -> Self { + ExprContinue { + attrs: self.attrs.clone(), + continue_token: self.continue_token.clone(), + label: self.label.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprField { + fn clone(&self) -> Self { + ExprField { + attrs: self.attrs.clone(), + base: self.base.clone(), + dot_token: self.dot_token.clone(), + member: self.member.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprForLoop { + fn clone(&self) -> Self { + ExprForLoop { + attrs: self.attrs.clone(), + label: self.label.clone(), + for_token: self.for_token.clone(), + pat: self.pat.clone(), + in_token: self.in_token.clone(), + expr: self.expr.clone(), + body: self.body.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprGroup { + fn clone(&self) -> Self { + ExprGroup { + attrs: self.attrs.clone(), + group_token: self.group_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprIf { + fn clone(&self) -> Self { + ExprIf { + attrs: self.attrs.clone(), + if_token: self.if_token.clone(), + cond: self.cond.clone(), + then_branch: self.then_branch.clone(), + else_branch: self.else_branch.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprIndex { + fn clone(&self) -> Self { + ExprIndex { + attrs: self.attrs.clone(), + expr: self.expr.clone(), + bracket_token: self.bracket_token.clone(), + index: self.index.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprLet { + fn clone(&self) -> Self { + ExprLet { + attrs: self.attrs.clone(), + let_token: self.let_token.clone(), + pat: self.pat.clone(), + eq_token: self.eq_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprLit { + fn clone(&self) -> Self { + ExprLit { + attrs: self.attrs.clone(), + lit: self.lit.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprLoop { + fn clone(&self) -> Self { + ExprLoop { + attrs: self.attrs.clone(), + label: self.label.clone(), + loop_token: self.loop_token.clone(), + body: self.body.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprMacro { + fn clone(&self) -> Self { + ExprMacro { + attrs: self.attrs.clone(), + mac: self.mac.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprMatch { + fn clone(&self) -> Self { + ExprMatch { + attrs: self.attrs.clone(), + match_token: self.match_token.clone(), + expr: self.expr.clone(), + brace_token: self.brace_token.clone(), + arms: self.arms.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprMethodCall { + fn clone(&self) -> Self { + ExprMethodCall { + attrs: self.attrs.clone(), + receiver: self.receiver.clone(), + dot_token: self.dot_token.clone(), + method: self.method.clone(), + turbofish: self.turbofish.clone(), + paren_token: self.paren_token.clone(), + args: self.args.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprParen { + fn clone(&self) -> Self { + ExprParen { + attrs: self.attrs.clone(), + paren_token: self.paren_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprPath { + fn clone(&self) -> Self { + ExprPath { + attrs: self.attrs.clone(), + qself: self.qself.clone(), + path: self.path.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprRange { + fn clone(&self) -> Self { + ExprRange { + attrs: self.attrs.clone(), + from: self.from.clone(), + limits: self.limits.clone(), + to: self.to.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprReference { + fn clone(&self) -> Self { + ExprReference { + attrs: self.attrs.clone(), + and_token: self.and_token.clone(), + raw: self.raw.clone(), + mutability: self.mutability.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprRepeat { + fn clone(&self) -> Self { + ExprRepeat { + attrs: self.attrs.clone(), + bracket_token: self.bracket_token.clone(), + expr: self.expr.clone(), + semi_token: self.semi_token.clone(), + len: self.len.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprReturn { + fn clone(&self) -> Self { + ExprReturn { + attrs: self.attrs.clone(), + return_token: self.return_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprStruct { + fn clone(&self) -> Self { + ExprStruct { + attrs: self.attrs.clone(), + path: self.path.clone(), + brace_token: self.brace_token.clone(), + fields: self.fields.clone(), + dot2_token: self.dot2_token.clone(), + rest: self.rest.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprTry { + fn clone(&self) -> Self { + ExprTry { + attrs: self.attrs.clone(), + expr: self.expr.clone(), + question_token: self.question_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprTryBlock { + fn clone(&self) -> Self { + ExprTryBlock { + attrs: self.attrs.clone(), + try_token: self.try_token.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprTuple { + fn clone(&self) -> Self { + ExprTuple { + attrs: self.attrs.clone(), + paren_token: self.paren_token.clone(), + elems: self.elems.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprType { + fn clone(&self) -> Self { + ExprType { + attrs: self.attrs.clone(), + expr: self.expr.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ExprUnary { + fn clone(&self) -> Self { + ExprUnary { + attrs: self.attrs.clone(), + op: self.op.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprUnsafe { + fn clone(&self) -> Self { + ExprUnsafe { + attrs: self.attrs.clone(), + unsafe_token: self.unsafe_token.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprWhile { + fn clone(&self) -> Self { + ExprWhile { + attrs: self.attrs.clone(), + label: self.label.clone(), + while_token: self.while_token.clone(), + cond: self.cond.clone(), + body: self.body.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ExprYield { + fn clone(&self) -> Self { + ExprYield { + attrs: self.attrs.clone(), + yield_token: self.yield_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Field { + fn clone(&self) -> Self { + Field { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for FieldPat { + fn clone(&self) -> Self { + FieldPat { + attrs: self.attrs.clone(), + member: self.member.clone(), + colon_token: self.colon_token.clone(), + pat: self.pat.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for FieldValue { + fn clone(&self) -> Self { + FieldValue { + attrs: self.attrs.clone(), + member: self.member.clone(), + colon_token: self.colon_token.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Fields { + fn clone(&self) -> Self { + match self { + Fields::Named(v0) => Fields::Named(v0.clone()), + Fields::Unnamed(v0) => Fields::Unnamed(v0.clone()), + Fields::Unit => Fields::Unit, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for FieldsNamed { + fn clone(&self) -> Self { + FieldsNamed { + brace_token: self.brace_token.clone(), + named: self.named.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for FieldsUnnamed { + fn clone(&self) -> Self { + FieldsUnnamed { + paren_token: self.paren_token.clone(), + unnamed: self.unnamed.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for File { + fn clone(&self) -> Self { + File { + shebang: self.shebang.clone(), + attrs: self.attrs.clone(), + items: self.items.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for FnArg { + fn clone(&self) -> Self { + match self { + FnArg::Receiver(v0) => FnArg::Receiver(v0.clone()), + FnArg::Typed(v0) => FnArg::Typed(v0.clone()), + } + } +} +#[cfg(feature = "full")] +impl Clone for ForeignItem { + fn clone(&self) -> Self { + match self { + ForeignItem::Fn(v0) => ForeignItem::Fn(v0.clone()), + ForeignItem::Static(v0) => ForeignItem::Static(v0.clone()), + ForeignItem::Type(v0) => ForeignItem::Type(v0.clone()), + ForeignItem::Macro(v0) => ForeignItem::Macro(v0.clone()), + ForeignItem::Verbatim(v0) => ForeignItem::Verbatim(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ForeignItemFn { + fn clone(&self) -> Self { + ForeignItemFn { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + sig: self.sig.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ForeignItemMacro { + fn clone(&self) -> Self { + ForeignItemMacro { + attrs: self.attrs.clone(), + mac: self.mac.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ForeignItemStatic { + fn clone(&self) -> Self { + ForeignItemStatic { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + static_token: self.static_token.clone(), + mutability: self.mutability.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ForeignItemType { + fn clone(&self) -> Self { + ForeignItemType { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + type_token: self.type_token.clone(), + ident: self.ident.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for GenericArgument { + fn clone(&self) -> Self { + match self { + GenericArgument::Lifetime(v0) => GenericArgument::Lifetime(v0.clone()), + GenericArgument::Type(v0) => GenericArgument::Type(v0.clone()), + GenericArgument::Binding(v0) => GenericArgument::Binding(v0.clone()), + GenericArgument::Constraint(v0) => GenericArgument::Constraint(v0.clone()), + GenericArgument::Const(v0) => GenericArgument::Const(v0.clone()), + } + } +} +#[cfg(feature = "full")] +impl Clone for GenericMethodArgument { + fn clone(&self) -> Self { + match self { + GenericMethodArgument::Type(v0) => GenericMethodArgument::Type(v0.clone()), + GenericMethodArgument::Const(v0) => GenericMethodArgument::Const(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for GenericParam { + fn clone(&self) -> Self { + match self { + GenericParam::Type(v0) => GenericParam::Type(v0.clone()), + GenericParam::Lifetime(v0) => GenericParam::Lifetime(v0.clone()), + GenericParam::Const(v0) => GenericParam::Const(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Generics { + fn clone(&self) -> Self { + Generics { + lt_token: self.lt_token.clone(), + params: self.params.clone(), + gt_token: self.gt_token.clone(), + where_clause: self.where_clause.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ImplItem { + fn clone(&self) -> Self { + match self { + ImplItem::Const(v0) => ImplItem::Const(v0.clone()), + ImplItem::Method(v0) => ImplItem::Method(v0.clone()), + ImplItem::Type(v0) => ImplItem::Type(v0.clone()), + ImplItem::Macro(v0) => ImplItem::Macro(v0.clone()), + ImplItem::Verbatim(v0) => ImplItem::Verbatim(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ImplItemConst { + fn clone(&self) -> Self { + ImplItemConst { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + defaultness: self.defaultness.clone(), + const_token: self.const_token.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + eq_token: self.eq_token.clone(), + expr: self.expr.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ImplItemMacro { + fn clone(&self) -> Self { + ImplItemMacro { + attrs: self.attrs.clone(), + mac: self.mac.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ImplItemMethod { + fn clone(&self) -> Self { + ImplItemMethod { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + defaultness: self.defaultness.clone(), + sig: self.sig.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ImplItemType { + fn clone(&self) -> Self { + ImplItemType { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + defaultness: self.defaultness.clone(), + type_token: self.type_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + eq_token: self.eq_token.clone(), + ty: self.ty.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Index { + fn clone(&self) -> Self { + Index { + index: self.index.clone(), + span: self.span.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Item { + fn clone(&self) -> Self { + match self { + Item::Const(v0) => Item::Const(v0.clone()), + Item::Enum(v0) => Item::Enum(v0.clone()), + Item::ExternCrate(v0) => Item::ExternCrate(v0.clone()), + Item::Fn(v0) => Item::Fn(v0.clone()), + Item::ForeignMod(v0) => Item::ForeignMod(v0.clone()), + Item::Impl(v0) => Item::Impl(v0.clone()), + Item::Macro(v0) => Item::Macro(v0.clone()), + Item::Macro2(v0) => Item::Macro2(v0.clone()), + Item::Mod(v0) => Item::Mod(v0.clone()), + Item::Static(v0) => Item::Static(v0.clone()), + Item::Struct(v0) => Item::Struct(v0.clone()), + Item::Trait(v0) => Item::Trait(v0.clone()), + Item::TraitAlias(v0) => Item::TraitAlias(v0.clone()), + Item::Type(v0) => Item::Type(v0.clone()), + Item::Union(v0) => Item::Union(v0.clone()), + Item::Use(v0) => Item::Use(v0.clone()), + Item::Verbatim(v0) => Item::Verbatim(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemConst { + fn clone(&self) -> Self { + ItemConst { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + const_token: self.const_token.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + eq_token: self.eq_token.clone(), + expr: self.expr.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemEnum { + fn clone(&self) -> Self { + ItemEnum { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + enum_token: self.enum_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + brace_token: self.brace_token.clone(), + variants: self.variants.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemExternCrate { + fn clone(&self) -> Self { + ItemExternCrate { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + extern_token: self.extern_token.clone(), + crate_token: self.crate_token.clone(), + ident: self.ident.clone(), + rename: self.rename.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemFn { + fn clone(&self) -> Self { + ItemFn { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + sig: self.sig.clone(), + block: self.block.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemForeignMod { + fn clone(&self) -> Self { + ItemForeignMod { + attrs: self.attrs.clone(), + abi: self.abi.clone(), + brace_token: self.brace_token.clone(), + items: self.items.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemImpl { + fn clone(&self) -> Self { + ItemImpl { + attrs: self.attrs.clone(), + defaultness: self.defaultness.clone(), + unsafety: self.unsafety.clone(), + impl_token: self.impl_token.clone(), + generics: self.generics.clone(), + trait_: self.trait_.clone(), + self_ty: self.self_ty.clone(), + brace_token: self.brace_token.clone(), + items: self.items.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemMacro { + fn clone(&self) -> Self { + ItemMacro { + attrs: self.attrs.clone(), + ident: self.ident.clone(), + mac: self.mac.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemMacro2 { + fn clone(&self) -> Self { + ItemMacro2 { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + macro_token: self.macro_token.clone(), + ident: self.ident.clone(), + rules: self.rules.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemMod { + fn clone(&self) -> Self { + ItemMod { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + mod_token: self.mod_token.clone(), + ident: self.ident.clone(), + content: self.content.clone(), + semi: self.semi.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemStatic { + fn clone(&self) -> Self { + ItemStatic { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + static_token: self.static_token.clone(), + mutability: self.mutability.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + eq_token: self.eq_token.clone(), + expr: self.expr.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemStruct { + fn clone(&self) -> Self { + ItemStruct { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + struct_token: self.struct_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + fields: self.fields.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemTrait { + fn clone(&self) -> Self { + ItemTrait { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + unsafety: self.unsafety.clone(), + auto_token: self.auto_token.clone(), + trait_token: self.trait_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + colon_token: self.colon_token.clone(), + supertraits: self.supertraits.clone(), + brace_token: self.brace_token.clone(), + items: self.items.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemTraitAlias { + fn clone(&self) -> Self { + ItemTraitAlias { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + trait_token: self.trait_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + eq_token: self.eq_token.clone(), + bounds: self.bounds.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemType { + fn clone(&self) -> Self { + ItemType { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + type_token: self.type_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + eq_token: self.eq_token.clone(), + ty: self.ty.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemUnion { + fn clone(&self) -> Self { + ItemUnion { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + union_token: self.union_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + fields: self.fields.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for ItemUse { + fn clone(&self) -> Self { + ItemUse { + attrs: self.attrs.clone(), + vis: self.vis.clone(), + use_token: self.use_token.clone(), + leading_colon: self.leading_colon.clone(), + tree: self.tree.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Label { + fn clone(&self) -> Self { + Label { + name: self.name.clone(), + colon_token: self.colon_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for LifetimeDef { + fn clone(&self) -> Self { + LifetimeDef { + attrs: self.attrs.clone(), + lifetime: self.lifetime.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + } + } +} +impl Clone for Lit { + fn clone(&self) -> Self { + match self { + Lit::Str(v0) => Lit::Str(v0.clone()), + Lit::ByteStr(v0) => Lit::ByteStr(v0.clone()), + Lit::Byte(v0) => Lit::Byte(v0.clone()), + Lit::Char(v0) => Lit::Char(v0.clone()), + Lit::Int(v0) => Lit::Int(v0.clone()), + Lit::Float(v0) => Lit::Float(v0.clone()), + Lit::Bool(v0) => Lit::Bool(v0.clone()), + Lit::Verbatim(v0) => Lit::Verbatim(v0.clone()), + } + } +} +impl Clone for LitBool { + fn clone(&self) -> Self { + LitBool { + value: self.value.clone(), + span: self.span.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Local { + fn clone(&self) -> Self { + Local { + attrs: self.attrs.clone(), + let_token: self.let_token.clone(), + pat: self.pat.clone(), + init: self.init.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Macro { + fn clone(&self) -> Self { + Macro { + path: self.path.clone(), + bang_token: self.bang_token.clone(), + delimiter: self.delimiter.clone(), + tokens: self.tokens.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for MacroDelimiter { + fn clone(&self) -> Self { + match self { + MacroDelimiter::Paren(v0) => MacroDelimiter::Paren(v0.clone()), + MacroDelimiter::Brace(v0) => MacroDelimiter::Brace(v0.clone()), + MacroDelimiter::Bracket(v0) => MacroDelimiter::Bracket(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Member { + fn clone(&self) -> Self { + match self { + Member::Named(v0) => Member::Named(v0.clone()), + Member::Unnamed(v0) => Member::Unnamed(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Meta { + fn clone(&self) -> Self { + match self { + Meta::Path(v0) => Meta::Path(v0.clone()), + Meta::List(v0) => Meta::List(v0.clone()), + Meta::NameValue(v0) => Meta::NameValue(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for MetaList { + fn clone(&self) -> Self { + MetaList { + path: self.path.clone(), + paren_token: self.paren_token.clone(), + nested: self.nested.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for MetaNameValue { + fn clone(&self) -> Self { + MetaNameValue { + path: self.path.clone(), + eq_token: self.eq_token.clone(), + lit: self.lit.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for MethodTurbofish { + fn clone(&self) -> Self { + MethodTurbofish { + colon2_token: self.colon2_token.clone(), + lt_token: self.lt_token.clone(), + args: self.args.clone(), + gt_token: self.gt_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for NestedMeta { + fn clone(&self) -> Self { + match self { + NestedMeta::Meta(v0) => NestedMeta::Meta(v0.clone()), + NestedMeta::Lit(v0) => NestedMeta::Lit(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ParenthesizedGenericArguments { + fn clone(&self) -> Self { + ParenthesizedGenericArguments { + paren_token: self.paren_token.clone(), + inputs: self.inputs.clone(), + output: self.output.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Pat { + fn clone(&self) -> Self { + match self { + Pat::Box(v0) => Pat::Box(v0.clone()), + Pat::Ident(v0) => Pat::Ident(v0.clone()), + Pat::Lit(v0) => Pat::Lit(v0.clone()), + Pat::Macro(v0) => Pat::Macro(v0.clone()), + Pat::Or(v0) => Pat::Or(v0.clone()), + Pat::Path(v0) => Pat::Path(v0.clone()), + Pat::Range(v0) => Pat::Range(v0.clone()), + Pat::Reference(v0) => Pat::Reference(v0.clone()), + Pat::Rest(v0) => Pat::Rest(v0.clone()), + Pat::Slice(v0) => Pat::Slice(v0.clone()), + Pat::Struct(v0) => Pat::Struct(v0.clone()), + Pat::Tuple(v0) => Pat::Tuple(v0.clone()), + Pat::TupleStruct(v0) => Pat::TupleStruct(v0.clone()), + Pat::Type(v0) => Pat::Type(v0.clone()), + Pat::Verbatim(v0) => Pat::Verbatim(v0.clone()), + Pat::Wild(v0) => Pat::Wild(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatBox { + fn clone(&self) -> Self { + PatBox { + attrs: self.attrs.clone(), + box_token: self.box_token.clone(), + pat: self.pat.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatIdent { + fn clone(&self) -> Self { + PatIdent { + attrs: self.attrs.clone(), + by_ref: self.by_ref.clone(), + mutability: self.mutability.clone(), + ident: self.ident.clone(), + subpat: self.subpat.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatLit { + fn clone(&self) -> Self { + PatLit { + attrs: self.attrs.clone(), + expr: self.expr.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatMacro { + fn clone(&self) -> Self { + PatMacro { + attrs: self.attrs.clone(), + mac: self.mac.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatOr { + fn clone(&self) -> Self { + PatOr { + attrs: self.attrs.clone(), + leading_vert: self.leading_vert.clone(), + cases: self.cases.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatPath { + fn clone(&self) -> Self { + PatPath { + attrs: self.attrs.clone(), + qself: self.qself.clone(), + path: self.path.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatRange { + fn clone(&self) -> Self { + PatRange { + attrs: self.attrs.clone(), + lo: self.lo.clone(), + limits: self.limits.clone(), + hi: self.hi.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatReference { + fn clone(&self) -> Self { + PatReference { + attrs: self.attrs.clone(), + and_token: self.and_token.clone(), + mutability: self.mutability.clone(), + pat: self.pat.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatRest { + fn clone(&self) -> Self { + PatRest { + attrs: self.attrs.clone(), + dot2_token: self.dot2_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatSlice { + fn clone(&self) -> Self { + PatSlice { + attrs: self.attrs.clone(), + bracket_token: self.bracket_token.clone(), + elems: self.elems.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatStruct { + fn clone(&self) -> Self { + PatStruct { + attrs: self.attrs.clone(), + path: self.path.clone(), + brace_token: self.brace_token.clone(), + fields: self.fields.clone(), + dot2_token: self.dot2_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatTuple { + fn clone(&self) -> Self { + PatTuple { + attrs: self.attrs.clone(), + paren_token: self.paren_token.clone(), + elems: self.elems.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatTupleStruct { + fn clone(&self) -> Self { + PatTupleStruct { + attrs: self.attrs.clone(), + path: self.path.clone(), + pat: self.pat.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatType { + fn clone(&self) -> Self { + PatType { + attrs: self.attrs.clone(), + pat: self.pat.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for PatWild { + fn clone(&self) -> Self { + PatWild { + attrs: self.attrs.clone(), + underscore_token: self.underscore_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Path { + fn clone(&self) -> Self { + Path { + leading_colon: self.leading_colon.clone(), + segments: self.segments.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for PathArguments { + fn clone(&self) -> Self { + match self { + PathArguments::None => PathArguments::None, + PathArguments::AngleBracketed(v0) => PathArguments::AngleBracketed(v0.clone()), + PathArguments::Parenthesized(v0) => PathArguments::Parenthesized(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for PathSegment { + fn clone(&self) -> Self { + PathSegment { + ident: self.ident.clone(), + arguments: self.arguments.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for PredicateEq { + fn clone(&self) -> Self { + PredicateEq { + lhs_ty: self.lhs_ty.clone(), + eq_token: self.eq_token.clone(), + rhs_ty: self.rhs_ty.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for PredicateLifetime { + fn clone(&self) -> Self { + PredicateLifetime { + lifetime: self.lifetime.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for PredicateType { + fn clone(&self) -> Self { + PredicateType { + lifetimes: self.lifetimes.clone(), + bounded_ty: self.bounded_ty.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for QSelf { + fn clone(&self) -> Self { + QSelf { + lt_token: self.lt_token.clone(), + ty: self.ty.clone(), + position: self.position.clone(), + as_token: self.as_token.clone(), + gt_token: self.gt_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Copy for RangeLimits {} +#[cfg(feature = "full")] +impl Clone for RangeLimits { + fn clone(&self) -> Self { + *self + } +} +#[cfg(feature = "full")] +impl Clone for Receiver { + fn clone(&self) -> Self { + Receiver { + attrs: self.attrs.clone(), + reference: self.reference.clone(), + mutability: self.mutability.clone(), + self_token: self.self_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for ReturnType { + fn clone(&self) -> Self { + match self { + ReturnType::Default => ReturnType::Default, + ReturnType::Type(v0, v1) => ReturnType::Type(v0.clone(), v1.clone()), + } + } +} +#[cfg(feature = "full")] +impl Clone for Signature { + fn clone(&self) -> Self { + Signature { + constness: self.constness.clone(), + asyncness: self.asyncness.clone(), + unsafety: self.unsafety.clone(), + abi: self.abi.clone(), + fn_token: self.fn_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + paren_token: self.paren_token.clone(), + inputs: self.inputs.clone(), + variadic: self.variadic.clone(), + output: self.output.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for Stmt { + fn clone(&self) -> Self { + match self { + Stmt::Local(v0) => Stmt::Local(v0.clone()), + Stmt::Item(v0) => Stmt::Item(v0.clone()), + Stmt::Expr(v0) => Stmt::Expr(v0.clone()), + Stmt::Semi(v0, v1) => Stmt::Semi(v0.clone(), v1.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TraitBound { + fn clone(&self) -> Self { + TraitBound { + paren_token: self.paren_token.clone(), + modifier: self.modifier.clone(), + lifetimes: self.lifetimes.clone(), + path: self.path.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Copy for TraitBoundModifier {} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TraitBoundModifier { + fn clone(&self) -> Self { + *self + } +} +#[cfg(feature = "full")] +impl Clone for TraitItem { + fn clone(&self) -> Self { + match self { + TraitItem::Const(v0) => TraitItem::Const(v0.clone()), + TraitItem::Method(v0) => TraitItem::Method(v0.clone()), + TraitItem::Type(v0) => TraitItem::Type(v0.clone()), + TraitItem::Macro(v0) => TraitItem::Macro(v0.clone()), + TraitItem::Verbatim(v0) => TraitItem::Verbatim(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Clone for TraitItemConst { + fn clone(&self) -> Self { + TraitItemConst { + attrs: self.attrs.clone(), + const_token: self.const_token.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + ty: self.ty.clone(), + default: self.default.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for TraitItemMacro { + fn clone(&self) -> Self { + TraitItemMacro { + attrs: self.attrs.clone(), + mac: self.mac.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for TraitItemMethod { + fn clone(&self) -> Self { + TraitItemMethod { + attrs: self.attrs.clone(), + sig: self.sig.clone(), + default: self.default.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for TraitItemType { + fn clone(&self) -> Self { + TraitItemType { + attrs: self.attrs.clone(), + type_token: self.type_token.clone(), + ident: self.ident.clone(), + generics: self.generics.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + default: self.default.clone(), + semi_token: self.semi_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Type { + fn clone(&self) -> Self { + match self { + Type::Array(v0) => Type::Array(v0.clone()), + Type::BareFn(v0) => Type::BareFn(v0.clone()), + Type::Group(v0) => Type::Group(v0.clone()), + Type::ImplTrait(v0) => Type::ImplTrait(v0.clone()), + Type::Infer(v0) => Type::Infer(v0.clone()), + Type::Macro(v0) => Type::Macro(v0.clone()), + Type::Never(v0) => Type::Never(v0.clone()), + Type::Paren(v0) => Type::Paren(v0.clone()), + Type::Path(v0) => Type::Path(v0.clone()), + Type::Ptr(v0) => Type::Ptr(v0.clone()), + Type::Reference(v0) => Type::Reference(v0.clone()), + Type::Slice(v0) => Type::Slice(v0.clone()), + Type::TraitObject(v0) => Type::TraitObject(v0.clone()), + Type::Tuple(v0) => Type::Tuple(v0.clone()), + Type::Verbatim(v0) => Type::Verbatim(v0.clone()), + _ => unreachable!(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeArray { + fn clone(&self) -> Self { + TypeArray { + bracket_token: self.bracket_token.clone(), + elem: self.elem.clone(), + semi_token: self.semi_token.clone(), + len: self.len.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeBareFn { + fn clone(&self) -> Self { + TypeBareFn { + lifetimes: self.lifetimes.clone(), + unsafety: self.unsafety.clone(), + abi: self.abi.clone(), + fn_token: self.fn_token.clone(), + paren_token: self.paren_token.clone(), + inputs: self.inputs.clone(), + variadic: self.variadic.clone(), + output: self.output.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeGroup { + fn clone(&self) -> Self { + TypeGroup { + group_token: self.group_token.clone(), + elem: self.elem.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeImplTrait { + fn clone(&self) -> Self { + TypeImplTrait { + impl_token: self.impl_token.clone(), + bounds: self.bounds.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeInfer { + fn clone(&self) -> Self { + TypeInfer { + underscore_token: self.underscore_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeMacro { + fn clone(&self) -> Self { + TypeMacro { + mac: self.mac.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeNever { + fn clone(&self) -> Self { + TypeNever { + bang_token: self.bang_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeParam { + fn clone(&self) -> Self { + TypeParam { + attrs: self.attrs.clone(), + ident: self.ident.clone(), + colon_token: self.colon_token.clone(), + bounds: self.bounds.clone(), + eq_token: self.eq_token.clone(), + default: self.default.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeParamBound { + fn clone(&self) -> Self { + match self { + TypeParamBound::Trait(v0) => TypeParamBound::Trait(v0.clone()), + TypeParamBound::Lifetime(v0) => TypeParamBound::Lifetime(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeParen { + fn clone(&self) -> Self { + TypeParen { + paren_token: self.paren_token.clone(), + elem: self.elem.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypePath { + fn clone(&self) -> Self { + TypePath { + qself: self.qself.clone(), + path: self.path.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypePtr { + fn clone(&self) -> Self { + TypePtr { + star_token: self.star_token.clone(), + const_token: self.const_token.clone(), + mutability: self.mutability.clone(), + elem: self.elem.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeReference { + fn clone(&self) -> Self { + TypeReference { + and_token: self.and_token.clone(), + lifetime: self.lifetime.clone(), + mutability: self.mutability.clone(), + elem: self.elem.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeSlice { + fn clone(&self) -> Self { + TypeSlice { + bracket_token: self.bracket_token.clone(), + elem: self.elem.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeTraitObject { + fn clone(&self) -> Self { + TypeTraitObject { + dyn_token: self.dyn_token.clone(), + bounds: self.bounds.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for TypeTuple { + fn clone(&self) -> Self { + TypeTuple { + paren_token: self.paren_token.clone(), + elems: self.elems.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Copy for UnOp {} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for UnOp { + fn clone(&self) -> Self { + *self + } +} +#[cfg(feature = "full")] +impl Clone for UseGlob { + fn clone(&self) -> Self { + UseGlob { + star_token: self.star_token.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for UseGroup { + fn clone(&self) -> Self { + UseGroup { + brace_token: self.brace_token.clone(), + items: self.items.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for UseName { + fn clone(&self) -> Self { + UseName { + ident: self.ident.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for UsePath { + fn clone(&self) -> Self { + UsePath { + ident: self.ident.clone(), + colon2_token: self.colon2_token.clone(), + tree: self.tree.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for UseRename { + fn clone(&self) -> Self { + UseRename { + ident: self.ident.clone(), + as_token: self.as_token.clone(), + rename: self.rename.clone(), + } + } +} +#[cfg(feature = "full")] +impl Clone for UseTree { + fn clone(&self) -> Self { + match self { + UseTree::Path(v0) => UseTree::Path(v0.clone()), + UseTree::Name(v0) => UseTree::Name(v0.clone()), + UseTree::Rename(v0) => UseTree::Rename(v0.clone()), + UseTree::Glob(v0) => UseTree::Glob(v0.clone()), + UseTree::Group(v0) => UseTree::Group(v0.clone()), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Variadic { + fn clone(&self) -> Self { + Variadic { + attrs: self.attrs.clone(), + dots: self.dots.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Variant { + fn clone(&self) -> Self { + Variant { + attrs: self.attrs.clone(), + ident: self.ident.clone(), + fields: self.fields.clone(), + discriminant: self.discriminant.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for VisCrate { + fn clone(&self) -> Self { + VisCrate { + crate_token: self.crate_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for VisPublic { + fn clone(&self) -> Self { + VisPublic { + pub_token: self.pub_token.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for VisRestricted { + fn clone(&self) -> Self { + VisRestricted { + pub_token: self.pub_token.clone(), + paren_token: self.paren_token.clone(), + in_token: self.in_token.clone(), + path: self.path.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for Visibility { + fn clone(&self) -> Self { + match self { + Visibility::Public(v0) => Visibility::Public(v0.clone()), + Visibility::Crate(v0) => Visibility::Crate(v0.clone()), + Visibility::Restricted(v0) => Visibility::Restricted(v0.clone()), + Visibility::Inherited => Visibility::Inherited, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for WhereClause { + fn clone(&self) -> Self { + WhereClause { + where_token: self.where_token.clone(), + predicates: self.predicates.clone(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Clone for WherePredicate { + fn clone(&self) -> Self { + match self { + WherePredicate::Type(v0) => WherePredicate::Type(v0.clone()), + WherePredicate::Lifetime(v0) => WherePredicate::Lifetime(v0.clone()), + WherePredicate::Eq(v0) => WherePredicate::Eq(v0.clone()), + } + } +} diff --git a/src/gen/debug.rs b/src/gen/debug.rs new file mode 100644 index 00000000..72baab05 --- /dev/null +++ b/src/gen/debug.rs @@ -0,0 +1,2857 @@ +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. + +use crate::*; +use std::fmt::{self, Debug}; +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Abi { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Abi"); + formatter.field("extern_token", &self.extern_token); + formatter.field("name", &self.name); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for AngleBracketedGenericArguments { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("AngleBracketedGenericArguments"); + formatter.field("colon2_token", &self.colon2_token); + formatter.field("lt_token", &self.lt_token); + formatter.field("args", &self.args); + formatter.field("gt_token", &self.gt_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Arm { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Arm"); + formatter.field("attrs", &self.attrs); + formatter.field("pat", &self.pat); + formatter.field("guard", &self.guard); + formatter.field("fat_arrow_token", &self.fat_arrow_token); + formatter.field("body", &self.body); + formatter.field("comma", &self.comma); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for AttrStyle { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + AttrStyle::Outer => formatter.write_str("Outer"), + AttrStyle::Inner(v0) => { + let mut formatter = formatter.debug_tuple("Inner"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Attribute { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Attribute"); + formatter.field("pound_token", &self.pound_token); + formatter.field("style", &self.style); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("path", &self.path); + formatter.field("tokens", &self.tokens); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for BareFnArg { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("BareFnArg"); + formatter.field("attrs", &self.attrs); + formatter.field("name", &self.name); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for BinOp { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + BinOp::Add(v0) => { + let mut formatter = formatter.debug_tuple("Add"); + formatter.field(v0); + formatter.finish() + } + BinOp::Sub(v0) => { + let mut formatter = formatter.debug_tuple("Sub"); + formatter.field(v0); + formatter.finish() + } + BinOp::Mul(v0) => { + let mut formatter = formatter.debug_tuple("Mul"); + formatter.field(v0); + formatter.finish() + } + BinOp::Div(v0) => { + let mut formatter = formatter.debug_tuple("Div"); + formatter.field(v0); + formatter.finish() + } + BinOp::Rem(v0) => { + let mut formatter = formatter.debug_tuple("Rem"); + formatter.field(v0); + formatter.finish() + } + BinOp::And(v0) => { + let mut formatter = formatter.debug_tuple("And"); + formatter.field(v0); + formatter.finish() + } + BinOp::Or(v0) => { + let mut formatter = formatter.debug_tuple("Or"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitXor(v0) => { + let mut formatter = formatter.debug_tuple("BitXor"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitAnd(v0) => { + let mut formatter = formatter.debug_tuple("BitAnd"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitOr(v0) => { + let mut formatter = formatter.debug_tuple("BitOr"); + formatter.field(v0); + formatter.finish() + } + BinOp::Shl(v0) => { + let mut formatter = formatter.debug_tuple("Shl"); + formatter.field(v0); + formatter.finish() + } + BinOp::Shr(v0) => { + let mut formatter = formatter.debug_tuple("Shr"); + formatter.field(v0); + formatter.finish() + } + BinOp::Eq(v0) => { + let mut formatter = formatter.debug_tuple("Eq"); + formatter.field(v0); + formatter.finish() + } + BinOp::Lt(v0) => { + let mut formatter = formatter.debug_tuple("Lt"); + formatter.field(v0); + formatter.finish() + } + BinOp::Le(v0) => { + let mut formatter = formatter.debug_tuple("Le"); + formatter.field(v0); + formatter.finish() + } + BinOp::Ne(v0) => { + let mut formatter = formatter.debug_tuple("Ne"); + formatter.field(v0); + formatter.finish() + } + BinOp::Ge(v0) => { + let mut formatter = formatter.debug_tuple("Ge"); + formatter.field(v0); + formatter.finish() + } + BinOp::Gt(v0) => { + let mut formatter = formatter.debug_tuple("Gt"); + formatter.field(v0); + formatter.finish() + } + BinOp::AddEq(v0) => { + let mut formatter = formatter.debug_tuple("AddEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::SubEq(v0) => { + let mut formatter = formatter.debug_tuple("SubEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::MulEq(v0) => { + let mut formatter = formatter.debug_tuple("MulEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::DivEq(v0) => { + let mut formatter = formatter.debug_tuple("DivEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::RemEq(v0) => { + let mut formatter = formatter.debug_tuple("RemEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitXorEq(v0) => { + let mut formatter = formatter.debug_tuple("BitXorEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitAndEq(v0) => { + let mut formatter = formatter.debug_tuple("BitAndEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::BitOrEq(v0) => { + let mut formatter = formatter.debug_tuple("BitOrEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::ShlEq(v0) => { + let mut formatter = formatter.debug_tuple("ShlEq"); + formatter.field(v0); + formatter.finish() + } + BinOp::ShrEq(v0) => { + let mut formatter = formatter.debug_tuple("ShrEq"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Binding { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Binding"); + formatter.field("ident", &self.ident); + formatter.field("eq_token", &self.eq_token); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Block { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Block"); + formatter.field("brace_token", &self.brace_token); + formatter.field("stmts", &self.stmts); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for BoundLifetimes { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("BoundLifetimes"); + formatter.field("for_token", &self.for_token); + formatter.field("lt_token", &self.lt_token); + formatter.field("lifetimes", &self.lifetimes); + formatter.field("gt_token", &self.gt_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ConstParam { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ConstParam"); + formatter.field("attrs", &self.attrs); + formatter.field("const_token", &self.const_token); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("eq_token", &self.eq_token); + formatter.field("default", &self.default); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Constraint { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Constraint"); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +#[cfg(feature = "derive")] +impl Debug for Data { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Data::Struct(v0) => { + let mut formatter = formatter.debug_tuple("Struct"); + formatter.field(v0); + formatter.finish() + } + Data::Enum(v0) => { + let mut formatter = formatter.debug_tuple("Enum"); + formatter.field(v0); + formatter.finish() + } + Data::Union(v0) => { + let mut formatter = formatter.debug_tuple("Union"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "derive")] +impl Debug for DataEnum { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("DataEnum"); + formatter.field("enum_token", &self.enum_token); + formatter.field("brace_token", &self.brace_token); + formatter.field("variants", &self.variants); + formatter.finish() + } +} +#[cfg(feature = "derive")] +impl Debug for DataStruct { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("DataStruct"); + formatter.field("struct_token", &self.struct_token); + formatter.field("fields", &self.fields); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "derive")] +impl Debug for DataUnion { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("DataUnion"); + formatter.field("union_token", &self.union_token); + formatter.field("fields", &self.fields); + formatter.finish() + } +} +#[cfg(feature = "derive")] +impl Debug for DeriveInput { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("DeriveInput"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("data", &self.data); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Expr { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + #[cfg(feature = "full")] + Expr::Array(v0) => { + let mut formatter = formatter.debug_tuple("Array"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Assign(v0) => { + let mut formatter = formatter.debug_tuple("Assign"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::AssignOp(v0) => { + let mut formatter = formatter.debug_tuple("AssignOp"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Async(v0) => { + let mut formatter = formatter.debug_tuple("Async"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Await(v0) => { + let mut formatter = formatter.debug_tuple("Await"); + formatter.field(v0); + formatter.finish() + } + Expr::Binary(v0) => { + let mut formatter = formatter.debug_tuple("Binary"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Block(v0) => { + let mut formatter = formatter.debug_tuple("Block"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Box(v0) => { + let mut formatter = formatter.debug_tuple("Box"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Break(v0) => { + let mut formatter = formatter.debug_tuple("Break"); + formatter.field(v0); + formatter.finish() + } + Expr::Call(v0) => { + let mut formatter = formatter.debug_tuple("Call"); + formatter.field(v0); + formatter.finish() + } + Expr::Cast(v0) => { + let mut formatter = formatter.debug_tuple("Cast"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Closure(v0) => { + let mut formatter = formatter.debug_tuple("Closure"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Continue(v0) => { + let mut formatter = formatter.debug_tuple("Continue"); + formatter.field(v0); + formatter.finish() + } + Expr::Field(v0) => { + let mut formatter = formatter.debug_tuple("Field"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::ForLoop(v0) => { + let mut formatter = formatter.debug_tuple("ForLoop"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Group(v0) => { + let mut formatter = formatter.debug_tuple("Group"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::If(v0) => { + let mut formatter = formatter.debug_tuple("If"); + formatter.field(v0); + formatter.finish() + } + Expr::Index(v0) => { + let mut formatter = formatter.debug_tuple("Index"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Let(v0) => { + let mut formatter = formatter.debug_tuple("Let"); + formatter.field(v0); + formatter.finish() + } + Expr::Lit(v0) => { + let mut formatter = formatter.debug_tuple("Lit"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Loop(v0) => { + let mut formatter = formatter.debug_tuple("Loop"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Match(v0) => { + let mut formatter = formatter.debug_tuple("Match"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::MethodCall(v0) => { + let mut formatter = formatter.debug_tuple("MethodCall"); + formatter.field(v0); + formatter.finish() + } + Expr::Paren(v0) => { + let mut formatter = formatter.debug_tuple("Paren"); + formatter.field(v0); + formatter.finish() + } + Expr::Path(v0) => { + let mut formatter = formatter.debug_tuple("Path"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Range(v0) => { + let mut formatter = formatter.debug_tuple("Range"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Reference(v0) => { + let mut formatter = formatter.debug_tuple("Reference"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Repeat(v0) => { + let mut formatter = formatter.debug_tuple("Repeat"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Return(v0) => { + let mut formatter = formatter.debug_tuple("Return"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Struct(v0) => { + let mut formatter = formatter.debug_tuple("Struct"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Try(v0) => { + let mut formatter = formatter.debug_tuple("Try"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::TryBlock(v0) => { + let mut formatter = formatter.debug_tuple("TryBlock"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Tuple(v0) => { + let mut formatter = formatter.debug_tuple("Tuple"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + Expr::Unary(v0) => { + let mut formatter = formatter.debug_tuple("Unary"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Unsafe(v0) => { + let mut formatter = formatter.debug_tuple("Unsafe"); + formatter.field(v0); + formatter.finish() + } + Expr::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::While(v0) => { + let mut formatter = formatter.debug_tuple("While"); + formatter.field(v0); + formatter.finish() + } + #[cfg(feature = "full")] + Expr::Yield(v0) => { + let mut formatter = formatter.debug_tuple("Yield"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for ExprArray { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprArray"); + formatter.field("attrs", &self.attrs); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("elems", &self.elems); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprAssign { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprAssign"); + formatter.field("attrs", &self.attrs); + formatter.field("left", &self.left); + formatter.field("eq_token", &self.eq_token); + formatter.field("right", &self.right); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprAssignOp { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprAssignOp"); + formatter.field("attrs", &self.attrs); + formatter.field("left", &self.left); + formatter.field("op", &self.op); + formatter.field("right", &self.right); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprAsync { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprAsync"); + formatter.field("attrs", &self.attrs); + formatter.field("async_token", &self.async_token); + formatter.field("capture", &self.capture); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprAwait { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprAwait"); + formatter.field("attrs", &self.attrs); + formatter.field("base", &self.base); + formatter.field("dot_token", &self.dot_token); + formatter.field("await_token", &self.await_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprBinary { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprBinary"); + formatter.field("attrs", &self.attrs); + formatter.field("left", &self.left); + formatter.field("op", &self.op); + formatter.field("right", &self.right); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprBlock { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprBlock"); + formatter.field("attrs", &self.attrs); + formatter.field("label", &self.label); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprBox { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprBox"); + formatter.field("attrs", &self.attrs); + formatter.field("box_token", &self.box_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprBreak { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprBreak"); + formatter.field("attrs", &self.attrs); + formatter.field("break_token", &self.break_token); + formatter.field("label", &self.label); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprCall { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprCall"); + formatter.field("attrs", &self.attrs); + formatter.field("func", &self.func); + formatter.field("paren_token", &self.paren_token); + formatter.field("args", &self.args); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprCast { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprCast"); + formatter.field("attrs", &self.attrs); + formatter.field("expr", &self.expr); + formatter.field("as_token", &self.as_token); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprClosure { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprClosure"); + formatter.field("attrs", &self.attrs); + formatter.field("asyncness", &self.asyncness); + formatter.field("movability", &self.movability); + formatter.field("capture", &self.capture); + formatter.field("or1_token", &self.or1_token); + formatter.field("inputs", &self.inputs); + formatter.field("or2_token", &self.or2_token); + formatter.field("output", &self.output); + formatter.field("body", &self.body); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprContinue { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprContinue"); + formatter.field("attrs", &self.attrs); + formatter.field("continue_token", &self.continue_token); + formatter.field("label", &self.label); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprField { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprField"); + formatter.field("attrs", &self.attrs); + formatter.field("base", &self.base); + formatter.field("dot_token", &self.dot_token); + formatter.field("member", &self.member); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprForLoop { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprForLoop"); + formatter.field("attrs", &self.attrs); + formatter.field("label", &self.label); + formatter.field("for_token", &self.for_token); + formatter.field("pat", &self.pat); + formatter.field("in_token", &self.in_token); + formatter.field("expr", &self.expr); + formatter.field("body", &self.body); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprGroup { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprGroup"); + formatter.field("attrs", &self.attrs); + formatter.field("group_token", &self.group_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprIf { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprIf"); + formatter.field("attrs", &self.attrs); + formatter.field("if_token", &self.if_token); + formatter.field("cond", &self.cond); + formatter.field("then_branch", &self.then_branch); + formatter.field("else_branch", &self.else_branch); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprIndex { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprIndex"); + formatter.field("attrs", &self.attrs); + formatter.field("expr", &self.expr); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("index", &self.index); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprLet { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprLet"); + formatter.field("attrs", &self.attrs); + formatter.field("let_token", &self.let_token); + formatter.field("pat", &self.pat); + formatter.field("eq_token", &self.eq_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprLit { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprLit"); + formatter.field("attrs", &self.attrs); + formatter.field("lit", &self.lit); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprLoop { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprLoop"); + formatter.field("attrs", &self.attrs); + formatter.field("label", &self.label); + formatter.field("loop_token", &self.loop_token); + formatter.field("body", &self.body); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("mac", &self.mac); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprMatch { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprMatch"); + formatter.field("attrs", &self.attrs); + formatter.field("match_token", &self.match_token); + formatter.field("expr", &self.expr); + formatter.field("brace_token", &self.brace_token); + formatter.field("arms", &self.arms); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprMethodCall { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprMethodCall"); + formatter.field("attrs", &self.attrs); + formatter.field("receiver", &self.receiver); + formatter.field("dot_token", &self.dot_token); + formatter.field("method", &self.method); + formatter.field("turbofish", &self.turbofish); + formatter.field("paren_token", &self.paren_token); + formatter.field("args", &self.args); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprParen { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprParen"); + formatter.field("attrs", &self.attrs); + formatter.field("paren_token", &self.paren_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprPath { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprPath"); + formatter.field("attrs", &self.attrs); + formatter.field("qself", &self.qself); + formatter.field("path", &self.path); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprRange { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprRange"); + formatter.field("attrs", &self.attrs); + formatter.field("from", &self.from); + formatter.field("limits", &self.limits); + formatter.field("to", &self.to); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprReference { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprReference"); + formatter.field("attrs", &self.attrs); + formatter.field("and_token", &self.and_token); + formatter.field("raw", &self.raw); + formatter.field("mutability", &self.mutability); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprRepeat { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprRepeat"); + formatter.field("attrs", &self.attrs); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("expr", &self.expr); + formatter.field("semi_token", &self.semi_token); + formatter.field("len", &self.len); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprReturn { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprReturn"); + formatter.field("attrs", &self.attrs); + formatter.field("return_token", &self.return_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprStruct { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprStruct"); + formatter.field("attrs", &self.attrs); + formatter.field("path", &self.path); + formatter.field("brace_token", &self.brace_token); + formatter.field("fields", &self.fields); + formatter.field("dot2_token", &self.dot2_token); + formatter.field("rest", &self.rest); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprTry { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprTry"); + formatter.field("attrs", &self.attrs); + formatter.field("expr", &self.expr); + formatter.field("question_token", &self.question_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprTryBlock { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprTryBlock"); + formatter.field("attrs", &self.attrs); + formatter.field("try_token", &self.try_token); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprTuple { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprTuple"); + formatter.field("attrs", &self.attrs); + formatter.field("paren_token", &self.paren_token); + formatter.field("elems", &self.elems); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprType"); + formatter.field("attrs", &self.attrs); + formatter.field("expr", &self.expr); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ExprUnary { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprUnary"); + formatter.field("attrs", &self.attrs); + formatter.field("op", &self.op); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprUnsafe { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprUnsafe"); + formatter.field("attrs", &self.attrs); + formatter.field("unsafe_token", &self.unsafe_token); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprWhile { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprWhile"); + formatter.field("attrs", &self.attrs); + formatter.field("label", &self.label); + formatter.field("while_token", &self.while_token); + formatter.field("cond", &self.cond); + formatter.field("body", &self.body); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ExprYield { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ExprYield"); + formatter.field("attrs", &self.attrs); + formatter.field("yield_token", &self.yield_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Field { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Field"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for FieldPat { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("FieldPat"); + formatter.field("attrs", &self.attrs); + formatter.field("member", &self.member); + formatter.field("colon_token", &self.colon_token); + formatter.field("pat", &self.pat); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for FieldValue { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("FieldValue"); + formatter.field("attrs", &self.attrs); + formatter.field("member", &self.member); + formatter.field("colon_token", &self.colon_token); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Fields { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Fields::Named(v0) => { + let mut formatter = formatter.debug_tuple("Named"); + formatter.field(v0); + formatter.finish() + } + Fields::Unnamed(v0) => { + let mut formatter = formatter.debug_tuple("Unnamed"); + formatter.field(v0); + formatter.finish() + } + Fields::Unit => formatter.write_str("Unit"), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for FieldsNamed { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("FieldsNamed"); + formatter.field("brace_token", &self.brace_token); + formatter.field("named", &self.named); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for FieldsUnnamed { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("FieldsUnnamed"); + formatter.field("paren_token", &self.paren_token); + formatter.field("unnamed", &self.unnamed); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for File { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("File"); + formatter.field("shebang", &self.shebang); + formatter.field("attrs", &self.attrs); + formatter.field("items", &self.items); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for FnArg { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + FnArg::Receiver(v0) => { + let mut formatter = formatter.debug_tuple("Receiver"); + formatter.field(v0); + formatter.finish() + } + FnArg::Typed(v0) => { + let mut formatter = formatter.debug_tuple("Typed"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for ForeignItem { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + ForeignItem::Fn(v0) => { + let mut formatter = formatter.debug_tuple("Fn"); + formatter.field(v0); + formatter.finish() + } + ForeignItem::Static(v0) => { + let mut formatter = formatter.debug_tuple("Static"); + formatter.field(v0); + formatter.finish() + } + ForeignItem::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + ForeignItem::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + ForeignItem::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for ForeignItemFn { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ForeignItemFn"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("sig", &self.sig); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ForeignItemMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ForeignItemMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("mac", &self.mac); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ForeignItemStatic { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ForeignItemStatic"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("static_token", &self.static_token); + formatter.field("mutability", &self.mutability); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ForeignItemType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ForeignItemType"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("type_token", &self.type_token); + formatter.field("ident", &self.ident); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for GenericArgument { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + GenericArgument::Lifetime(v0) => { + let mut formatter = formatter.debug_tuple("Lifetime"); + formatter.field(v0); + formatter.finish() + } + GenericArgument::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + GenericArgument::Binding(v0) => { + let mut formatter = formatter.debug_tuple("Binding"); + formatter.field(v0); + formatter.finish() + } + GenericArgument::Constraint(v0) => { + let mut formatter = formatter.debug_tuple("Constraint"); + formatter.field(v0); + formatter.finish() + } + GenericArgument::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for GenericMethodArgument { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + GenericMethodArgument::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + GenericMethodArgument::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for GenericParam { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + GenericParam::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + GenericParam::Lifetime(v0) => { + let mut formatter = formatter.debug_tuple("Lifetime"); + formatter.field(v0); + formatter.finish() + } + GenericParam::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Generics { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Generics"); + formatter.field("lt_token", &self.lt_token); + formatter.field("params", &self.params); + formatter.field("gt_token", &self.gt_token); + formatter.field("where_clause", &self.where_clause); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ImplItem { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + ImplItem::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + ImplItem::Method(v0) => { + let mut formatter = formatter.debug_tuple("Method"); + formatter.field(v0); + formatter.finish() + } + ImplItem::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + ImplItem::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + ImplItem::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for ImplItemConst { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ImplItemConst"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("defaultness", &self.defaultness); + formatter.field("const_token", &self.const_token); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("eq_token", &self.eq_token); + formatter.field("expr", &self.expr); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ImplItemMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ImplItemMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("mac", &self.mac); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ImplItemMethod { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ImplItemMethod"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("defaultness", &self.defaultness); + formatter.field("sig", &self.sig); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ImplItemType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ImplItemType"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("defaultness", &self.defaultness); + formatter.field("type_token", &self.type_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("eq_token", &self.eq_token); + formatter.field("ty", &self.ty); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Index { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Index"); + formatter.field("index", &self.index); + formatter.field("span", &self.span); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Item { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Item::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + Item::Enum(v0) => { + let mut formatter = formatter.debug_tuple("Enum"); + formatter.field(v0); + formatter.finish() + } + Item::ExternCrate(v0) => { + let mut formatter = formatter.debug_tuple("ExternCrate"); + formatter.field(v0); + formatter.finish() + } + Item::Fn(v0) => { + let mut formatter = formatter.debug_tuple("Fn"); + formatter.field(v0); + formatter.finish() + } + Item::ForeignMod(v0) => { + let mut formatter = formatter.debug_tuple("ForeignMod"); + formatter.field(v0); + formatter.finish() + } + Item::Impl(v0) => { + let mut formatter = formatter.debug_tuple("Impl"); + formatter.field(v0); + formatter.finish() + } + Item::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + Item::Macro2(v0) => { + let mut formatter = formatter.debug_tuple("Macro2"); + formatter.field(v0); + formatter.finish() + } + Item::Mod(v0) => { + let mut formatter = formatter.debug_tuple("Mod"); + formatter.field(v0); + formatter.finish() + } + Item::Static(v0) => { + let mut formatter = formatter.debug_tuple("Static"); + formatter.field(v0); + formatter.finish() + } + Item::Struct(v0) => { + let mut formatter = formatter.debug_tuple("Struct"); + formatter.field(v0); + formatter.finish() + } + Item::Trait(v0) => { + let mut formatter = formatter.debug_tuple("Trait"); + formatter.field(v0); + formatter.finish() + } + Item::TraitAlias(v0) => { + let mut formatter = formatter.debug_tuple("TraitAlias"); + formatter.field(v0); + formatter.finish() + } + Item::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + Item::Union(v0) => { + let mut formatter = formatter.debug_tuple("Union"); + formatter.field(v0); + formatter.finish() + } + Item::Use(v0) => { + let mut formatter = formatter.debug_tuple("Use"); + formatter.field(v0); + formatter.finish() + } + Item::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for ItemConst { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemConst"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("const_token", &self.const_token); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("eq_token", &self.eq_token); + formatter.field("expr", &self.expr); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemEnum { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemEnum"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("enum_token", &self.enum_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("brace_token", &self.brace_token); + formatter.field("variants", &self.variants); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemExternCrate { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemExternCrate"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("extern_token", &self.extern_token); + formatter.field("crate_token", &self.crate_token); + formatter.field("ident", &self.ident); + formatter.field("rename", &self.rename); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemFn { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemFn"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("sig", &self.sig); + formatter.field("block", &self.block); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemForeignMod { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemForeignMod"); + formatter.field("attrs", &self.attrs); + formatter.field("abi", &self.abi); + formatter.field("brace_token", &self.brace_token); + formatter.field("items", &self.items); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemImpl { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemImpl"); + formatter.field("attrs", &self.attrs); + formatter.field("defaultness", &self.defaultness); + formatter.field("unsafety", &self.unsafety); + formatter.field("impl_token", &self.impl_token); + formatter.field("generics", &self.generics); + formatter.field("trait_", &self.trait_); + formatter.field("self_ty", &self.self_ty); + formatter.field("brace_token", &self.brace_token); + formatter.field("items", &self.items); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("ident", &self.ident); + formatter.field("mac", &self.mac); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemMacro2 { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemMacro2"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("macro_token", &self.macro_token); + formatter.field("ident", &self.ident); + formatter.field("rules", &self.rules); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemMod { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemMod"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("mod_token", &self.mod_token); + formatter.field("ident", &self.ident); + formatter.field("content", &self.content); + formatter.field("semi", &self.semi); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemStatic { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemStatic"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("static_token", &self.static_token); + formatter.field("mutability", &self.mutability); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("eq_token", &self.eq_token); + formatter.field("expr", &self.expr); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemStruct { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemStruct"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("struct_token", &self.struct_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("fields", &self.fields); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemTrait { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemTrait"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("unsafety", &self.unsafety); + formatter.field("auto_token", &self.auto_token); + formatter.field("trait_token", &self.trait_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("colon_token", &self.colon_token); + formatter.field("supertraits", &self.supertraits); + formatter.field("brace_token", &self.brace_token); + formatter.field("items", &self.items); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemTraitAlias { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemTraitAlias"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("trait_token", &self.trait_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("eq_token", &self.eq_token); + formatter.field("bounds", &self.bounds); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemType"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("type_token", &self.type_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("eq_token", &self.eq_token); + formatter.field("ty", &self.ty); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemUnion { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemUnion"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("union_token", &self.union_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("fields", &self.fields); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for ItemUse { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ItemUse"); + formatter.field("attrs", &self.attrs); + formatter.field("vis", &self.vis); + formatter.field("use_token", &self.use_token); + formatter.field("leading_colon", &self.leading_colon); + formatter.field("tree", &self.tree); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Label { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Label"); + formatter.field("name", &self.name); + formatter.field("colon_token", &self.colon_token); + formatter.finish() + } +} +impl Debug for Lifetime { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Lifetime"); + formatter.field("apostrophe", &self.apostrophe); + formatter.field("ident", &self.ident); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for LifetimeDef { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("LifetimeDef"); + formatter.field("attrs", &self.attrs); + formatter.field("lifetime", &self.lifetime); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +impl Debug for Lit { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Lit::Str(v0) => { + let mut formatter = formatter.debug_tuple("Str"); + formatter.field(v0); + formatter.finish() + } + Lit::ByteStr(v0) => { + let mut formatter = formatter.debug_tuple("ByteStr"); + formatter.field(v0); + formatter.finish() + } + Lit::Byte(v0) => { + let mut formatter = formatter.debug_tuple("Byte"); + formatter.field(v0); + formatter.finish() + } + Lit::Char(v0) => { + let mut formatter = formatter.debug_tuple("Char"); + formatter.field(v0); + formatter.finish() + } + Lit::Int(v0) => { + let mut formatter = formatter.debug_tuple("Int"); + formatter.field(v0); + formatter.finish() + } + Lit::Float(v0) => { + let mut formatter = formatter.debug_tuple("Float"); + formatter.field(v0); + formatter.finish() + } + Lit::Bool(v0) => { + let mut formatter = formatter.debug_tuple("Bool"); + formatter.field(v0); + formatter.finish() + } + Lit::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for Local { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Local"); + formatter.field("attrs", &self.attrs); + formatter.field("let_token", &self.let_token); + formatter.field("pat", &self.pat); + formatter.field("init", &self.init); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Macro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Macro"); + formatter.field("path", &self.path); + formatter.field("bang_token", &self.bang_token); + formatter.field("delimiter", &self.delimiter); + formatter.field("tokens", &self.tokens); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for MacroDelimiter { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + MacroDelimiter::Paren(v0) => { + let mut formatter = formatter.debug_tuple("Paren"); + formatter.field(v0); + formatter.finish() + } + MacroDelimiter::Brace(v0) => { + let mut formatter = formatter.debug_tuple("Brace"); + formatter.field(v0); + formatter.finish() + } + MacroDelimiter::Bracket(v0) => { + let mut formatter = formatter.debug_tuple("Bracket"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Member { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Member::Named(v0) => { + let mut formatter = formatter.debug_tuple("Named"); + formatter.field(v0); + formatter.finish() + } + Member::Unnamed(v0) => { + let mut formatter = formatter.debug_tuple("Unnamed"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Meta { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Meta::Path(v0) => { + let mut formatter = formatter.debug_tuple("Path"); + formatter.field(v0); + formatter.finish() + } + Meta::List(v0) => { + let mut formatter = formatter.debug_tuple("List"); + formatter.field(v0); + formatter.finish() + } + Meta::NameValue(v0) => { + let mut formatter = formatter.debug_tuple("NameValue"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for MetaList { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("MetaList"); + formatter.field("path", &self.path); + formatter.field("paren_token", &self.paren_token); + formatter.field("nested", &self.nested); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for MetaNameValue { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("MetaNameValue"); + formatter.field("path", &self.path); + formatter.field("eq_token", &self.eq_token); + formatter.field("lit", &self.lit); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for MethodTurbofish { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("MethodTurbofish"); + formatter.field("colon2_token", &self.colon2_token); + formatter.field("lt_token", &self.lt_token); + formatter.field("args", &self.args); + formatter.field("gt_token", &self.gt_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for NestedMeta { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + NestedMeta::Meta(v0) => { + let mut formatter = formatter.debug_tuple("Meta"); + formatter.field(v0); + formatter.finish() + } + NestedMeta::Lit(v0) => { + let mut formatter = formatter.debug_tuple("Lit"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ParenthesizedGenericArguments { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("ParenthesizedGenericArguments"); + formatter.field("paren_token", &self.paren_token); + formatter.field("inputs", &self.inputs); + formatter.field("output", &self.output); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Pat { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Pat::Box(v0) => { + let mut formatter = formatter.debug_tuple("Box"); + formatter.field(v0); + formatter.finish() + } + Pat::Ident(v0) => { + let mut formatter = formatter.debug_tuple("Ident"); + formatter.field(v0); + formatter.finish() + } + Pat::Lit(v0) => { + let mut formatter = formatter.debug_tuple("Lit"); + formatter.field(v0); + formatter.finish() + } + Pat::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + Pat::Or(v0) => { + let mut formatter = formatter.debug_tuple("Or"); + formatter.field(v0); + formatter.finish() + } + Pat::Path(v0) => { + let mut formatter = formatter.debug_tuple("Path"); + formatter.field(v0); + formatter.finish() + } + Pat::Range(v0) => { + let mut formatter = formatter.debug_tuple("Range"); + formatter.field(v0); + formatter.finish() + } + Pat::Reference(v0) => { + let mut formatter = formatter.debug_tuple("Reference"); + formatter.field(v0); + formatter.finish() + } + Pat::Rest(v0) => { + let mut formatter = formatter.debug_tuple("Rest"); + formatter.field(v0); + formatter.finish() + } + Pat::Slice(v0) => { + let mut formatter = formatter.debug_tuple("Slice"); + formatter.field(v0); + formatter.finish() + } + Pat::Struct(v0) => { + let mut formatter = formatter.debug_tuple("Struct"); + formatter.field(v0); + formatter.finish() + } + Pat::Tuple(v0) => { + let mut formatter = formatter.debug_tuple("Tuple"); + formatter.field(v0); + formatter.finish() + } + Pat::TupleStruct(v0) => { + let mut formatter = formatter.debug_tuple("TupleStruct"); + formatter.field(v0); + formatter.finish() + } + Pat::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + Pat::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + Pat::Wild(v0) => { + let mut formatter = formatter.debug_tuple("Wild"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for PatBox { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatBox"); + formatter.field("attrs", &self.attrs); + formatter.field("box_token", &self.box_token); + formatter.field("pat", &self.pat); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatIdent { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatIdent"); + formatter.field("attrs", &self.attrs); + formatter.field("by_ref", &self.by_ref); + formatter.field("mutability", &self.mutability); + formatter.field("ident", &self.ident); + formatter.field("subpat", &self.subpat); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatLit { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatLit"); + formatter.field("attrs", &self.attrs); + formatter.field("expr", &self.expr); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("mac", &self.mac); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatOr { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatOr"); + formatter.field("attrs", &self.attrs); + formatter.field("leading_vert", &self.leading_vert); + formatter.field("cases", &self.cases); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatPath { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatPath"); + formatter.field("attrs", &self.attrs); + formatter.field("qself", &self.qself); + formatter.field("path", &self.path); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatRange { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatRange"); + formatter.field("attrs", &self.attrs); + formatter.field("lo", &self.lo); + formatter.field("limits", &self.limits); + formatter.field("hi", &self.hi); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatReference { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatReference"); + formatter.field("attrs", &self.attrs); + formatter.field("and_token", &self.and_token); + formatter.field("mutability", &self.mutability); + formatter.field("pat", &self.pat); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatRest { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatRest"); + formatter.field("attrs", &self.attrs); + formatter.field("dot2_token", &self.dot2_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatSlice { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatSlice"); + formatter.field("attrs", &self.attrs); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("elems", &self.elems); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatStruct { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatStruct"); + formatter.field("attrs", &self.attrs); + formatter.field("path", &self.path); + formatter.field("brace_token", &self.brace_token); + formatter.field("fields", &self.fields); + formatter.field("dot2_token", &self.dot2_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatTuple { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatTuple"); + formatter.field("attrs", &self.attrs); + formatter.field("paren_token", &self.paren_token); + formatter.field("elems", &self.elems); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatTupleStruct { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatTupleStruct"); + formatter.field("attrs", &self.attrs); + formatter.field("path", &self.path); + formatter.field("pat", &self.pat); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatType"); + formatter.field("attrs", &self.attrs); + formatter.field("pat", &self.pat); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for PatWild { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PatWild"); + formatter.field("attrs", &self.attrs); + formatter.field("underscore_token", &self.underscore_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Path { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Path"); + formatter.field("leading_colon", &self.leading_colon); + formatter.field("segments", &self.segments); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for PathArguments { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + PathArguments::None => formatter.write_str("None"), + PathArguments::AngleBracketed(v0) => { + let mut formatter = formatter.debug_tuple("AngleBracketed"); + formatter.field(v0); + formatter.finish() + } + PathArguments::Parenthesized(v0) => { + let mut formatter = formatter.debug_tuple("Parenthesized"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for PathSegment { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PathSegment"); + formatter.field("ident", &self.ident); + formatter.field("arguments", &self.arguments); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for PredicateEq { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PredicateEq"); + formatter.field("lhs_ty", &self.lhs_ty); + formatter.field("eq_token", &self.eq_token); + formatter.field("rhs_ty", &self.rhs_ty); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for PredicateLifetime { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PredicateLifetime"); + formatter.field("lifetime", &self.lifetime); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for PredicateType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("PredicateType"); + formatter.field("lifetimes", &self.lifetimes); + formatter.field("bounded_ty", &self.bounded_ty); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for QSelf { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("QSelf"); + formatter.field("lt_token", &self.lt_token); + formatter.field("ty", &self.ty); + formatter.field("position", &self.position); + formatter.field("as_token", &self.as_token); + formatter.field("gt_token", &self.gt_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for RangeLimits { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + RangeLimits::HalfOpen(v0) => { + let mut formatter = formatter.debug_tuple("HalfOpen"); + formatter.field(v0); + formatter.finish() + } + RangeLimits::Closed(v0) => { + let mut formatter = formatter.debug_tuple("Closed"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for Receiver { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Receiver"); + formatter.field("attrs", &self.attrs); + formatter.field("reference", &self.reference); + formatter.field("mutability", &self.mutability); + formatter.field("self_token", &self.self_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for ReturnType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + ReturnType::Default => formatter.write_str("Default"), + ReturnType::Type(v0, v1) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.field(v1); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for Signature { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Signature"); + formatter.field("constness", &self.constness); + formatter.field("asyncness", &self.asyncness); + formatter.field("unsafety", &self.unsafety); + formatter.field("abi", &self.abi); + formatter.field("fn_token", &self.fn_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("paren_token", &self.paren_token); + formatter.field("inputs", &self.inputs); + formatter.field("variadic", &self.variadic); + formatter.field("output", &self.output); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for Stmt { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Stmt::Local(v0) => { + let mut formatter = formatter.debug_tuple("Local"); + formatter.field(v0); + formatter.finish() + } + Stmt::Item(v0) => { + let mut formatter = formatter.debug_tuple("Item"); + formatter.field(v0); + formatter.finish() + } + Stmt::Expr(v0) => { + let mut formatter = formatter.debug_tuple("Expr"); + formatter.field(v0); + formatter.finish() + } + Stmt::Semi(v0, v1) => { + let mut formatter = formatter.debug_tuple("Semi"); + formatter.field(v0); + formatter.field(v1); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TraitBound { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TraitBound"); + formatter.field("paren_token", &self.paren_token); + formatter.field("modifier", &self.modifier); + formatter.field("lifetimes", &self.lifetimes); + formatter.field("path", &self.path); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TraitBoundModifier { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + TraitBoundModifier::None => formatter.write_str("None"), + TraitBoundModifier::Maybe(v0) => { + let mut formatter = formatter.debug_tuple("Maybe"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for TraitItem { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + TraitItem::Const(v0) => { + let mut formatter = formatter.debug_tuple("Const"); + formatter.field(v0); + formatter.finish() + } + TraitItem::Method(v0) => { + let mut formatter = formatter.debug_tuple("Method"); + formatter.field(v0); + formatter.finish() + } + TraitItem::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + TraitItem::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + TraitItem::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Debug for TraitItemConst { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TraitItemConst"); + formatter.field("attrs", &self.attrs); + formatter.field("const_token", &self.const_token); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("ty", &self.ty); + formatter.field("default", &self.default); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for TraitItemMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TraitItemMacro"); + formatter.field("attrs", &self.attrs); + formatter.field("mac", &self.mac); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for TraitItemMethod { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TraitItemMethod"); + formatter.field("attrs", &self.attrs); + formatter.field("sig", &self.sig); + formatter.field("default", &self.default); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for TraitItemType { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TraitItemType"); + formatter.field("attrs", &self.attrs); + formatter.field("type_token", &self.type_token); + formatter.field("ident", &self.ident); + formatter.field("generics", &self.generics); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.field("default", &self.default); + formatter.field("semi_token", &self.semi_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Type { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Type::Array(v0) => { + let mut formatter = formatter.debug_tuple("Array"); + formatter.field(v0); + formatter.finish() + } + Type::BareFn(v0) => { + let mut formatter = formatter.debug_tuple("BareFn"); + formatter.field(v0); + formatter.finish() + } + Type::Group(v0) => { + let mut formatter = formatter.debug_tuple("Group"); + formatter.field(v0); + formatter.finish() + } + Type::ImplTrait(v0) => { + let mut formatter = formatter.debug_tuple("ImplTrait"); + formatter.field(v0); + formatter.finish() + } + Type::Infer(v0) => { + let mut formatter = formatter.debug_tuple("Infer"); + formatter.field(v0); + formatter.finish() + } + Type::Macro(v0) => { + let mut formatter = formatter.debug_tuple("Macro"); + formatter.field(v0); + formatter.finish() + } + Type::Never(v0) => { + let mut formatter = formatter.debug_tuple("Never"); + formatter.field(v0); + formatter.finish() + } + Type::Paren(v0) => { + let mut formatter = formatter.debug_tuple("Paren"); + formatter.field(v0); + formatter.finish() + } + Type::Path(v0) => { + let mut formatter = formatter.debug_tuple("Path"); + formatter.field(v0); + formatter.finish() + } + Type::Ptr(v0) => { + let mut formatter = formatter.debug_tuple("Ptr"); + formatter.field(v0); + formatter.finish() + } + Type::Reference(v0) => { + let mut formatter = formatter.debug_tuple("Reference"); + formatter.field(v0); + formatter.finish() + } + Type::Slice(v0) => { + let mut formatter = formatter.debug_tuple("Slice"); + formatter.field(v0); + formatter.finish() + } + Type::TraitObject(v0) => { + let mut formatter = formatter.debug_tuple("TraitObject"); + formatter.field(v0); + formatter.finish() + } + Type::Tuple(v0) => { + let mut formatter = formatter.debug_tuple("Tuple"); + formatter.field(v0); + formatter.finish() + } + Type::Verbatim(v0) => { + let mut formatter = formatter.debug_tuple("Verbatim"); + formatter.field(v0); + formatter.finish() + } + _ => unreachable!(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeArray { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeArray"); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("elem", &self.elem); + formatter.field("semi_token", &self.semi_token); + formatter.field("len", &self.len); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeBareFn { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeBareFn"); + formatter.field("lifetimes", &self.lifetimes); + formatter.field("unsafety", &self.unsafety); + formatter.field("abi", &self.abi); + formatter.field("fn_token", &self.fn_token); + formatter.field("paren_token", &self.paren_token); + formatter.field("inputs", &self.inputs); + formatter.field("variadic", &self.variadic); + formatter.field("output", &self.output); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeGroup { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeGroup"); + formatter.field("group_token", &self.group_token); + formatter.field("elem", &self.elem); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeImplTrait { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeImplTrait"); + formatter.field("impl_token", &self.impl_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeInfer { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeInfer"); + formatter.field("underscore_token", &self.underscore_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeMacro { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeMacro"); + formatter.field("mac", &self.mac); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeNever { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeNever"); + formatter.field("bang_token", &self.bang_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeParam { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeParam"); + formatter.field("attrs", &self.attrs); + formatter.field("ident", &self.ident); + formatter.field("colon_token", &self.colon_token); + formatter.field("bounds", &self.bounds); + formatter.field("eq_token", &self.eq_token); + formatter.field("default", &self.default); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeParamBound { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + TypeParamBound::Trait(v0) => { + let mut formatter = formatter.debug_tuple("Trait"); + formatter.field(v0); + formatter.finish() + } + TypeParamBound::Lifetime(v0) => { + let mut formatter = formatter.debug_tuple("Lifetime"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeParen { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeParen"); + formatter.field("paren_token", &self.paren_token); + formatter.field("elem", &self.elem); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypePath { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypePath"); + formatter.field("qself", &self.qself); + formatter.field("path", &self.path); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypePtr { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypePtr"); + formatter.field("star_token", &self.star_token); + formatter.field("const_token", &self.const_token); + formatter.field("mutability", &self.mutability); + formatter.field("elem", &self.elem); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeReference { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeReference"); + formatter.field("and_token", &self.and_token); + formatter.field("lifetime", &self.lifetime); + formatter.field("mutability", &self.mutability); + formatter.field("elem", &self.elem); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeSlice { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeSlice"); + formatter.field("bracket_token", &self.bracket_token); + formatter.field("elem", &self.elem); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeTraitObject { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeTraitObject"); + formatter.field("dyn_token", &self.dyn_token); + formatter.field("bounds", &self.bounds); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for TypeTuple { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("TypeTuple"); + formatter.field("paren_token", &self.paren_token); + formatter.field("elems", &self.elems); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for UnOp { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + UnOp::Deref(v0) => { + let mut formatter = formatter.debug_tuple("Deref"); + formatter.field(v0); + formatter.finish() + } + UnOp::Not(v0) => { + let mut formatter = formatter.debug_tuple("Not"); + formatter.field(v0); + formatter.finish() + } + UnOp::Neg(v0) => { + let mut formatter = formatter.debug_tuple("Neg"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(feature = "full")] +impl Debug for UseGlob { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("UseGlob"); + formatter.field("star_token", &self.star_token); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for UseGroup { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("UseGroup"); + formatter.field("brace_token", &self.brace_token); + formatter.field("items", &self.items); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for UseName { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("UseName"); + formatter.field("ident", &self.ident); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for UsePath { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("UsePath"); + formatter.field("ident", &self.ident); + formatter.field("colon2_token", &self.colon2_token); + formatter.field("tree", &self.tree); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for UseRename { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("UseRename"); + formatter.field("ident", &self.ident); + formatter.field("as_token", &self.as_token); + formatter.field("rename", &self.rename); + formatter.finish() + } +} +#[cfg(feature = "full")] +impl Debug for UseTree { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + UseTree::Path(v0) => { + let mut formatter = formatter.debug_tuple("Path"); + formatter.field(v0); + formatter.finish() + } + UseTree::Name(v0) => { + let mut formatter = formatter.debug_tuple("Name"); + formatter.field(v0); + formatter.finish() + } + UseTree::Rename(v0) => { + let mut formatter = formatter.debug_tuple("Rename"); + formatter.field(v0); + formatter.finish() + } + UseTree::Glob(v0) => { + let mut formatter = formatter.debug_tuple("Glob"); + formatter.field(v0); + formatter.finish() + } + UseTree::Group(v0) => { + let mut formatter = formatter.debug_tuple("Group"); + formatter.field(v0); + formatter.finish() + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Variadic { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Variadic"); + formatter.field("attrs", &self.attrs); + formatter.field("dots", &self.dots); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Variant { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("Variant"); + formatter.field("attrs", &self.attrs); + formatter.field("ident", &self.ident); + formatter.field("fields", &self.fields); + formatter.field("discriminant", &self.discriminant); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for VisCrate { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("VisCrate"); + formatter.field("crate_token", &self.crate_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for VisPublic { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("VisPublic"); + formatter.field("pub_token", &self.pub_token); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for VisRestricted { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("VisRestricted"); + formatter.field("pub_token", &self.pub_token); + formatter.field("paren_token", &self.paren_token); + formatter.field("in_token", &self.in_token); + formatter.field("path", &self.path); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for Visibility { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Visibility::Public(v0) => { + let mut formatter = formatter.debug_tuple("Public"); + formatter.field(v0); + formatter.finish() + } + Visibility::Crate(v0) => { + let mut formatter = formatter.debug_tuple("Crate"); + formatter.field(v0); + formatter.finish() + } + Visibility::Restricted(v0) => { + let mut formatter = formatter.debug_tuple("Restricted"); + formatter.field(v0); + formatter.finish() + } + Visibility::Inherited => formatter.write_str("Inherited"), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for WhereClause { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut formatter = formatter.debug_struct("WhereClause"); + formatter.field("where_token", &self.where_token); + formatter.field("predicates", &self.predicates); + formatter.finish() + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Debug for WherePredicate { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + WherePredicate::Type(v0) => { + let mut formatter = formatter.debug_tuple("Type"); + formatter.field(v0); + formatter.finish() + } + WherePredicate::Lifetime(v0) => { + let mut formatter = formatter.debug_tuple("Lifetime"); + formatter.field(v0); + formatter.finish() + } + WherePredicate::Eq(v0) => { + let mut formatter = formatter.debug_tuple("Eq"); + formatter.field(v0); + formatter.finish() + } + } + } +} diff --git a/src/gen/eq.rs b/src/gen/eq.rs new file mode 100644 index 00000000..15b2bcbb --- /dev/null +++ b/src/gen/eq.rs @@ -0,0 +1,1930 @@ +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. + +#[cfg(any(feature = "derive", feature = "full"))] +use crate::tt::TokenStreamHelper; +use crate::*; +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Abi {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Abi { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for AngleBracketedGenericArguments {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for AngleBracketedGenericArguments { + fn eq(&self, other: &Self) -> bool { + self.colon2_token == other.colon2_token && self.args == other.args + } +} +#[cfg(feature = "full")] +impl Eq for Arm {} +#[cfg(feature = "full")] +impl PartialEq for Arm { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.pat == other.pat + && self.guard == other.guard + && self.body == other.body + && self.comma == other.comma + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for AttrStyle {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for AttrStyle { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (AttrStyle::Outer, AttrStyle::Outer) => true, + (AttrStyle::Inner(_), AttrStyle::Inner(_)) => true, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Attribute {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Attribute { + fn eq(&self, other: &Self) -> bool { + self.style == other.style + && self.path == other.path + && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens) + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for BareFnArg {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for BareFnArg { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.name == other.name && self.ty == other.ty + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for BinOp {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for BinOp { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (BinOp::Add(_), BinOp::Add(_)) => true, + (BinOp::Sub(_), BinOp::Sub(_)) => true, + (BinOp::Mul(_), BinOp::Mul(_)) => true, + (BinOp::Div(_), BinOp::Div(_)) => true, + (BinOp::Rem(_), BinOp::Rem(_)) => true, + (BinOp::And(_), BinOp::And(_)) => true, + (BinOp::Or(_), BinOp::Or(_)) => true, + (BinOp::BitXor(_), BinOp::BitXor(_)) => true, + (BinOp::BitAnd(_), BinOp::BitAnd(_)) => true, + (BinOp::BitOr(_), BinOp::BitOr(_)) => true, + (BinOp::Shl(_), BinOp::Shl(_)) => true, + (BinOp::Shr(_), BinOp::Shr(_)) => true, + (BinOp::Eq(_), BinOp::Eq(_)) => true, + (BinOp::Lt(_), BinOp::Lt(_)) => true, + (BinOp::Le(_), BinOp::Le(_)) => true, + (BinOp::Ne(_), BinOp::Ne(_)) => true, + (BinOp::Ge(_), BinOp::Ge(_)) => true, + (BinOp::Gt(_), BinOp::Gt(_)) => true, + (BinOp::AddEq(_), BinOp::AddEq(_)) => true, + (BinOp::SubEq(_), BinOp::SubEq(_)) => true, + (BinOp::MulEq(_), BinOp::MulEq(_)) => true, + (BinOp::DivEq(_), BinOp::DivEq(_)) => true, + (BinOp::RemEq(_), BinOp::RemEq(_)) => true, + (BinOp::BitXorEq(_), BinOp::BitXorEq(_)) => true, + (BinOp::BitAndEq(_), BinOp::BitAndEq(_)) => true, + (BinOp::BitOrEq(_), BinOp::BitOrEq(_)) => true, + (BinOp::ShlEq(_), BinOp::ShlEq(_)) => true, + (BinOp::ShrEq(_), BinOp::ShrEq(_)) => true, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Binding {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Binding { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for Block {} +#[cfg(feature = "full")] +impl PartialEq for Block { + fn eq(&self, other: &Self) -> bool { + self.stmts == other.stmts + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for BoundLifetimes {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for BoundLifetimes { + fn eq(&self, other: &Self) -> bool { + self.lifetimes == other.lifetimes + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ConstParam {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ConstParam { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.ty == other.ty + && self.eq_token == other.eq_token + && self.default == other.default + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Constraint {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Constraint { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident && self.bounds == other.bounds + } +} +#[cfg(feature = "derive")] +impl Eq for Data {} +#[cfg(feature = "derive")] +impl PartialEq for Data { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Data::Struct(self0), Data::Struct(other0)) => self0 == other0, + (Data::Enum(self0), Data::Enum(other0)) => self0 == other0, + (Data::Union(self0), Data::Union(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(feature = "derive")] +impl Eq for DataEnum {} +#[cfg(feature = "derive")] +impl PartialEq for DataEnum { + fn eq(&self, other: &Self) -> bool { + self.variants == other.variants + } +} +#[cfg(feature = "derive")] +impl Eq for DataStruct {} +#[cfg(feature = "derive")] +impl PartialEq for DataStruct { + fn eq(&self, other: &Self) -> bool { + self.fields == other.fields && self.semi_token == other.semi_token + } +} +#[cfg(feature = "derive")] +impl Eq for DataUnion {} +#[cfg(feature = "derive")] +impl PartialEq for DataUnion { + fn eq(&self, other: &Self) -> bool { + self.fields == other.fields + } +} +#[cfg(feature = "derive")] +impl Eq for DeriveInput {} +#[cfg(feature = "derive")] +impl PartialEq for DeriveInput { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.data == other.data + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Expr {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Expr { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + #[cfg(feature = "full")] + (Expr::Array(self0), Expr::Array(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Assign(self0), Expr::Assign(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::AssignOp(self0), Expr::AssignOp(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Async(self0), Expr::Async(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Await(self0), Expr::Await(other0)) => self0 == other0, + (Expr::Binary(self0), Expr::Binary(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Block(self0), Expr::Block(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Box(self0), Expr::Box(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Break(self0), Expr::Break(other0)) => self0 == other0, + (Expr::Call(self0), Expr::Call(other0)) => self0 == other0, + (Expr::Cast(self0), Expr::Cast(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Closure(self0), Expr::Closure(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Continue(self0), Expr::Continue(other0)) => self0 == other0, + (Expr::Field(self0), Expr::Field(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::ForLoop(self0), Expr::ForLoop(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Group(self0), Expr::Group(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::If(self0), Expr::If(other0)) => self0 == other0, + (Expr::Index(self0), Expr::Index(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Let(self0), Expr::Let(other0)) => self0 == other0, + (Expr::Lit(self0), Expr::Lit(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Loop(self0), Expr::Loop(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Macro(self0), Expr::Macro(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Match(self0), Expr::Match(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::MethodCall(self0), Expr::MethodCall(other0)) => self0 == other0, + (Expr::Paren(self0), Expr::Paren(other0)) => self0 == other0, + (Expr::Path(self0), Expr::Path(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Range(self0), Expr::Range(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Reference(self0), Expr::Reference(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Repeat(self0), Expr::Repeat(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Return(self0), Expr::Return(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Struct(self0), Expr::Struct(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Try(self0), Expr::Try(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::TryBlock(self0), Expr::TryBlock(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Tuple(self0), Expr::Tuple(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Type(self0), Expr::Type(other0)) => self0 == other0, + (Expr::Unary(self0), Expr::Unary(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Unsafe(self0), Expr::Unsafe(other0)) => self0 == other0, + (Expr::Verbatim(self0), Expr::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + #[cfg(feature = "full")] + (Expr::While(self0), Expr::While(other0)) => self0 == other0, + #[cfg(feature = "full")] + (Expr::Yield(self0), Expr::Yield(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for ExprArray {} +#[cfg(feature = "full")] +impl PartialEq for ExprArray { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.elems == other.elems + } +} +#[cfg(feature = "full")] +impl Eq for ExprAssign {} +#[cfg(feature = "full")] +impl PartialEq for ExprAssign { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.left == other.left && self.right == other.right + } +} +#[cfg(feature = "full")] +impl Eq for ExprAssignOp {} +#[cfg(feature = "full")] +impl PartialEq for ExprAssignOp { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.left == other.left + && self.op == other.op + && self.right == other.right + } +} +#[cfg(feature = "full")] +impl Eq for ExprAsync {} +#[cfg(feature = "full")] +impl PartialEq for ExprAsync { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.capture == other.capture && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ExprAwait {} +#[cfg(feature = "full")] +impl PartialEq for ExprAwait { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.base == other.base + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprBinary {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprBinary { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.left == other.left + && self.op == other.op + && self.right == other.right + } +} +#[cfg(feature = "full")] +impl Eq for ExprBlock {} +#[cfg(feature = "full")] +impl PartialEq for ExprBlock { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.label == other.label && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ExprBox {} +#[cfg(feature = "full")] +impl PartialEq for ExprBox { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprBreak {} +#[cfg(feature = "full")] +impl PartialEq for ExprBreak { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.label == other.label && self.expr == other.expr + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprCall {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprCall { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.func == other.func && self.args == other.args + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprCast {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprCast { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for ExprClosure {} +#[cfg(feature = "full")] +impl PartialEq for ExprClosure { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.asyncness == other.asyncness + && self.movability == other.movability + && self.capture == other.capture + && self.inputs == other.inputs + && self.output == other.output + && self.body == other.body + } +} +#[cfg(feature = "full")] +impl Eq for ExprContinue {} +#[cfg(feature = "full")] +impl PartialEq for ExprContinue { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.label == other.label + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprField {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprField { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.base == other.base && self.member == other.member + } +} +#[cfg(feature = "full")] +impl Eq for ExprForLoop {} +#[cfg(feature = "full")] +impl PartialEq for ExprForLoop { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.label == other.label + && self.pat == other.pat + && self.expr == other.expr + && self.body == other.body + } +} +#[cfg(feature = "full")] +impl Eq for ExprGroup {} +#[cfg(feature = "full")] +impl PartialEq for ExprGroup { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprIf {} +#[cfg(feature = "full")] +impl PartialEq for ExprIf { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.cond == other.cond + && self.then_branch == other.then_branch + && self.else_branch == other.else_branch + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprIndex {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprIndex { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr && self.index == other.index + } +} +#[cfg(feature = "full")] +impl Eq for ExprLet {} +#[cfg(feature = "full")] +impl PartialEq for ExprLet { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.pat == other.pat && self.expr == other.expr + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprLit {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprLit { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.lit == other.lit + } +} +#[cfg(feature = "full")] +impl Eq for ExprLoop {} +#[cfg(feature = "full")] +impl PartialEq for ExprLoop { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.label == other.label && self.body == other.body + } +} +#[cfg(feature = "full")] +impl Eq for ExprMacro {} +#[cfg(feature = "full")] +impl PartialEq for ExprMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mac == other.mac + } +} +#[cfg(feature = "full")] +impl Eq for ExprMatch {} +#[cfg(feature = "full")] +impl PartialEq for ExprMatch { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr && self.arms == other.arms + } +} +#[cfg(feature = "full")] +impl Eq for ExprMethodCall {} +#[cfg(feature = "full")] +impl PartialEq for ExprMethodCall { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.receiver == other.receiver + && self.method == other.method + && self.turbofish == other.turbofish + && self.args == other.args + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprParen {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprParen { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprPath {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprPath { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.qself == other.qself && self.path == other.path + } +} +#[cfg(feature = "full")] +impl Eq for ExprRange {} +#[cfg(feature = "full")] +impl PartialEq for ExprRange { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.from == other.from + && self.limits == other.limits + && self.to == other.to + } +} +#[cfg(feature = "full")] +impl Eq for ExprReference {} +#[cfg(feature = "full")] +impl PartialEq for ExprReference { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mutability == other.mutability && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprRepeat {} +#[cfg(feature = "full")] +impl PartialEq for ExprRepeat { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr && self.len == other.len + } +} +#[cfg(feature = "full")] +impl Eq for ExprReturn {} +#[cfg(feature = "full")] +impl PartialEq for ExprReturn { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprStruct {} +#[cfg(feature = "full")] +impl PartialEq for ExprStruct { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.path == other.path + && self.fields == other.fields + && self.dot2_token == other.dot2_token + && self.rest == other.rest + } +} +#[cfg(feature = "full")] +impl Eq for ExprTry {} +#[cfg(feature = "full")] +impl PartialEq for ExprTry { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprTryBlock {} +#[cfg(feature = "full")] +impl PartialEq for ExprTryBlock { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ExprTuple {} +#[cfg(feature = "full")] +impl PartialEq for ExprTuple { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.elems == other.elems + } +} +#[cfg(feature = "full")] +impl Eq for ExprType {} +#[cfg(feature = "full")] +impl PartialEq for ExprType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr && self.ty == other.ty + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ExprUnary {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ExprUnary { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.op == other.op && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ExprUnsafe {} +#[cfg(feature = "full")] +impl PartialEq for ExprUnsafe { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ExprWhile {} +#[cfg(feature = "full")] +impl PartialEq for ExprWhile { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.label == other.label + && self.cond == other.cond + && self.body == other.body + } +} +#[cfg(feature = "full")] +impl Eq for ExprYield {} +#[cfg(feature = "full")] +impl PartialEq for ExprYield { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Field {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Field { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.colon_token == other.colon_token + && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for FieldPat {} +#[cfg(feature = "full")] +impl PartialEq for FieldPat { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.member == other.member + && self.colon_token == other.colon_token + && self.pat == other.pat + } +} +#[cfg(feature = "full")] +impl Eq for FieldValue {} +#[cfg(feature = "full")] +impl PartialEq for FieldValue { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.member == other.member + && self.colon_token == other.colon_token + && self.expr == other.expr + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Fields {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Fields { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Fields::Named(self0), Fields::Named(other0)) => self0 == other0, + (Fields::Unnamed(self0), Fields::Unnamed(other0)) => self0 == other0, + (Fields::Unit, Fields::Unit) => true, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for FieldsNamed {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for FieldsNamed { + fn eq(&self, other: &Self) -> bool { + self.named == other.named + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for FieldsUnnamed {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for FieldsUnnamed { + fn eq(&self, other: &Self) -> bool { + self.unnamed == other.unnamed + } +} +#[cfg(feature = "full")] +impl Eq for File {} +#[cfg(feature = "full")] +impl PartialEq for File { + fn eq(&self, other: &Self) -> bool { + self.shebang == other.shebang && self.attrs == other.attrs && self.items == other.items + } +} +#[cfg(feature = "full")] +impl Eq for FnArg {} +#[cfg(feature = "full")] +impl PartialEq for FnArg { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (FnArg::Receiver(self0), FnArg::Receiver(other0)) => self0 == other0, + (FnArg::Typed(self0), FnArg::Typed(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for ForeignItem {} +#[cfg(feature = "full")] +impl PartialEq for ForeignItem { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (ForeignItem::Fn(self0), ForeignItem::Fn(other0)) => self0 == other0, + (ForeignItem::Static(self0), ForeignItem::Static(other0)) => self0 == other0, + (ForeignItem::Type(self0), ForeignItem::Type(other0)) => self0 == other0, + (ForeignItem::Macro(self0), ForeignItem::Macro(other0)) => self0 == other0, + (ForeignItem::Verbatim(self0), ForeignItem::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for ForeignItemFn {} +#[cfg(feature = "full")] +impl PartialEq for ForeignItemFn { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.vis == other.vis && self.sig == other.sig + } +} +#[cfg(feature = "full")] +impl Eq for ForeignItemMacro {} +#[cfg(feature = "full")] +impl PartialEq for ForeignItemMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for ForeignItemStatic {} +#[cfg(feature = "full")] +impl PartialEq for ForeignItemStatic { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.mutability == other.mutability + && self.ident == other.ident + && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for ForeignItemType {} +#[cfg(feature = "full")] +impl PartialEq for ForeignItemType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.vis == other.vis && self.ident == other.ident + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for GenericArgument {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for GenericArgument { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (GenericArgument::Lifetime(self0), GenericArgument::Lifetime(other0)) => { + self0 == other0 + } + (GenericArgument::Type(self0), GenericArgument::Type(other0)) => self0 == other0, + (GenericArgument::Binding(self0), GenericArgument::Binding(other0)) => self0 == other0, + (GenericArgument::Constraint(self0), GenericArgument::Constraint(other0)) => { + self0 == other0 + } + (GenericArgument::Const(self0), GenericArgument::Const(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for GenericMethodArgument {} +#[cfg(feature = "full")] +impl PartialEq for GenericMethodArgument { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (GenericMethodArgument::Type(self0), GenericMethodArgument::Type(other0)) => { + self0 == other0 + } + (GenericMethodArgument::Const(self0), GenericMethodArgument::Const(other0)) => { + self0 == other0 + } + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for GenericParam {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for GenericParam { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (GenericParam::Type(self0), GenericParam::Type(other0)) => self0 == other0, + (GenericParam::Lifetime(self0), GenericParam::Lifetime(other0)) => self0 == other0, + (GenericParam::Const(self0), GenericParam::Const(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Generics {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Generics { + fn eq(&self, other: &Self) -> bool { + self.lt_token == other.lt_token + && self.params == other.params + && self.gt_token == other.gt_token + && self.where_clause == other.where_clause + } +} +#[cfg(feature = "full")] +impl Eq for ImplItem {} +#[cfg(feature = "full")] +impl PartialEq for ImplItem { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (ImplItem::Const(self0), ImplItem::Const(other0)) => self0 == other0, + (ImplItem::Method(self0), ImplItem::Method(other0)) => self0 == other0, + (ImplItem::Type(self0), ImplItem::Type(other0)) => self0 == other0, + (ImplItem::Macro(self0), ImplItem::Macro(other0)) => self0 == other0, + (ImplItem::Verbatim(self0), ImplItem::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for ImplItemConst {} +#[cfg(feature = "full")] +impl PartialEq for ImplItemConst { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.defaultness == other.defaultness + && self.ident == other.ident + && self.ty == other.ty + && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ImplItemMacro {} +#[cfg(feature = "full")] +impl PartialEq for ImplItemMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for ImplItemMethod {} +#[cfg(feature = "full")] +impl PartialEq for ImplItemMethod { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.defaultness == other.defaultness + && self.sig == other.sig + && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ImplItemType {} +#[cfg(feature = "full")] +impl PartialEq for ImplItemType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.defaultness == other.defaultness + && self.ident == other.ident + && self.generics == other.generics + && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for Item {} +#[cfg(feature = "full")] +impl PartialEq for Item { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Item::Const(self0), Item::Const(other0)) => self0 == other0, + (Item::Enum(self0), Item::Enum(other0)) => self0 == other0, + (Item::ExternCrate(self0), Item::ExternCrate(other0)) => self0 == other0, + (Item::Fn(self0), Item::Fn(other0)) => self0 == other0, + (Item::ForeignMod(self0), Item::ForeignMod(other0)) => self0 == other0, + (Item::Impl(self0), Item::Impl(other0)) => self0 == other0, + (Item::Macro(self0), Item::Macro(other0)) => self0 == other0, + (Item::Macro2(self0), Item::Macro2(other0)) => self0 == other0, + (Item::Mod(self0), Item::Mod(other0)) => self0 == other0, + (Item::Static(self0), Item::Static(other0)) => self0 == other0, + (Item::Struct(self0), Item::Struct(other0)) => self0 == other0, + (Item::Trait(self0), Item::Trait(other0)) => self0 == other0, + (Item::TraitAlias(self0), Item::TraitAlias(other0)) => self0 == other0, + (Item::Type(self0), Item::Type(other0)) => self0 == other0, + (Item::Union(self0), Item::Union(other0)) => self0 == other0, + (Item::Use(self0), Item::Use(other0)) => self0 == other0, + (Item::Verbatim(self0), Item::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for ItemConst {} +#[cfg(feature = "full")] +impl PartialEq for ItemConst { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.ty == other.ty + && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ItemEnum {} +#[cfg(feature = "full")] +impl PartialEq for ItemEnum { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.variants == other.variants + } +} +#[cfg(feature = "full")] +impl Eq for ItemExternCrate {} +#[cfg(feature = "full")] +impl PartialEq for ItemExternCrate { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.rename == other.rename + } +} +#[cfg(feature = "full")] +impl Eq for ItemFn {} +#[cfg(feature = "full")] +impl PartialEq for ItemFn { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.sig == other.sig + && self.block == other.block + } +} +#[cfg(feature = "full")] +impl Eq for ItemForeignMod {} +#[cfg(feature = "full")] +impl PartialEq for ItemForeignMod { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.abi == other.abi && self.items == other.items + } +} +#[cfg(feature = "full")] +impl Eq for ItemImpl {} +#[cfg(feature = "full")] +impl PartialEq for ItemImpl { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.defaultness == other.defaultness + && self.unsafety == other.unsafety + && self.generics == other.generics + && self.trait_ == other.trait_ + && self.self_ty == other.self_ty + && self.items == other.items + } +} +#[cfg(feature = "full")] +impl Eq for ItemMacro {} +#[cfg(feature = "full")] +impl PartialEq for ItemMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.mac == other.mac + && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for ItemMacro2 {} +#[cfg(feature = "full")] +impl PartialEq for ItemMacro2 { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && TokenStreamHelper(&self.rules) == TokenStreamHelper(&other.rules) + } +} +#[cfg(feature = "full")] +impl Eq for ItemMod {} +#[cfg(feature = "full")] +impl PartialEq for ItemMod { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.content == other.content + && self.semi == other.semi + } +} +#[cfg(feature = "full")] +impl Eq for ItemStatic {} +#[cfg(feature = "full")] +impl PartialEq for ItemStatic { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.mutability == other.mutability + && self.ident == other.ident + && self.ty == other.ty + && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for ItemStruct {} +#[cfg(feature = "full")] +impl PartialEq for ItemStruct { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.fields == other.fields + && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for ItemTrait {} +#[cfg(feature = "full")] +impl PartialEq for ItemTrait { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.unsafety == other.unsafety + && self.auto_token == other.auto_token + && self.ident == other.ident + && self.generics == other.generics + && self.colon_token == other.colon_token + && self.supertraits == other.supertraits + && self.items == other.items + } +} +#[cfg(feature = "full")] +impl Eq for ItemTraitAlias {} +#[cfg(feature = "full")] +impl PartialEq for ItemTraitAlias { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.bounds == other.bounds + } +} +#[cfg(feature = "full")] +impl Eq for ItemType {} +#[cfg(feature = "full")] +impl PartialEq for ItemType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for ItemUnion {} +#[cfg(feature = "full")] +impl PartialEq for ItemUnion { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.ident == other.ident + && self.generics == other.generics + && self.fields == other.fields + } +} +#[cfg(feature = "full")] +impl Eq for ItemUse {} +#[cfg(feature = "full")] +impl PartialEq for ItemUse { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.vis == other.vis + && self.leading_colon == other.leading_colon + && self.tree == other.tree + } +} +#[cfg(feature = "full")] +impl Eq for Label {} +#[cfg(feature = "full")] +impl PartialEq for Label { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for LifetimeDef {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for LifetimeDef { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.lifetime == other.lifetime + && self.colon_token == other.colon_token + && self.bounds == other.bounds + } +} +impl Eq for Lit {} +impl PartialEq for Lit { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Lit::Str(self0), Lit::Str(other0)) => self0 == other0, + (Lit::ByteStr(self0), Lit::ByteStr(other0)) => self0 == other0, + (Lit::Byte(self0), Lit::Byte(other0)) => self0 == other0, + (Lit::Char(self0), Lit::Char(other0)) => self0 == other0, + (Lit::Int(self0), Lit::Int(other0)) => self0 == other0, + (Lit::Float(self0), Lit::Float(other0)) => self0 == other0, + (Lit::Bool(self0), Lit::Bool(other0)) => self0 == other0, + (Lit::Verbatim(self0), Lit::Verbatim(other0)) => { + self0.to_string() == other0.to_string() + } + _ => false, + } + } +} +impl Eq for LitBool {} +impl PartialEq for LitBool { + fn eq(&self, other: &Self) -> bool { + self.value == other.value + } +} +impl Eq for LitByte {} +impl Eq for LitByteStr {} +impl Eq for LitChar {} +impl Eq for LitFloat {} +impl Eq for LitInt {} +impl Eq for LitStr {} +#[cfg(feature = "full")] +impl Eq for Local {} +#[cfg(feature = "full")] +impl PartialEq for Local { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.pat == other.pat && self.init == other.init + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Macro {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Macro { + fn eq(&self, other: &Self) -> bool { + self.path == other.path + && self.delimiter == other.delimiter + && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens) + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for MacroDelimiter {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for MacroDelimiter { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (MacroDelimiter::Paren(_), MacroDelimiter::Paren(_)) => true, + (MacroDelimiter::Brace(_), MacroDelimiter::Brace(_)) => true, + (MacroDelimiter::Bracket(_), MacroDelimiter::Bracket(_)) => true, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Meta {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Meta { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Meta::Path(self0), Meta::Path(other0)) => self0 == other0, + (Meta::List(self0), Meta::List(other0)) => self0 == other0, + (Meta::NameValue(self0), Meta::NameValue(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for MetaList {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for MetaList { + fn eq(&self, other: &Self) -> bool { + self.path == other.path && self.nested == other.nested + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for MetaNameValue {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for MetaNameValue { + fn eq(&self, other: &Self) -> bool { + self.path == other.path && self.lit == other.lit + } +} +#[cfg(feature = "full")] +impl Eq for MethodTurbofish {} +#[cfg(feature = "full")] +impl PartialEq for MethodTurbofish { + fn eq(&self, other: &Self) -> bool { + self.args == other.args + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for NestedMeta {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for NestedMeta { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (NestedMeta::Meta(self0), NestedMeta::Meta(other0)) => self0 == other0, + (NestedMeta::Lit(self0), NestedMeta::Lit(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ParenthesizedGenericArguments {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ParenthesizedGenericArguments { + fn eq(&self, other: &Self) -> bool { + self.inputs == other.inputs && self.output == other.output + } +} +#[cfg(feature = "full")] +impl Eq for Pat {} +#[cfg(feature = "full")] +impl PartialEq for Pat { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Pat::Box(self0), Pat::Box(other0)) => self0 == other0, + (Pat::Ident(self0), Pat::Ident(other0)) => self0 == other0, + (Pat::Lit(self0), Pat::Lit(other0)) => self0 == other0, + (Pat::Macro(self0), Pat::Macro(other0)) => self0 == other0, + (Pat::Or(self0), Pat::Or(other0)) => self0 == other0, + (Pat::Path(self0), Pat::Path(other0)) => self0 == other0, + (Pat::Range(self0), Pat::Range(other0)) => self0 == other0, + (Pat::Reference(self0), Pat::Reference(other0)) => self0 == other0, + (Pat::Rest(self0), Pat::Rest(other0)) => self0 == other0, + (Pat::Slice(self0), Pat::Slice(other0)) => self0 == other0, + (Pat::Struct(self0), Pat::Struct(other0)) => self0 == other0, + (Pat::Tuple(self0), Pat::Tuple(other0)) => self0 == other0, + (Pat::TupleStruct(self0), Pat::TupleStruct(other0)) => self0 == other0, + (Pat::Type(self0), Pat::Type(other0)) => self0 == other0, + (Pat::Verbatim(self0), Pat::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + (Pat::Wild(self0), Pat::Wild(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for PatBox {} +#[cfg(feature = "full")] +impl PartialEq for PatBox { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.pat == other.pat + } +} +#[cfg(feature = "full")] +impl Eq for PatIdent {} +#[cfg(feature = "full")] +impl PartialEq for PatIdent { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.by_ref == other.by_ref + && self.mutability == other.mutability + && self.ident == other.ident + && self.subpat == other.subpat + } +} +#[cfg(feature = "full")] +impl Eq for PatLit {} +#[cfg(feature = "full")] +impl PartialEq for PatLit { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.expr == other.expr + } +} +#[cfg(feature = "full")] +impl Eq for PatMacro {} +#[cfg(feature = "full")] +impl PartialEq for PatMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mac == other.mac + } +} +#[cfg(feature = "full")] +impl Eq for PatOr {} +#[cfg(feature = "full")] +impl PartialEq for PatOr { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.leading_vert == other.leading_vert + && self.cases == other.cases + } +} +#[cfg(feature = "full")] +impl Eq for PatPath {} +#[cfg(feature = "full")] +impl PartialEq for PatPath { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.qself == other.qself && self.path == other.path + } +} +#[cfg(feature = "full")] +impl Eq for PatRange {} +#[cfg(feature = "full")] +impl PartialEq for PatRange { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.lo == other.lo + && self.limits == other.limits + && self.hi == other.hi + } +} +#[cfg(feature = "full")] +impl Eq for PatReference {} +#[cfg(feature = "full")] +impl PartialEq for PatReference { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mutability == other.mutability && self.pat == other.pat + } +} +#[cfg(feature = "full")] +impl Eq for PatRest {} +#[cfg(feature = "full")] +impl PartialEq for PatRest { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + } +} +#[cfg(feature = "full")] +impl Eq for PatSlice {} +#[cfg(feature = "full")] +impl PartialEq for PatSlice { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.elems == other.elems + } +} +#[cfg(feature = "full")] +impl Eq for PatStruct {} +#[cfg(feature = "full")] +impl PartialEq for PatStruct { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.path == other.path + && self.fields == other.fields + && self.dot2_token == other.dot2_token + } +} +#[cfg(feature = "full")] +impl Eq for PatTuple {} +#[cfg(feature = "full")] +impl PartialEq for PatTuple { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.elems == other.elems + } +} +#[cfg(feature = "full")] +impl Eq for PatTupleStruct {} +#[cfg(feature = "full")] +impl PartialEq for PatTupleStruct { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.path == other.path && self.pat == other.pat + } +} +#[cfg(feature = "full")] +impl Eq for PatType {} +#[cfg(feature = "full")] +impl PartialEq for PatType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.pat == other.pat && self.ty == other.ty + } +} +#[cfg(feature = "full")] +impl Eq for PatWild {} +#[cfg(feature = "full")] +impl PartialEq for PatWild { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Path {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Path { + fn eq(&self, other: &Self) -> bool { + self.leading_colon == other.leading_colon && self.segments == other.segments + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for PathArguments {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for PathArguments { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (PathArguments::None, PathArguments::None) => true, + (PathArguments::AngleBracketed(self0), PathArguments::AngleBracketed(other0)) => { + self0 == other0 + } + (PathArguments::Parenthesized(self0), PathArguments::Parenthesized(other0)) => { + self0 == other0 + } + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for PathSegment {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for PathSegment { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident && self.arguments == other.arguments + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for PredicateEq {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for PredicateEq { + fn eq(&self, other: &Self) -> bool { + self.lhs_ty == other.lhs_ty && self.rhs_ty == other.rhs_ty + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for PredicateLifetime {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for PredicateLifetime { + fn eq(&self, other: &Self) -> bool { + self.lifetime == other.lifetime && self.bounds == other.bounds + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for PredicateType {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for PredicateType { + fn eq(&self, other: &Self) -> bool { + self.lifetimes == other.lifetimes + && self.bounded_ty == other.bounded_ty + && self.bounds == other.bounds + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for QSelf {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for QSelf { + fn eq(&self, other: &Self) -> bool { + self.ty == other.ty && self.position == other.position && self.as_token == other.as_token + } +} +#[cfg(feature = "full")] +impl Eq for RangeLimits {} +#[cfg(feature = "full")] +impl PartialEq for RangeLimits { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (RangeLimits::HalfOpen(_), RangeLimits::HalfOpen(_)) => true, + (RangeLimits::Closed(_), RangeLimits::Closed(_)) => true, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for Receiver {} +#[cfg(feature = "full")] +impl PartialEq for Receiver { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.reference == other.reference + && self.mutability == other.mutability + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for ReturnType {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for ReturnType { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (ReturnType::Default, ReturnType::Default) => true, + (ReturnType::Type(_, self1), ReturnType::Type(_, other1)) => self1 == other1, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for Signature {} +#[cfg(feature = "full")] +impl PartialEq for Signature { + fn eq(&self, other: &Self) -> bool { + self.constness == other.constness + && self.asyncness == other.asyncness + && self.unsafety == other.unsafety + && self.abi == other.abi + && self.ident == other.ident + && self.generics == other.generics + && self.inputs == other.inputs + && self.variadic == other.variadic + && self.output == other.output + } +} +#[cfg(feature = "full")] +impl Eq for Stmt {} +#[cfg(feature = "full")] +impl PartialEq for Stmt { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Stmt::Local(self0), Stmt::Local(other0)) => self0 == other0, + (Stmt::Item(self0), Stmt::Item(other0)) => self0 == other0, + (Stmt::Expr(self0), Stmt::Expr(other0)) => self0 == other0, + (Stmt::Semi(self0, _), Stmt::Semi(other0, _)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TraitBound {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TraitBound { + fn eq(&self, other: &Self) -> bool { + self.paren_token == other.paren_token + && self.modifier == other.modifier + && self.lifetimes == other.lifetimes + && self.path == other.path + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TraitBoundModifier {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TraitBoundModifier { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (TraitBoundModifier::None, TraitBoundModifier::None) => true, + (TraitBoundModifier::Maybe(_), TraitBoundModifier::Maybe(_)) => true, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for TraitItem {} +#[cfg(feature = "full")] +impl PartialEq for TraitItem { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (TraitItem::Const(self0), TraitItem::Const(other0)) => self0 == other0, + (TraitItem::Method(self0), TraitItem::Method(other0)) => self0 == other0, + (TraitItem::Type(self0), TraitItem::Type(other0)) => self0 == other0, + (TraitItem::Macro(self0), TraitItem::Macro(other0)) => self0 == other0, + (TraitItem::Verbatim(self0), TraitItem::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for TraitItemConst {} +#[cfg(feature = "full")] +impl PartialEq for TraitItemConst { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.ty == other.ty + && self.default == other.default + } +} +#[cfg(feature = "full")] +impl Eq for TraitItemMacro {} +#[cfg(feature = "full")] +impl PartialEq for TraitItemMacro { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs && self.mac == other.mac && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for TraitItemMethod {} +#[cfg(feature = "full")] +impl PartialEq for TraitItemMethod { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.sig == other.sig + && self.default == other.default + && self.semi_token == other.semi_token + } +} +#[cfg(feature = "full")] +impl Eq for TraitItemType {} +#[cfg(feature = "full")] +impl PartialEq for TraitItemType { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.generics == other.generics + && self.colon_token == other.colon_token + && self.bounds == other.bounds + && self.default == other.default + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Type {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Type { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Type::Array(self0), Type::Array(other0)) => self0 == other0, + (Type::BareFn(self0), Type::BareFn(other0)) => self0 == other0, + (Type::Group(self0), Type::Group(other0)) => self0 == other0, + (Type::ImplTrait(self0), Type::ImplTrait(other0)) => self0 == other0, + (Type::Infer(self0), Type::Infer(other0)) => self0 == other0, + (Type::Macro(self0), Type::Macro(other0)) => self0 == other0, + (Type::Never(self0), Type::Never(other0)) => self0 == other0, + (Type::Paren(self0), Type::Paren(other0)) => self0 == other0, + (Type::Path(self0), Type::Path(other0)) => self0 == other0, + (Type::Ptr(self0), Type::Ptr(other0)) => self0 == other0, + (Type::Reference(self0), Type::Reference(other0)) => self0 == other0, + (Type::Slice(self0), Type::Slice(other0)) => self0 == other0, + (Type::TraitObject(self0), Type::TraitObject(other0)) => self0 == other0, + (Type::Tuple(self0), Type::Tuple(other0)) => self0 == other0, + (Type::Verbatim(self0), Type::Verbatim(other0)) => { + TokenStreamHelper(self0) == TokenStreamHelper(other0) + } + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeArray {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeArray { + fn eq(&self, other: &Self) -> bool { + self.elem == other.elem && self.len == other.len + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeBareFn {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeBareFn { + fn eq(&self, other: &Self) -> bool { + self.lifetimes == other.lifetimes + && self.unsafety == other.unsafety + && self.abi == other.abi + && self.inputs == other.inputs + && self.variadic == other.variadic + && self.output == other.output + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeGroup {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeGroup { + fn eq(&self, other: &Self) -> bool { + self.elem == other.elem + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeImplTrait {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeImplTrait { + fn eq(&self, other: &Self) -> bool { + self.bounds == other.bounds + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeInfer {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeInfer { + fn eq(&self, _other: &Self) -> bool { + true + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeMacro {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeMacro { + fn eq(&self, other: &Self) -> bool { + self.mac == other.mac + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeNever {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeNever { + fn eq(&self, _other: &Self) -> bool { + true + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeParam {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeParam { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.colon_token == other.colon_token + && self.bounds == other.bounds + && self.eq_token == other.eq_token + && self.default == other.default + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeParamBound {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeParamBound { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (TypeParamBound::Trait(self0), TypeParamBound::Trait(other0)) => self0 == other0, + (TypeParamBound::Lifetime(self0), TypeParamBound::Lifetime(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeParen {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeParen { + fn eq(&self, other: &Self) -> bool { + self.elem == other.elem + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypePath {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypePath { + fn eq(&self, other: &Self) -> bool { + self.qself == other.qself && self.path == other.path + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypePtr {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypePtr { + fn eq(&self, other: &Self) -> bool { + self.const_token == other.const_token + && self.mutability == other.mutability + && self.elem == other.elem + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeReference {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeReference { + fn eq(&self, other: &Self) -> bool { + self.lifetime == other.lifetime + && self.mutability == other.mutability + && self.elem == other.elem + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeSlice {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeSlice { + fn eq(&self, other: &Self) -> bool { + self.elem == other.elem + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeTraitObject {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeTraitObject { + fn eq(&self, other: &Self) -> bool { + self.dyn_token == other.dyn_token && self.bounds == other.bounds + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for TypeTuple {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for TypeTuple { + fn eq(&self, other: &Self) -> bool { + self.elems == other.elems + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for UnOp {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for UnOp { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (UnOp::Deref(_), UnOp::Deref(_)) => true, + (UnOp::Not(_), UnOp::Not(_)) => true, + (UnOp::Neg(_), UnOp::Neg(_)) => true, + _ => false, + } + } +} +#[cfg(feature = "full")] +impl Eq for UseGlob {} +#[cfg(feature = "full")] +impl PartialEq for UseGlob { + fn eq(&self, _other: &Self) -> bool { + true + } +} +#[cfg(feature = "full")] +impl Eq for UseGroup {} +#[cfg(feature = "full")] +impl PartialEq for UseGroup { + fn eq(&self, other: &Self) -> bool { + self.items == other.items + } +} +#[cfg(feature = "full")] +impl Eq for UseName {} +#[cfg(feature = "full")] +impl PartialEq for UseName { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident + } +} +#[cfg(feature = "full")] +impl Eq for UsePath {} +#[cfg(feature = "full")] +impl PartialEq for UsePath { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident && self.tree == other.tree + } +} +#[cfg(feature = "full")] +impl Eq for UseRename {} +#[cfg(feature = "full")] +impl PartialEq for UseRename { + fn eq(&self, other: &Self) -> bool { + self.ident == other.ident && self.rename == other.rename + } +} +#[cfg(feature = "full")] +impl Eq for UseTree {} +#[cfg(feature = "full")] +impl PartialEq for UseTree { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (UseTree::Path(self0), UseTree::Path(other0)) => self0 == other0, + (UseTree::Name(self0), UseTree::Name(other0)) => self0 == other0, + (UseTree::Rename(self0), UseTree::Rename(other0)) => self0 == other0, + (UseTree::Glob(self0), UseTree::Glob(other0)) => self0 == other0, + (UseTree::Group(self0), UseTree::Group(other0)) => self0 == other0, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Variadic {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Variadic { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Variant {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Variant { + fn eq(&self, other: &Self) -> bool { + self.attrs == other.attrs + && self.ident == other.ident + && self.fields == other.fields + && self.discriminant == other.discriminant + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for VisCrate {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for VisCrate { + fn eq(&self, _other: &Self) -> bool { + true + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for VisPublic {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for VisPublic { + fn eq(&self, _other: &Self) -> bool { + true + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for VisRestricted {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for VisRestricted { + fn eq(&self, other: &Self) -> bool { + self.in_token == other.in_token && self.path == other.path + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for Visibility {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for Visibility { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (Visibility::Public(self0), Visibility::Public(other0)) => self0 == other0, + (Visibility::Crate(self0), Visibility::Crate(other0)) => self0 == other0, + (Visibility::Restricted(self0), Visibility::Restricted(other0)) => self0 == other0, + (Visibility::Inherited, Visibility::Inherited) => true, + _ => false, + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for WhereClause {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for WhereClause { + fn eq(&self, other: &Self) -> bool { + self.predicates == other.predicates + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Eq for WherePredicate {} +#[cfg(any(feature = "derive", feature = "full"))] +impl PartialEq for WherePredicate { + fn eq(&self, other: &Self) -> bool { + match (self, other) { + (WherePredicate::Type(self0), WherePredicate::Type(other0)) => self0 == other0, + (WherePredicate::Lifetime(self0), WherePredicate::Lifetime(other0)) => self0 == other0, + (WherePredicate::Eq(self0), WherePredicate::Eq(other0)) => self0 == other0, + _ => false, + } + } +} diff --git a/src/gen/fold.rs b/src/gen/fold.rs index ec1bcfda..d9dd32a4 100644 --- a/src/gen/fold.rs +++ b/src/gen/fold.rs @@ -792,10 +792,10 @@ where F: Fold + ?Sized, { AngleBracketedGenericArguments { - colon2_token: (node.colon2_token).map(|it| Token ! [ :: ](tokens_helper(f, &it.spans))), - lt_token: Token ! [ < ](tokens_helper(f, &node.lt_token.spans)), + colon2_token: (node.colon2_token).map(|it| Token ! [::](tokens_helper(f, &it.spans))), + lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)), args: FoldHelper::lift(node.args, |it| f.fold_generic_argument(it)), - gt_token: Token ! [ > ](tokens_helper(f, &node.gt_token.spans)), + gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(feature = "full")] @@ -812,9 +812,9 @@ where Box::new(f.fold_expr(*(it).1)), ) }), - fat_arrow_token: Token ! [ => ](tokens_helper(f, &node.fat_arrow_token.spans)), + fat_arrow_token: Token ! [=>](tokens_helper(f, &node.fat_arrow_token.spans)), body: Box::new(f.fold_expr(*node.body)), - comma: (node.comma).map(|it| Token ! [ , ](tokens_helper(f, &it.spans))), + comma: (node.comma).map(|it| Token ! [,](tokens_helper(f, &it.spans))), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -835,7 +835,7 @@ where F: Fold + ?Sized, { Attribute { - pound_token: Token ! [ # ](tokens_helper(f, &node.pound_token.spans)), + pound_token: Token ! [#](tokens_helper(f, &node.pound_token.spans)), style: f.fold_attr_style(node.style), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), path: f.fold_path(node.path), @@ -852,7 +852,7 @@ where name: (node.name).map(|it| { ( f.fold_ident((it).0), - Token ! [ : ](tokens_helper(f, &(it).1.spans)), + Token ! [:](tokens_helper(f, &(it).1.spans)), ) }), ty: f.fold_type(node.ty), @@ -864,59 +864,47 @@ where F: Fold + ?Sized, { match node { - BinOp::Add(_binding_0) => BinOp::Add(Token ! [ + ](tokens_helper(f, &_binding_0.spans))), - BinOp::Sub(_binding_0) => BinOp::Sub(Token ! [ - ](tokens_helper(f, &_binding_0.spans))), - BinOp::Mul(_binding_0) => BinOp::Mul(Token ! [ * ](tokens_helper(f, &_binding_0.spans))), - BinOp::Div(_binding_0) => BinOp::Div(Token ! [ / ](tokens_helper(f, &_binding_0.spans))), - BinOp::Rem(_binding_0) => BinOp::Rem(Token ! [ % ](tokens_helper(f, &_binding_0.spans))), - BinOp::And(_binding_0) => BinOp::And(Token ! [ && ](tokens_helper(f, &_binding_0.spans))), - BinOp::Or(_binding_0) => BinOp::Or(Token ! [ || ](tokens_helper(f, &_binding_0.spans))), + BinOp::Add(_binding_0) => BinOp::Add(Token ! [+](tokens_helper(f, &_binding_0.spans))), + BinOp::Sub(_binding_0) => BinOp::Sub(Token ! [-](tokens_helper(f, &_binding_0.spans))), + BinOp::Mul(_binding_0) => BinOp::Mul(Token ! [*](tokens_helper(f, &_binding_0.spans))), + BinOp::Div(_binding_0) => BinOp::Div(Token ! [/](tokens_helper(f, &_binding_0.spans))), + BinOp::Rem(_binding_0) => BinOp::Rem(Token ! [%](tokens_helper(f, &_binding_0.spans))), + BinOp::And(_binding_0) => BinOp::And(Token ! [&&](tokens_helper(f, &_binding_0.spans))), + BinOp::Or(_binding_0) => BinOp::Or(Token ! [||](tokens_helper(f, &_binding_0.spans))), BinOp::BitXor(_binding_0) => { - BinOp::BitXor(Token ! [ ^ ](tokens_helper(f, &_binding_0.spans))) + BinOp::BitXor(Token ! [^](tokens_helper(f, &_binding_0.spans))) } BinOp::BitAnd(_binding_0) => { - BinOp::BitAnd(Token ! [ & ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::BitOr(_binding_0) => { - BinOp::BitOr(Token ! [ | ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::Shl(_binding_0) => BinOp::Shl(Token ! [ << ](tokens_helper(f, &_binding_0.spans))), - BinOp::Shr(_binding_0) => BinOp::Shr(Token ! [ >> ](tokens_helper(f, &_binding_0.spans))), - BinOp::Eq(_binding_0) => BinOp::Eq(Token ! [ == ](tokens_helper(f, &_binding_0.spans))), - BinOp::Lt(_binding_0) => BinOp::Lt(Token ! [ < ](tokens_helper(f, &_binding_0.spans))), - BinOp::Le(_binding_0) => BinOp::Le(Token ! [ <= ](tokens_helper(f, &_binding_0.spans))), - BinOp::Ne(_binding_0) => BinOp::Ne(Token ! [ != ](tokens_helper(f, &_binding_0.spans))), - BinOp::Ge(_binding_0) => BinOp::Ge(Token ! [ >= ](tokens_helper(f, &_binding_0.spans))), - BinOp::Gt(_binding_0) => BinOp::Gt(Token ! [ > ](tokens_helper(f, &_binding_0.spans))), - BinOp::AddEq(_binding_0) => { - BinOp::AddEq(Token ! [ += ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::SubEq(_binding_0) => { - BinOp::SubEq(Token ! [ -= ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::MulEq(_binding_0) => { - BinOp::MulEq(Token ! [ *= ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::DivEq(_binding_0) => { - BinOp::DivEq(Token ! [ /= ](tokens_helper(f, &_binding_0.spans))) - } - BinOp::RemEq(_binding_0) => { - BinOp::RemEq(Token ! [ %= ](tokens_helper(f, &_binding_0.spans))) + BinOp::BitAnd(Token ! [&](tokens_helper(f, &_binding_0.spans))) } + BinOp::BitOr(_binding_0) => BinOp::BitOr(Token ! [|](tokens_helper(f, &_binding_0.spans))), + BinOp::Shl(_binding_0) => BinOp::Shl(Token ! [<<](tokens_helper(f, &_binding_0.spans))), + BinOp::Shr(_binding_0) => BinOp::Shr(Token ! [>>](tokens_helper(f, &_binding_0.spans))), + BinOp::Eq(_binding_0) => BinOp::Eq(Token ! [==](tokens_helper(f, &_binding_0.spans))), + BinOp::Lt(_binding_0) => BinOp::Lt(Token ! [<](tokens_helper(f, &_binding_0.spans))), + BinOp::Le(_binding_0) => BinOp::Le(Token ! [<=](tokens_helper(f, &_binding_0.spans))), + BinOp::Ne(_binding_0) => BinOp::Ne(Token ! [!=](tokens_helper(f, &_binding_0.spans))), + BinOp::Ge(_binding_0) => BinOp::Ge(Token ! [>=](tokens_helper(f, &_binding_0.spans))), + BinOp::Gt(_binding_0) => BinOp::Gt(Token ! [>](tokens_helper(f, &_binding_0.spans))), + BinOp::AddEq(_binding_0) => BinOp::AddEq(Token ! [+=](tokens_helper(f, &_binding_0.spans))), + BinOp::SubEq(_binding_0) => BinOp::SubEq(Token ! [-=](tokens_helper(f, &_binding_0.spans))), + BinOp::MulEq(_binding_0) => BinOp::MulEq(Token ! [*=](tokens_helper(f, &_binding_0.spans))), + BinOp::DivEq(_binding_0) => BinOp::DivEq(Token ! [/=](tokens_helper(f, &_binding_0.spans))), + BinOp::RemEq(_binding_0) => BinOp::RemEq(Token ! [%=](tokens_helper(f, &_binding_0.spans))), BinOp::BitXorEq(_binding_0) => { - BinOp::BitXorEq(Token ! [ ^= ](tokens_helper(f, &_binding_0.spans))) + BinOp::BitXorEq(Token ! [^=](tokens_helper(f, &_binding_0.spans))) } BinOp::BitAndEq(_binding_0) => { - BinOp::BitAndEq(Token ! [ &= ](tokens_helper(f, &_binding_0.spans))) + BinOp::BitAndEq(Token ! [&=](tokens_helper(f, &_binding_0.spans))) } BinOp::BitOrEq(_binding_0) => { - BinOp::BitOrEq(Token ! [ |= ](tokens_helper(f, &_binding_0.spans))) + BinOp::BitOrEq(Token ! [|=](tokens_helper(f, &_binding_0.spans))) } BinOp::ShlEq(_binding_0) => { - BinOp::ShlEq(Token ! [ <<= ](tokens_helper(f, &_binding_0.spans))) + BinOp::ShlEq(Token ! [<<=](tokens_helper(f, &_binding_0.spans))) } BinOp::ShrEq(_binding_0) => { - BinOp::ShrEq(Token ! [ >>= ](tokens_helper(f, &_binding_0.spans))) + BinOp::ShrEq(Token ! [>>=](tokens_helper(f, &_binding_0.spans))) } } } @@ -927,7 +915,7 @@ where { Binding { ident: f.fold_ident(node.ident), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), ty: f.fold_type(node.ty), } } @@ -948,9 +936,9 @@ where { BoundLifetimes { for_token: Token![for](tokens_helper(f, &node.for_token.span)), - lt_token: Token ! [ < ](tokens_helper(f, &node.lt_token.spans)), + lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)), lifetimes: FoldHelper::lift(node.lifetimes, |it| f.fold_lifetime_def(it)), - gt_token: Token ! [ > ](tokens_helper(f, &node.gt_token.spans)), + gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -962,9 +950,9 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), - eq_token: (node.eq_token).map(|it| Token ! [ = ](tokens_helper(f, &it.spans))), + eq_token: (node.eq_token).map(|it| Token ! [=](tokens_helper(f, &it.spans))), default: (node.default).map(|it| f.fold_expr(it)), } } @@ -975,7 +963,7 @@ where { Constraint { ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } @@ -1009,7 +997,7 @@ where DataStruct { struct_token: Token![struct](tokens_helper(f, &node.struct_token.span)), fields: f.fold_fields(node.fields), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "derive")] @@ -1105,7 +1093,7 @@ where ExprAssign { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), left: Box::new(f.fold_expr(*node.left)), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), right: Box::new(f.fold_expr(*node.right)), } } @@ -1141,7 +1129,7 @@ where ExprAwait { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), base: Box::new(f.fold_expr(*node.base)), - dot_token: Token ! [ . ](tokens_helper(f, &node.dot_token.spans)), + dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)), await_token: crate::token::Await(tokens_helper(f, &node.await_token.span)), } } @@ -1225,9 +1213,9 @@ where asyncness: (node.asyncness).map(|it| Token![async](tokens_helper(f, &it.span))), movability: (node.movability).map(|it| Token![static](tokens_helper(f, &it.span))), capture: (node.capture).map(|it| Token![move](tokens_helper(f, &it.span))), - or1_token: Token ! [ | ](tokens_helper(f, &node.or1_token.spans)), + or1_token: Token ! [|](tokens_helper(f, &node.or1_token.spans)), inputs: FoldHelper::lift(node.inputs, |it| f.fold_pat(it)), - or2_token: Token ! [ | ](tokens_helper(f, &node.or2_token.spans)), + or2_token: Token ! [|](tokens_helper(f, &node.or2_token.spans)), output: f.fold_return_type(node.output), body: Box::new(f.fold_expr(*node.body)), } @@ -1251,7 +1239,7 @@ where ExprField { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), base: Box::new(f.fold_expr(*node.base)), - dot_token: Token ! [ . ](tokens_helper(f, &node.dot_token.spans)), + dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)), member: f.fold_member(node.member), } } @@ -1320,7 +1308,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), let_token: Token![let](tokens_helper(f, &node.let_token.span)), pat: f.fold_pat(node.pat), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), } } @@ -1377,7 +1365,7 @@ where ExprMethodCall { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), receiver: Box::new(f.fold_expr(*node.receiver)), - dot_token: Token ! [ . ](tokens_helper(f, &node.dot_token.spans)), + dot_token: Token ! [.](tokens_helper(f, &node.dot_token.spans)), method: f.fold_ident(node.method), turbofish: (node.turbofish).map(|it| f.fold_method_turbofish(it)), paren_token: Paren(tokens_helper(f, &node.paren_token.span)), @@ -1425,7 +1413,7 @@ where { ExprReference { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), - and_token: Token ! [ & ](tokens_helper(f, &node.and_token.spans)), + and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)), raw: node.raw, mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), expr: Box::new(f.fold_expr(*node.expr)), @@ -1440,7 +1428,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), expr: Box::new(f.fold_expr(*node.expr)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), len: Box::new(f.fold_expr(*node.len)), } } @@ -1477,7 +1465,7 @@ where ExprTry { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), - question_token: Token ! [ ? ](tokens_helper(f, &node.question_token.spans)), + question_token: Token ! [?](tokens_helper(f, &node.question_token.spans)), } } #[cfg(feature = "full")] @@ -1510,7 +1498,7 @@ where ExprType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), expr: Box::new(f.fold_expr(*node.expr)), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), } } @@ -1569,7 +1557,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), ident: (node.ident).map(|it| f.fold_ident(it)), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), ty: f.fold_type(node.ty), } } @@ -1581,7 +1569,7 @@ where FieldPat { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), member: f.fold_member(node.member), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), pat: Box::new(f.fold_pat(*node.pat)), } } @@ -1593,7 +1581,7 @@ where FieldValue { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), member: f.fold_member(node.member), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), expr: f.fold_expr(node.expr), } } @@ -1674,7 +1662,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), sig: f.fold_signature(node.sig), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -1685,7 +1673,7 @@ where ForeignItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -1699,9 +1687,9 @@ where static_token: Token![static](tokens_helper(f, &node.static_token.span)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -1714,7 +1702,7 @@ where vis: f.fold_visibility(node.vis), type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -1772,9 +1760,9 @@ where F: Fold + ?Sized, { Generics { - lt_token: (node.lt_token).map(|it| Token ! [ < ](tokens_helper(f, &it.spans))), + lt_token: (node.lt_token).map(|it| Token ! [<](tokens_helper(f, &it.spans))), params: FoldHelper::lift(node.params, |it| f.fold_generic_param(it)), - gt_token: (node.gt_token).map(|it| Token ! [ > ](tokens_helper(f, &it.spans))), + gt_token: (node.gt_token).map(|it| Token ! [>](tokens_helper(f, &it.spans))), where_clause: (node.where_clause).map(|it| f.fold_where_clause(it)), } } @@ -1812,11 +1800,11 @@ where defaultness: (node.defaultness).map(|it| Token![default](tokens_helper(f, &it.span))), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), expr: f.fold_expr(node.expr), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -1827,7 +1815,7 @@ where ImplItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -1855,9 +1843,9 @@ where type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), ty: f.fold_type(node.ty), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -1906,11 +1894,11 @@ where vis: f.fold_visibility(node.vis), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -1945,7 +1933,7 @@ where f.fold_ident((it).1), ) }), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2004,7 +1992,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), ident: (node.ident).map(|it| f.fold_ident(it)), mac: f.fold_macro(node.mac), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -2036,7 +2024,7 @@ where FoldHelper::lift((it).1, |it| f.fold_item(it)), ) }), - semi: (node.semi).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi: (node.semi).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -2050,11 +2038,11 @@ where static_token: Token![static](tokens_helper(f, &node.static_token.span)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), expr: Box::new(f.fold_expr(*node.expr)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2069,7 +2057,7 @@ where ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), fields: f.fold_fields(node.fields), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -2085,7 +2073,7 @@ where trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), supertraits: FoldHelper::lift(node.supertraits, |it| f.fold_type_param_bound(it)), brace_token: Brace(tokens_helper(f, &node.brace_token.span)), items: FoldHelper::lift(node.items, |it| f.fold_trait_item(it)), @@ -2102,9 +2090,9 @@ where trait_token: Token![trait](tokens_helper(f, &node.trait_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2118,9 +2106,9 @@ where type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), ty: Box::new(f.fold_type(*node.ty)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2146,9 +2134,9 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), vis: f.fold_visibility(node.vis), use_token: Token![use](tokens_helper(f, &node.use_token.span)), - leading_colon: (node.leading_colon).map(|it| Token ! [ :: ](tokens_helper(f, &it.spans))), + leading_colon: (node.leading_colon).map(|it| Token ! [::](tokens_helper(f, &it.spans))), tree: f.fold_use_tree(node.tree), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2158,7 +2146,7 @@ where { Label { name: f.fold_lifetime(node.name), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), } } pub fn fold_lifetime(f: &mut F, node: Lifetime) -> Lifetime @@ -2178,7 +2166,7 @@ where LifetimeDef { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), lifetime: f.fold_lifetime(node.lifetime), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), } } @@ -2271,11 +2259,11 @@ where pat: f.fold_pat(node.pat), init: (node.init).map(|it| { ( - Token ! [ = ](tokens_helper(f, &(it).0.spans)), + Token ! [=](tokens_helper(f, &(it).0.spans)), Box::new(f.fold_expr(*(it).1)), ) }), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -2346,7 +2334,7 @@ where { MetaNameValue { path: f.fold_path(node.path), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), lit: f.fold_lit(node.lit), } } @@ -2356,10 +2344,10 @@ where F: Fold + ?Sized, { MethodTurbofish { - colon2_token: Token ! [ :: ](tokens_helper(f, &node.colon2_token.spans)), - lt_token: Token ! [ < ](tokens_helper(f, &node.lt_token.spans)), + colon2_token: Token ! [::](tokens_helper(f, &node.colon2_token.spans)), + lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)), args: FoldHelper::lift(node.args, |it| f.fold_generic_method_argument(it)), - gt_token: Token ! [ > ](tokens_helper(f, &node.gt_token.spans)), + gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -2434,7 +2422,7 @@ where ident: f.fold_ident(node.ident), subpat: (node.subpat).map(|it| { ( - Token ! [ @ ](tokens_helper(f, &(it).0.spans)), + Token ! [@](tokens_helper(f, &(it).0.spans)), Box::new(f.fold_pat(*(it).1)), ) }), @@ -2467,7 +2455,7 @@ where { PatOr { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), - leading_vert: (node.leading_vert).map(|it| Token ! [ | ](tokens_helper(f, &it.spans))), + leading_vert: (node.leading_vert).map(|it| Token ! [|](tokens_helper(f, &it.spans))), cases: FoldHelper::lift(node.cases, |it| f.fold_pat(it)), } } @@ -2501,7 +2489,7 @@ where { PatReference { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), - and_token: Token ! [ & ](tokens_helper(f, &node.and_token.spans)), + and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), pat: Box::new(f.fold_pat(*node.pat)), } @@ -2570,7 +2558,7 @@ where PatType { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), pat: Box::new(f.fold_pat(*node.pat)), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: Box::new(f.fold_type(*node.ty)), } } @@ -2590,7 +2578,7 @@ where F: Fold + ?Sized, { Path { - leading_colon: (node.leading_colon).map(|it| Token ! [ :: ](tokens_helper(f, &it.spans))), + leading_colon: (node.leading_colon).map(|it| Token ! [::](tokens_helper(f, &it.spans))), segments: FoldHelper::lift(node.segments, |it| f.fold_path_segment(it)), } } @@ -2626,7 +2614,7 @@ where { PredicateEq { lhs_ty: f.fold_type(node.lhs_ty), - eq_token: Token ! [ = ](tokens_helper(f, &node.eq_token.spans)), + eq_token: Token ! [=](tokens_helper(f, &node.eq_token.spans)), rhs_ty: f.fold_type(node.rhs_ty), } } @@ -2637,7 +2625,7 @@ where { PredicateLifetime { lifetime: f.fold_lifetime(node.lifetime), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_lifetime(it)), } } @@ -2649,7 +2637,7 @@ where PredicateType { lifetimes: (node.lifetimes).map(|it| f.fold_bound_lifetimes(it)), bounded_ty: f.fold_type(node.bounded_ty), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), } } @@ -2659,11 +2647,11 @@ where F: Fold + ?Sized, { QSelf { - lt_token: Token ! [ < ](tokens_helper(f, &node.lt_token.spans)), + lt_token: Token ! [<](tokens_helper(f, &node.lt_token.spans)), ty: Box::new(f.fold_type(*node.ty)), position: node.position, as_token: (node.as_token).map(|it| Token![as](tokens_helper(f, &it.span))), - gt_token: Token ! [ > ](tokens_helper(f, &node.gt_token.spans)), + gt_token: Token ! [>](tokens_helper(f, &node.gt_token.spans)), } } #[cfg(feature = "full")] @@ -2676,7 +2664,7 @@ where RangeLimits::HalfOpen(Token![..](tokens_helper(f, &_binding_0.spans))) } RangeLimits::Closed(_binding_0) => { - RangeLimits::Closed(Token ! [ ..= ](tokens_helper(f, &_binding_0.spans))) + RangeLimits::Closed(Token ! [..=](tokens_helper(f, &_binding_0.spans))) } } } @@ -2689,7 +2677,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), reference: (node.reference).map(|it| { ( - Token ! [ & ](tokens_helper(f, &(it).0.spans)), + Token ! [&](tokens_helper(f, &(it).0.spans)), ((it).1).map(|it| f.fold_lifetime(it)), ) }), @@ -2705,7 +2693,7 @@ where match node { ReturnType::Default => ReturnType::Default, ReturnType::Type(_binding_0, _binding_1) => ReturnType::Type( - Token ! [ -> ](tokens_helper(f, &_binding_0.spans)), + Token ! [->](tokens_helper(f, &_binding_0.spans)), Box::new(f.fold_type(*_binding_1)), ), } @@ -2746,7 +2734,7 @@ where Stmt::Expr(_binding_0) => Stmt::Expr(f.fold_expr(_binding_0)), Stmt::Semi(_binding_0, _binding_1) => Stmt::Semi( f.fold_expr(_binding_0), - Token ! [ ; ](tokens_helper(f, &_binding_1.spans)), + Token ! [;](tokens_helper(f, &_binding_1.spans)), ), } } @@ -2770,7 +2758,7 @@ where match node { TraitBoundModifier::None => TraitBoundModifier::None, TraitBoundModifier::Maybe(_binding_0) => { - TraitBoundModifier::Maybe(Token ! [ ? ](tokens_helper(f, &_binding_0.spans))) + TraitBoundModifier::Maybe(Token ! [?](tokens_helper(f, &_binding_0.spans))) } } } @@ -2797,15 +2785,15 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), const_token: Token![const](tokens_helper(f, &node.const_token.span)), ident: f.fold_ident(node.ident), - colon_token: Token ! [ : ](tokens_helper(f, &node.colon_token.spans)), + colon_token: Token ! [:](tokens_helper(f, &node.colon_token.spans)), ty: f.fold_type(node.ty), default: (node.default).map(|it| { ( - Token ! [ = ](tokens_helper(f, &(it).0.spans)), + Token ! [=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1), ) }), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(feature = "full")] @@ -2816,7 +2804,7 @@ where TraitItemMacro { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), mac: f.fold_macro(node.mac), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -2828,7 +2816,7 @@ where attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), sig: f.fold_signature(node.sig), default: (node.default).map(|it| f.fold_block(it)), - semi_token: (node.semi_token).map(|it| Token ! [ ; ](tokens_helper(f, &it.spans))), + semi_token: (node.semi_token).map(|it| Token ! [;](tokens_helper(f, &it.spans))), } } #[cfg(feature = "full")] @@ -2841,15 +2829,15 @@ where type_token: Token![type](tokens_helper(f, &node.type_token.span)), ident: f.fold_ident(node.ident), generics: f.fold_generics(node.generics), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), default: (node.default).map(|it| { ( - Token ! [ = ](tokens_helper(f, &(it).0.spans)), + Token ! [=](tokens_helper(f, &(it).0.spans)), f.fold_type((it).1), ) }), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -2884,7 +2872,7 @@ where TypeArray { bracket_token: Bracket(tokens_helper(f, &node.bracket_token.span)), elem: Box::new(f.fold_type(*node.elem)), - semi_token: Token ! [ ; ](tokens_helper(f, &node.semi_token.spans)), + semi_token: Token ! [;](tokens_helper(f, &node.semi_token.spans)), len: f.fold_expr(node.len), } } @@ -2959,9 +2947,9 @@ where TypeParam { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), ident: f.fold_ident(node.ident), - colon_token: (node.colon_token).map(|it| Token ! [ : ](tokens_helper(f, &it.spans))), + colon_token: (node.colon_token).map(|it| Token ! [:](tokens_helper(f, &it.spans))), bounds: FoldHelper::lift(node.bounds, |it| f.fold_type_param_bound(it)), - eq_token: (node.eq_token).map(|it| Token ! [ = ](tokens_helper(f, &it.spans))), + eq_token: (node.eq_token).map(|it| Token ! [=](tokens_helper(f, &it.spans))), default: (node.default).map(|it| f.fold_type(it)), } } @@ -3003,7 +2991,7 @@ where F: Fold + ?Sized, { TypePtr { - star_token: Token ! [ * ](tokens_helper(f, &node.star_token.spans)), + star_token: Token ! [*](tokens_helper(f, &node.star_token.spans)), const_token: (node.const_token).map(|it| Token![const](tokens_helper(f, &it.span))), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), elem: Box::new(f.fold_type(*node.elem)), @@ -3015,7 +3003,7 @@ where F: Fold + ?Sized, { TypeReference { - and_token: Token ! [ & ](tokens_helper(f, &node.and_token.spans)), + and_token: Token ! [&](tokens_helper(f, &node.and_token.spans)), lifetime: (node.lifetime).map(|it| f.fold_lifetime(it)), mutability: (node.mutability).map(|it| Token![mut](tokens_helper(f, &it.span))), elem: Box::new(f.fold_type(*node.elem)), @@ -3057,9 +3045,9 @@ where F: Fold + ?Sized, { match node { - UnOp::Deref(_binding_0) => UnOp::Deref(Token ! [ * ](tokens_helper(f, &_binding_0.spans))), + UnOp::Deref(_binding_0) => UnOp::Deref(Token ! [*](tokens_helper(f, &_binding_0.spans))), UnOp::Not(_binding_0) => UnOp::Not(Token![!](tokens_helper(f, &_binding_0.spans))), - UnOp::Neg(_binding_0) => UnOp::Neg(Token ! [ - ](tokens_helper(f, &_binding_0.spans))), + UnOp::Neg(_binding_0) => UnOp::Neg(Token ! [-](tokens_helper(f, &_binding_0.spans))), } } #[cfg(feature = "full")] @@ -3068,7 +3056,7 @@ where F: Fold + ?Sized, { UseGlob { - star_token: Token ! [ * ](tokens_helper(f, &node.star_token.spans)), + star_token: Token ! [*](tokens_helper(f, &node.star_token.spans)), } } #[cfg(feature = "full")] @@ -3097,7 +3085,7 @@ where { UsePath { ident: f.fold_ident(node.ident), - colon2_token: Token ! [ :: ](tokens_helper(f, &node.colon2_token.spans)), + colon2_token: Token ! [::](tokens_helper(f, &node.colon2_token.spans)), tree: Box::new(f.fold_use_tree(*node.tree)), } } @@ -3132,7 +3120,7 @@ where { Variadic { attrs: FoldHelper::lift(node.attrs, |it| f.fold_attribute(it)), - dots: Token ! [ ... ](tokens_helper(f, &node.dots.spans)), + dots: Token ! [...](tokens_helper(f, &node.dots.spans)), } } #[cfg(any(feature = "derive", feature = "full"))] @@ -3146,7 +3134,7 @@ where fields: f.fold_fields(node.fields), discriminant: (node.discriminant).map(|it| { ( - Token ! [ = ](tokens_helper(f, &(it).0.spans)), + Token ! [=](tokens_helper(f, &(it).0.spans)), f.fold_expr((it).1), ) }), diff --git a/src/gen/hash.rs b/src/gen/hash.rs new file mode 100644 index 00000000..9e9e84a7 --- /dev/null +++ b/src/gen/hash.rs @@ -0,0 +1,2691 @@ +// This file is @generated by syn-internal-codegen. +// It is not intended for manual editing. + +#[cfg(any(feature = "derive", feature = "full"))] +use crate::tt::TokenStreamHelper; +use crate::*; +use std::hash::{Hash, Hasher}; +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Abi { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.name.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for AngleBracketedGenericArguments { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.colon2_token.hash(state); + self.args.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Arm { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.pat.hash(state); + self.guard.hash(state); + self.body.hash(state); + self.comma.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for AttrStyle { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + AttrStyle::Outer => { + state.write_u8(0u8); + } + AttrStyle::Inner(_) => { + state.write_u8(1u8); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Attribute { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.style.hash(state); + self.path.hash(state); + TokenStreamHelper(&self.tokens).hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for BareFnArg { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.name.hash(state); + self.ty.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for BinOp { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + BinOp::Add(_) => { + state.write_u8(0u8); + } + BinOp::Sub(_) => { + state.write_u8(1u8); + } + BinOp::Mul(_) => { + state.write_u8(2u8); + } + BinOp::Div(_) => { + state.write_u8(3u8); + } + BinOp::Rem(_) => { + state.write_u8(4u8); + } + BinOp::And(_) => { + state.write_u8(5u8); + } + BinOp::Or(_) => { + state.write_u8(6u8); + } + BinOp::BitXor(_) => { + state.write_u8(7u8); + } + BinOp::BitAnd(_) => { + state.write_u8(8u8); + } + BinOp::BitOr(_) => { + state.write_u8(9u8); + } + BinOp::Shl(_) => { + state.write_u8(10u8); + } + BinOp::Shr(_) => { + state.write_u8(11u8); + } + BinOp::Eq(_) => { + state.write_u8(12u8); + } + BinOp::Lt(_) => { + state.write_u8(13u8); + } + BinOp::Le(_) => { + state.write_u8(14u8); + } + BinOp::Ne(_) => { + state.write_u8(15u8); + } + BinOp::Ge(_) => { + state.write_u8(16u8); + } + BinOp::Gt(_) => { + state.write_u8(17u8); + } + BinOp::AddEq(_) => { + state.write_u8(18u8); + } + BinOp::SubEq(_) => { + state.write_u8(19u8); + } + BinOp::MulEq(_) => { + state.write_u8(20u8); + } + BinOp::DivEq(_) => { + state.write_u8(21u8); + } + BinOp::RemEq(_) => { + state.write_u8(22u8); + } + BinOp::BitXorEq(_) => { + state.write_u8(23u8); + } + BinOp::BitAndEq(_) => { + state.write_u8(24u8); + } + BinOp::BitOrEq(_) => { + state.write_u8(25u8); + } + BinOp::ShlEq(_) => { + state.write_u8(26u8); + } + BinOp::ShrEq(_) => { + state.write_u8(27u8); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Binding { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Block { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.stmts.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for BoundLifetimes { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lifetimes.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ConstParam { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.ty.hash(state); + self.eq_token.hash(state); + self.default.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Constraint { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + self.bounds.hash(state); + } +} +#[cfg(feature = "derive")] +impl Hash for Data { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Data::Struct(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Data::Enum(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Data::Union(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + } + } +} +#[cfg(feature = "derive")] +impl Hash for DataEnum { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.variants.hash(state); + } +} +#[cfg(feature = "derive")] +impl Hash for DataStruct { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.fields.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "derive")] +impl Hash for DataUnion { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.fields.hash(state); + } +} +#[cfg(feature = "derive")] +impl Hash for DeriveInput { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.data.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Expr { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + #[cfg(feature = "full")] + Expr::Array(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Assign(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::AssignOp(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Async(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Await(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + Expr::Binary(v0) => { + state.write_u8(5u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Block(v0) => { + state.write_u8(6u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Box(v0) => { + state.write_u8(7u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Break(v0) => { + state.write_u8(8u8); + v0.hash(state); + } + Expr::Call(v0) => { + state.write_u8(9u8); + v0.hash(state); + } + Expr::Cast(v0) => { + state.write_u8(10u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Closure(v0) => { + state.write_u8(11u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Continue(v0) => { + state.write_u8(12u8); + v0.hash(state); + } + Expr::Field(v0) => { + state.write_u8(13u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::ForLoop(v0) => { + state.write_u8(14u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Group(v0) => { + state.write_u8(15u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::If(v0) => { + state.write_u8(16u8); + v0.hash(state); + } + Expr::Index(v0) => { + state.write_u8(17u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Let(v0) => { + state.write_u8(18u8); + v0.hash(state); + } + Expr::Lit(v0) => { + state.write_u8(19u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Loop(v0) => { + state.write_u8(20u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Macro(v0) => { + state.write_u8(21u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Match(v0) => { + state.write_u8(22u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::MethodCall(v0) => { + state.write_u8(23u8); + v0.hash(state); + } + Expr::Paren(v0) => { + state.write_u8(24u8); + v0.hash(state); + } + Expr::Path(v0) => { + state.write_u8(25u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Range(v0) => { + state.write_u8(26u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Reference(v0) => { + state.write_u8(27u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Repeat(v0) => { + state.write_u8(28u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Return(v0) => { + state.write_u8(29u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Struct(v0) => { + state.write_u8(30u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Try(v0) => { + state.write_u8(31u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::TryBlock(v0) => { + state.write_u8(32u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Tuple(v0) => { + state.write_u8(33u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Type(v0) => { + state.write_u8(34u8); + v0.hash(state); + } + Expr::Unary(v0) => { + state.write_u8(35u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Unsafe(v0) => { + state.write_u8(36u8); + v0.hash(state); + } + Expr::Verbatim(v0) => { + state.write_u8(37u8); + TokenStreamHelper(v0).hash(state); + } + #[cfg(feature = "full")] + Expr::While(v0) => { + state.write_u8(38u8); + v0.hash(state); + } + #[cfg(feature = "full")] + Expr::Yield(v0) => { + state.write_u8(39u8); + v0.hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for ExprArray { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.elems.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprAssign { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.left.hash(state); + self.right.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprAssignOp { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.left.hash(state); + self.op.hash(state); + self.right.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprAsync { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.capture.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprAwait { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.base.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprBinary { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.left.hash(state); + self.op.hash(state); + self.right.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprBlock { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprBox { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprBreak { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + self.expr.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprCall { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.func.hash(state); + self.args.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprCast { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprClosure { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.asyncness.hash(state); + self.movability.hash(state); + self.capture.hash(state); + self.inputs.hash(state); + self.output.hash(state); + self.body.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprContinue { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprField { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.base.hash(state); + self.member.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprForLoop { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + self.pat.hash(state); + self.expr.hash(state); + self.body.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprGroup { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprIf { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.cond.hash(state); + self.then_branch.hash(state); + self.else_branch.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprIndex { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + self.index.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprLet { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.pat.hash(state); + self.expr.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprLit { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.lit.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprLoop { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + self.body.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mac.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprMatch { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + self.arms.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprMethodCall { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.receiver.hash(state); + self.method.hash(state); + self.turbofish.hash(state); + self.args.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprParen { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprPath { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.qself.hash(state); + self.path.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprRange { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.from.hash(state); + self.limits.hash(state); + self.to.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprReference { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mutability.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprRepeat { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + self.len.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprReturn { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprStruct { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.path.hash(state); + self.fields.hash(state); + self.dot2_token.hash(state); + self.rest.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprTry { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprTryBlock { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprTuple { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.elems.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + self.ty.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ExprUnary { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.op.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprUnsafe { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprWhile { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.label.hash(state); + self.cond.hash(state); + self.body.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ExprYield { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Field { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.colon_token.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for FieldPat { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.member.hash(state); + self.colon_token.hash(state); + self.pat.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for FieldValue { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.member.hash(state); + self.colon_token.hash(state); + self.expr.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Fields { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Fields::Named(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Fields::Unnamed(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Fields::Unit => { + state.write_u8(2u8); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for FieldsNamed { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.named.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for FieldsUnnamed { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.unnamed.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for File { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.shebang.hash(state); + self.attrs.hash(state); + self.items.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for FnArg { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + FnArg::Receiver(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + FnArg::Typed(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for ForeignItem { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + ForeignItem::Fn(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + ForeignItem::Static(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + ForeignItem::Type(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + ForeignItem::Macro(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + ForeignItem::Verbatim(v0) => { + state.write_u8(4u8); + TokenStreamHelper(v0).hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for ForeignItemFn { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.sig.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ForeignItemMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mac.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ForeignItemStatic { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.mutability.hash(state); + self.ident.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ForeignItemType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for GenericArgument { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + GenericArgument::Lifetime(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + GenericArgument::Type(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + GenericArgument::Binding(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + GenericArgument::Constraint(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + GenericArgument::Const(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for GenericMethodArgument { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + GenericMethodArgument::Type(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + GenericMethodArgument::Const(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for GenericParam { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + GenericParam::Type(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + GenericParam::Lifetime(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + GenericParam::Const(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Generics { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lt_token.hash(state); + self.params.hash(state); + self.gt_token.hash(state); + self.where_clause.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ImplItem { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + ImplItem::Const(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + ImplItem::Method(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + ImplItem::Type(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + ImplItem::Macro(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + ImplItem::Verbatim(v0) => { + state.write_u8(4u8); + TokenStreamHelper(v0).hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for ImplItemConst { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.defaultness.hash(state); + self.ident.hash(state); + self.ty.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ImplItemMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mac.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ImplItemMethod { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.defaultness.hash(state); + self.sig.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ImplItemType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.defaultness.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Item { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Item::Const(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Item::Enum(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Item::ExternCrate(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Item::Fn(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + Item::ForeignMod(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + Item::Impl(v0) => { + state.write_u8(5u8); + v0.hash(state); + } + Item::Macro(v0) => { + state.write_u8(6u8); + v0.hash(state); + } + Item::Macro2(v0) => { + state.write_u8(7u8); + v0.hash(state); + } + Item::Mod(v0) => { + state.write_u8(8u8); + v0.hash(state); + } + Item::Static(v0) => { + state.write_u8(9u8); + v0.hash(state); + } + Item::Struct(v0) => { + state.write_u8(10u8); + v0.hash(state); + } + Item::Trait(v0) => { + state.write_u8(11u8); + v0.hash(state); + } + Item::TraitAlias(v0) => { + state.write_u8(12u8); + v0.hash(state); + } + Item::Type(v0) => { + state.write_u8(13u8); + v0.hash(state); + } + Item::Union(v0) => { + state.write_u8(14u8); + v0.hash(state); + } + Item::Use(v0) => { + state.write_u8(15u8); + v0.hash(state); + } + Item::Verbatim(v0) => { + state.write_u8(16u8); + TokenStreamHelper(v0).hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for ItemConst { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.ty.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemEnum { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.variants.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemExternCrate { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.rename.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemFn { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.sig.hash(state); + self.block.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemForeignMod { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.abi.hash(state); + self.items.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemImpl { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.defaultness.hash(state); + self.unsafety.hash(state); + self.generics.hash(state); + self.trait_.hash(state); + self.self_ty.hash(state); + self.items.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.mac.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemMacro2 { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + TokenStreamHelper(&self.rules).hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemMod { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.content.hash(state); + self.semi.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemStatic { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.mutability.hash(state); + self.ident.hash(state); + self.ty.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemStruct { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.fields.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemTrait { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.unsafety.hash(state); + self.auto_token.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.colon_token.hash(state); + self.supertraits.hash(state); + self.items.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemTraitAlias { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.bounds.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemUnion { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.fields.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for ItemUse { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.vis.hash(state); + self.leading_colon.hash(state); + self.tree.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Label { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.name.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for LifetimeDef { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.lifetime.hash(state); + self.colon_token.hash(state); + self.bounds.hash(state); + } +} +impl Hash for Lit { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Lit::Str(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Lit::ByteStr(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Lit::Byte(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Lit::Char(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + Lit::Int(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + Lit::Float(v0) => { + state.write_u8(5u8); + v0.hash(state); + } + Lit::Bool(v0) => { + state.write_u8(6u8); + v0.hash(state); + } + Lit::Verbatim(v0) => { + state.write_u8(7u8); + v0.to_string().hash(state); + } + } + } +} +impl Hash for LitBool { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.value.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Local { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.pat.hash(state); + self.init.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Macro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.path.hash(state); + self.delimiter.hash(state); + TokenStreamHelper(&self.tokens).hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for MacroDelimiter { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + MacroDelimiter::Paren(_) => { + state.write_u8(0u8); + } + MacroDelimiter::Brace(_) => { + state.write_u8(1u8); + } + MacroDelimiter::Bracket(_) => { + state.write_u8(2u8); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Meta { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Meta::Path(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Meta::List(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Meta::NameValue(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for MetaList { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.path.hash(state); + self.nested.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for MetaNameValue { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.path.hash(state); + self.lit.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for MethodTurbofish { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.args.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for NestedMeta { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + NestedMeta::Meta(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + NestedMeta::Lit(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ParenthesizedGenericArguments { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.inputs.hash(state); + self.output.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Pat { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Pat::Box(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Pat::Ident(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Pat::Lit(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Pat::Macro(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + Pat::Or(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + Pat::Path(v0) => { + state.write_u8(5u8); + v0.hash(state); + } + Pat::Range(v0) => { + state.write_u8(6u8); + v0.hash(state); + } + Pat::Reference(v0) => { + state.write_u8(7u8); + v0.hash(state); + } + Pat::Rest(v0) => { + state.write_u8(8u8); + v0.hash(state); + } + Pat::Slice(v0) => { + state.write_u8(9u8); + v0.hash(state); + } + Pat::Struct(v0) => { + state.write_u8(10u8); + v0.hash(state); + } + Pat::Tuple(v0) => { + state.write_u8(11u8); + v0.hash(state); + } + Pat::TupleStruct(v0) => { + state.write_u8(12u8); + v0.hash(state); + } + Pat::Type(v0) => { + state.write_u8(13u8); + v0.hash(state); + } + Pat::Verbatim(v0) => { + state.write_u8(14u8); + TokenStreamHelper(v0).hash(state); + } + Pat::Wild(v0) => { + state.write_u8(15u8); + v0.hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for PatBox { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.pat.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatIdent { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.by_ref.hash(state); + self.mutability.hash(state); + self.ident.hash(state); + self.subpat.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatLit { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.expr.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mac.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatOr { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.leading_vert.hash(state); + self.cases.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatPath { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.qself.hash(state); + self.path.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatRange { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.lo.hash(state); + self.limits.hash(state); + self.hi.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatReference { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mutability.hash(state); + self.pat.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatRest { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatSlice { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.elems.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatStruct { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.path.hash(state); + self.fields.hash(state); + self.dot2_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatTuple { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.elems.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatTupleStruct { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.path.hash(state); + self.pat.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.pat.hash(state); + self.ty.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for PatWild { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Path { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.leading_colon.hash(state); + self.segments.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for PathArguments { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + PathArguments::None => { + state.write_u8(0u8); + } + PathArguments::AngleBracketed(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + PathArguments::Parenthesized(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for PathSegment { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + self.arguments.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for PredicateEq { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lhs_ty.hash(state); + self.rhs_ty.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for PredicateLifetime { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lifetime.hash(state); + self.bounds.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for PredicateType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lifetimes.hash(state); + self.bounded_ty.hash(state); + self.bounds.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for QSelf { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ty.hash(state); + self.position.hash(state); + self.as_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for RangeLimits { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + RangeLimits::HalfOpen(_) => { + state.write_u8(0u8); + } + RangeLimits::Closed(_) => { + state.write_u8(1u8); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for Receiver { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.reference.hash(state); + self.mutability.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for ReturnType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + ReturnType::Default => { + state.write_u8(0u8); + } + ReturnType::Type(_, v1) => { + state.write_u8(1u8); + v1.hash(state); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for Signature { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.constness.hash(state); + self.asyncness.hash(state); + self.unsafety.hash(state); + self.abi.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.inputs.hash(state); + self.variadic.hash(state); + self.output.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for Stmt { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Stmt::Local(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Stmt::Item(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Stmt::Expr(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Stmt::Semi(v0, _) => { + state.write_u8(3u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TraitBound { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.paren_token.hash(state); + self.modifier.hash(state); + self.lifetimes.hash(state); + self.path.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TraitBoundModifier { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + TraitBoundModifier::None => { + state.write_u8(0u8); + } + TraitBoundModifier::Maybe(_) => { + state.write_u8(1u8); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for TraitItem { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + TraitItem::Const(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + TraitItem::Method(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + TraitItem::Type(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + TraitItem::Macro(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + TraitItem::Verbatim(v0) => { + state.write_u8(4u8); + TokenStreamHelper(v0).hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(feature = "full")] +impl Hash for TraitItemConst { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.ty.hash(state); + self.default.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for TraitItemMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.mac.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for TraitItemMethod { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.sig.hash(state); + self.default.hash(state); + self.semi_token.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for TraitItemType { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.generics.hash(state); + self.colon_token.hash(state); + self.bounds.hash(state); + self.default.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Type { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Type::Array(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Type::BareFn(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Type::Group(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Type::ImplTrait(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + Type::Infer(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + Type::Macro(v0) => { + state.write_u8(5u8); + v0.hash(state); + } + Type::Never(v0) => { + state.write_u8(6u8); + v0.hash(state); + } + Type::Paren(v0) => { + state.write_u8(7u8); + v0.hash(state); + } + Type::Path(v0) => { + state.write_u8(8u8); + v0.hash(state); + } + Type::Ptr(v0) => { + state.write_u8(9u8); + v0.hash(state); + } + Type::Reference(v0) => { + state.write_u8(10u8); + v0.hash(state); + } + Type::Slice(v0) => { + state.write_u8(11u8); + v0.hash(state); + } + Type::TraitObject(v0) => { + state.write_u8(12u8); + v0.hash(state); + } + Type::Tuple(v0) => { + state.write_u8(13u8); + v0.hash(state); + } + Type::Verbatim(v0) => { + state.write_u8(14u8); + TokenStreamHelper(v0).hash(state); + } + _ => unreachable!(), + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeArray { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.elem.hash(state); + self.len.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeBareFn { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lifetimes.hash(state); + self.unsafety.hash(state); + self.abi.hash(state); + self.inputs.hash(state); + self.variadic.hash(state); + self.output.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeGroup { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.elem.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeImplTrait { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.bounds.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeInfer { + fn hash(&self, _state: &mut H) + where + H: Hasher, + { + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeMacro { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.mac.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeNever { + fn hash(&self, _state: &mut H) + where + H: Hasher, + { + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeParam { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.colon_token.hash(state); + self.bounds.hash(state); + self.eq_token.hash(state); + self.default.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeParamBound { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + TypeParamBound::Trait(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + TypeParamBound::Lifetime(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeParen { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.elem.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypePath { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.qself.hash(state); + self.path.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypePtr { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.const_token.hash(state); + self.mutability.hash(state); + self.elem.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeReference { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.lifetime.hash(state); + self.mutability.hash(state); + self.elem.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeSlice { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.elem.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeTraitObject { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.dyn_token.hash(state); + self.bounds.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for TypeTuple { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.elems.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for UnOp { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + UnOp::Deref(_) => { + state.write_u8(0u8); + } + UnOp::Not(_) => { + state.write_u8(1u8); + } + UnOp::Neg(_) => { + state.write_u8(2u8); + } + } + } +} +#[cfg(feature = "full")] +impl Hash for UseGlob { + fn hash(&self, _state: &mut H) + where + H: Hasher, + { + } +} +#[cfg(feature = "full")] +impl Hash for UseGroup { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.items.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for UseName { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for UsePath { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + self.tree.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for UseRename { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.ident.hash(state); + self.rename.hash(state); + } +} +#[cfg(feature = "full")] +impl Hash for UseTree { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + UseTree::Path(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + UseTree::Name(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + UseTree::Rename(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + UseTree::Glob(v0) => { + state.write_u8(3u8); + v0.hash(state); + } + UseTree::Group(v0) => { + state.write_u8(4u8); + v0.hash(state); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Variadic { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Variant { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.attrs.hash(state); + self.ident.hash(state); + self.fields.hash(state); + self.discriminant.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for VisCrate { + fn hash(&self, _state: &mut H) + where + H: Hasher, + { + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for VisPublic { + fn hash(&self, _state: &mut H) + where + H: Hasher, + { + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for VisRestricted { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.in_token.hash(state); + self.path.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for Visibility { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + Visibility::Public(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + Visibility::Crate(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + Visibility::Restricted(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + Visibility::Inherited => { + state.write_u8(3u8); + } + } + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for WhereClause { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.predicates.hash(state); + } +} +#[cfg(any(feature = "derive", feature = "full"))] +impl Hash for WherePredicate { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + match self { + WherePredicate::Type(v0) => { + state.write_u8(0u8); + v0.hash(state); + } + WherePredicate::Lifetime(v0) => { + state.write_u8(1u8); + v0.hash(state); + } + WherePredicate::Eq(v0) => { + state.write_u8(2u8); + v0.hash(state); + } + } + } +} diff --git a/src/generics.rs b/src/generics.rs index d0015dbc..05e8ef5c 100644 --- a/src/generics.rs +++ b/src/generics.rs @@ -1,5 +1,9 @@ use super::*; use crate::punctuated::{Iter, IterMut, Punctuated}; +#[cfg(all(feature = "printing", feature = "extra-traits"))] +use std::fmt::{self, Debug}; +#[cfg(all(feature = "printing", feature = "extra-traits"))] +use std::hash::{Hash, Hasher}; ast_struct! { /// Lifetimes and type parameters attached to a declaration of a function, @@ -7,7 +11,6 @@ ast_struct! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[derive(Default)] pub struct Generics { pub lt_token: Option, pub params: Punctuated, @@ -84,6 +87,17 @@ ast_struct! { } } +impl Default for Generics { + fn default() -> Self { + Generics { + lt_token: None, + params: Punctuated::new(), + gt_token: None, + where_clause: None, + } + } +} + impl Generics { /// Returns an /// Iterator for ConstParamsMut<'a> { /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature and the `"printing"` feature.* #[cfg(feature = "printing")] -#[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] -#[cfg_attr(feature = "clone-impls", derive(Clone))] pub struct ImplGenerics<'a>(&'a Generics); /// Returned by `Generics::split_for_impl`. @@ -289,8 +301,6 @@ pub struct ImplGenerics<'a>(&'a Generics); /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature and the `"printing"` feature.* #[cfg(feature = "printing")] -#[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] -#[cfg_attr(feature = "clone-impls", derive(Clone))] pub struct TypeGenerics<'a>(&'a Generics); /// Returned by `TypeGenerics::as_turbofish`. @@ -298,8 +308,6 @@ pub struct TypeGenerics<'a>(&'a Generics); /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature and the `"printing"` feature.* #[cfg(feature = "printing")] -#[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] -#[cfg_attr(feature = "clone-impls", derive(Clone))] pub struct Turbofish<'a>(&'a Generics); #[cfg(feature = "printing")] @@ -334,6 +342,52 @@ impl Generics { } } +#[cfg(feature = "printing")] +macro_rules! generics_wrapper_impls { + ($ty:ident) => { + #[cfg(feature = "clone-impls")] + impl<'a> Clone for $ty<'a> { + fn clone(&self) -> Self { + $ty(self.0) + } + } + + #[cfg(feature = "extra-traits")] + impl<'a> Debug for $ty<'a> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter + .debug_tuple(stringify!($ty)) + .field(self.0) + .finish() + } + } + + #[cfg(feature = "extra-traits")] + impl<'a> Eq for $ty<'a> {} + + #[cfg(feature = "extra-traits")] + impl<'a> PartialEq for $ty<'a> { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + + #[cfg(feature = "extra-traits")] + impl<'a> Hash for $ty<'a> { + fn hash(&self, state: &mut H) { + self.0.hash(state); + } + } + }; +} + +#[cfg(feature = "printing")] +generics_wrapper_impls!(ImplGenerics); +#[cfg(feature = "printing")] +generics_wrapper_impls!(TypeGenerics); +#[cfg(feature = "printing")] +generics_wrapper_impls!(Turbofish); + #[cfg(feature = "printing")] impl<'a> TypeGenerics<'a> { /// Turn a type's generics like `` into a turbofish like `::`. @@ -350,7 +404,6 @@ ast_struct! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[derive(Default)] pub struct BoundLifetimes { pub for_token: Token![for], pub lt_token: Token![<], @@ -359,6 +412,17 @@ ast_struct! { } } +impl Default for BoundLifetimes { + fn default() -> Self { + BoundLifetimes { + for_token: Default::default(), + lt_token: Default::default(), + lifetimes: Punctuated::new(), + gt_token: Default::default(), + } + } +} + impl LifetimeDef { pub fn new(lifetime: Lifetime) -> Self { LifetimeDef { @@ -415,7 +479,6 @@ ast_enum! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[cfg_attr(feature = "clone-impls", derive(Copy))] pub enum TraitBoundModifier { None, Maybe(Token![?]), @@ -513,7 +576,6 @@ pub mod parsing { let mut params = Punctuated::new(); let mut allow_lifetime_param = true; - let mut allow_type_param = true; loop { if input.peek(Token![>]) { break; @@ -526,7 +588,7 @@ pub mod parsing { attrs, ..input.parse()? })); - } else if allow_type_param && lookahead.peek(Ident) { + } else if lookahead.peek(Ident) { allow_lifetime_param = false; params.push_value(GenericParam::Type(TypeParam { attrs, @@ -534,7 +596,6 @@ pub mod parsing { })); } else if lookahead.peek(Token![const]) { allow_lifetime_param = false; - allow_type_param = false; params.push_value(GenericParam::Const(ConstParam { attrs, ..input.parse()? @@ -1123,9 +1184,9 @@ mod printing { self.ident.to_tokens(tokens); self.colon_token.to_tokens(tokens); self.ty.to_tokens(tokens); - if self.default.is_some() { + if let Some(default) = &self.default { TokensOrDefault(&self.eq_token).to_tokens(tokens); - self.default.to_tokens(tokens); + default.to_tokens(tokens); } } } diff --git a/src/item.rs b/src/item.rs index 45e05a3d..0d8f7d3d 100644 --- a/src/item.rs +++ b/src/item.rs @@ -3,10 +3,6 @@ use crate::derive::{Data, DataEnum, DataStruct, DataUnion, DeriveInput}; use crate::punctuated::Punctuated; use proc_macro2::TokenStream; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; -#[cfg(feature = "extra-traits")] -use std::hash::{Hash, Hasher}; #[cfg(feature = "parsing")] use std::mem; @@ -23,7 +19,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum Item #manual_extra_traits { + pub enum Item { /// A constant item: `const MAX: u16 = 65535`. Const(ItemConst), @@ -191,7 +187,7 @@ ast_struct! { /// A 2.0-style declarative macro introduced by the `macro` keyword. /// /// *This type is available only if Syn is built with the `"full"` feature.* - pub struct ItemMacro2 #manual_extra_traits { + pub struct ItemMacro2 { pub attrs: Vec, pub vis: Visibility, pub macro_token: Token![macro], @@ -326,117 +322,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Item {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Item { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (Item::Const(this), Item::Const(other)) => this == other, - (Item::Enum(this), Item::Enum(other)) => this == other, - (Item::ExternCrate(this), Item::ExternCrate(other)) => this == other, - (Item::Fn(this), Item::Fn(other)) => this == other, - (Item::ForeignMod(this), Item::ForeignMod(other)) => this == other, - (Item::Impl(this), Item::Impl(other)) => this == other, - (Item::Macro(this), Item::Macro(other)) => this == other, - (Item::Macro2(this), Item::Macro2(other)) => this == other, - (Item::Mod(this), Item::Mod(other)) => this == other, - (Item::Static(this), Item::Static(other)) => this == other, - (Item::Struct(this), Item::Struct(other)) => this == other, - (Item::Trait(this), Item::Trait(other)) => this == other, - (Item::TraitAlias(this), Item::TraitAlias(other)) => this == other, - (Item::Type(this), Item::Type(other)) => this == other, - (Item::Union(this), Item::Union(other)) => this == other, - (Item::Use(this), Item::Use(other)) => this == other, - (Item::Verbatim(this), Item::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Item { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - match self { - Item::Const(item) => { - state.write_u8(0); - item.hash(state); - } - Item::Enum(item) => { - state.write_u8(1); - item.hash(state); - } - Item::ExternCrate(item) => { - state.write_u8(2); - item.hash(state); - } - Item::Fn(item) => { - state.write_u8(3); - item.hash(state); - } - Item::ForeignMod(item) => { - state.write_u8(4); - item.hash(state); - } - Item::Impl(item) => { - state.write_u8(5); - item.hash(state); - } - Item::Macro(item) => { - state.write_u8(6); - item.hash(state); - } - Item::Macro2(item) => { - state.write_u8(7); - item.hash(state); - } - Item::Mod(item) => { - state.write_u8(8); - item.hash(state); - } - Item::Static(item) => { - state.write_u8(9); - item.hash(state); - } - Item::Struct(item) => { - state.write_u8(10); - item.hash(state); - } - Item::Trait(item) => { - state.write_u8(11); - item.hash(state); - } - Item::TraitAlias(item) => { - state.write_u8(12); - item.hash(state); - } - Item::Type(item) => { - state.write_u8(13); - item.hash(state); - } - Item::Union(item) => { - state.write_u8(14); - item.hash(state); - } - Item::Use(item) => { - state.write_u8(15); - item.hash(state); - } - Item::Verbatim(item) => { - state.write_u8(16); - TokenStreamHelper(item).hash(state); - } - Item::__Nonexhaustive => unreachable!(), - } - } -} - impl Item { #[cfg(feature = "parsing")] pub(crate) fn replace_attrs(&mut self, new: Vec) -> Vec { @@ -463,34 +348,6 @@ impl Item { } } -#[cfg(feature = "extra-traits")] -impl Eq for ItemMacro2 {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for ItemMacro2 { - fn eq(&self, other: &Self) -> bool { - self.attrs == other.attrs - && self.vis == other.vis - && self.macro_token == other.macro_token - && self.ident == other.ident - && TokenStreamHelper(&self.rules) == TokenStreamHelper(&other.rules) - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for ItemMacro2 { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - self.attrs.hash(state); - self.vis.hash(state); - self.macro_token.hash(state); - self.ident.hash(state); - TokenStreamHelper(&self.rules).hash(state); - } -} - impl From for Item { fn from(input: DeriveInput) -> Item { match input.data { @@ -665,7 +522,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum ForeignItem #manual_extra_traits { + pub enum ForeignItem { /// A foreign function in an `extern` block. Fn(ForeignItemFn), @@ -738,57 +595,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for ForeignItem {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for ForeignItem { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (ForeignItem::Fn(this), ForeignItem::Fn(other)) => this == other, - (ForeignItem::Static(this), ForeignItem::Static(other)) => this == other, - (ForeignItem::Type(this), ForeignItem::Type(other)) => this == other, - (ForeignItem::Macro(this), ForeignItem::Macro(other)) => this == other, - (ForeignItem::Verbatim(this), ForeignItem::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for ForeignItem { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - match self { - ForeignItem::Fn(item) => { - state.write_u8(0); - item.hash(state); - } - ForeignItem::Static(item) => { - state.write_u8(1); - item.hash(state); - } - ForeignItem::Type(item) => { - state.write_u8(2); - item.hash(state); - } - ForeignItem::Macro(item) => { - state.write_u8(3); - item.hash(state); - } - ForeignItem::Verbatim(item) => { - state.write_u8(4); - TokenStreamHelper(item).hash(state); - } - ForeignItem::__Nonexhaustive => unreachable!(), - } - } -} - ast_enum_of_structs! { /// An item declaration within the definition of a trait. /// @@ -802,7 +608,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum TraitItem #manual_extra_traits { + pub enum TraitItem { /// An associated constant within the definition of a trait. Const(TraitItemConst), @@ -877,57 +683,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for TraitItem {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for TraitItem { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (TraitItem::Const(this), TraitItem::Const(other)) => this == other, - (TraitItem::Method(this), TraitItem::Method(other)) => this == other, - (TraitItem::Type(this), TraitItem::Type(other)) => this == other, - (TraitItem::Macro(this), TraitItem::Macro(other)) => this == other, - (TraitItem::Verbatim(this), TraitItem::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for TraitItem { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - match self { - TraitItem::Const(item) => { - state.write_u8(0); - item.hash(state); - } - TraitItem::Method(item) => { - state.write_u8(1); - item.hash(state); - } - TraitItem::Type(item) => { - state.write_u8(2); - item.hash(state); - } - TraitItem::Macro(item) => { - state.write_u8(3); - item.hash(state); - } - TraitItem::Verbatim(item) => { - state.write_u8(4); - TokenStreamHelper(item).hash(state); - } - TraitItem::__Nonexhaustive => unreachable!(), - } - } -} - ast_enum_of_structs! { /// An item within an impl block. /// @@ -941,7 +696,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum ImplItem #manual_extra_traits { + pub enum ImplItem { /// An associated constant within an impl block. Const(ImplItemConst), @@ -1021,57 +776,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for ImplItem {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for ImplItem { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (ImplItem::Const(this), ImplItem::Const(other)) => this == other, - (ImplItem::Method(this), ImplItem::Method(other)) => this == other, - (ImplItem::Type(this), ImplItem::Type(other)) => this == other, - (ImplItem::Macro(this), ImplItem::Macro(other)) => this == other, - (ImplItem::Verbatim(this), ImplItem::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for ImplItem { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - match self { - ImplItem::Const(item) => { - state.write_u8(0); - item.hash(state); - } - ImplItem::Method(item) => { - state.write_u8(1); - item.hash(state); - } - ImplItem::Type(item) => { - state.write_u8(2); - item.hash(state); - } - ImplItem::Macro(item) => { - state.write_u8(3); - item.hash(state); - } - ImplItem::Verbatim(item) => { - state.write_u8(4); - TokenStreamHelper(item).hash(state); - } - ImplItem::__Nonexhaustive => unreachable!(), - } - } -} - ast_struct! { /// A function signature in a trait or implementation: `unsafe fn /// initialize(&self)`. diff --git a/src/lib.rs b/src/lib.rs index f715c7f6..3da50673 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -250,7 +250,7 @@ //! dynamic library libproc_macro from rustc toolchain. // Syn types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/syn/1.0.38")] +#![doc(html_root_url = "https://docs.rs/syn/1.0.40")] #![deny(clippy::all, clippy::pedantic)] // Ignored clippy lints. #![allow( @@ -274,7 +274,9 @@ // Ignored clippy_pedantic lints. #![allow( clippy::cast_possible_truncation, + clippy::default_trait_access, clippy::empty_enum, + clippy::expl_impl_clone_on_copy, clippy::if_not_else, clippy::items_after_statements, clippy::match_same_arms, @@ -762,6 +764,22 @@ mod gen { #[rustfmt::skip] pub mod fold; + #[cfg(feature = "clone-impls")] + #[rustfmt::skip] + mod clone; + + #[cfg(feature = "extra-traits")] + #[rustfmt::skip] + mod eq; + + #[cfg(feature = "extra-traits")] + #[rustfmt::skip] + mod hash; + + #[cfg(feature = "extra-traits")] + #[rustfmt::skip] + mod debug; + #[cfg(any(feature = "full", feature = "derive"))] #[path = "../gen_helper.rs"] mod helper; @@ -784,6 +802,9 @@ mod lookahead; #[cfg(feature = "parsing")] pub mod parse; +#[cfg(feature = "full")] +mod reserved; + #[cfg(all(any(feature = "full", feature = "derive"), feature = "parsing"))] mod verbatim; diff --git a/src/lifetime.rs b/src/lifetime.rs index d34df34b..959cc5f9 100644 --- a/src/lifetime.rs +++ b/src/lifetime.rs @@ -20,8 +20,6 @@ use crate::lookahead; /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* -#[cfg_attr(feature = "extra-traits", derive(Debug))] -#[derive(Clone)] pub struct Lifetime { pub apostrophe: Span, pub ident: Ident, @@ -72,6 +70,15 @@ impl Display for Lifetime { } } +impl Clone for Lifetime { + fn clone(&self) -> Self { + Lifetime { + apostrophe: self.apostrophe, + ident: self.ident.clone(), + } + } +} + impl PartialEq for Lifetime { fn eq(&self, other: &Lifetime) -> bool { self.ident.eq(&other.ident) diff --git a/src/lit.rs b/src/lit.rs index 692391d9..ee77e75b 100644 --- a/src/lit.rs +++ b/src/lit.rs @@ -30,7 +30,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum Lit #manual_extra_traits { + pub enum Lit { /// A UTF-8 string literal: `"foo"`. Str(LitStr), @@ -61,33 +61,32 @@ ast_enum_of_structs! { ast_struct! { /// A UTF-8 string literal: `"foo"`. - pub struct LitStr #manual_extra_traits_debug { + pub struct LitStr { repr: Box, } } ast_struct! { /// A byte string literal: `b"foo"`. - pub struct LitByteStr #manual_extra_traits_debug { + pub struct LitByteStr { repr: Box, } } ast_struct! { /// A byte literal: `b'f'`. - pub struct LitByte #manual_extra_traits_debug { + pub struct LitByte { repr: Box, } } ast_struct! { /// A character literal: `'a'`. - pub struct LitChar #manual_extra_traits_debug { + pub struct LitChar { repr: Box, } } -#[cfg_attr(feature = "clone-impls", derive(Clone))] struct LitRepr { token: Literal, suffix: Box, @@ -95,12 +94,11 @@ struct LitRepr { ast_struct! { /// An integer literal: `1` or `1u16`. - pub struct LitInt #manual_extra_traits_debug { + pub struct LitInt { repr: Box, } } -#[cfg_attr(feature = "clone-impls", derive(Clone))] struct LitIntRepr { token: Literal, digits: Box, @@ -111,12 +109,11 @@ ast_struct! { /// A floating point literal: `1f64` or `1.0e10f64`. /// /// Must be finite. May not be infinte or NaN. - pub struct LitFloat #manual_extra_traits_debug { + pub struct LitFloat { repr: Box, } } -#[cfg_attr(feature = "clone-impls", derive(Clone))] struct LitFloatRepr { token: Literal, digits: Box, @@ -125,75 +122,12 @@ struct LitFloatRepr { ast_struct! { /// A boolean literal: `true` or `false`. - pub struct LitBool #manual_extra_traits_debug { + pub struct LitBool { pub value: bool, pub span: Span, } } -#[cfg(feature = "extra-traits")] -impl Eq for Lit {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Lit { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (Lit::Str(this), Lit::Str(other)) => this == other, - (Lit::ByteStr(this), Lit::ByteStr(other)) => this == other, - (Lit::Byte(this), Lit::Byte(other)) => this == other, - (Lit::Char(this), Lit::Char(other)) => this == other, - (Lit::Int(this), Lit::Int(other)) => this == other, - (Lit::Float(this), Lit::Float(other)) => this == other, - (Lit::Bool(this), Lit::Bool(other)) => this == other, - (Lit::Verbatim(this), Lit::Verbatim(other)) => this.to_string() == other.to_string(), - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Lit { - fn hash(&self, hash: &mut H) - where - H: Hasher, - { - match self { - Lit::Str(lit) => { - hash.write_u8(0); - lit.hash(hash); - } - Lit::ByteStr(lit) => { - hash.write_u8(1); - lit.hash(hash); - } - Lit::Byte(lit) => { - hash.write_u8(2); - lit.hash(hash); - } - Lit::Char(lit) => { - hash.write_u8(3); - lit.hash(hash); - } - Lit::Int(lit) => { - hash.write_u8(4); - lit.hash(hash); - } - Lit::Float(lit) => { - hash.write_u8(5); - lit.hash(hash); - } - Lit::Bool(lit) => { - hash.write_u8(6); - lit.hash(hash); - } - Lit::Verbatim(lit) => { - hash.write_u8(7); - lit.to_string().hash(hash); - } - } - } -} - impl LitStr { pub fn new(value: &str, span: Span) -> Self { let mut token = Literal::string(value); @@ -646,15 +580,53 @@ mod debug_impls { } } +#[cfg(feature = "clone-impls")] +impl Clone for LitRepr { + fn clone(&self) -> Self { + LitRepr { + token: self.token.clone(), + suffix: self.suffix.clone(), + } + } +} + +#[cfg(feature = "clone-impls")] +impl Clone for LitIntRepr { + fn clone(&self) -> Self { + LitIntRepr { + token: self.token.clone(), + digits: self.digits.clone(), + suffix: self.suffix.clone(), + } + } +} + +#[cfg(feature = "clone-impls")] +impl Clone for LitFloatRepr { + fn clone(&self) -> Self { + LitFloatRepr { + token: self.token.clone(), + digits: self.digits.clone(), + suffix: self.suffix.clone(), + } + } +} + macro_rules! lit_extra_traits { - ($ty:ident, $($field:ident).+) => { - #[cfg(feature = "extra-traits")] - impl Eq for $ty {} + ($ty:ident) => { + #[cfg(feature = "clone-impls")] + impl Clone for $ty { + fn clone(&self) -> Self { + $ty { + repr: self.repr.clone(), + } + } + } #[cfg(feature = "extra-traits")] impl PartialEq for $ty { fn eq(&self, other: &Self) -> bool { - self.$($field).+.to_string() == other.$($field).+.to_string() + self.repr.token.to_string() == other.repr.token.to_string() } } @@ -664,7 +636,7 @@ macro_rules! lit_extra_traits { where H: Hasher, { - self.$($field).+.to_string().hash(state); + self.repr.token.to_string().hash(state); } } @@ -677,13 +649,19 @@ macro_rules! lit_extra_traits { }; } -lit_extra_traits!(LitStr, repr.token); -lit_extra_traits!(LitByteStr, repr.token); -lit_extra_traits!(LitByte, repr.token); -lit_extra_traits!(LitChar, repr.token); -lit_extra_traits!(LitInt, repr.token); -lit_extra_traits!(LitFloat, repr.token); -lit_extra_traits!(LitBool, value); +lit_extra_traits!(LitStr); +lit_extra_traits!(LitByteStr); +lit_extra_traits!(LitByte); +lit_extra_traits!(LitChar); +lit_extra_traits!(LitInt); +lit_extra_traits!(LitFloat); + +#[cfg(feature = "parsing")] +#[doc(hidden)] +#[allow(non_snake_case)] +pub fn LitBool(marker: lookahead::TokenMarker) -> LitBool { + match marker {} +} ast_enum! { /// The style of a string literal, either plain quoted or a raw string like @@ -1453,7 +1431,11 @@ mod value { } b'e' | b'E' => { if has_e { - return None; + if has_exponent { + break; + } else { + return None; + } } has_e = true; bytes[write] = b'e'; diff --git a/src/mac.rs b/src/mac.rs index 2d94c951..de288a34 100644 --- a/src/mac.rs +++ b/src/mac.rs @@ -6,17 +6,13 @@ use proc_macro2::{Delimiter, Group, Span, TokenTree}; #[cfg(feature = "parsing")] use crate::parse::{Parse, ParseStream, Parser, Result}; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; -#[cfg(feature = "extra-traits")] -use std::hash::{Hash, Hasher}; ast_struct! { /// A macro invocation: `println!("{}", mac)`. /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - pub struct Macro #manual_extra_traits { + pub struct Macro { pub path: Path, pub bang_token: Token![!], pub delimiter: MacroDelimiter, @@ -36,32 +32,6 @@ ast_enum! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Macro {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Macro { - fn eq(&self, other: &Self) -> bool { - self.path == other.path - && self.bang_token == other.bang_token - && self.delimiter == other.delimiter - && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens) - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Macro { - fn hash(&self, state: &mut H) - where - H: Hasher, - { - self.path.hash(state); - self.bang_token.hash(state); - self.delimiter.hash(state); - TokenStreamHelper(&self.tokens).hash(state); - } -} - #[cfg(feature = "parsing")] fn delimiter_span_close(macro_delimiter: &MacroDelimiter) -> Span { let delimiter = match macro_delimiter { diff --git a/src/macros.rs b/src/macros.rs index 57091c09..80602243 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -4,15 +4,11 @@ macro_rules! ast_struct { struct $name:ident #full $($rest:tt)* ) => { #[cfg(feature = "full")] - #[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] $($attrs_pub)* struct $name $($rest)* #[cfg(not(feature = "full"))] - #[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] $($attrs_pub)* struct $name { - _noconstruct: (), + _noconstruct: ::std::marker::PhantomData<::proc_macro2::Span>, } #[cfg(all(not(feature = "full"), feature = "printing"))] @@ -23,29 +19,10 @@ macro_rules! ast_struct { } }; - ( - [$($attrs_pub:tt)*] - struct $name:ident #manual_extra_traits $($rest:tt)* - ) => { - #[cfg_attr(feature = "extra-traits", derive(Debug))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] - $($attrs_pub)* struct $name $($rest)* - }; - - ( - [$($attrs_pub:tt)*] - struct $name:ident #manual_extra_traits_debug $($rest:tt)* - ) => { - #[cfg_attr(feature = "clone-impls", derive(Clone))] - $($attrs_pub)* struct $name $($rest)* - }; - ( [$($attrs_pub:tt)*] struct $name:ident $($rest:tt)* ) => { - #[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] $($attrs_pub)* struct $name $($rest)* }; @@ -63,21 +40,10 @@ macro_rules! ast_enum { ast_enum!([$($attrs_pub)*] enum $name $($rest)*); ); - ( - [$($attrs_pub:tt)*] - enum $name:ident #manual_extra_traits $($rest:tt)* - ) => ( - #[cfg_attr(feature = "extra-traits", derive(Debug))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] - $($attrs_pub)* enum $name $($rest)* - ); - ( [$($attrs_pub:tt)*] enum $name:ident $($rest:tt)* ) => ( - #[cfg_attr(feature = "extra-traits", derive(Debug, Eq, PartialEq, Hash))] - #[cfg_attr(feature = "clone-impls", derive(Clone))] $($attrs_pub)* enum $name $($rest)* ); diff --git a/src/op.rs b/src/op.rs index e0e7809f..d254673b 100644 --- a/src/op.rs +++ b/src/op.rs @@ -3,7 +3,6 @@ ast_enum! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[cfg_attr(feature = "clone-impls", derive(Copy))] pub enum BinOp { /// The `+` operator (addition) Add(Token![+]), @@ -69,7 +68,6 @@ ast_enum! { /// /// *This type is available only if Syn is built with the `"derive"` or `"full"` /// feature.* - #[cfg_attr(feature = "clone-impls", derive(Copy))] pub enum UnOp { /// The `*` operator for dereferencing Deref(Token![*]), diff --git a/src/parse.rs b/src/parse.rs index dffc2ad3..abb4c4c1 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -336,7 +336,6 @@ impl<'a> Debug for ParseBuffer<'a> { /// # .unwrap(); /// # assert_eq!(remainder.to_string(), "b c"); /// ``` -#[derive(Copy, Clone)] pub struct StepCursor<'c, 'a> { scope: Span, // This field is covariant in 'c. @@ -360,6 +359,14 @@ impl<'c, 'a> Deref for StepCursor<'c, 'a> { } } +impl<'c, 'a> Copy for StepCursor<'c, 'a> {} + +impl<'c, 'a> Clone for StepCursor<'c, 'a> { + fn clone(&self) -> Self { + *self + } +} + impl<'c, 'a> StepCursor<'c, 'a> { /// Triggers an error at the current position of the parse stream. /// @@ -393,7 +400,6 @@ pub(crate) fn new_parse_buffer( } } -#[derive(Clone)] pub(crate) enum Unexpected { None, Some(Span), @@ -406,6 +412,16 @@ impl Default for Unexpected { } } +impl Clone for Unexpected { + fn clone(&self) -> Self { + match self { + Unexpected::None => Unexpected::None, + Unexpected::Some(span) => Unexpected::Some(*span), + Unexpected::Chain(next) => Unexpected::Chain(next.clone()), + } + } +} + // We call this on Cell and Cell> where temporarily // swapping in a None is cheap. fn cell_clone(cell: &Cell) -> T { diff --git a/src/pat.rs b/src/pat.rs index 68d58dc5..e9576a23 100644 --- a/src/pat.rs +++ b/src/pat.rs @@ -1,10 +1,6 @@ use super::*; use crate::punctuated::Punctuated; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; use proc_macro2::TokenStream; -#[cfg(feature = "extra-traits")] -use std::hash::{Hash, Hasher}; ast_enum_of_structs! { /// A pattern in a local binding, function signature, match expression, or @@ -20,7 +16,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum Pat #manual_extra_traits { + pub enum Pat { /// A box pattern: `box v`. Box(PatBox), @@ -278,112 +274,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Pat {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Pat { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (Pat::Box(this), Pat::Box(other)) => this == other, - (Pat::Ident(this), Pat::Ident(other)) => this == other, - (Pat::Lit(this), Pat::Lit(other)) => this == other, - (Pat::Macro(this), Pat::Macro(other)) => this == other, - (Pat::Or(this), Pat::Or(other)) => this == other, - (Pat::Path(this), Pat::Path(other)) => this == other, - (Pat::Range(this), Pat::Range(other)) => this == other, - (Pat::Reference(this), Pat::Reference(other)) => this == other, - (Pat::Rest(this), Pat::Rest(other)) => this == other, - (Pat::Slice(this), Pat::Slice(other)) => this == other, - (Pat::Struct(this), Pat::Struct(other)) => this == other, - (Pat::Tuple(this), Pat::Tuple(other)) => this == other, - (Pat::TupleStruct(this), Pat::TupleStruct(other)) => this == other, - (Pat::Type(this), Pat::Type(other)) => this == other, - (Pat::Verbatim(this), Pat::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - (Pat::Wild(this), Pat::Wild(other)) => this == other, - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Pat { - fn hash(&self, hash: &mut H) - where - H: Hasher, - { - match self { - Pat::Box(pat) => { - hash.write_u8(0); - pat.hash(hash); - } - Pat::Ident(pat) => { - hash.write_u8(1); - pat.hash(hash); - } - Pat::Lit(pat) => { - hash.write_u8(2); - pat.hash(hash); - } - Pat::Macro(pat) => { - hash.write_u8(3); - pat.hash(hash); - } - Pat::Or(pat) => { - hash.write_u8(4); - pat.hash(hash); - } - Pat::Path(pat) => { - hash.write_u8(5); - pat.hash(hash); - } - Pat::Range(pat) => { - hash.write_u8(6); - pat.hash(hash); - } - Pat::Reference(pat) => { - hash.write_u8(7); - pat.hash(hash); - } - Pat::Rest(pat) => { - hash.write_u8(8); - pat.hash(hash); - } - Pat::Slice(pat) => { - hash.write_u8(9); - pat.hash(hash); - } - Pat::Struct(pat) => { - hash.write_u8(10); - pat.hash(hash); - } - Pat::Tuple(pat) => { - hash.write_u8(11); - pat.hash(hash); - } - Pat::TupleStruct(pat) => { - hash.write_u8(12); - pat.hash(hash); - } - Pat::Type(pat) => { - hash.write_u8(13); - pat.hash(hash); - } - Pat::Verbatim(pat) => { - hash.write_u8(14); - TokenStreamHelper(pat).hash(hash); - } - Pat::Wild(pat) => { - hash.write_u8(15); - pat.hash(hash); - } - Pat::__Nonexhaustive => unreachable!(), - } - } -} - #[cfg(feature = "parsing")] pub mod parsing { use super::*; diff --git a/src/punctuated.rs b/src/punctuated.rs index cdd25c06..46c82a65 100644 --- a/src/punctuated.rs +++ b/src/punctuated.rs @@ -22,6 +22,8 @@ #[cfg(feature = "extra-traits")] use std::fmt::{self, Debug}; +#[cfg(feature = "extra-traits")] +use std::hash::{Hash, Hasher}; #[cfg(any(feature = "full", feature = "derive"))] use std::iter; use std::iter::FromIterator; @@ -41,8 +43,6 @@ use crate::token::Token; /// Refer to the [module documentation] for details about punctuated sequences. /// /// [module documentation]: self -#[cfg_attr(feature = "extra-traits", derive(Eq, PartialEq, Hash))] -#[cfg_attr(feature = "clone-impls", derive(Clone))] pub struct Punctuated { inner: Vec<(T, P)>, last: Option>, @@ -341,6 +341,53 @@ impl Punctuated { } } +#[cfg(feature = "clone-impls")] +impl Clone for Punctuated +where + T: Clone, + P: Clone, +{ + fn clone(&self) -> Self { + Punctuated { + inner: self.inner.clone(), + last: self.last.clone(), + } + } +} + +#[cfg(feature = "extra-traits")] +impl Eq for Punctuated +where + T: Eq, + P: Eq, +{ +} + +#[cfg(feature = "extra-traits")] +impl PartialEq for Punctuated +where + T: PartialEq, + P: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + let Punctuated { inner, last } = self; + *inner == other.inner && *last == other.last + } +} + +#[cfg(feature = "extra-traits")] +impl Hash for Punctuated +where + T: Hash, + P: Hash, +{ + fn hash(&self, state: &mut H) { + let Punctuated { inner, last } = self; + inner.hash(state); + last.hash(state); + } +} + #[cfg(feature = "extra-traits")] impl Debug for Punctuated { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -539,7 +586,6 @@ impl<'a, T, P> ExactSizeIterator for PairsMut<'a, T, P> { /// Refer to the [module documentation] for details about punctuated sequences. /// /// [module documentation]: self -#[derive(Clone)] pub struct IntoPairs { inner: vec::IntoIter<(T, P)>, last: option::IntoIter, @@ -575,12 +621,24 @@ impl ExactSizeIterator for IntoPairs { } } +impl Clone for IntoPairs +where + T: Clone, + P: Clone, +{ + fn clone(&self) -> Self { + IntoPairs { + inner: self.inner.clone(), + last: self.last.clone(), + } + } +} + /// An iterator over owned values of type `T`. /// /// Refer to the [module documentation] for details about punctuated sequences. /// /// [module documentation]: self -#[derive(Clone)] pub struct IntoIter { inner: vec::IntoIter, } @@ -609,6 +667,17 @@ impl ExactSizeIterator for IntoIter { } } +impl Clone for IntoIter +where + T: Clone, +{ + fn clone(&self) -> Self { + IntoIter { + inner: self.inner.clone(), + } + } +} + /// An iterator over borrowed values of type `&T`. /// /// Refer to the [module documentation] for details about punctuated sequences. @@ -802,7 +871,6 @@ impl<'a, T: 'a, I: 'a> IterMutTrait<'a, T> for I where /// Refer to the [module documentation] for details about punctuated sequences. /// /// [module documentation]: self -#[cfg_attr(feature = "clone-impls", derive(Clone))] pub enum Pair { Punctuated(T, P), End(T), @@ -859,6 +927,20 @@ impl Pair { } } +#[cfg(feature = "clone-impls")] +impl Clone for Pair +where + T: Clone, + P: Clone, +{ + fn clone(&self) -> Self { + match self { + Pair::Punctuated(t, p) => Pair::Punctuated(t.clone(), p.clone()), + Pair::End(t) => Pair::End(t.clone()), + } + } +} + impl Index for Punctuated { type Output = T; diff --git a/src/reserved.rs b/src/reserved.rs new file mode 100644 index 00000000..ccfb8b5a --- /dev/null +++ b/src/reserved.rs @@ -0,0 +1,42 @@ +// Type for a syntax tree node that is reserved for future use. +// +// For example ExprReference contains a field `raw` of type Reserved. If `&raw +// place` syntax becomes a thing as per https://github.com/rust-lang/rfcs/pull/2582, +// we can backward compatibly change `raw`'s type to Option without +// the possibility of breaking any code. + +use proc_macro2::Span; +use std::marker::PhantomData; + +#[cfg(feature = "extra-traits")] +use std::fmt::{self, Debug}; + +ast_struct! { + pub struct Reserved { + _private: PhantomData, + } +} + +impl Default for Reserved { + fn default() -> Self { + Reserved { + _private: PhantomData, + } + } +} + +#[cfg(feature = "clone-impls")] +impl Clone for Reserved { + fn clone(&self) -> Self { + Reserved { + _private: self._private, + } + } +} + +#[cfg(feature = "extra-traits")] +impl Debug for Reserved { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.debug_struct("Reserved").finish() + } +} diff --git a/src/token.rs b/src/token.rs index d23f126b..8539378c 100644 --- a/src/token.rs +++ b/src/token.rs @@ -243,7 +243,6 @@ impl Token for T { macro_rules! define_keywords { ($($token:tt pub struct $name:ident #[$doc:meta])*) => { $( - #[cfg_attr(feature = "clone-impls", derive(Copy, Clone))] #[$doc] /// /// Don't try to remember the name of this type — use the @@ -270,6 +269,16 @@ macro_rules! define_keywords { } } + #[cfg(feature = "clone-impls")] + impl Copy for $name {} + + #[cfg(feature = "clone-impls")] + impl Clone for $name { + fn clone(&self) -> Self { + *self + } + } + #[cfg(feature = "extra-traits")] impl Debug for $name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -348,7 +357,6 @@ macro_rules! impl_deref_if_len_is_1 { macro_rules! define_punctuation_structs { ($($token:tt pub struct $name:ident/$len:tt #[$doc:meta])*) => { $( - #[cfg_attr(feature = "clone-impls", derive(Copy, Clone))] #[repr(C)] #[$doc] /// @@ -376,6 +384,16 @@ macro_rules! define_punctuation_structs { } } + #[cfg(feature = "clone-impls")] + impl Copy for $name {} + + #[cfg(feature = "clone-impls")] + impl Clone for $name { + fn clone(&self) -> Self { + *self + } + } + #[cfg(feature = "extra-traits")] impl Debug for $name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { @@ -446,7 +464,6 @@ macro_rules! define_punctuation { macro_rules! define_delimiters { ($($token:tt pub struct $name:ident #[$doc:meta])*) => { $( - #[cfg_attr(feature = "clone-impls", derive(Copy, Clone))] #[$doc] pub struct $name { pub span: Span, @@ -468,6 +485,16 @@ macro_rules! define_delimiters { } } + #[cfg(feature = "clone-impls")] + impl Copy for $name {} + + #[cfg(feature = "clone-impls")] + impl Clone for $name { + fn clone(&self) -> Self { + *self + } + } + #[cfg(feature = "extra-traits")] impl Debug for $name { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/src/ty.rs b/src/ty.rs index ed263e67..fd7c97ea 100644 --- a/src/ty.rs +++ b/src/ty.rs @@ -1,10 +1,6 @@ use super::*; use crate::punctuated::Punctuated; -#[cfg(feature = "extra-traits")] -use crate::tt::TokenStreamHelper; use proc_macro2::TokenStream; -#[cfg(feature = "extra-traits")] -use std::hash::{Hash, Hasher}; ast_enum_of_structs! { /// The possible types that a Rust value could have. @@ -20,7 +16,7 @@ ast_enum_of_structs! { // // TODO: change syntax-tree-enum link to an intra rustdoc link, currently // blocked on https://github.com/rust-lang/rust/issues/62833 - pub enum Type #manual_extra_traits { + pub enum Type { /// A fixed size array type: `[T; n]`. Array(TypeArray), @@ -240,107 +236,6 @@ ast_struct! { } } -#[cfg(feature = "extra-traits")] -impl Eq for Type {} - -#[cfg(feature = "extra-traits")] -impl PartialEq for Type { - fn eq(&self, other: &Self) -> bool { - match (self, other) { - (Type::Array(this), Type::Array(other)) => this == other, - (Type::BareFn(this), Type::BareFn(other)) => this == other, - (Type::Group(this), Type::Group(other)) => this == other, - (Type::ImplTrait(this), Type::ImplTrait(other)) => this == other, - (Type::Infer(this), Type::Infer(other)) => this == other, - (Type::Macro(this), Type::Macro(other)) => this == other, - (Type::Never(this), Type::Never(other)) => this == other, - (Type::Paren(this), Type::Paren(other)) => this == other, - (Type::Path(this), Type::Path(other)) => this == other, - (Type::Ptr(this), Type::Ptr(other)) => this == other, - (Type::Reference(this), Type::Reference(other)) => this == other, - (Type::Slice(this), Type::Slice(other)) => this == other, - (Type::TraitObject(this), Type::TraitObject(other)) => this == other, - (Type::Tuple(this), Type::Tuple(other)) => this == other, - (Type::Verbatim(this), Type::Verbatim(other)) => { - TokenStreamHelper(this) == TokenStreamHelper(other) - } - _ => false, - } - } -} - -#[cfg(feature = "extra-traits")] -impl Hash for Type { - fn hash(&self, hash: &mut H) - where - H: Hasher, - { - match self { - Type::Array(ty) => { - hash.write_u8(0); - ty.hash(hash); - } - Type::BareFn(ty) => { - hash.write_u8(1); - ty.hash(hash); - } - Type::Group(ty) => { - hash.write_u8(2); - ty.hash(hash); - } - Type::ImplTrait(ty) => { - hash.write_u8(3); - ty.hash(hash); - } - Type::Infer(ty) => { - hash.write_u8(4); - ty.hash(hash); - } - Type::Macro(ty) => { - hash.write_u8(5); - ty.hash(hash); - } - Type::Never(ty) => { - hash.write_u8(6); - ty.hash(hash); - } - Type::Paren(ty) => { - hash.write_u8(7); - ty.hash(hash); - } - Type::Path(ty) => { - hash.write_u8(8); - ty.hash(hash); - } - Type::Ptr(ty) => { - hash.write_u8(9); - ty.hash(hash); - } - Type::Reference(ty) => { - hash.write_u8(10); - ty.hash(hash); - } - Type::Slice(ty) => { - hash.write_u8(11); - ty.hash(hash); - } - Type::TraitObject(ty) => { - hash.write_u8(12); - ty.hash(hash); - } - Type::Tuple(ty) => { - hash.write_u8(13); - ty.hash(hash); - } - Type::Verbatim(ty) => { - hash.write_u8(14); - TokenStreamHelper(ty).hash(hash); - } - Type::__Nonexhaustive => unreachable!(), - } - } -} - ast_struct! { /// The binary interface of a function: `extern "C"`. /// diff --git a/tests/common/eq.rs b/tests/common/eq.rs index 247a58b7..7589a075 100644 --- a/tests/common/eq.rs +++ b/tests/common/eq.rs @@ -14,22 +14,22 @@ use rustc_ast::ast::{ GenericParam, GenericParamKind, Generics, GlobalAsm, ImplPolarity, InlineAsm, InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass, InlineAsmTemplatePiece, IntTy, IsAuto, Item, ItemKind, Label, Lifetime, Lit, LitFloatType, LitIntType, LitKind, LlvmAsmDialect, - LlvmInlineAsm, LlvmInlineAsmOutput, Local, MacArgs, MacCall, MacDelimiter, MacStmtStyle, - MacroDef, Mod, Movability, MutTy, Mutability, NodeId, Param, ParenthesizedArgs, Pat, PatKind, - Path, PathSegment, PolyTraitRef, QSelf, RangeEnd, RangeLimits, RangeSyntax, Stmt, StmtKind, - StrLit, StrStyle, StructField, TraitBoundModifier, TraitObjectSyntax, TraitRef, Ty, TyKind, - UintTy, UnOp, Unsafe, UnsafeSource, UseTree, UseTreeKind, Variant, VariantData, VisibilityKind, - WhereBoundPredicate, WhereClause, WhereEqPredicate, WherePredicate, WhereRegionPredicate, + LlvmInlineAsm, LlvmInlineAsmOutput, Local, MacArgs, MacCall, MacCallStmt, MacDelimiter, + MacStmtStyle, MacroDef, Mod, Movability, MutTy, Mutability, NodeId, Param, ParenthesizedArgs, + Pat, PatKind, Path, PathSegment, PolyTraitRef, QSelf, RangeEnd, RangeLimits, RangeSyntax, Stmt, + StmtKind, StrLit, StrStyle, StructField, TraitBoundModifier, TraitObjectSyntax, TraitRef, Ty, + TyKind, UintTy, UnOp, Unsafe, UnsafeSource, UseTree, UseTreeKind, Variant, VariantData, + VisibilityKind, WhereBoundPredicate, WhereClause, WhereEqPredicate, WherePredicate, + WhereRegionPredicate, }; use rustc_ast::ptr::P; -use rustc_ast::token::{self, DelimToken, Token, TokenKind}; +use rustc_ast::token::{self, CommentKind, DelimToken, Token, TokenKind}; use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree}; -use rustc_ast::util::comments; use rustc_data_structures::sync::Lrc; use rustc_data_structures::thin_vec::ThinVec; use rustc_span::source_map::Spanned; use rustc_span::symbol::Ident; -use rustc_span::{sym, Span, Symbol, SyntaxContext, DUMMY_SP}; +use rustc_span::{Span, Symbol, SyntaxContext}; pub trait SpanlessEq { fn eq(&self, other: &Self) -> bool; @@ -85,14 +85,6 @@ impl SpanlessEq for (A, B) { } } -impl SpanlessEq for (A, B, C) { - fn eq(&self, other: &Self) -> bool { - SpanlessEq::eq(&self.0, &other.0) - && SpanlessEq::eq(&self.1, &other.1) - && SpanlessEq::eq(&self.2, &other.2) - } -} - macro_rules! spanless_eq_true { ($name:ident) => { impl SpanlessEq for $name { @@ -127,6 +119,7 @@ spanless_eq_partial_eq!(usize); spanless_eq_partial_eq!(char); spanless_eq_partial_eq!(String); spanless_eq_partial_eq!(Symbol); +spanless_eq_partial_eq!(CommentKind); spanless_eq_partial_eq!(DelimToken); spanless_eq_partial_eq!(InlineAsmOptions); @@ -278,7 +271,7 @@ spanless_eq_struct!(Field; attrs id span ident expr is_shorthand is_placeholder) spanless_eq_struct!(FieldPat; ident pat is_shorthand attrs id span is_placeholder); spanless_eq_struct!(FnDecl; inputs output); spanless_eq_struct!(FnHeader; constness asyncness unsafety ext); -spanless_eq_struct!(FnSig; header decl); +spanless_eq_struct!(FnSig; header decl span); spanless_eq_struct!(ForeignMod; abi items); spanless_eq_struct!(GenericParam; id ident attrs bounds is_placeholder kind); spanless_eq_struct!(Generics; params where_clause span); @@ -292,12 +285,13 @@ spanless_eq_struct!(LlvmInlineAsm; asm asm_str_style outputs inputs clobbers vol spanless_eq_struct!(LlvmInlineAsmOutput; constraint expr is_rw is_indirect); spanless_eq_struct!(Local; pat ty init id span attrs); spanless_eq_struct!(MacCall; path args prior_type_ascription); +spanless_eq_struct!(MacCallStmt; mac style attrs); spanless_eq_struct!(MacroDef; body macro_rules); spanless_eq_struct!(Mod; inner items inline); spanless_eq_struct!(MutTy; ty mutbl); spanless_eq_struct!(Param; attrs ty pat id span is_placeholder); spanless_eq_struct!(ParenthesizedArgs; span inputs output); -spanless_eq_struct!(Pat; id kind span); +spanless_eq_struct!(Pat; id kind span tokens); spanless_eq_struct!(Path; span segments); spanless_eq_struct!(PathSegment; ident id args); spanless_eq_struct!(PolyTraitRef; bound_generic_params trait_ref span); @@ -318,7 +312,7 @@ spanless_eq_enum!(AngleBracketedArg; Arg(0) Constraint(0)); spanless_eq_enum!(AssocItemKind; Const(0 1 2) Fn(0 1 2 3) TyAlias(0 1 2 3) MacCall(0)); spanless_eq_enum!(AssocTyConstraintKind; Equality(ty) Bound(bounds)); spanless_eq_enum!(Async; Yes(span closure_id return_impl_trait_id) No); -spanless_eq_enum!(AttrKind; Normal(0) DocComment(0)); +spanless_eq_enum!(AttrKind; Normal(0) DocComment(0 1)); spanless_eq_enum!(AttrStyle; Outer Inner); spanless_eq_enum!(BinOpKind; Add Sub Mul Div Rem And Or BitXor BitAnd BitOr Shl Shr Eq Lt Le Ne Ge Gt); spanless_eq_enum!(BindingMode; ByRef(0) ByValue(0)); @@ -425,44 +419,20 @@ impl SpanlessEq for TokenKind { impl SpanlessEq for TokenStream { fn eq(&self, other: &Self) -> bool { - SpanlessEq::eq(&expand_tts(self), &expand_tts(other)) - } -} - -fn expand_tts(tts: &TokenStream) -> Vec { - let mut tokens = Vec::new(); - for tt in tts.clone().into_trees() { - let c = match tt { - TokenTree::Token(Token { - kind: TokenKind::DocComment(c), - .. - }) => c, - _ => { - tokens.push(tt); - continue; + let mut this = self.clone().into_trees(); + let mut other = other.clone().into_trees(); + loop { + let this = match this.next() { + None => return other.next().is_none(), + Some(val) => val, + }; + let other = match other.next() { + None => return false, + Some(val) => val, + }; + if !SpanlessEq::eq(&this, &other) { + return false; } - }; - let contents = comments::strip_doc_comment_decoration(c); - let style = comments::doc_comment_style(c); - tokens.push(TokenTree::token(TokenKind::Pound, DUMMY_SP)); - if style == AttrStyle::Inner { - tokens.push(TokenTree::token(TokenKind::Not, DUMMY_SP)); } - let lit = token::Lit { - kind: token::LitKind::Str, - symbol: Symbol::intern(&contents), - suffix: None, - }; - let tts = vec![ - TokenTree::token(TokenKind::Ident(sym::doc, false), DUMMY_SP), - TokenTree::token(TokenKind::Eq, DUMMY_SP), - TokenTree::token(TokenKind::Literal(lit), DUMMY_SP), - ]; - tokens.push(TokenTree::Delimited( - DelimSpan::dummy(), - DelimToken::Bracket, - tts.into_iter().collect::().into(), - )); } - tokens } diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs index 20c5fdd3..1d3e1f0e 100644 --- a/tests/repo/mod.rs +++ b/tests/repo/mod.rs @@ -8,17 +8,20 @@ use std::path::Path; use tar::Archive; use walkdir::DirEntry; -const REVISION: &str = "81e754c359c471f91263813c46c67955071716a7"; +const REVISION: &str = "792c645ca7d11a8d254df307d019c5bf01445c37"; #[rustfmt::skip] static EXCLUDE: &[&str] = &[ + // Compile-fail expr parameter in const generic position: f::<1 + 2>() + "test/ui/const-generics/const-expression-parameter.rs", + // Deprecated anonymous parameter syntax in traits "test/ui/issues/issue-13105.rs", "test/ui/issues/issue-13775.rs", "test/ui/issues/issue-34074.rs", "test/ui/proc-macro/trait-fn-args-2015.rs", - // not actually test cases + // Not actually test cases "test/rustdoc-ui/test-compile-fail2.rs", "test/rustdoc-ui/test-compile-fail3.rs", "test/ui/include-single-expr-helper.rs", diff --git a/tests/test_derive_input.rs b/tests/test_derive_input.rs index fd31fe6b..bf1ebdb6 100644 --- a/tests/test_derive_input.rs +++ b/tests/test_derive_input.rs @@ -46,7 +46,7 @@ fn test_struct() { }, ], }, - tokens: TokenStream(`( Debug , Clone )`), + tokens: TokenStream(`(Debug , Clone)`), }, ], vis: Visibility::Public, @@ -378,7 +378,7 @@ fn test_attr_with_path() { }, ], }, - tokens: TokenStream(`fn main ( ) { assert_eq ! ( foo ( ) , "Hello, world!" ) ; }`), + tokens: TokenStream(`fn main () { assert_eq ! (foo () , "Hello, world!") ; }`), }, ], vis: Inherited, diff --git a/tests/test_generics.rs b/tests/test_generics.rs index adf1f557..b29434a1 100644 --- a/tests/test_generics.rs +++ b/tests/test_generics.rs @@ -265,7 +265,7 @@ fn test_fn_precedence_in_where_clause() { assert_eq!(predicate.bounds.len(), 2, "{:#?}", predicate.bounds); let first_bound = &predicate.bounds[0]; - assert_eq!(quote!(#first_bound).to_string(), "FnOnce ( ) -> i32"); + assert_eq!(quote!(#first_bound).to_string(), "FnOnce () -> i32"); let second_bound = &predicate.bounds[1]; assert_eq!(quote!(#second_bound).to_string(), "Send"); diff --git a/tests/test_grouping.rs b/tests/test_grouping.rs index c53ab346..a0fe7163 100644 --- a/tests/test_grouping.rs +++ b/tests/test_grouping.rs @@ -23,7 +23,7 @@ fn test_grouping() { TokenTree::Literal(Literal::i32_suffixed(4)), ]); - assert_eq!(tokens.to_string(), "1i32 + 2i32 + 3i32 * 4i32"); + assert_eq!(tokens.to_string(), "1i32 + 2i32 + 3i32 * 4i32"); snapshot!(tokens as Expr, @r###" Expr::Binary { diff --git a/tests/test_lit.rs b/tests/test_lit.rs index 0bd170c3..e995f228 100644 --- a/tests/test_lit.rs +++ b/tests/test_lit.rs @@ -191,6 +191,7 @@ fn floats() { test_float("5.5e12", 5.5e12, ""); test_float("1.0__3e-12", 1.03e-12, ""); test_float("1.03e+12", 1.03e12, ""); + test_float("9e99e99", 9e99, "e99"); } #[test] diff --git a/tests/test_precedence.rs b/tests/test_precedence.rs index dfdab3f4..a586b3fe 100644 --- a/tests/test_precedence.rs +++ b/tests/test_precedence.rs @@ -156,7 +156,7 @@ fn test_expressions(edition: Edition, exprs: Vec) -> (usize, usize) { let mut passed = 0; let mut failed = 0; - rustc_ast::with_session_globals(edition, || { + rustc_span::with_session_globals(edition, || { for expr in exprs { let raw = quote!(#expr).to_string(); diff --git a/tests/test_round_trip.rs b/tests/test_round_trip.rs index 99268a7c..260dd0c3 100644 --- a/tests/test_round_trip.rs +++ b/tests/test_round_trip.rs @@ -79,7 +79,7 @@ fn test_round_trip() { let edition = repo::edition(path).parse().unwrap(); let equal = panic::catch_unwind(|| { - rustc_ast::with_session_globals(edition, || { + rustc_span::with_session_globals(edition, || { let sess = ParseSess::new(FilePathMapping::empty()); let before = match librustc_parse(content, &sess) { Ok(before) => before, diff --git a/tests/test_shebang.rs b/tests/test_shebang.rs index e76e1803..dc26b9aa 100644 --- a/tests/test_shebang.rs +++ b/tests/test_shebang.rs @@ -40,7 +40,7 @@ fn test_comment() { }, ], }, - tokens: TokenStream(`( dead_code )`), + tokens: TokenStream(`(dead_code)`), }, ], items: [ diff --git a/tests/test_token_trees.rs b/tests/test_token_trees.rs index 4256382d..5b00448a 100644 --- a/tests/test_token_trees.rs +++ b/tests/test_token_trees.rs @@ -17,7 +17,7 @@ fn test_struct() { snapshot!(input as TokenStream, @r###" TokenStream( - `# [ derive ( Debug , Clone ) ] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`, + `# [derive (Debug , Clone)] pub struct Item { pub ident : Ident , pub attrs : Vec < Attribute >, }`, ) "###); } -- cgit v1.2.3