1fad3a1d3Sopenharmony_ci#![allow(unused_macro_rules)]
2fad3a1d3Sopenharmony_ci
3fad3a1d3Sopenharmony_ciextern crate rustc_ast;
4fad3a1d3Sopenharmony_ciextern crate rustc_data_structures;
5fad3a1d3Sopenharmony_ciextern crate rustc_driver;
6fad3a1d3Sopenharmony_ciextern crate rustc_span;
7fad3a1d3Sopenharmony_ciextern crate thin_vec;
8fad3a1d3Sopenharmony_ci
9fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AngleBracketedArg;
10fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AngleBracketedArgs;
11fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AnonConst;
12fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Arm;
13fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AssocConstraint;
14fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AssocConstraintKind;
15fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AssocItemKind;
16fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrArgs;
17fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrArgsEq;
18fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrId;
19fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrItem;
20fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrKind;
21fad3a1d3Sopenharmony_ciuse rustc_ast::ast::AttrStyle;
22fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Attribute;
23fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BareFnTy;
24fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BinOpKind;
25fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BindingAnnotation;
26fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Block;
27fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BlockCheckMode;
28fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BorrowKind;
29fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BoundConstness;
30fad3a1d3Sopenharmony_ciuse rustc_ast::ast::BoundPolarity;
31fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ByRef;
32fad3a1d3Sopenharmony_ciuse rustc_ast::ast::CaptureBy;
33fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Closure;
34fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ClosureBinder;
35fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Const;
36fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ConstItem;
37fad3a1d3Sopenharmony_ciuse rustc_ast::ast::CoroutineKind;
38fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Crate;
39fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Defaultness;
40fad3a1d3Sopenharmony_ciuse rustc_ast::ast::DelimArgs;
41fad3a1d3Sopenharmony_ciuse rustc_ast::ast::EnumDef;
42fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Expr;
43fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ExprField;
44fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ExprKind;
45fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Extern;
46fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FieldDef;
47fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FloatTy;
48fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Fn;
49fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FnDecl;
50fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FnHeader;
51fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FnRetTy;
52fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FnSig;
53fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ForLoopKind;
54fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ForeignItemKind;
55fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ForeignMod;
56fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatAlignment;
57fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgPosition;
58fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgPositionKind;
59fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgs;
60fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgsPiece;
61fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgument;
62fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArgumentKind;
63fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatArguments;
64fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatCount;
65fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatDebugHex;
66fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatOptions;
67fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatPlaceholder;
68fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatSign;
69fad3a1d3Sopenharmony_ciuse rustc_ast::ast::FormatTrait;
70fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenBlockKind;
71fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenericArg;
72fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenericArgs;
73fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenericBound;
74fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenericParam;
75fad3a1d3Sopenharmony_ciuse rustc_ast::ast::GenericParamKind;
76fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Generics;
77fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Impl;
78fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ImplPolarity;
79fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Inline;
80fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsm;
81fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsmOperand;
82fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsmOptions;
83fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsmRegOrRegClass;
84fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsmSym;
85fad3a1d3Sopenharmony_ciuse rustc_ast::ast::InlineAsmTemplatePiece;
86fad3a1d3Sopenharmony_ciuse rustc_ast::ast::IntTy;
87fad3a1d3Sopenharmony_ciuse rustc_ast::ast::IsAuto;
88fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Item;
89fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ItemKind;
90fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Label;
91fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Lifetime;
92fad3a1d3Sopenharmony_ciuse rustc_ast::ast::LitFloatType;
93fad3a1d3Sopenharmony_ciuse rustc_ast::ast::LitIntType;
94fad3a1d3Sopenharmony_ciuse rustc_ast::ast::LitKind;
95fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Local;
96fad3a1d3Sopenharmony_ciuse rustc_ast::ast::LocalKind;
97fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MacCall;
98fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MacCallStmt;
99fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MacStmtStyle;
100fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MacroDef;
101fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MetaItemLit;
102fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MethodCall;
103fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ModKind;
104fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ModSpans;
105fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Movability;
106fad3a1d3Sopenharmony_ciuse rustc_ast::ast::MutTy;
107fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Mutability;
108fad3a1d3Sopenharmony_ciuse rustc_ast::ast::NodeId;
109fad3a1d3Sopenharmony_ciuse rustc_ast::ast::NormalAttr;
110fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Param;
111fad3a1d3Sopenharmony_ciuse rustc_ast::ast::ParenthesizedArgs;
112fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Pat;
113fad3a1d3Sopenharmony_ciuse rustc_ast::ast::PatField;
114fad3a1d3Sopenharmony_ciuse rustc_ast::ast::PatFieldsRest;
115fad3a1d3Sopenharmony_ciuse rustc_ast::ast::PatKind;
116fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Path;
117fad3a1d3Sopenharmony_ciuse rustc_ast::ast::PathSegment;
118fad3a1d3Sopenharmony_ciuse rustc_ast::ast::PolyTraitRef;
119fad3a1d3Sopenharmony_ciuse rustc_ast::ast::QSelf;
120fad3a1d3Sopenharmony_ciuse rustc_ast::ast::RangeEnd;
121fad3a1d3Sopenharmony_ciuse rustc_ast::ast::RangeLimits;
122fad3a1d3Sopenharmony_ciuse rustc_ast::ast::RangeSyntax;
123fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StaticItem;
124fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Stmt;
125fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StmtKind;
126fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StrLit;
127fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StrStyle;
128fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StructExpr;
129fad3a1d3Sopenharmony_ciuse rustc_ast::ast::StructRest;
130fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Term;
131fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Trait;
132fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TraitBoundModifiers;
133fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TraitObjectSyntax;
134fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TraitRef;
135fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Ty;
136fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TyAlias;
137fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TyAliasWhereClause;
138fad3a1d3Sopenharmony_ciuse rustc_ast::ast::TyKind;
139fad3a1d3Sopenharmony_ciuse rustc_ast::ast::UintTy;
140fad3a1d3Sopenharmony_ciuse rustc_ast::ast::UnOp;
141fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Unsafe;
142fad3a1d3Sopenharmony_ciuse rustc_ast::ast::UnsafeSource;
143fad3a1d3Sopenharmony_ciuse rustc_ast::ast::UseTree;
144fad3a1d3Sopenharmony_ciuse rustc_ast::ast::UseTreeKind;
145fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Variant;
146fad3a1d3Sopenharmony_ciuse rustc_ast::ast::VariantData;
147fad3a1d3Sopenharmony_ciuse rustc_ast::ast::Visibility;
148fad3a1d3Sopenharmony_ciuse rustc_ast::ast::VisibilityKind;
149fad3a1d3Sopenharmony_ciuse rustc_ast::ast::WhereBoundPredicate;
150fad3a1d3Sopenharmony_ciuse rustc_ast::ast::WhereClause;
151fad3a1d3Sopenharmony_ciuse rustc_ast::ast::WhereEqPredicate;
152fad3a1d3Sopenharmony_ciuse rustc_ast::ast::WherePredicate;
153fad3a1d3Sopenharmony_ciuse rustc_ast::ast::WhereRegionPredicate;
154fad3a1d3Sopenharmony_ciuse rustc_ast::ptr::P;
155fad3a1d3Sopenharmony_ciuse rustc_ast::token::{self, CommentKind, Delimiter, Lit, Nonterminal, Token, TokenKind};
156fad3a1d3Sopenharmony_ciuse rustc_ast::tokenstream::{
157fad3a1d3Sopenharmony_ci    AttrTokenStream, AttrTokenTree, AttributesData, DelimSpacing, DelimSpan, LazyAttrTokenStream,
158fad3a1d3Sopenharmony_ci    Spacing, TokenStream, TokenTree,
159fad3a1d3Sopenharmony_ci};
160fad3a1d3Sopenharmony_ciuse rustc_data_structures::sync::Lrc;
161fad3a1d3Sopenharmony_ciuse rustc_span::source_map::Spanned;
162fad3a1d3Sopenharmony_ciuse rustc_span::symbol::{sym, Ident};
163fad3a1d3Sopenharmony_ciuse rustc_span::{ErrorGuaranteed, Span, Symbol, SyntaxContext, DUMMY_SP};
164fad3a1d3Sopenharmony_ciuse std::collections::HashMap;
165fad3a1d3Sopenharmony_ciuse std::hash::{BuildHasher, Hash};
166fad3a1d3Sopenharmony_ciuse thin_vec::ThinVec;
167fad3a1d3Sopenharmony_ci
168fad3a1d3Sopenharmony_cipub trait SpanlessEq {
169fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool;
170fad3a1d3Sopenharmony_ci}
171fad3a1d3Sopenharmony_ci
172fad3a1d3Sopenharmony_ciimpl<T: ?Sized + SpanlessEq> SpanlessEq for Box<T> {
173fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
174fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&**self, &**other)
175fad3a1d3Sopenharmony_ci    }
176fad3a1d3Sopenharmony_ci}
177fad3a1d3Sopenharmony_ci
178fad3a1d3Sopenharmony_ciimpl<T: ?Sized + SpanlessEq> SpanlessEq for P<T> {
179fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
180fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&**self, &**other)
181fad3a1d3Sopenharmony_ci    }
182fad3a1d3Sopenharmony_ci}
183fad3a1d3Sopenharmony_ci
184fad3a1d3Sopenharmony_ciimpl<T: ?Sized + SpanlessEq> SpanlessEq for Lrc<T> {
185fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
186fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&**self, &**other)
187fad3a1d3Sopenharmony_ci    }
188fad3a1d3Sopenharmony_ci}
189fad3a1d3Sopenharmony_ci
190fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq> SpanlessEq for Option<T> {
191fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
192fad3a1d3Sopenharmony_ci        match (self, other) {
193fad3a1d3Sopenharmony_ci            (None, None) => true,
194fad3a1d3Sopenharmony_ci            (Some(this), Some(other)) => SpanlessEq::eq(this, other),
195fad3a1d3Sopenharmony_ci            _ => false,
196fad3a1d3Sopenharmony_ci        }
197fad3a1d3Sopenharmony_ci    }
198fad3a1d3Sopenharmony_ci}
199fad3a1d3Sopenharmony_ci
200fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq, E: SpanlessEq> SpanlessEq for Result<T, E> {
201fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
202fad3a1d3Sopenharmony_ci        match (self, other) {
203fad3a1d3Sopenharmony_ci            (Ok(this), Ok(other)) => SpanlessEq::eq(this, other),
204fad3a1d3Sopenharmony_ci            (Err(this), Err(other)) => SpanlessEq::eq(this, other),
205fad3a1d3Sopenharmony_ci            _ => false,
206fad3a1d3Sopenharmony_ci        }
207fad3a1d3Sopenharmony_ci    }
208fad3a1d3Sopenharmony_ci}
209fad3a1d3Sopenharmony_ci
210fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq> SpanlessEq for [T] {
211fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
212fad3a1d3Sopenharmony_ci        self.len() == other.len() && self.iter().zip(other).all(|(a, b)| SpanlessEq::eq(a, b))
213fad3a1d3Sopenharmony_ci    }
214fad3a1d3Sopenharmony_ci}
215fad3a1d3Sopenharmony_ci
216fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq> SpanlessEq for Vec<T> {
217fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
218fad3a1d3Sopenharmony_ci        <[T] as SpanlessEq>::eq(self, other)
219fad3a1d3Sopenharmony_ci    }
220fad3a1d3Sopenharmony_ci}
221fad3a1d3Sopenharmony_ci
222fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq> SpanlessEq for ThinVec<T> {
223fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
224fad3a1d3Sopenharmony_ci        self.len() == other.len()
225fad3a1d3Sopenharmony_ci            && self
226fad3a1d3Sopenharmony_ci                .iter()
227fad3a1d3Sopenharmony_ci                .zip(other.iter())
228fad3a1d3Sopenharmony_ci                .all(|(a, b)| SpanlessEq::eq(a, b))
229fad3a1d3Sopenharmony_ci    }
230fad3a1d3Sopenharmony_ci}
231fad3a1d3Sopenharmony_ci
232fad3a1d3Sopenharmony_ciimpl<K: Eq + Hash, V: SpanlessEq, S: BuildHasher> SpanlessEq for HashMap<K, V, S> {
233fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
234fad3a1d3Sopenharmony_ci        self.len() == other.len()
235fad3a1d3Sopenharmony_ci            && self.iter().all(|(key, this_v)| {
236fad3a1d3Sopenharmony_ci                other
237fad3a1d3Sopenharmony_ci                    .get(key)
238fad3a1d3Sopenharmony_ci                    .map_or(false, |other_v| SpanlessEq::eq(this_v, other_v))
239fad3a1d3Sopenharmony_ci            })
240fad3a1d3Sopenharmony_ci    }
241fad3a1d3Sopenharmony_ci}
242fad3a1d3Sopenharmony_ci
243fad3a1d3Sopenharmony_ciimpl<T: SpanlessEq> SpanlessEq for Spanned<T> {
244fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
245fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&self.node, &other.node)
246fad3a1d3Sopenharmony_ci    }
247fad3a1d3Sopenharmony_ci}
248fad3a1d3Sopenharmony_ci
249fad3a1d3Sopenharmony_ciimpl<A: SpanlessEq, B: SpanlessEq> SpanlessEq for (A, B) {
250fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
251fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&self.0, &other.0) && SpanlessEq::eq(&self.1, &other.1)
252fad3a1d3Sopenharmony_ci    }
253fad3a1d3Sopenharmony_ci}
254fad3a1d3Sopenharmony_ci
255fad3a1d3Sopenharmony_ciimpl<A: SpanlessEq, B: SpanlessEq, C: SpanlessEq> SpanlessEq for (A, B, C) {
256fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
257fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&self.0, &other.0)
258fad3a1d3Sopenharmony_ci            && SpanlessEq::eq(&self.1, &other.1)
259fad3a1d3Sopenharmony_ci            && SpanlessEq::eq(&self.2, &other.2)
260fad3a1d3Sopenharmony_ci    }
261fad3a1d3Sopenharmony_ci}
262fad3a1d3Sopenharmony_ci
263fad3a1d3Sopenharmony_cimacro_rules! spanless_eq_true {
264fad3a1d3Sopenharmony_ci    ($name:ty) => {
265fad3a1d3Sopenharmony_ci        impl SpanlessEq for $name {
266fad3a1d3Sopenharmony_ci            fn eq(&self, _other: &Self) -> bool {
267fad3a1d3Sopenharmony_ci                true
268fad3a1d3Sopenharmony_ci            }
269fad3a1d3Sopenharmony_ci        }
270fad3a1d3Sopenharmony_ci    };
271fad3a1d3Sopenharmony_ci}
272fad3a1d3Sopenharmony_ci
273fad3a1d3Sopenharmony_cispanless_eq_true!(Span);
274fad3a1d3Sopenharmony_cispanless_eq_true!(DelimSpan);
275fad3a1d3Sopenharmony_cispanless_eq_true!(AttrId);
276fad3a1d3Sopenharmony_cispanless_eq_true!(NodeId);
277fad3a1d3Sopenharmony_cispanless_eq_true!(SyntaxContext);
278fad3a1d3Sopenharmony_cispanless_eq_true!(Spacing);
279fad3a1d3Sopenharmony_ci
280fad3a1d3Sopenharmony_cimacro_rules! spanless_eq_partial_eq {
281fad3a1d3Sopenharmony_ci    ($name:ty) => {
282fad3a1d3Sopenharmony_ci        impl SpanlessEq for $name {
283fad3a1d3Sopenharmony_ci            fn eq(&self, other: &Self) -> bool {
284fad3a1d3Sopenharmony_ci                PartialEq::eq(self, other)
285fad3a1d3Sopenharmony_ci            }
286fad3a1d3Sopenharmony_ci        }
287fad3a1d3Sopenharmony_ci    };
288fad3a1d3Sopenharmony_ci}
289fad3a1d3Sopenharmony_ci
290fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(bool);
291fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(u8);
292fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(u16);
293fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(u32);
294fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(u128);
295fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(usize);
296fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(char);
297fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(String);
298fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(Symbol);
299fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(CommentKind);
300fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(Delimiter);
301fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(InlineAsmOptions);
302fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(token::LitKind);
303fad3a1d3Sopenharmony_cispanless_eq_partial_eq!(ErrorGuaranteed);
304fad3a1d3Sopenharmony_ci
305fad3a1d3Sopenharmony_cimacro_rules! spanless_eq_struct {
306fad3a1d3Sopenharmony_ci    {
307fad3a1d3Sopenharmony_ci        $($name:ident)::+ $(<$param:ident>)?
308fad3a1d3Sopenharmony_ci        $([$field:tt $this:ident $other:ident])*
309fad3a1d3Sopenharmony_ci        $(![$ignore:tt])*;
310fad3a1d3Sopenharmony_ci    } => {
311fad3a1d3Sopenharmony_ci        impl $(<$param: SpanlessEq>)* SpanlessEq for $($name)::+ $(<$param>)* {
312fad3a1d3Sopenharmony_ci            fn eq(&self, other: &Self) -> bool {
313fad3a1d3Sopenharmony_ci                let $($name)::+ { $($field: $this,)* $($ignore: _,)* } = self;
314fad3a1d3Sopenharmony_ci                let $($name)::+ { $($field: $other,)* $($ignore: _,)* } = other;
315fad3a1d3Sopenharmony_ci                true $(&& SpanlessEq::eq($this, $other))*
316fad3a1d3Sopenharmony_ci            }
317fad3a1d3Sopenharmony_ci        }
318fad3a1d3Sopenharmony_ci    };
319fad3a1d3Sopenharmony_ci
320fad3a1d3Sopenharmony_ci    {
321fad3a1d3Sopenharmony_ci        $($name:ident)::+ $(<$param:ident>)?
322fad3a1d3Sopenharmony_ci        $([$field:tt $this:ident $other:ident])*
323fad3a1d3Sopenharmony_ci        $(![$ignore:tt])*;
324fad3a1d3Sopenharmony_ci        !$next:tt
325fad3a1d3Sopenharmony_ci        $($rest:tt)*
326fad3a1d3Sopenharmony_ci    } => {
327fad3a1d3Sopenharmony_ci        spanless_eq_struct! {
328fad3a1d3Sopenharmony_ci            $($name)::+ $(<$param>)*
329fad3a1d3Sopenharmony_ci            $([$field $this $other])*
330fad3a1d3Sopenharmony_ci            $(![$ignore])*
331fad3a1d3Sopenharmony_ci            ![$next];
332fad3a1d3Sopenharmony_ci            $($rest)*
333fad3a1d3Sopenharmony_ci        }
334fad3a1d3Sopenharmony_ci    };
335fad3a1d3Sopenharmony_ci
336fad3a1d3Sopenharmony_ci    {
337fad3a1d3Sopenharmony_ci        $($name:ident)::+ $(<$param:ident>)?
338fad3a1d3Sopenharmony_ci        $([$field:tt $this:ident $other:ident])*
339fad3a1d3Sopenharmony_ci        $(![$ignore:tt])*;
340fad3a1d3Sopenharmony_ci        $next:tt
341fad3a1d3Sopenharmony_ci        $($rest:tt)*
342fad3a1d3Sopenharmony_ci    } => {
343fad3a1d3Sopenharmony_ci        spanless_eq_struct! {
344fad3a1d3Sopenharmony_ci            $($name)::+ $(<$param>)*
345fad3a1d3Sopenharmony_ci            $([$field $this $other])*
346fad3a1d3Sopenharmony_ci            [$next this other]
347fad3a1d3Sopenharmony_ci            $(![$ignore])*;
348fad3a1d3Sopenharmony_ci            $($rest)*
349fad3a1d3Sopenharmony_ci        }
350fad3a1d3Sopenharmony_ci    };
351fad3a1d3Sopenharmony_ci}
352fad3a1d3Sopenharmony_ci
353fad3a1d3Sopenharmony_cimacro_rules! spanless_eq_enum {
354fad3a1d3Sopenharmony_ci    {
355fad3a1d3Sopenharmony_ci        $($name:ident)::+;
356fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $([$field:tt $this:ident $other:ident])* $(![$ignore:tt])*])*
357fad3a1d3Sopenharmony_ci    } => {
358fad3a1d3Sopenharmony_ci        impl SpanlessEq for $($name)::+ {
359fad3a1d3Sopenharmony_ci            fn eq(&self, other: &Self) -> bool {
360fad3a1d3Sopenharmony_ci                match self {
361fad3a1d3Sopenharmony_ci                    $(
362fad3a1d3Sopenharmony_ci                        $($variant)::+ { .. } => {}
363fad3a1d3Sopenharmony_ci                    )*
364fad3a1d3Sopenharmony_ci                }
365fad3a1d3Sopenharmony_ci                #[allow(unreachable_patterns)]
366fad3a1d3Sopenharmony_ci                match (self, other) {
367fad3a1d3Sopenharmony_ci                    $(
368fad3a1d3Sopenharmony_ci                        (
369fad3a1d3Sopenharmony_ci                            $($variant)::+ { $($field: $this,)* $($ignore: _,)* },
370fad3a1d3Sopenharmony_ci                            $($variant)::+ { $($field: $other,)* $($ignore: _,)* },
371fad3a1d3Sopenharmony_ci                        ) => {
372fad3a1d3Sopenharmony_ci                            true $(&& SpanlessEq::eq($this, $other))*
373fad3a1d3Sopenharmony_ci                        }
374fad3a1d3Sopenharmony_ci                    )*
375fad3a1d3Sopenharmony_ci                    _ => false,
376fad3a1d3Sopenharmony_ci                }
377fad3a1d3Sopenharmony_ci            }
378fad3a1d3Sopenharmony_ci        }
379fad3a1d3Sopenharmony_ci    };
380fad3a1d3Sopenharmony_ci
381fad3a1d3Sopenharmony_ci    {
382fad3a1d3Sopenharmony_ci        $($name:ident)::+;
383fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $($fields:tt)*])*
384fad3a1d3Sopenharmony_ci        $next:ident [$([$($named:tt)*])* $(![$ignore:tt])*] (!$i:tt $($field:tt)*)
385fad3a1d3Sopenharmony_ci        $($rest:tt)*
386fad3a1d3Sopenharmony_ci    } => {
387fad3a1d3Sopenharmony_ci        spanless_eq_enum! {
388fad3a1d3Sopenharmony_ci            $($name)::+;
389fad3a1d3Sopenharmony_ci            $([$($variant)::+; $($fields)*])*
390fad3a1d3Sopenharmony_ci            $next [$([$($named)*])* $(![$ignore])* ![$i]] ($($field)*)
391fad3a1d3Sopenharmony_ci            $($rest)*
392fad3a1d3Sopenharmony_ci        }
393fad3a1d3Sopenharmony_ci    };
394fad3a1d3Sopenharmony_ci
395fad3a1d3Sopenharmony_ci    {
396fad3a1d3Sopenharmony_ci        $($name:ident)::+;
397fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $($fields:tt)*])*
398fad3a1d3Sopenharmony_ci        $next:ident [$([$($named:tt)*])* $(![$ignore:tt])*] ($i:tt $($field:tt)*)
399fad3a1d3Sopenharmony_ci        $($rest:tt)*
400fad3a1d3Sopenharmony_ci    } => {
401fad3a1d3Sopenharmony_ci        spanless_eq_enum! {
402fad3a1d3Sopenharmony_ci            $($name)::+;
403fad3a1d3Sopenharmony_ci            $([$($variant)::+; $($fields)*])*
404fad3a1d3Sopenharmony_ci            $next [$([$($named)*])* [$i this other] $(![$ignore])*] ($($field)*)
405fad3a1d3Sopenharmony_ci            $($rest)*
406fad3a1d3Sopenharmony_ci        }
407fad3a1d3Sopenharmony_ci    };
408fad3a1d3Sopenharmony_ci
409fad3a1d3Sopenharmony_ci    {
410fad3a1d3Sopenharmony_ci        $($name:ident)::+;
411fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $($fields:tt)*])*
412fad3a1d3Sopenharmony_ci        $next:ident [$($named:tt)*] ()
413fad3a1d3Sopenharmony_ci        $($rest:tt)*
414fad3a1d3Sopenharmony_ci    } => {
415fad3a1d3Sopenharmony_ci        spanless_eq_enum! {
416fad3a1d3Sopenharmony_ci            $($name)::+;
417fad3a1d3Sopenharmony_ci            $([$($variant)::+; $($fields)*])*
418fad3a1d3Sopenharmony_ci            [$($name)::+::$next; $($named)*]
419fad3a1d3Sopenharmony_ci            $($rest)*
420fad3a1d3Sopenharmony_ci        }
421fad3a1d3Sopenharmony_ci    };
422fad3a1d3Sopenharmony_ci
423fad3a1d3Sopenharmony_ci    {
424fad3a1d3Sopenharmony_ci        $($name:ident)::+;
425fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $($fields:tt)*])*
426fad3a1d3Sopenharmony_ci        $next:ident ($($field:tt)*)
427fad3a1d3Sopenharmony_ci        $($rest:tt)*
428fad3a1d3Sopenharmony_ci    } => {
429fad3a1d3Sopenharmony_ci        spanless_eq_enum! {
430fad3a1d3Sopenharmony_ci            $($name)::+;
431fad3a1d3Sopenharmony_ci            $([$($variant)::+; $($fields)*])*
432fad3a1d3Sopenharmony_ci            $next [] ($($field)*)
433fad3a1d3Sopenharmony_ci            $($rest)*
434fad3a1d3Sopenharmony_ci        }
435fad3a1d3Sopenharmony_ci    };
436fad3a1d3Sopenharmony_ci
437fad3a1d3Sopenharmony_ci    {
438fad3a1d3Sopenharmony_ci        $($name:ident)::+;
439fad3a1d3Sopenharmony_ci        $([$($variant:ident)::+; $($fields:tt)*])*
440fad3a1d3Sopenharmony_ci        $next:ident
441fad3a1d3Sopenharmony_ci        $($rest:tt)*
442fad3a1d3Sopenharmony_ci    } => {
443fad3a1d3Sopenharmony_ci        spanless_eq_enum! {
444fad3a1d3Sopenharmony_ci            $($name)::+;
445fad3a1d3Sopenharmony_ci            $([$($variant)::+; $($fields)*])*
446fad3a1d3Sopenharmony_ci            [$($name)::+::$next;]
447fad3a1d3Sopenharmony_ci            $($rest)*
448fad3a1d3Sopenharmony_ci        }
449fad3a1d3Sopenharmony_ci    };
450fad3a1d3Sopenharmony_ci}
451fad3a1d3Sopenharmony_ci
452fad3a1d3Sopenharmony_cispanless_eq_struct!(AngleBracketedArgs; span args);
453fad3a1d3Sopenharmony_cispanless_eq_struct!(AnonConst; id value);
454fad3a1d3Sopenharmony_cispanless_eq_struct!(Arm; attrs pat guard body span id is_placeholder);
455fad3a1d3Sopenharmony_cispanless_eq_struct!(AssocConstraint; id ident gen_args kind span);
456fad3a1d3Sopenharmony_cispanless_eq_struct!(AttrItem; path args tokens);
457fad3a1d3Sopenharmony_cispanless_eq_struct!(AttrTokenStream; 0);
458fad3a1d3Sopenharmony_cispanless_eq_struct!(Attribute; kind id style span);
459fad3a1d3Sopenharmony_cispanless_eq_struct!(AttributesData; attrs tokens);
460fad3a1d3Sopenharmony_cispanless_eq_struct!(BareFnTy; unsafety ext generic_params decl decl_span);
461fad3a1d3Sopenharmony_cispanless_eq_struct!(BindingAnnotation; 0 1);
462fad3a1d3Sopenharmony_cispanless_eq_struct!(Block; stmts id rules span tokens could_be_bare_literal);
463fad3a1d3Sopenharmony_cispanless_eq_struct!(Closure; binder capture_clause constness coroutine_kind movability fn_decl body !fn_decl_span !fn_arg_span);
464fad3a1d3Sopenharmony_cispanless_eq_struct!(ConstItem; defaultness generics ty expr);
465fad3a1d3Sopenharmony_cispanless_eq_struct!(Crate; attrs items spans id is_placeholder);
466fad3a1d3Sopenharmony_cispanless_eq_struct!(DelimArgs; dspan delim tokens);
467fad3a1d3Sopenharmony_cispanless_eq_struct!(DelimSpacing; open close);
468fad3a1d3Sopenharmony_cispanless_eq_struct!(EnumDef; variants);
469fad3a1d3Sopenharmony_cispanless_eq_struct!(Expr; id kind span attrs !tokens);
470fad3a1d3Sopenharmony_cispanless_eq_struct!(ExprField; attrs id span ident expr is_shorthand is_placeholder);
471fad3a1d3Sopenharmony_cispanless_eq_struct!(FieldDef; attrs id span vis ident ty is_placeholder);
472fad3a1d3Sopenharmony_cispanless_eq_struct!(Fn; defaultness generics sig body);
473fad3a1d3Sopenharmony_cispanless_eq_struct!(FnDecl; inputs output);
474fad3a1d3Sopenharmony_cispanless_eq_struct!(FnHeader; constness coroutine_kind unsafety ext);
475fad3a1d3Sopenharmony_cispanless_eq_struct!(FnSig; header decl span);
476fad3a1d3Sopenharmony_cispanless_eq_struct!(ForeignMod; unsafety abi items);
477fad3a1d3Sopenharmony_cispanless_eq_struct!(FormatArgPosition; index kind span);
478fad3a1d3Sopenharmony_cispanless_eq_struct!(FormatArgs; span template arguments);
479fad3a1d3Sopenharmony_cispanless_eq_struct!(FormatArgument; kind expr);
480fad3a1d3Sopenharmony_cispanless_eq_struct!(FormatOptions; width precision alignment fill sign alternate zero_pad debug_hex);
481fad3a1d3Sopenharmony_cispanless_eq_struct!(FormatPlaceholder; argument span format_trait format_options);
482fad3a1d3Sopenharmony_cispanless_eq_struct!(GenericParam; id ident attrs bounds is_placeholder kind !colon_span);
483fad3a1d3Sopenharmony_cispanless_eq_struct!(Generics; params where_clause span);
484fad3a1d3Sopenharmony_cispanless_eq_struct!(Impl; defaultness unsafety generics constness polarity of_trait self_ty items);
485fad3a1d3Sopenharmony_cispanless_eq_struct!(InlineAsm; template template_strs operands clobber_abis options line_spans);
486fad3a1d3Sopenharmony_cispanless_eq_struct!(InlineAsmSym; id qself path);
487fad3a1d3Sopenharmony_cispanless_eq_struct!(Item<K>; attrs id span vis ident kind !tokens);
488fad3a1d3Sopenharmony_cispanless_eq_struct!(Label; ident);
489fad3a1d3Sopenharmony_cispanless_eq_struct!(Lifetime; id ident);
490fad3a1d3Sopenharmony_cispanless_eq_struct!(Lit; kind symbol suffix);
491fad3a1d3Sopenharmony_cispanless_eq_struct!(Local; pat ty kind id span attrs !tokens);
492fad3a1d3Sopenharmony_cispanless_eq_struct!(MacCall; path args);
493fad3a1d3Sopenharmony_cispanless_eq_struct!(MacCallStmt; mac style attrs tokens);
494fad3a1d3Sopenharmony_cispanless_eq_struct!(MacroDef; body macro_rules);
495fad3a1d3Sopenharmony_cispanless_eq_struct!(MetaItemLit; symbol suffix kind span);
496fad3a1d3Sopenharmony_cispanless_eq_struct!(MethodCall; seg receiver args !span);
497fad3a1d3Sopenharmony_cispanless_eq_struct!(ModSpans; !inner_span !inject_use_span);
498fad3a1d3Sopenharmony_cispanless_eq_struct!(MutTy; ty mutbl);
499fad3a1d3Sopenharmony_cispanless_eq_struct!(NormalAttr; item tokens);
500fad3a1d3Sopenharmony_cispanless_eq_struct!(ParenthesizedArgs; span inputs inputs_span output);
501fad3a1d3Sopenharmony_cispanless_eq_struct!(Pat; id kind span tokens);
502fad3a1d3Sopenharmony_cispanless_eq_struct!(PatField; ident pat is_shorthand attrs id span is_placeholder);
503fad3a1d3Sopenharmony_cispanless_eq_struct!(Path; span segments tokens);
504fad3a1d3Sopenharmony_cispanless_eq_struct!(PathSegment; ident id args);
505fad3a1d3Sopenharmony_cispanless_eq_struct!(PolyTraitRef; bound_generic_params trait_ref span);
506fad3a1d3Sopenharmony_cispanless_eq_struct!(QSelf; ty path_span position);
507fad3a1d3Sopenharmony_cispanless_eq_struct!(StaticItem; ty mutability expr);
508fad3a1d3Sopenharmony_cispanless_eq_struct!(Stmt; id kind span);
509fad3a1d3Sopenharmony_cispanless_eq_struct!(StrLit; symbol suffix symbol_unescaped style span);
510fad3a1d3Sopenharmony_cispanless_eq_struct!(StructExpr; qself path fields rest);
511fad3a1d3Sopenharmony_cispanless_eq_struct!(Token; kind span);
512fad3a1d3Sopenharmony_cispanless_eq_struct!(Trait; unsafety is_auto generics bounds items);
513fad3a1d3Sopenharmony_cispanless_eq_struct!(TraitBoundModifiers; constness polarity);
514fad3a1d3Sopenharmony_cispanless_eq_struct!(TraitRef; path ref_id);
515fad3a1d3Sopenharmony_cispanless_eq_struct!(Ty; id kind span tokens);
516fad3a1d3Sopenharmony_cispanless_eq_struct!(TyAlias; defaultness generics where_clauses !where_predicates_split bounds ty);
517fad3a1d3Sopenharmony_cispanless_eq_struct!(TyAliasWhereClause; !0 1);
518fad3a1d3Sopenharmony_cispanless_eq_struct!(UseTree; prefix kind span);
519fad3a1d3Sopenharmony_cispanless_eq_struct!(Variant; attrs id span !vis ident data disr_expr is_placeholder);
520fad3a1d3Sopenharmony_cispanless_eq_struct!(Visibility; kind span tokens);
521fad3a1d3Sopenharmony_cispanless_eq_struct!(WhereBoundPredicate; span bound_generic_params bounded_ty bounds);
522fad3a1d3Sopenharmony_cispanless_eq_struct!(WhereClause; has_where_token predicates span);
523fad3a1d3Sopenharmony_cispanless_eq_struct!(WhereEqPredicate; span lhs_ty rhs_ty);
524fad3a1d3Sopenharmony_cispanless_eq_struct!(WhereRegionPredicate; span lifetime bounds);
525fad3a1d3Sopenharmony_cispanless_eq_enum!(AngleBracketedArg; Arg(0) Constraint(0));
526fad3a1d3Sopenharmony_cispanless_eq_enum!(AssocConstraintKind; Equality(term) Bound(bounds));
527fad3a1d3Sopenharmony_cispanless_eq_enum!(AssocItemKind; Const(0) Fn(0) Type(0) MacCall(0));
528fad3a1d3Sopenharmony_cispanless_eq_enum!(AttrArgs; Empty Delimited(0) Eq(0 1));
529fad3a1d3Sopenharmony_cispanless_eq_enum!(AttrArgsEq; Ast(0) Hir(0));
530fad3a1d3Sopenharmony_cispanless_eq_enum!(AttrStyle; Outer Inner);
531fad3a1d3Sopenharmony_cispanless_eq_enum!(AttrTokenTree; Token(0 1) Delimited(0 1 2 3) Attributes(0));
532fad3a1d3Sopenharmony_cispanless_eq_enum!(BinOpKind; Add Sub Mul Div Rem And Or BitXor BitAnd BitOr Shl Shr Eq Lt Le Ne Ge Gt);
533fad3a1d3Sopenharmony_cispanless_eq_enum!(BlockCheckMode; Default Unsafe(0));
534fad3a1d3Sopenharmony_cispanless_eq_enum!(BorrowKind; Ref Raw);
535fad3a1d3Sopenharmony_cispanless_eq_enum!(BoundConstness; Never Always(0) Maybe(0));
536fad3a1d3Sopenharmony_cispanless_eq_enum!(BoundPolarity; Positive Negative(0) Maybe(0));
537fad3a1d3Sopenharmony_cispanless_eq_enum!(ByRef; Yes No);
538fad3a1d3Sopenharmony_cispanless_eq_enum!(CaptureBy; Value(move_kw) Ref);
539fad3a1d3Sopenharmony_cispanless_eq_enum!(ClosureBinder; NotPresent For(span generic_params));
540fad3a1d3Sopenharmony_cispanless_eq_enum!(Const; Yes(0) No);
541fad3a1d3Sopenharmony_cispanless_eq_enum!(Defaultness; Default(0) Final);
542fad3a1d3Sopenharmony_cispanless_eq_enum!(Extern; None Implicit(0) Explicit(0 1));
543fad3a1d3Sopenharmony_cispanless_eq_enum!(FloatTy; F32 F64);
544fad3a1d3Sopenharmony_cispanless_eq_enum!(FnRetTy; Default(0) Ty(0));
545fad3a1d3Sopenharmony_cispanless_eq_enum!(ForLoopKind; For ForAwait);
546fad3a1d3Sopenharmony_cispanless_eq_enum!(ForeignItemKind; Static(0 1 2) Fn(0) TyAlias(0) MacCall(0));
547fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatAlignment; Left Right Center);
548fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatArgPositionKind; Implicit Number Named);
549fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatArgsPiece; Literal(0) Placeholder(0));
550fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatArgumentKind; Normal Named(0) Captured(0));
551fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatCount; Literal(0) Argument(0));
552fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatDebugHex; Lower Upper);
553fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatSign; Plus Minus);
554fad3a1d3Sopenharmony_cispanless_eq_enum!(FormatTrait; Display Debug LowerExp UpperExp Octal Pointer Binary LowerHex UpperHex);
555fad3a1d3Sopenharmony_cispanless_eq_enum!(GenBlockKind; Async Gen AsyncGen);
556fad3a1d3Sopenharmony_cispanless_eq_enum!(GenericArg; Lifetime(0) Type(0) Const(0));
557fad3a1d3Sopenharmony_cispanless_eq_enum!(GenericArgs; AngleBracketed(0) Parenthesized(0));
558fad3a1d3Sopenharmony_cispanless_eq_enum!(GenericBound; Trait(0 1) Outlives(0));
559fad3a1d3Sopenharmony_cispanless_eq_enum!(GenericParamKind; Lifetime Type(default) Const(ty kw_span default));
560fad3a1d3Sopenharmony_cispanless_eq_enum!(ImplPolarity; Positive Negative(0));
561fad3a1d3Sopenharmony_cispanless_eq_enum!(Inline; Yes No);
562fad3a1d3Sopenharmony_cispanless_eq_enum!(InlineAsmRegOrRegClass; Reg(0) RegClass(0));
563fad3a1d3Sopenharmony_cispanless_eq_enum!(InlineAsmTemplatePiece; String(0) Placeholder(operand_idx modifier span));
564fad3a1d3Sopenharmony_cispanless_eq_enum!(IntTy; Isize I8 I16 I32 I64 I128);
565fad3a1d3Sopenharmony_cispanless_eq_enum!(IsAuto; Yes No);
566fad3a1d3Sopenharmony_cispanless_eq_enum!(LitFloatType; Suffixed(0) Unsuffixed);
567fad3a1d3Sopenharmony_cispanless_eq_enum!(LitIntType; Signed(0) Unsigned(0) Unsuffixed);
568fad3a1d3Sopenharmony_cispanless_eq_enum!(LocalKind; Decl Init(0) InitElse(0 1));
569fad3a1d3Sopenharmony_cispanless_eq_enum!(MacStmtStyle; Semicolon Braces NoBraces);
570fad3a1d3Sopenharmony_cispanless_eq_enum!(ModKind; Loaded(0 1 2) Unloaded);
571fad3a1d3Sopenharmony_cispanless_eq_enum!(Movability; Static Movable);
572fad3a1d3Sopenharmony_cispanless_eq_enum!(Mutability; Mut Not);
573fad3a1d3Sopenharmony_cispanless_eq_enum!(PatFieldsRest; Rest None);
574fad3a1d3Sopenharmony_cispanless_eq_enum!(RangeEnd; Included(0) Excluded);
575fad3a1d3Sopenharmony_cispanless_eq_enum!(RangeLimits; HalfOpen Closed);
576fad3a1d3Sopenharmony_cispanless_eq_enum!(StmtKind; Local(0) Item(0) Expr(0) Semi(0) Empty MacCall(0));
577fad3a1d3Sopenharmony_cispanless_eq_enum!(StrStyle; Cooked Raw(0));
578fad3a1d3Sopenharmony_cispanless_eq_enum!(StructRest; Base(0) Rest(0) None);
579fad3a1d3Sopenharmony_cispanless_eq_enum!(Term; Ty(0) Const(0));
580fad3a1d3Sopenharmony_cispanless_eq_enum!(TokenTree; Token(0 1) Delimited(0 1 2 3));
581fad3a1d3Sopenharmony_cispanless_eq_enum!(TraitObjectSyntax; Dyn DynStar None);
582fad3a1d3Sopenharmony_cispanless_eq_enum!(UintTy; Usize U8 U16 U32 U64 U128);
583fad3a1d3Sopenharmony_cispanless_eq_enum!(UnOp; Deref Not Neg);
584fad3a1d3Sopenharmony_cispanless_eq_enum!(Unsafe; Yes(0) No);
585fad3a1d3Sopenharmony_cispanless_eq_enum!(UnsafeSource; CompilerGenerated UserProvided);
586fad3a1d3Sopenharmony_cispanless_eq_enum!(UseTreeKind; Simple(0) Nested(0) Glob);
587fad3a1d3Sopenharmony_cispanless_eq_enum!(VariantData; Struct(fields recovered) Tuple(0 1) Unit(0));
588fad3a1d3Sopenharmony_cispanless_eq_enum!(VisibilityKind; Public Restricted(path id shorthand) Inherited);
589fad3a1d3Sopenharmony_cispanless_eq_enum!(WherePredicate; BoundPredicate(0) RegionPredicate(0) EqPredicate(0));
590fad3a1d3Sopenharmony_cispanless_eq_enum!(CoroutineKind; Async(span closure_id return_impl_trait_id)
591fad3a1d3Sopenharmony_ci    Gen(span closure_id return_impl_trait_id)
592fad3a1d3Sopenharmony_ci    AsyncGen(span closure_id return_impl_trait_id));
593fad3a1d3Sopenharmony_cispanless_eq_enum!(ExprKind; Array(0) ConstBlock(0) Call(0 1) MethodCall(0)
594fad3a1d3Sopenharmony_ci    Tup(0) Binary(0 1 2) Unary(0 1) Lit(0) Cast(0 1) Type(0 1) Let(0 1 2 3)
595fad3a1d3Sopenharmony_ci    If(0 1 2) While(0 1 2) ForLoop(pat iter body label kind) Loop(0 1 2)
596fad3a1d3Sopenharmony_ci    Match(0 1) Closure(0) Block(0 1) Gen(0 1 2) Await(0 1) TryBlock(0)
597fad3a1d3Sopenharmony_ci    Assign(0 1 2) AssignOp(0 1 2) Field(0 1) Index(0 1 2) Underscore
598fad3a1d3Sopenharmony_ci    Range(0 1 2) Path(0 1) AddrOf(0 1 2) Break(0 1) Continue(0) Ret(0)
599fad3a1d3Sopenharmony_ci    InlineAsm(0) OffsetOf(0 1) MacCall(0) Struct(0) Repeat(0 1) Paren(0) Try(0)
600fad3a1d3Sopenharmony_ci    Yield(0) Yeet(0) Become(0) IncludedBytes(0) FormatArgs(0) Err);
601fad3a1d3Sopenharmony_cispanless_eq_enum!(InlineAsmOperand; In(reg expr) Out(reg late expr)
602fad3a1d3Sopenharmony_ci    InOut(reg late expr) SplitInOut(reg late in_expr out_expr) Const(anon_const)
603fad3a1d3Sopenharmony_ci    Sym(sym));
604fad3a1d3Sopenharmony_cispanless_eq_enum!(ItemKind; ExternCrate(0) Use(0) Static(0) Const(0) Fn(0)
605fad3a1d3Sopenharmony_ci    Mod(0 1) ForeignMod(0) GlobalAsm(0) TyAlias(0) Enum(0 1) Struct(0 1)
606fad3a1d3Sopenharmony_ci    Union(0 1) Trait(0) TraitAlias(0 1) Impl(0) MacCall(0) MacroDef(0));
607fad3a1d3Sopenharmony_cispanless_eq_enum!(LitKind; Str(0 1) ByteStr(0 1) CStr(0 1) Byte(0) Char(0)
608fad3a1d3Sopenharmony_ci    Int(0 1) Float(0 1) Bool(0) Err);
609fad3a1d3Sopenharmony_cispanless_eq_enum!(PatKind; Wild Ident(0 1 2) Struct(0 1 2 3) TupleStruct(0 1 2)
610fad3a1d3Sopenharmony_ci    Or(0) Path(0 1) Tuple(0) Box(0) Ref(0 1) Lit(0) Range(0 1 2) Slice(0) Rest
611fad3a1d3Sopenharmony_ci    Never Paren(0) MacCall(0));
612fad3a1d3Sopenharmony_cispanless_eq_enum!(TyKind; Slice(0) Array(0 1) Ptr(0) Ref(0 1) BareFn(0) Never
613fad3a1d3Sopenharmony_ci    Tup(0) AnonStruct(0) AnonUnion(0) Path(0 1) TraitObject(0 1) ImplTrait(0 1)
614fad3a1d3Sopenharmony_ci    Paren(0) Typeof(0) Infer ImplicitSelf MacCall(0) Err CVarArgs);
615fad3a1d3Sopenharmony_ci
616fad3a1d3Sopenharmony_ciimpl SpanlessEq for Ident {
617fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
618fad3a1d3Sopenharmony_ci        self.as_str() == other.as_str()
619fad3a1d3Sopenharmony_ci    }
620fad3a1d3Sopenharmony_ci}
621fad3a1d3Sopenharmony_ci
622fad3a1d3Sopenharmony_ciimpl SpanlessEq for RangeSyntax {
623fad3a1d3Sopenharmony_ci    fn eq(&self, _other: &Self) -> bool {
624fad3a1d3Sopenharmony_ci        match self {
625fad3a1d3Sopenharmony_ci            RangeSyntax::DotDotDot | RangeSyntax::DotDotEq => true,
626fad3a1d3Sopenharmony_ci        }
627fad3a1d3Sopenharmony_ci    }
628fad3a1d3Sopenharmony_ci}
629fad3a1d3Sopenharmony_ci
630fad3a1d3Sopenharmony_ciimpl SpanlessEq for Param {
631fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
632fad3a1d3Sopenharmony_ci        let Param {
633fad3a1d3Sopenharmony_ci            attrs,
634fad3a1d3Sopenharmony_ci            ty,
635fad3a1d3Sopenharmony_ci            pat,
636fad3a1d3Sopenharmony_ci            id,
637fad3a1d3Sopenharmony_ci            span: _,
638fad3a1d3Sopenharmony_ci            is_placeholder,
639fad3a1d3Sopenharmony_ci        } = self;
640fad3a1d3Sopenharmony_ci        let Param {
641fad3a1d3Sopenharmony_ci            attrs: attrs2,
642fad3a1d3Sopenharmony_ci            ty: ty2,
643fad3a1d3Sopenharmony_ci            pat: pat2,
644fad3a1d3Sopenharmony_ci            id: id2,
645fad3a1d3Sopenharmony_ci            span: _,
646fad3a1d3Sopenharmony_ci            is_placeholder: is_placeholder2,
647fad3a1d3Sopenharmony_ci        } = other;
648fad3a1d3Sopenharmony_ci        SpanlessEq::eq(id, id2)
649fad3a1d3Sopenharmony_ci            && SpanlessEq::eq(is_placeholder, is_placeholder2)
650fad3a1d3Sopenharmony_ci            && (matches!(ty.kind, TyKind::Err)
651fad3a1d3Sopenharmony_ci                || matches!(ty2.kind, TyKind::Err)
652fad3a1d3Sopenharmony_ci                || SpanlessEq::eq(attrs, attrs2)
653fad3a1d3Sopenharmony_ci                    && SpanlessEq::eq(ty, ty2)
654fad3a1d3Sopenharmony_ci                    && SpanlessEq::eq(pat, pat2))
655fad3a1d3Sopenharmony_ci    }
656fad3a1d3Sopenharmony_ci}
657fad3a1d3Sopenharmony_ci
658fad3a1d3Sopenharmony_ciimpl SpanlessEq for TokenKind {
659fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
660fad3a1d3Sopenharmony_ci        match (self, other) {
661fad3a1d3Sopenharmony_ci            (TokenKind::Literal(this), TokenKind::Literal(other)) => SpanlessEq::eq(this, other),
662fad3a1d3Sopenharmony_ci            (TokenKind::DotDotEq | TokenKind::DotDotDot, _) => match other {
663fad3a1d3Sopenharmony_ci                TokenKind::DotDotEq | TokenKind::DotDotDot => true,
664fad3a1d3Sopenharmony_ci                _ => false,
665fad3a1d3Sopenharmony_ci            },
666fad3a1d3Sopenharmony_ci            (TokenKind::Interpolated(this), TokenKind::Interpolated(other)) => {
667fad3a1d3Sopenharmony_ci                let (this, this_span) = this.as_ref();
668fad3a1d3Sopenharmony_ci                let (other, other_span) = other.as_ref();
669fad3a1d3Sopenharmony_ci                SpanlessEq::eq(this_span, other_span)
670fad3a1d3Sopenharmony_ci                    && match (this, other) {
671fad3a1d3Sopenharmony_ci                        (Nonterminal::NtExpr(this), Nonterminal::NtExpr(other)) => {
672fad3a1d3Sopenharmony_ci                            SpanlessEq::eq(this, other)
673fad3a1d3Sopenharmony_ci                        }
674fad3a1d3Sopenharmony_ci                        _ => this == other,
675fad3a1d3Sopenharmony_ci                    }
676fad3a1d3Sopenharmony_ci            }
677fad3a1d3Sopenharmony_ci            _ => self == other,
678fad3a1d3Sopenharmony_ci        }
679fad3a1d3Sopenharmony_ci    }
680fad3a1d3Sopenharmony_ci}
681fad3a1d3Sopenharmony_ci
682fad3a1d3Sopenharmony_ciimpl SpanlessEq for TokenStream {
683fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
684fad3a1d3Sopenharmony_ci        let mut this_trees = self.trees();
685fad3a1d3Sopenharmony_ci        let mut other_trees = other.trees();
686fad3a1d3Sopenharmony_ci        loop {
687fad3a1d3Sopenharmony_ci            let this = match this_trees.next() {
688fad3a1d3Sopenharmony_ci                None => return other_trees.next().is_none(),
689fad3a1d3Sopenharmony_ci                Some(tree) => tree,
690fad3a1d3Sopenharmony_ci            };
691fad3a1d3Sopenharmony_ci            let other = match other_trees.next() {
692fad3a1d3Sopenharmony_ci                None => return false,
693fad3a1d3Sopenharmony_ci                Some(tree) => tree,
694fad3a1d3Sopenharmony_ci            };
695fad3a1d3Sopenharmony_ci            if SpanlessEq::eq(this, other) {
696fad3a1d3Sopenharmony_ci                continue;
697fad3a1d3Sopenharmony_ci            }
698fad3a1d3Sopenharmony_ci            if let (TokenTree::Token(this, _), TokenTree::Token(other, _)) = (this, other) {
699fad3a1d3Sopenharmony_ci                if match (&this.kind, &other.kind) {
700fad3a1d3Sopenharmony_ci                    (TokenKind::Literal(this), TokenKind::Literal(other)) => {
701fad3a1d3Sopenharmony_ci                        SpanlessEq::eq(this, other)
702fad3a1d3Sopenharmony_ci                    }
703fad3a1d3Sopenharmony_ci                    (TokenKind::DocComment(_kind, style, symbol), TokenKind::Pound) => {
704fad3a1d3Sopenharmony_ci                        doc_comment(*style, *symbol, &mut other_trees)
705fad3a1d3Sopenharmony_ci                    }
706fad3a1d3Sopenharmony_ci                    (TokenKind::Pound, TokenKind::DocComment(_kind, style, symbol)) => {
707fad3a1d3Sopenharmony_ci                        doc_comment(*style, *symbol, &mut this_trees)
708fad3a1d3Sopenharmony_ci                    }
709fad3a1d3Sopenharmony_ci                    _ => false,
710fad3a1d3Sopenharmony_ci                } {
711fad3a1d3Sopenharmony_ci                    continue;
712fad3a1d3Sopenharmony_ci                }
713fad3a1d3Sopenharmony_ci            }
714fad3a1d3Sopenharmony_ci            return false;
715fad3a1d3Sopenharmony_ci        }
716fad3a1d3Sopenharmony_ci    }
717fad3a1d3Sopenharmony_ci}
718fad3a1d3Sopenharmony_ci
719fad3a1d3Sopenharmony_cifn doc_comment<'a>(
720fad3a1d3Sopenharmony_ci    style: AttrStyle,
721fad3a1d3Sopenharmony_ci    unescaped: Symbol,
722fad3a1d3Sopenharmony_ci    trees: &mut impl Iterator<Item = &'a TokenTree>,
723fad3a1d3Sopenharmony_ci) -> bool {
724fad3a1d3Sopenharmony_ci    if match style {
725fad3a1d3Sopenharmony_ci        AttrStyle::Outer => false,
726fad3a1d3Sopenharmony_ci        AttrStyle::Inner => true,
727fad3a1d3Sopenharmony_ci    } {
728fad3a1d3Sopenharmony_ci        match trees.next() {
729fad3a1d3Sopenharmony_ci            Some(TokenTree::Token(
730fad3a1d3Sopenharmony_ci                Token {
731fad3a1d3Sopenharmony_ci                    kind: TokenKind::Not,
732fad3a1d3Sopenharmony_ci                    span: _,
733fad3a1d3Sopenharmony_ci                },
734fad3a1d3Sopenharmony_ci                _spacing,
735fad3a1d3Sopenharmony_ci            )) => {}
736fad3a1d3Sopenharmony_ci            _ => return false,
737fad3a1d3Sopenharmony_ci        }
738fad3a1d3Sopenharmony_ci    }
739fad3a1d3Sopenharmony_ci    let stream = match trees.next() {
740fad3a1d3Sopenharmony_ci        Some(TokenTree::Delimited(_span, _spacing, Delimiter::Bracket, stream)) => stream,
741fad3a1d3Sopenharmony_ci        _ => return false,
742fad3a1d3Sopenharmony_ci    };
743fad3a1d3Sopenharmony_ci    let mut trees = stream.trees();
744fad3a1d3Sopenharmony_ci    match trees.next() {
745fad3a1d3Sopenharmony_ci        Some(TokenTree::Token(
746fad3a1d3Sopenharmony_ci            Token {
747fad3a1d3Sopenharmony_ci                kind: TokenKind::Ident(symbol, false),
748fad3a1d3Sopenharmony_ci                span: _,
749fad3a1d3Sopenharmony_ci            },
750fad3a1d3Sopenharmony_ci            _spacing,
751fad3a1d3Sopenharmony_ci        )) if *symbol == sym::doc => {}
752fad3a1d3Sopenharmony_ci        _ => return false,
753fad3a1d3Sopenharmony_ci    }
754fad3a1d3Sopenharmony_ci    match trees.next() {
755fad3a1d3Sopenharmony_ci        Some(TokenTree::Token(
756fad3a1d3Sopenharmony_ci            Token {
757fad3a1d3Sopenharmony_ci                kind: TokenKind::Eq,
758fad3a1d3Sopenharmony_ci                span: _,
759fad3a1d3Sopenharmony_ci            },
760fad3a1d3Sopenharmony_ci            _spacing,
761fad3a1d3Sopenharmony_ci        )) => {}
762fad3a1d3Sopenharmony_ci        _ => return false,
763fad3a1d3Sopenharmony_ci    }
764fad3a1d3Sopenharmony_ci    match trees.next() {
765fad3a1d3Sopenharmony_ci        Some(TokenTree::Token(token, _spacing)) => {
766fad3a1d3Sopenharmony_ci            is_escaped_literal_token(token, unescaped) && trees.next().is_none()
767fad3a1d3Sopenharmony_ci        }
768fad3a1d3Sopenharmony_ci        _ => false,
769fad3a1d3Sopenharmony_ci    }
770fad3a1d3Sopenharmony_ci}
771fad3a1d3Sopenharmony_ci
772fad3a1d3Sopenharmony_cifn is_escaped_literal_token(token: &Token, unescaped: Symbol) -> bool {
773fad3a1d3Sopenharmony_ci    match token {
774fad3a1d3Sopenharmony_ci        Token {
775fad3a1d3Sopenharmony_ci            kind: TokenKind::Literal(lit),
776fad3a1d3Sopenharmony_ci            span: _,
777fad3a1d3Sopenharmony_ci        } => match MetaItemLit::from_token_lit(*lit, DUMMY_SP) {
778fad3a1d3Sopenharmony_ci            Ok(lit) => is_escaped_literal_meta_item_lit(&lit, unescaped),
779fad3a1d3Sopenharmony_ci            Err(_) => false,
780fad3a1d3Sopenharmony_ci        },
781fad3a1d3Sopenharmony_ci        Token {
782fad3a1d3Sopenharmony_ci            kind: TokenKind::Interpolated(nonterminal),
783fad3a1d3Sopenharmony_ci            span: _,
784fad3a1d3Sopenharmony_ci        } => match &nonterminal.0 {
785fad3a1d3Sopenharmony_ci            Nonterminal::NtExpr(expr) => match &expr.kind {
786fad3a1d3Sopenharmony_ci                ExprKind::Lit(lit) => is_escaped_lit(lit, unescaped),
787fad3a1d3Sopenharmony_ci                _ => false,
788fad3a1d3Sopenharmony_ci            },
789fad3a1d3Sopenharmony_ci            _ => false,
790fad3a1d3Sopenharmony_ci        },
791fad3a1d3Sopenharmony_ci        _ => false,
792fad3a1d3Sopenharmony_ci    }
793fad3a1d3Sopenharmony_ci}
794fad3a1d3Sopenharmony_ci
795fad3a1d3Sopenharmony_cifn is_escaped_literal_attr_args(value: &AttrArgsEq, unescaped: Symbol) -> bool {
796fad3a1d3Sopenharmony_ci    match value {
797fad3a1d3Sopenharmony_ci        AttrArgsEq::Ast(expr) => match &expr.kind {
798fad3a1d3Sopenharmony_ci            ExprKind::Lit(lit) => is_escaped_lit(lit, unescaped),
799fad3a1d3Sopenharmony_ci            _ => false,
800fad3a1d3Sopenharmony_ci        },
801fad3a1d3Sopenharmony_ci        AttrArgsEq::Hir(lit) => is_escaped_literal_meta_item_lit(lit, unescaped),
802fad3a1d3Sopenharmony_ci    }
803fad3a1d3Sopenharmony_ci}
804fad3a1d3Sopenharmony_ci
805fad3a1d3Sopenharmony_cifn is_escaped_literal_meta_item_lit(lit: &MetaItemLit, unescaped: Symbol) -> bool {
806fad3a1d3Sopenharmony_ci    match lit {
807fad3a1d3Sopenharmony_ci        MetaItemLit {
808fad3a1d3Sopenharmony_ci            symbol: _,
809fad3a1d3Sopenharmony_ci            suffix: None,
810fad3a1d3Sopenharmony_ci            kind,
811fad3a1d3Sopenharmony_ci            span: _,
812fad3a1d3Sopenharmony_ci        } => is_escaped_lit_kind(kind, unescaped),
813fad3a1d3Sopenharmony_ci        _ => false,
814fad3a1d3Sopenharmony_ci    }
815fad3a1d3Sopenharmony_ci}
816fad3a1d3Sopenharmony_ci
817fad3a1d3Sopenharmony_cifn is_escaped_lit(lit: &Lit, unescaped: Symbol) -> bool {
818fad3a1d3Sopenharmony_ci    match lit {
819fad3a1d3Sopenharmony_ci        Lit {
820fad3a1d3Sopenharmony_ci            kind: token::LitKind::Str,
821fad3a1d3Sopenharmony_ci            symbol: _,
822fad3a1d3Sopenharmony_ci            suffix: None,
823fad3a1d3Sopenharmony_ci        } => match LitKind::from_token_lit(*lit) {
824fad3a1d3Sopenharmony_ci            Ok(lit_kind) => is_escaped_lit_kind(&lit_kind, unescaped),
825fad3a1d3Sopenharmony_ci            _ => false,
826fad3a1d3Sopenharmony_ci        },
827fad3a1d3Sopenharmony_ci        _ => false,
828fad3a1d3Sopenharmony_ci    }
829fad3a1d3Sopenharmony_ci}
830fad3a1d3Sopenharmony_ci
831fad3a1d3Sopenharmony_cifn is_escaped_lit_kind(kind: &LitKind, unescaped: Symbol) -> bool {
832fad3a1d3Sopenharmony_ci    match kind {
833fad3a1d3Sopenharmony_ci        LitKind::Str(symbol, StrStyle::Cooked) => {
834fad3a1d3Sopenharmony_ci            symbol.as_str().replace('\r', "") == unescaped.as_str().replace('\r', "")
835fad3a1d3Sopenharmony_ci        }
836fad3a1d3Sopenharmony_ci        _ => false,
837fad3a1d3Sopenharmony_ci    }
838fad3a1d3Sopenharmony_ci}
839fad3a1d3Sopenharmony_ci
840fad3a1d3Sopenharmony_ciimpl SpanlessEq for LazyAttrTokenStream {
841fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
842fad3a1d3Sopenharmony_ci        let this = self.to_attr_token_stream();
843fad3a1d3Sopenharmony_ci        let other = other.to_attr_token_stream();
844fad3a1d3Sopenharmony_ci        SpanlessEq::eq(&this, &other)
845fad3a1d3Sopenharmony_ci    }
846fad3a1d3Sopenharmony_ci}
847fad3a1d3Sopenharmony_ci
848fad3a1d3Sopenharmony_ciimpl SpanlessEq for AttrKind {
849fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
850fad3a1d3Sopenharmony_ci        match (self, other) {
851fad3a1d3Sopenharmony_ci            (AttrKind::Normal(normal), AttrKind::Normal(normal2)) => {
852fad3a1d3Sopenharmony_ci                SpanlessEq::eq(normal, normal2)
853fad3a1d3Sopenharmony_ci            }
854fad3a1d3Sopenharmony_ci            (AttrKind::DocComment(kind, symbol), AttrKind::DocComment(kind2, symbol2)) => {
855fad3a1d3Sopenharmony_ci                SpanlessEq::eq(kind, kind2) && SpanlessEq::eq(symbol, symbol2)
856fad3a1d3Sopenharmony_ci            }
857fad3a1d3Sopenharmony_ci            (AttrKind::DocComment(kind, unescaped), AttrKind::Normal(normal2)) => {
858fad3a1d3Sopenharmony_ci                match kind {
859fad3a1d3Sopenharmony_ci                    CommentKind::Line | CommentKind::Block => {}
860fad3a1d3Sopenharmony_ci                }
861fad3a1d3Sopenharmony_ci                let path = Path::from_ident(Ident::with_dummy_span(sym::doc));
862fad3a1d3Sopenharmony_ci                SpanlessEq::eq(&path, &normal2.item.path)
863fad3a1d3Sopenharmony_ci                    && match &normal2.item.args {
864fad3a1d3Sopenharmony_ci                        AttrArgs::Empty | AttrArgs::Delimited(_) => false,
865fad3a1d3Sopenharmony_ci                        AttrArgs::Eq(_span, value) => {
866fad3a1d3Sopenharmony_ci                            is_escaped_literal_attr_args(value, *unescaped)
867fad3a1d3Sopenharmony_ci                        }
868fad3a1d3Sopenharmony_ci                    }
869fad3a1d3Sopenharmony_ci            }
870fad3a1d3Sopenharmony_ci            (AttrKind::Normal(_), AttrKind::DocComment(..)) => SpanlessEq::eq(other, self),
871fad3a1d3Sopenharmony_ci        }
872fad3a1d3Sopenharmony_ci    }
873fad3a1d3Sopenharmony_ci}
874fad3a1d3Sopenharmony_ci
875fad3a1d3Sopenharmony_ciimpl SpanlessEq for FormatArguments {
876fad3a1d3Sopenharmony_ci    fn eq(&self, other: &Self) -> bool {
877fad3a1d3Sopenharmony_ci        SpanlessEq::eq(self.all_args(), other.all_args())
878fad3a1d3Sopenharmony_ci    }
879fad3a1d3Sopenharmony_ci}
880