Skip to main content

rustc_hir/
hir.rs

1// ignore-tidy-filelength
2use std::borrow::Cow;
3use std::fmt;
4use std::ops::Not;
5
6use rustc_abi::ExternAbi;
7use rustc_ast::attr::AttributeExt;
8use rustc_ast::token::DocFragmentKind;
9use rustc_ast::util::parser::ExprPrecedence;
10use rustc_ast::{
11    self as ast, FloatTy, InlineAsmOptions, InlineAsmTemplatePiece, IntTy, Label, LitIntType,
12    LitKind, TraitObjectSyntax, UintTy, UnsafeBinderCastKind, join_path_idents,
13};
14pub use rustc_ast::{
15    AssignOp, AssignOpKind, AttrId, AttrStyle, BinOp, BinOpKind, BindingMode, BorrowKind,
16    BoundConstness, BoundPolarity, ByRef, CaptureBy, DelimArgs, ImplPolarity, IsAuto,
17    MetaItemInner, MetaItemLit, Movability, Mutability, Pinnedness, UnOp,
18};
19use rustc_data_structures::fingerprint::Fingerprint;
20use rustc_data_structures::sorted_map::SortedMap;
21use rustc_data_structures::tagged_ptr::TaggedRef;
22use rustc_error_messages::{DiagArgValue, IntoDiagArg};
23use rustc_index::IndexVec;
24use rustc_macros::{Decodable, Encodable, HashStable_Generic};
25use rustc_span::def_id::LocalDefId;
26use rustc_span::{
27    BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, Span, Spanned, Symbol, kw, sym,
28};
29use rustc_target::asm::InlineAsmRegOrRegClass;
30use smallvec::SmallVec;
31use thin_vec::ThinVec;
32use tracing::debug;
33
34use crate::attrs::AttributeKind;
35use crate::def::{CtorKind, DefKind, MacroKinds, PerNS, Res};
36use crate::def_id::{DefId, LocalDefIdMap};
37pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
38use crate::intravisit::{FnKind, VisitorExt};
39use crate::lints::DelayedLints;
40
41#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AngleBrackets {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AngleBrackets::Missing => "Missing",
                AngleBrackets::Empty => "Empty",
                AngleBrackets::Full => "Full",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for AngleBrackets { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AngleBrackets {
    #[inline]
    fn clone(&self) -> AngleBrackets { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for AngleBrackets {
    #[inline]
    fn eq(&self, other: &AngleBrackets) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for AngleBrackets {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AngleBrackets where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    AngleBrackets::Missing => {}
                    AngleBrackets::Empty => {}
                    AngleBrackets::Full => {}
                }
            }
        }
    };HashStable_Generic)]
42pub enum AngleBrackets {
43    /// E.g. `Path`.
44    Missing,
45    /// E.g. `Path<>`.
46    Empty,
47    /// E.g. `Path<T>`.
48    Full,
49}
50
51#[derive(#[automatically_derived]
impl ::core::fmt::Debug for LifetimeSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            LifetimeSource::Reference =>
                ::core::fmt::Formatter::write_str(f, "Reference"),
            LifetimeSource::Path { angle_brackets: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Path",
                    "angle_brackets", &__self_0),
            LifetimeSource::OutlivesBound =>
                ::core::fmt::Formatter::write_str(f, "OutlivesBound"),
            LifetimeSource::PreciseCapturing =>
                ::core::fmt::Formatter::write_str(f, "PreciseCapturing"),
            LifetimeSource::Other =>
                ::core::fmt::Formatter::write_str(f, "Other"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for LifetimeSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LifetimeSource {
    #[inline]
    fn clone(&self) -> LifetimeSource {
        let _: ::core::clone::AssertParamIsClone<AngleBrackets>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for LifetimeSource {
    #[inline]
    fn eq(&self, other: &LifetimeSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (LifetimeSource::Path { angle_brackets: __self_0 },
                    LifetimeSource::Path { angle_brackets: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LifetimeSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<AngleBrackets>;
    }
}Eq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LifetimeSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LifetimeSource::Reference => {}
                    LifetimeSource::Path { angle_brackets: ref __binding_0 } =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    LifetimeSource::OutlivesBound => {}
                    LifetimeSource::PreciseCapturing => {}
                    LifetimeSource::Other => {}
                }
            }
        }
    };HashStable_Generic)]
52pub enum LifetimeSource {
53    /// E.g. `&Type`, `&'_ Type`, `&'a Type`, `&mut Type`, `&'_ mut Type`, `&'a mut Type`
54    Reference,
55
56    /// E.g. `ContainsLifetime`, `ContainsLifetime<>`, `ContainsLifetime<'_>`,
57    /// `ContainsLifetime<'a>`
58    Path { angle_brackets: AngleBrackets },
59
60    /// E.g. `impl Trait + '_`, `impl Trait + 'a`
61    OutlivesBound,
62
63    /// E.g. `impl Trait + use<'_>`, `impl Trait + use<'a>`
64    PreciseCapturing,
65
66    /// Other usages which have not yet been categorized. Feel free to
67    /// add new sources that you find useful.
68    ///
69    /// Some non-exhaustive examples:
70    /// - `where T: 'a`
71    /// - `fn(_: dyn Trait + 'a)`
72    Other,
73}
74
75#[derive(#[automatically_derived]
impl ::core::fmt::Debug for LifetimeSyntax {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                LifetimeSyntax::Implicit => "Implicit",
                LifetimeSyntax::ExplicitAnonymous => "ExplicitAnonymous",
                LifetimeSyntax::ExplicitBound => "ExplicitBound",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for LifetimeSyntax { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LifetimeSyntax {
    #[inline]
    fn clone(&self) -> LifetimeSyntax { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for LifetimeSyntax {
    #[inline]
    fn eq(&self, other: &LifetimeSyntax) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LifetimeSyntax {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LifetimeSyntax where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LifetimeSyntax::Implicit => {}
                    LifetimeSyntax::ExplicitAnonymous => {}
                    LifetimeSyntax::ExplicitBound => {}
                }
            }
        }
    };HashStable_Generic)]
76pub enum LifetimeSyntax {
77    /// E.g. `&Type`, `ContainsLifetime`
78    Implicit,
79
80    /// E.g. `&'_ Type`, `ContainsLifetime<'_>`, `impl Trait + '_`, `impl Trait + use<'_>`
81    ExplicitAnonymous,
82
83    /// E.g. `&'a Type`, `ContainsLifetime<'a>`, `impl Trait + 'a`, `impl Trait + use<'a>`
84    ExplicitBound,
85}
86
87impl From<Ident> for LifetimeSyntax {
88    fn from(ident: Ident) -> Self {
89        let name = ident.name;
90
91        if name == sym::empty {
92            {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("A lifetime name should never be empty")));
};unreachable!("A lifetime name should never be empty");
93        } else if name == kw::UnderscoreLifetime {
94            LifetimeSyntax::ExplicitAnonymous
95        } else {
96            if true {
    if !name.as_str().starts_with('\'') {
        ::core::panicking::panic("assertion failed: name.as_str().starts_with(\'\\\'\')")
    };
};debug_assert!(name.as_str().starts_with('\''));
97            LifetimeSyntax::ExplicitBound
98        }
99    }
100}
101
102/// A lifetime. The valid field combinations are non-obvious and not all
103/// combinations are possible. The following example shows some of
104/// them. See also the comments on `LifetimeKind` and `LifetimeSource`.
105///
106/// ```
107/// #[repr(C)]
108/// struct S<'a>(&'a u32);       // res=Param, name='a, source=Reference, syntax=ExplicitBound
109/// unsafe extern "C" {
110///     fn f1(s: S);             // res=Param, name='_, source=Path, syntax=Implicit
111///     fn f2(s: S<'_>);         // res=Param, name='_, source=Path, syntax=ExplicitAnonymous
112///     fn f3<'a>(s: S<'a>);     // res=Param, name='a, source=Path, syntax=ExplicitBound
113/// }
114///
115/// struct St<'a> { x: &'a u32 } // res=Param, name='a, source=Reference, syntax=ExplicitBound
116/// fn f() {
117///     _ = St { x: &0 };        // res=Infer, name='_, source=Path, syntax=Implicit
118///     _ = St::<'_> { x: &0 };  // res=Infer, name='_, source=Path, syntax=ExplicitAnonymous
119/// }
120///
121/// struct Name<'a>(&'a str);    // res=Param,  name='a, source=Reference, syntax=ExplicitBound
122/// const A: Name = Name("a");   // res=Static, name='_, source=Path, syntax=Implicit
123/// const B: &str = "";          // res=Static, name='_, source=Reference, syntax=Implicit
124/// static C: &'_ str = "";      // res=Static, name='_, source=Reference, syntax=ExplicitAnonymous
125/// static D: &'static str = ""; // res=Static, name='static, source=Reference, syntax=ExplicitBound
126///
127/// trait Tr {}
128/// fn tr(_: Box<dyn Tr>) {}     // res=ImplicitObjectLifetimeDefault, name='_, source=Other, syntax=Implicit
129///
130/// fn capture_outlives<'a>() ->
131///     impl FnOnce() + 'a       // res=Param, ident='a, source=OutlivesBound, syntax=ExplicitBound
132/// {
133///     || {}
134/// }
135///
136/// fn capture_precise<'a>() ->
137///     impl FnOnce() + use<'a>  // res=Param, ident='a, source=PreciseCapturing, syntax=ExplicitBound
138/// {
139///     || {}
140/// }
141///
142/// // (commented out because these cases trigger errors)
143/// // struct S1<'a>(&'a str);   // res=Param, name='a, source=Reference, syntax=ExplicitBound
144/// // struct S2(S1);            // res=Error, name='_, source=Path, syntax=Implicit
145/// // struct S3(S1<'_>);        // res=Error, name='_, source=Path, syntax=ExplicitAnonymous
146/// // struct S4(S1<'a>);        // res=Error, name='a, source=Path, syntax=ExplicitBound
147/// ```
148///
149/// Some combinations that cannot occur are `LifetimeSyntax::Implicit` with
150/// `LifetimeSource::OutlivesBound` or `LifetimeSource::PreciseCapturing`
151/// — there's no way to "elide" these lifetimes.
152#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Lifetime {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "Lifetime",
            "hir_id", &self.hir_id, "ident", &self.ident, "kind", &self.kind,
            "source", &self.source, "syntax", &&self.syntax)
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Lifetime { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Lifetime {
    #[inline]
    fn clone(&self) -> Lifetime {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<LifetimeKind>;
        let _: ::core::clone::AssertParamIsClone<LifetimeSource>;
        let _: ::core::clone::AssertParamIsClone<LifetimeSyntax>;
        *self
    }
}Clone, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Lifetime where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Lifetime {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        kind: ref __binding_2,
                        source: ref __binding_3,
                        syntax: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
153// Raise the alignment to at least 4 bytes.
154// This is relied on in other parts of the compiler (for pointer tagging):
155// <https://github.com/rust-lang/rust/blob/ce5fdd7d42aba9a2925692e11af2bd39cf37798a/compiler/rustc_data_structures/src/tagged_ptr.rs#L163>
156// Removing this `repr(4)` will cause the compiler to not build on platforms
157// like `m68k` Linux, where the alignment of u32 and usize is only 2.
158// Since `repr(align)` may only raise alignment, this has no effect on
159// platforms where the alignment is already sufficient.
160#[repr(align(4))]
161pub struct Lifetime {
162    #[stable_hasher(ignore)]
163    pub hir_id: HirId,
164
165    /// Either a named lifetime definition (e.g. `'a`, `'static`) or an
166    /// anonymous lifetime (`'_`, either explicitly written, or inserted for
167    /// things like `&type`).
168    pub ident: Ident,
169
170    /// Semantics of this lifetime.
171    pub kind: LifetimeKind,
172
173    /// The context in which the lifetime occurred. See `Lifetime::suggestion`
174    /// for example use.
175    pub source: LifetimeSource,
176
177    /// The syntax that the user used to declare this lifetime. See
178    /// `Lifetime::suggestion` for example use.
179    pub syntax: LifetimeSyntax,
180}
181
182#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ParamName {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ParamName::Plain(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Plain",
                    &__self_0),
            ParamName::Error(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
                    &__self_0),
            ParamName::Fresh => ::core::fmt::Formatter::write_str(f, "Fresh"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for ParamName { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ParamName {
    #[inline]
    fn clone(&self) -> ParamName {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        *self
    }
}Clone, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ParamName where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ParamName::Plain(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ParamName::Error(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ParamName::Fresh => {}
                }
            }
        }
    };HashStable_Generic)]
183pub enum ParamName {
184    /// Some user-given name like `T` or `'x`.
185    Plain(Ident),
186
187    /// Indicates an illegal name was given and an error has been
188    /// reported (so we should squelch other derived errors).
189    ///
190    /// Occurs when, e.g., `'_` is used in the wrong place, or a
191    /// lifetime name is duplicated.
192    Error(Ident),
193
194    /// Synthetic name generated when user elided a lifetime in an impl header.
195    ///
196    /// E.g., the lifetimes in cases like these:
197    /// ```ignore (fragment)
198    /// impl Foo for &u32
199    /// impl Foo<'_> for u32
200    /// ```
201    /// in that case, we rewrite to
202    /// ```ignore (fragment)
203    /// impl<'f> Foo for &'f u32
204    /// impl<'f> Foo<'f> for u32
205    /// ```
206    /// where `'f` is something like `Fresh(0)`. The indices are
207    /// unique per impl, but not necessarily continuous.
208    Fresh,
209}
210
211impl ParamName {
212    pub fn ident(&self) -> Ident {
213        match *self {
214            ParamName::Plain(ident) | ParamName::Error(ident) => ident,
215            ParamName::Fresh => Ident::with_dummy_span(kw::UnderscoreLifetime),
216        }
217    }
218}
219
220#[derive(#[automatically_derived]
impl ::core::fmt::Debug for LifetimeKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            LifetimeKind::Param(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Param",
                    &__self_0),
            LifetimeKind::ImplicitObjectLifetimeDefault =>
                ::core::fmt::Formatter::write_str(f,
                    "ImplicitObjectLifetimeDefault"),
            LifetimeKind::Error(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
                    &__self_0),
            LifetimeKind::Infer =>
                ::core::fmt::Formatter::write_str(f, "Infer"),
            LifetimeKind::Static =>
                ::core::fmt::Formatter::write_str(f, "Static"),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for LifetimeKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LifetimeKind {
    #[inline]
    fn clone(&self) -> LifetimeKind {
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for LifetimeKind {
    #[inline]
    fn eq(&self, other: &LifetimeKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (LifetimeKind::Param(__self_0), LifetimeKind::Param(__arg1_0))
                    => __self_0 == __arg1_0,
                (LifetimeKind::Error(__self_0), LifetimeKind::Error(__arg1_0))
                    => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for LifetimeKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<LocalDefId>;
        let _: ::core::cmp::AssertParamIsEq<ErrorGuaranteed>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for LifetimeKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            LifetimeKind::Param(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            LifetimeKind::Error(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LifetimeKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LifetimeKind::Param(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    LifetimeKind::ImplicitObjectLifetimeDefault => {}
                    LifetimeKind::Error(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    LifetimeKind::Infer => {}
                    LifetimeKind::Static => {}
                }
            }
        }
    };HashStable_Generic)]
221pub enum LifetimeKind {
222    /// User-given names or fresh (synthetic) names.
223    Param(LocalDefId),
224
225    /// Implicit lifetime in a context like `dyn Foo`. This is
226    /// distinguished from implicit lifetimes elsewhere because the
227    /// lifetime that they default to must appear elsewhere within the
228    /// enclosing type. This means that, in an `impl Trait` context, we
229    /// don't have to create a parameter for them. That is, `impl
230    /// Trait<Item = &u32>` expands to an opaque type like `type
231    /// Foo<'a> = impl Trait<Item = &'a u32>`, but `impl Trait<item =
232    /// dyn Bar>` expands to `type Foo = impl Trait<Item = dyn Bar +
233    /// 'static>`. The latter uses `ImplicitObjectLifetimeDefault` so
234    /// that surrounding code knows not to create a lifetime
235    /// parameter.
236    ImplicitObjectLifetimeDefault,
237
238    /// Indicates an error during lowering (usually `'_` in wrong place)
239    /// that was already reported.
240    Error(ErrorGuaranteed),
241
242    /// User wrote an anonymous lifetime, either `'_` or nothing (which gets
243    /// converted to `'_`). The semantics of this lifetime should be inferred
244    /// by typechecking code.
245    Infer,
246
247    /// User wrote `'static` or nothing (which gets converted to `'_`).
248    Static,
249}
250
251impl LifetimeKind {
252    fn is_elided(&self) -> bool {
253        match self {
254            LifetimeKind::ImplicitObjectLifetimeDefault | LifetimeKind::Infer => true,
255
256            // It might seem surprising that `Fresh` counts as not *elided*
257            // -- but this is because, as far as the code in the compiler is
258            // concerned -- `Fresh` variants act equivalently to "some fresh name".
259            // They correspond to early-bound regions on an impl, in other words.
260            LifetimeKind::Error(..) | LifetimeKind::Param(..) | LifetimeKind::Static => false,
261        }
262    }
263}
264
265impl fmt::Display for Lifetime {
266    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
267        self.ident.name.fmt(f)
268    }
269}
270
271impl Lifetime {
272    pub fn new(
273        hir_id: HirId,
274        ident: Ident,
275        kind: LifetimeKind,
276        source: LifetimeSource,
277        syntax: LifetimeSyntax,
278    ) -> Lifetime {
279        let lifetime = Lifetime { hir_id, ident, kind, source, syntax };
280
281        // Sanity check: elided lifetimes form a strict subset of anonymous lifetimes.
282        #[cfg(debug_assertions)]
283        match (lifetime.is_elided(), lifetime.is_anonymous()) {
284            (false, false) => {} // e.g. `'a`
285            (false, true) => {}  // e.g. explicit `'_`
286            (true, true) => {}   // e.g. `&x`
287            (true, false) => { ::core::panicking::panic_fmt(format_args!("bad Lifetime")); }panic!("bad Lifetime"),
288        }
289
290        lifetime
291    }
292
293    pub fn is_elided(&self) -> bool {
294        self.kind.is_elided()
295    }
296
297    pub fn is_anonymous(&self) -> bool {
298        self.ident.name == kw::UnderscoreLifetime
299    }
300
301    pub fn is_implicit(&self) -> bool {
302        #[allow(non_exhaustive_omitted_patterns)] match self.syntax {
    LifetimeSyntax::Implicit => true,
    _ => false,
}matches!(self.syntax, LifetimeSyntax::Implicit)
303    }
304
305    pub fn is_static(&self) -> bool {
306        self.kind == LifetimeKind::Static
307    }
308
309    pub fn suggestion(&self, new_lifetime: &str) -> (Span, String) {
310        use LifetimeSource::*;
311        use LifetimeSyntax::*;
312
313        if true {
    if !new_lifetime.starts_with('\'') {
        ::core::panicking::panic("assertion failed: new_lifetime.starts_with(\'\\\'\')")
    };
};debug_assert!(new_lifetime.starts_with('\''));
314
315        match (self.syntax, self.source) {
316            // The user wrote `'a` or `'_`.
317            (ExplicitBound | ExplicitAnonymous, _) => (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", new_lifetime))
    })format!("{new_lifetime}")),
318
319            // The user wrote `Path<T>`, and omitted the `'_,`.
320            (Implicit, Path { angle_brackets: AngleBrackets::Full }) => {
321                (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}, ", new_lifetime))
    })format!("{new_lifetime}, "))
322            }
323
324            // The user wrote `Path<>`, and omitted the `'_`..
325            (Implicit, Path { angle_brackets: AngleBrackets::Empty }) => {
326                (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", new_lifetime))
    })format!("{new_lifetime}"))
327            }
328
329            // The user wrote `Path` and omitted the `<'_>`.
330            (Implicit, Path { angle_brackets: AngleBrackets::Missing }) => {
331                (self.ident.span.shrink_to_hi(), ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("<{0}>", new_lifetime))
    })format!("<{new_lifetime}>"))
332            }
333
334            // The user wrote `&type` or `&mut type`.
335            (Implicit, Reference) => (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0} ", new_lifetime))
    })format!("{new_lifetime} ")),
336
337            (Implicit, source) => {
338                {
    ::core::panicking::panic_fmt(format_args!("internal error: entered unreachable code: {0}",
            format_args!("can\'t suggest for a implicit lifetime of {0:?}",
                source)));
}unreachable!("can't suggest for a implicit lifetime of {source:?}")
339            }
340        }
341    }
342}
343
344/// A `Path` is essentially Rust's notion of a name; for instance,
345/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
346/// along with a bunch of supporting information.
347#[derive(#[automatically_derived]
impl<'hir, R: ::core::fmt::Debug> ::core::fmt::Debug for Path<'hir, R> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Path", "span",
            &self.span, "res", &self.res, "segments", &&self.segments)
    }
}Debug, #[automatically_derived]
impl<'hir, R: ::core::clone::Clone> ::core::clone::Clone for Path<'hir, R> {
    #[inline]
    fn clone(&self) -> Path<'hir, R> {
        Path {
            span: ::core::clone::Clone::clone(&self.span),
            res: ::core::clone::Clone::clone(&self.res),
            segments: ::core::clone::Clone::clone(&self.segments),
        }
    }
}Clone, #[automatically_derived]
impl<'hir, R: ::core::marker::Copy> ::core::marker::Copy for Path<'hir, R> { }Copy, const _: () =
    {
        impl<'hir, R, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Path<'hir, R> where __CTX: crate::HashStableContext,
            R: ::rustc_data_structures::stable_hasher::HashStable<__CTX> {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Path {
                        span: ref __binding_0,
                        res: ref __binding_1,
                        segments: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
348pub struct Path<'hir, R = Res> {
349    pub span: Span,
350    /// The resolution for the path.
351    pub res: R,
352    /// The segments in the path: the things separated by `::`.
353    pub segments: &'hir [PathSegment<'hir>],
354}
355
356/// Up to three resolutions for type, value and macro namespaces.
357pub type UsePath<'hir> = Path<'hir, PerNS<Option<Res>>>;
358
359impl Path<'_> {
360    pub fn is_global(&self) -> bool {
361        self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
362    }
363}
364
365/// A segment of a path: an identifier, an optional lifetime, and a set of
366/// types.
367#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PathSegment<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "PathSegment",
            "ident", &self.ident, "hir_id", &self.hir_id, "res", &self.res,
            "args", &self.args, "infer_args", &&self.infer_args)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for PathSegment<'hir> {
    #[inline]
    fn clone(&self) -> PathSegment<'hir> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Res>;
        let _:
                ::core::clone::AssertParamIsClone<Option<&'hir GenericArgs<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PathSegment<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PathSegment<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    PathSegment {
                        ident: ref __binding_0,
                        hir_id: ref __binding_1,
                        res: ref __binding_2,
                        args: ref __binding_3,
                        infer_args: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
368pub struct PathSegment<'hir> {
369    /// The identifier portion of this path segment.
370    pub ident: Ident,
371    #[stable_hasher(ignore)]
372    pub hir_id: HirId,
373    pub res: Res,
374
375    /// Type/lifetime parameters attached to this path. They come in
376    /// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
377    /// this is more than just simple syntactic sugar; the use of
378    /// parens affects the region binding rules, so we preserve the
379    /// distinction.
380    pub args: Option<&'hir GenericArgs<'hir>>,
381
382    /// Whether to infer remaining type parameters, if any.
383    /// This only applies to expression and pattern paths, and
384    /// out of those only the segments with no type parameters
385    /// to begin with, e.g., `Vec::new` is `<Vec<..>>::new::<..>`.
386    pub infer_args: bool,
387}
388
389impl<'hir> PathSegment<'hir> {
390    /// Converts an identifier to the corresponding segment.
391    pub fn new(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> {
392        PathSegment { ident, hir_id, res, infer_args: true, args: None }
393    }
394
395    pub fn invalid() -> Self {
396        Self::new(Ident::dummy(), HirId::INVALID, Res::Err)
397    }
398
399    pub fn args(&self) -> &GenericArgs<'hir> {
400        if let Some(ref args) = self.args {
401            args
402        } else {
403            const DUMMY: &GenericArgs<'_> = &GenericArgs::none();
404            DUMMY
405        }
406    }
407}
408
409#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for ConstItemRhs<'hir> {
    #[inline]
    fn clone(&self) -> ConstItemRhs<'hir> {
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ConstItemRhs<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for ConstItemRhs<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ConstItemRhs::Body(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Body",
                    &__self_0),
            ConstItemRhs::TypeConst(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TypeConst", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ConstItemRhs<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ConstItemRhs::Body(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstItemRhs::TypeConst(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
410pub enum ConstItemRhs<'hir> {
411    Body(BodyId),
412    TypeConst(&'hir ConstArg<'hir>),
413}
414
415impl<'hir> ConstItemRhs<'hir> {
416    pub fn hir_id(&self) -> HirId {
417        match self {
418            ConstItemRhs::Body(body_id) => body_id.hir_id,
419            ConstItemRhs::TypeConst(ct_arg) => ct_arg.hir_id,
420        }
421    }
422
423    pub fn span<'tcx>(&self, tcx: impl crate::intravisit::HirTyCtxt<'tcx>) -> Span {
424        match self {
425            ConstItemRhs::Body(body_id) => tcx.hir_body(*body_id).value.span,
426            ConstItemRhs::TypeConst(ct_arg) => ct_arg.span,
427        }
428    }
429}
430
431/// A constant that enters the type system, used for arguments to const generics (e.g. array lengths).
432///
433/// These are distinct from [`AnonConst`] as anon consts in the type system are not allowed
434/// to use any generic parameters, therefore we must represent `N` differently. Additionally
435/// future designs for supporting generic parameters in const arguments will likely not use
436/// an anon const based design.
437///
438/// So, `ConstArg` (specifically, [`ConstArgKind`]) distinguishes between const args
439/// that are [just paths](ConstArgKind::Path) (currently just bare const params)
440/// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`).
441///
442/// For an explanation of the `Unambig` generic parameter see the dev-guide:
443/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
444#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
    ConstArg<'hir, Unambig> {
    #[inline]
    fn clone(&self) -> ConstArg<'hir, Unambig> {
        ConstArg {
            hir_id: ::core::clone::Clone::clone(&self.hir_id),
            kind: ::core::clone::Clone::clone(&self.kind),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl<'hir, Unambig: ::core::marker::Copy> ::core::marker::Copy for
    ConstArg<'hir, Unambig> {
}Copy, #[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
    ConstArg<'hir, Unambig> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "ConstArg",
            "hir_id", &self.hir_id, "kind", &self.kind, "span", &&self.span)
    }
}Debug, const _: () =
    {
        impl<'hir, Unambig, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ConstArg<'hir, Unambig> where __CTX: crate::HashStableContext,
            Unambig: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ConstArg {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
445#[repr(C)]
446pub struct ConstArg<'hir, Unambig = ()> {
447    #[stable_hasher(ignore)]
448    pub hir_id: HirId,
449    pub kind: ConstArgKind<'hir, Unambig>,
450    pub span: Span,
451}
452
453impl<'hir> ConstArg<'hir, AmbigArg> {
454    /// Converts a `ConstArg` in an ambiguous position to one in an unambiguous position.
455    ///
456    /// Functions accepting unambiguous consts may expect the [`ConstArgKind::Infer`] variant
457    /// to be used. Care should be taken to separately handle infer consts when calling this
458    /// function as it cannot be handled by downstream code making use of the returned const.
459    ///
460    /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or
461    /// specifically matching on [`GenericArg::Infer`] when handling generic arguments.
462    ///
463    /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer]
464    pub fn as_unambig_ct(&self) -> &ConstArg<'hir> {
465        // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the
466        // layout is the same across different ZST type arguments.
467        let ptr = self as *const ConstArg<'hir, AmbigArg> as *const ConstArg<'hir, ()>;
468        unsafe { &*ptr }
469    }
470}
471
472impl<'hir> ConstArg<'hir> {
473    /// Converts a `ConstArg` in an unambiguous position to one in an ambiguous position. This is
474    /// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions.
475    ///
476    /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if
477    /// infer consts are relevant to you then care should be taken to handle them separately.
478    pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> {
479        if let ConstArgKind::Infer(()) = self.kind {
480            return None;
481        }
482
483        // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the layout is
484        // the same across different ZST type arguments. We also asserted that the `self` is
485        // not a `ConstArgKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`.
486        let ptr = self as *const ConstArg<'hir> as *const ConstArg<'hir, AmbigArg>;
487        Some(unsafe { &*ptr })
488    }
489}
490
491impl<'hir, Unambig> ConstArg<'hir, Unambig> {
492    pub fn anon_const_hir_id(&self) -> Option<HirId> {
493        match self.kind {
494            ConstArgKind::Anon(ac) => Some(ac.hir_id),
495            _ => None,
496        }
497    }
498}
499
500/// See [`ConstArg`].
501#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
    ConstArgKind<'hir, Unambig> {
    #[inline]
    fn clone(&self) -> ConstArgKind<'hir, Unambig> {
        match self {
            ConstArgKind::Tup(__self_0) =>
                ConstArgKind::Tup(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Path(__self_0) =>
                ConstArgKind::Path(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Anon(__self_0) =>
                ConstArgKind::Anon(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Struct(__self_0, __self_1) =>
                ConstArgKind::Struct(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            ConstArgKind::TupleCall(__self_0, __self_1) =>
                ConstArgKind::TupleCall(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            ConstArgKind::Array(__self_0) =>
                ConstArgKind::Array(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Error(__self_0) =>
                ConstArgKind::Error(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Infer(__self_0) =>
                ConstArgKind::Infer(::core::clone::Clone::clone(__self_0)),
            ConstArgKind::Literal { lit: __self_0, negated: __self_1 } =>
                ConstArgKind::Literal {
                    lit: ::core::clone::Clone::clone(__self_0),
                    negated: ::core::clone::Clone::clone(__self_1),
                },
        }
    }
}Clone, #[automatically_derived]
impl<'hir, Unambig: ::core::marker::Copy> ::core::marker::Copy for
    ConstArgKind<'hir, Unambig> {
}Copy, #[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
    ConstArgKind<'hir, Unambig> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ConstArgKind::Tup(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
                    &__self_0),
            ConstArgKind::Path(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
                    &__self_0),
            ConstArgKind::Anon(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Anon",
                    &__self_0),
            ConstArgKind::Struct(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Struct",
                    __self_0, &__self_1),
            ConstArgKind::TupleCall(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "TupleCall", __self_0, &__self_1),
            ConstArgKind::Array(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
                    &__self_0),
            ConstArgKind::Error(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Error",
                    &__self_0),
            ConstArgKind::Infer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
                    &__self_0),
            ConstArgKind::Literal { lit: __self_0, negated: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Literal", "lit", __self_0, "negated", &__self_1),
        }
    }
}Debug, const _: () =
    {
        impl<'hir, Unambig, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ConstArgKind<'hir, Unambig> where __CTX: crate::HashStableContext,
            Unambig: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ConstArgKind::Tup(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Path(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Anon(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Struct(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::TupleCall(ref __binding_0, ref __binding_1) =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Array(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Error(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Infer(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstArgKind::Literal {
                        lit: ref __binding_0, negated: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
502#[repr(u8, C)]
503pub enum ConstArgKind<'hir, Unambig = ()> {
504    Tup(&'hir [&'hir ConstArg<'hir, Unambig>]),
505    /// **Note:** Currently this is only used for bare const params
506    /// (`N` where `fn foo<const N: usize>(...)`),
507    /// not paths to any const (`N` where `const N: usize = ...`).
508    ///
509    /// However, in the future, we'll be using it for all of those.
510    Path(QPath<'hir>),
511    Anon(&'hir AnonConst),
512    /// Represents construction of struct/struct variants
513    Struct(QPath<'hir>, &'hir [&'hir ConstArgExprField<'hir>]),
514    /// Tuple constructor variant
515    TupleCall(QPath<'hir>, &'hir [&'hir ConstArg<'hir>]),
516    /// Array literal argument
517    Array(&'hir ConstArgArrayExpr<'hir>),
518    /// Error const
519    Error(ErrorGuaranteed),
520    /// This variant is not always used to represent inference consts, sometimes
521    /// [`GenericArg::Infer`] is used instead.
522    Infer(Unambig),
523    Literal {
524        lit: LitKind,
525        negated: bool,
526    },
527}
528
529#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for ConstArgExprField<'hir> {
    #[inline]
    fn clone(&self) -> ConstArgExprField<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ConstArgExprField<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for ConstArgExprField<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "ConstArgExprField", "hir_id", &self.hir_id, "span", &self.span,
            "field", &self.field, "expr", &&self.expr)
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ConstArgExprField<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ConstArgExprField {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        field: ref __binding_2,
                        expr: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
530pub struct ConstArgExprField<'hir> {
531    pub hir_id: HirId,
532    pub span: Span,
533    pub field: Ident,
534    pub expr: &'hir ConstArg<'hir>,
535}
536
537#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for ConstArgArrayExpr<'hir> {
    #[inline]
    fn clone(&self) -> ConstArgArrayExpr<'hir> {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [&'hir ConstArg<'hir>]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ConstArgArrayExpr<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for ConstArgArrayExpr<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "ConstArgArrayExpr", "span", &self.span, "elems", &&self.elems)
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ConstArgArrayExpr<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ConstArgArrayExpr {
                        span: ref __binding_0, elems: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
538pub struct ConstArgArrayExpr<'hir> {
539    pub span: Span,
540    pub elems: &'hir [&'hir ConstArg<'hir>],
541}
542
543#[derive(#[automatically_derived]
impl ::core::clone::Clone for InferArg {
    #[inline]
    fn clone(&self) -> InferArg {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for InferArg { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for InferArg {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "InferArg",
            "hir_id", &self.hir_id, "span", &&self.span)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for InferArg where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    InferArg { hir_id: ref __binding_0, span: ref __binding_1 }
                        => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
544pub struct InferArg {
545    #[stable_hasher(ignore)]
546    pub hir_id: HirId,
547    pub span: Span,
548}
549
550impl InferArg {
551    pub fn to_ty(&self) -> Ty<'static> {
552        Ty { kind: TyKind::Infer(()), span: self.span, hir_id: self.hir_id }
553    }
554}
555
556#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericArg<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            GenericArg::Lifetime(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Lifetime", &__self_0),
            GenericArg::Type(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Type",
                    &__self_0),
            GenericArg::Const(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Const",
                    &__self_0),
            GenericArg::Infer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for GenericArg<'hir> {
    #[inline]
    fn clone(&self) -> GenericArg<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir, AmbigArg>>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir,
                AmbigArg>>;
        let _: ::core::clone::AssertParamIsClone<InferArg>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for GenericArg<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            GenericArg<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    GenericArg::Lifetime(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericArg::Type(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericArg::Const(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericArg::Infer(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
557pub enum GenericArg<'hir> {
558    Lifetime(&'hir Lifetime),
559    Type(&'hir Ty<'hir, AmbigArg>),
560    Const(&'hir ConstArg<'hir, AmbigArg>),
561    /// Inference variables in [`GenericArg`] are always represented by
562    /// `GenericArg::Infer` instead of the `Infer` variants on [`TyKind`] and
563    /// [`ConstArgKind`] as it is not clear until hir ty lowering whether a
564    /// `_` argument is a type or const argument.
565    ///
566    /// However, some builtin types' generic arguments are represented by [`TyKind`]
567    /// without a [`GenericArg`], instead directly storing a [`Ty`] or [`ConstArg`]. In
568    /// such cases they *are* represented by the `Infer` variants on [`TyKind`] and
569    /// [`ConstArgKind`] as it is not ambiguous whether the argument is a type or const.
570    Infer(InferArg),
571}
572
573impl GenericArg<'_> {
574    pub fn span(&self) -> Span {
575        match self {
576            GenericArg::Lifetime(l) => l.ident.span,
577            GenericArg::Type(t) => t.span,
578            GenericArg::Const(c) => c.span,
579            GenericArg::Infer(i) => i.span,
580        }
581    }
582
583    pub fn hir_id(&self) -> HirId {
584        match self {
585            GenericArg::Lifetime(l) => l.hir_id,
586            GenericArg::Type(t) => t.hir_id,
587            GenericArg::Const(c) => c.hir_id,
588            GenericArg::Infer(i) => i.hir_id,
589        }
590    }
591
592    pub fn descr(&self) -> &'static str {
593        match self {
594            GenericArg::Lifetime(_) => "lifetime",
595            GenericArg::Type(_) => "type",
596            GenericArg::Const(_) => "constant",
597            GenericArg::Infer(_) => "placeholder",
598        }
599    }
600
601    pub fn to_ord(&self) -> ast::ParamKindOrd {
602        match self {
603            GenericArg::Lifetime(_) => ast::ParamKindOrd::Lifetime,
604            GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => {
605                ast::ParamKindOrd::TypeOrConst
606            }
607        }
608    }
609
610    pub fn is_ty_or_const(&self) -> bool {
611        match self {
612            GenericArg::Lifetime(_) => false,
613            GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => true,
614        }
615    }
616}
617
618/// The generic arguments and associated item constraints of a path segment.
619#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericArgs<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "GenericArgs",
            "args", &self.args, "constraints", &self.constraints,
            "parenthesized", &self.parenthesized, "span_ext", &&self.span_ext)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for GenericArgs<'hir> {
    #[inline]
    fn clone(&self) -> GenericArgs<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericArg<'hir>]>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [AssocItemConstraint<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<GenericArgsParentheses>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for GenericArgs<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            GenericArgs<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    GenericArgs {
                        args: ref __binding_0,
                        constraints: ref __binding_1,
                        parenthesized: ref __binding_2,
                        span_ext: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
620pub struct GenericArgs<'hir> {
621    /// The generic arguments for this path segment.
622    pub args: &'hir [GenericArg<'hir>],
623    /// The associated item constraints for this path segment.
624    pub constraints: &'hir [AssocItemConstraint<'hir>],
625    /// Whether the arguments were written in parenthesized form (e.g., `Fn(T) -> U`).
626    ///
627    /// This is required mostly for pretty-printing and diagnostics,
628    /// but also for changing lifetime elision rules to be "function-like".
629    pub parenthesized: GenericArgsParentheses,
630    /// The span encompassing the arguments, constraints and the surrounding brackets (`<>` or `()`).
631    ///
632    /// For example:
633    ///
634    /// ```ignore (illustrative)
635    ///       Foo<A, B, AssocTy = D>           Fn(T, U, V) -> W
636    ///          ^^^^^^^^^^^^^^^^^^^             ^^^^^^^^^
637    /// ```
638    ///
639    /// Note that this may be:
640    /// - empty, if there are no generic brackets (but there may be hidden lifetimes)
641    /// - dummy, if this was generated during desugaring
642    pub span_ext: Span,
643}
644
645impl<'hir> GenericArgs<'hir> {
646    pub const fn none() -> Self {
647        Self {
648            args: &[],
649            constraints: &[],
650            parenthesized: GenericArgsParentheses::No,
651            span_ext: DUMMY_SP,
652        }
653    }
654
655    /// Obtain the list of input types and the output type if the generic arguments are parenthesized.
656    ///
657    /// Returns the `Ty0, Ty1, ...` and the `RetTy` in `Trait(Ty0, Ty1, ...) -> RetTy`.
658    /// Panics if the parenthesized arguments have an incorrect form (this shouldn't happen).
659    pub fn paren_sugar_inputs_output(&self) -> Option<(&[Ty<'hir>], &Ty<'hir>)> {
660        if self.parenthesized != GenericArgsParentheses::ParenSugar {
661            return None;
662        }
663
664        let inputs = self
665            .args
666            .iter()
667            .find_map(|arg| {
668                let GenericArg::Type(ty) = arg else { return None };
669                let TyKind::Tup(tys) = &ty.kind else { return None };
670                Some(tys)
671            })
672            .unwrap();
673
674        Some((inputs, self.paren_sugar_output_inner()))
675    }
676
677    /// Obtain the output type if the generic arguments are parenthesized.
678    ///
679    /// Returns the `RetTy` in `Trait(Ty0, Ty1, ...) -> RetTy`.
680    /// Panics if the parenthesized arguments have an incorrect form (this shouldn't happen).
681    pub fn paren_sugar_output(&self) -> Option<&Ty<'hir>> {
682        (self.parenthesized == GenericArgsParentheses::ParenSugar)
683            .then(|| self.paren_sugar_output_inner())
684    }
685
686    fn paren_sugar_output_inner(&self) -> &Ty<'hir> {
687        let [constraint] = self.constraints.try_into().unwrap();
688        if true {
    match (&constraint.ident.name, &sym::Output) {
        (left_val, right_val) => {
            if !(*left_val == *right_val) {
                let kind = ::core::panicking::AssertKind::Eq;
                ::core::panicking::assert_failed(kind, &*left_val,
                    &*right_val, ::core::option::Option::None);
            }
        }
    };
};debug_assert_eq!(constraint.ident.name, sym::Output);
689        constraint.ty().unwrap()
690    }
691
692    pub fn has_err(&self) -> Option<ErrorGuaranteed> {
693        self.args
694            .iter()
695            .find_map(|arg| {
696                let GenericArg::Type(ty) = arg else { return None };
697                let TyKind::Err(guar) = ty.kind else { return None };
698                Some(guar)
699            })
700            .or_else(|| {
701                self.constraints.iter().find_map(|constraint| {
702                    let TyKind::Err(guar) = constraint.ty()?.kind else { return None };
703                    Some(guar)
704                })
705            })
706    }
707
708    #[inline]
709    pub fn num_lifetime_params(&self) -> usize {
710        self.args.iter().filter(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
711    }
712
713    #[inline]
714    pub fn has_lifetime_params(&self) -> bool {
715        self.args.iter().any(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_)))
716    }
717
718    #[inline]
719    /// This function returns the number of type and const generic params.
720    /// It should only be used for diagnostics.
721    pub fn num_generic_params(&self) -> usize {
722        self.args.iter().filter(|arg| !#[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
723    }
724
725    /// The span encompassing the arguments and constraints[^1] inside the surrounding brackets.
726    ///
727    /// Returns `None` if the span is empty (i.e., no brackets) or dummy.
728    ///
729    /// [^1]: Unless of the form `-> Ty` (see [`GenericArgsParentheses`]).
730    pub fn span(&self) -> Option<Span> {
731        let span_ext = self.span_ext()?;
732        Some(span_ext.with_lo(span_ext.lo() + BytePos(1)).with_hi(span_ext.hi() - BytePos(1)))
733    }
734
735    /// Returns span encompassing arguments and their surrounding `<>` or `()`
736    pub fn span_ext(&self) -> Option<Span> {
737        Some(self.span_ext).filter(|span| !span.is_empty())
738    }
739
740    pub fn is_empty(&self) -> bool {
741        self.args.is_empty()
742    }
743}
744
745#[derive(#[automatically_derived]
impl ::core::marker::Copy for GenericArgsParentheses { }Copy, #[automatically_derived]
impl ::core::clone::Clone for GenericArgsParentheses {
    #[inline]
    fn clone(&self) -> GenericArgsParentheses { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for GenericArgsParentheses {
    #[inline]
    fn eq(&self, other: &GenericArgsParentheses) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenericArgsParentheses {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for GenericArgsParentheses {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                GenericArgsParentheses::No => "No",
                GenericArgsParentheses::ReturnTypeNotation =>
                    "ReturnTypeNotation",
                GenericArgsParentheses::ParenSugar => "ParenSugar",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for GenericArgsParentheses where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    GenericArgsParentheses::No => {}
                    GenericArgsParentheses::ReturnTypeNotation => {}
                    GenericArgsParentheses::ParenSugar => {}
                }
            }
        }
    };HashStable_Generic)]
746pub enum GenericArgsParentheses {
747    No,
748    /// Bounds for `feature(return_type_notation)`, like `T: Trait<method(..): Send>`,
749    /// where the args are explicitly elided with `..`
750    ReturnTypeNotation,
751    /// parenthesized function-family traits, like `T: Fn(u32) -> i32`
752    ParenSugar,
753}
754
755/// The modifiers on a trait bound.
756#[derive(#[automatically_derived]
impl ::core::marker::Copy for TraitBoundModifiers { }Copy, #[automatically_derived]
impl ::core::clone::Clone for TraitBoundModifiers {
    #[inline]
    fn clone(&self) -> TraitBoundModifiers {
        let _: ::core::clone::AssertParamIsClone<BoundConstness>;
        let _: ::core::clone::AssertParamIsClone<BoundPolarity>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for TraitBoundModifiers {
    #[inline]
    fn eq(&self, other: &TraitBoundModifiers) -> bool {
        self.constness == other.constness && self.polarity == other.polarity
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for TraitBoundModifiers {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<BoundConstness>;
        let _: ::core::cmp::AssertParamIsEq<BoundPolarity>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for TraitBoundModifiers {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.constness, state);
        ::core::hash::Hash::hash(&self.polarity, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for TraitBoundModifiers {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "TraitBoundModifiers", "constness", &self.constness, "polarity",
            &&self.polarity)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for TraitBoundModifiers where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitBoundModifiers {
                        constness: ref __binding_0, polarity: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
757pub struct TraitBoundModifiers {
758    pub constness: BoundConstness,
759    pub polarity: BoundPolarity,
760}
761
762impl TraitBoundModifiers {
763    pub const NONE: Self =
764        TraitBoundModifiers { constness: BoundConstness::Never, polarity: BoundPolarity::Positive };
765}
766
767#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for GenericBound<'hir> {
    #[inline]
    fn clone(&self) -> GenericBound<'hir> {
        let _: ::core::clone::AssertParamIsClone<PolyTraitRef<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [PreciseCapturingArg<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for GenericBound<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericBound<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            GenericBound::Trait(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Trait",
                    &__self_0),
            GenericBound::Outlives(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Outlives", &__self_0),
            GenericBound::Use(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
                    __self_0, &__self_1),
        }
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            GenericBound<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    GenericBound::Trait(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericBound::Outlives(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericBound::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
768pub enum GenericBound<'hir> {
769    Trait(PolyTraitRef<'hir>),
770    Outlives(&'hir Lifetime),
771    Use(&'hir [PreciseCapturingArg<'hir>], Span),
772}
773
774impl GenericBound<'_> {
775    pub fn trait_ref(&self) -> Option<&TraitRef<'_>> {
776        match self {
777            GenericBound::Trait(data) => Some(&data.trait_ref),
778            _ => None,
779        }
780    }
781
782    pub fn span(&self) -> Span {
783        match self {
784            GenericBound::Trait(t, ..) => t.span,
785            GenericBound::Outlives(l) => l.ident.span,
786            GenericBound::Use(_, span) => *span,
787        }
788    }
789}
790
791pub type GenericBounds<'hir> = &'hir [GenericBound<'hir>];
792
793#[derive(#[automatically_derived]
impl ::core::marker::Copy for MissingLifetimeKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for MissingLifetimeKind {
    #[inline]
    fn clone(&self) -> MissingLifetimeKind { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for MissingLifetimeKind {
    #[inline]
    fn eq(&self, other: &MissingLifetimeKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MissingLifetimeKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for MissingLifetimeKind {
    #[inline]
    fn partial_cmp(&self, other: &MissingLifetimeKind)
        -> ::core::option::Option<::core::cmp::Ordering> {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for MissingLifetimeKind {
    #[inline]
    fn cmp(&self, other: &MissingLifetimeKind) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for MissingLifetimeKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for MissingLifetimeKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    MissingLifetimeKind::Underscore => {}
                    MissingLifetimeKind::Ampersand => {}
                    MissingLifetimeKind::Comma => {}
                    MissingLifetimeKind::Brackets => {}
                }
            }
        }
    };HashStable_Generic, #[automatically_derived]
impl ::core::fmt::Debug for MissingLifetimeKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                MissingLifetimeKind::Underscore => "Underscore",
                MissingLifetimeKind::Ampersand => "Ampersand",
                MissingLifetimeKind::Comma => "Comma",
                MissingLifetimeKind::Brackets => "Brackets",
            })
    }
}Debug)]
794pub enum MissingLifetimeKind {
795    /// An explicit `'_`.
796    Underscore,
797    /// An elided lifetime `&' ty`.
798    Ampersand,
799    /// An elided lifetime in brackets with written brackets.
800    Comma,
801    /// An elided lifetime with elided brackets.
802    Brackets,
803}
804
805#[derive(#[automatically_derived]
impl ::core::marker::Copy for LifetimeParamKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LifetimeParamKind {
    #[inline]
    fn clone(&self) -> LifetimeParamKind {
        let _: ::core::clone::AssertParamIsClone<MissingLifetimeKind>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LifetimeParamKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            LifetimeParamKind::Explicit =>
                ::core::fmt::Formatter::write_str(f, "Explicit"),
            LifetimeParamKind::Elided(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Elided",
                    &__self_0),
            LifetimeParamKind::Error =>
                ::core::fmt::Formatter::write_str(f, "Error"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LifetimeParamKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LifetimeParamKind::Explicit => {}
                    LifetimeParamKind::Elided(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    LifetimeParamKind::Error => {}
                }
            }
        }
    };HashStable_Generic)]
806pub enum LifetimeParamKind {
807    // Indicates that the lifetime definition was explicitly declared (e.g., in
808    // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`).
809    Explicit,
810
811    // Indication that the lifetime was elided (e.g., in both cases in
812    // `fn foo(x: &u8) -> &'_ u8 { x }`).
813    Elided(MissingLifetimeKind),
814
815    // Indication that the lifetime name was somehow in error.
816    Error,
817}
818
819#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericParamKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            GenericParamKind::Lifetime { kind: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Lifetime", "kind", &__self_0),
            GenericParamKind::Type { default: __self_0, synthetic: __self_1 }
                =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Type",
                    "default", __self_0, "synthetic", &__self_1),
            GenericParamKind::Const { ty: __self_0, default: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Const",
                    "ty", __self_0, "default", &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for GenericParamKind<'hir> {
    #[inline]
    fn clone(&self) -> GenericParamKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<LifetimeParamKind>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<Option<&'hir ConstArg<'hir>>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for GenericParamKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            GenericParamKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    GenericParamKind::Lifetime { kind: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    GenericParamKind::Type {
                        default: ref __binding_0, synthetic: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    GenericParamKind::Const {
                        ty: ref __binding_0, default: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
820pub enum GenericParamKind<'hir> {
821    /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
822    Lifetime {
823        kind: LifetimeParamKind,
824    },
825    Type {
826        default: Option<&'hir Ty<'hir>>,
827        synthetic: bool,
828    },
829    Const {
830        ty: &'hir Ty<'hir>,
831        /// Optional default value for the const generic param
832        default: Option<&'hir ConstArg<'hir>>,
833    },
834}
835
836#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for GenericParam<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["hir_id", "def_id", "name", "span", "pure_wrt_drop", "kind",
                        "colon_span", "source"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.hir_id, &self.def_id, &self.name, &self.span,
                        &self.pure_wrt_drop, &self.kind, &self.colon_span,
                        &&self.source];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "GenericParam",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for GenericParam<'hir> {
    #[inline]
    fn clone(&self) -> GenericParam<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<ParamName>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<GenericParamKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<Span>>;
        let _: ::core::clone::AssertParamIsClone<GenericParamSource>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for GenericParam<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            GenericParam<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    GenericParam {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        name: ref __binding_2,
                        span: ref __binding_3,
                        pure_wrt_drop: ref __binding_4,
                        kind: ref __binding_5,
                        colon_span: ref __binding_6,
                        source: ref __binding_7 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                        { __binding_7.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
837pub struct GenericParam<'hir> {
838    #[stable_hasher(ignore)]
839    pub hir_id: HirId,
840    pub def_id: LocalDefId,
841    pub name: ParamName,
842    pub span: Span,
843    pub pure_wrt_drop: bool,
844    pub kind: GenericParamKind<'hir>,
845    pub colon_span: Option<Span>,
846    pub source: GenericParamSource,
847}
848
849impl<'hir> GenericParam<'hir> {
850    /// Synthetic type-parameters are inserted after normal ones.
851    /// In order for normal parameters to be able to refer to synthetic ones,
852    /// scans them first.
853    pub fn is_impl_trait(&self) -> bool {
854        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Type { synthetic: true, .. } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Type { synthetic: true, .. })
855    }
856
857    /// This can happen for `async fn`, e.g. `async fn f<'_>(&'_ self)`.
858    ///
859    /// See `lifetime_to_generic_param` in `rustc_ast_lowering` for more information.
860    pub fn is_elided_lifetime(&self) -> bool {
861        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) })
862    }
863
864    pub fn is_lifetime(&self) -> bool {
865        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Lifetime { .. } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Lifetime { .. })
866    }
867}
868
869/// Records where the generic parameter originated from.
870///
871/// This can either be from an item's generics, in which case it's typically
872/// early-bound (but can be a late-bound lifetime in functions, for example),
873/// or from a `for<...>` binder, in which case it's late-bound (and notably,
874/// does not show up in the parent item's generics).
875#[derive(#[automatically_derived]
impl ::core::fmt::Debug for GenericParamSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                GenericParamSource::Generics => "Generics",
                GenericParamSource::Binder => "Binder",
            })
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for GenericParamSource {
    #[inline]
    fn clone(&self) -> GenericParamSource { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GenericParamSource { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for GenericParamSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    GenericParamSource::Generics => {}
                    GenericParamSource::Binder => {}
                }
            }
        }
    };HashStable_Generic)]
876pub enum GenericParamSource {
877    // Early or late-bound parameters defined on an item
878    Generics,
879    // Late-bound parameters defined via a `for<...>`
880    Binder,
881}
882
883#[derive(#[automatically_derived]
impl ::core::default::Default for GenericParamCount {
    #[inline]
    fn default() -> GenericParamCount {
        GenericParamCount {
            lifetimes: ::core::default::Default::default(),
            types: ::core::default::Default::default(),
            consts: ::core::default::Default::default(),
            infer: ::core::default::Default::default(),
        }
    }
}Default)]
884pub struct GenericParamCount {
885    pub lifetimes: usize,
886    pub types: usize,
887    pub consts: usize,
888    pub infer: usize,
889}
890
891/// Represents lifetimes and type parameters attached to a declaration
892/// of a function, enum, trait, etc.
893#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Generics<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "Generics",
            "params", &self.params, "predicates", &self.predicates,
            "has_where_clause_predicates", &self.has_where_clause_predicates,
            "where_clause_span", &self.where_clause_span, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Generics<'hir> {
    #[inline]
    fn clone(&self) -> Generics<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [WherePredicate<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Generics<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Generics<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Generics {
                        params: ref __binding_0,
                        predicates: ref __binding_1,
                        has_where_clause_predicates: ref __binding_2,
                        where_clause_span: ref __binding_3,
                        span: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
894pub struct Generics<'hir> {
895    pub params: &'hir [GenericParam<'hir>],
896    pub predicates: &'hir [WherePredicate<'hir>],
897    pub has_where_clause_predicates: bool,
898    pub where_clause_span: Span,
899    pub span: Span,
900}
901
902impl<'hir> Generics<'hir> {
903    pub const fn empty() -> &'hir Generics<'hir> {
904        const NOPE: Generics<'_> = Generics {
905            params: &[],
906            predicates: &[],
907            has_where_clause_predicates: false,
908            where_clause_span: DUMMY_SP,
909            span: DUMMY_SP,
910        };
911        &NOPE
912    }
913
914    pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'hir>> {
915        self.params.iter().find(|&param| name == param.name.ident().name)
916    }
917
918    /// If there are generic parameters, return where to introduce a new one.
919    pub fn span_for_lifetime_suggestion(&self) -> Option<Span> {
920        if let Some(first) = self.params.first()
921            && self.span.contains(first.span)
922        {
923            // `fn foo<A>(t: impl Trait)`
924            //         ^ suggest `'a, ` here
925            Some(first.span.shrink_to_lo())
926        } else {
927            None
928        }
929    }
930
931    /// If there are generic parameters, return where to introduce a new one.
932    pub fn span_for_param_suggestion(&self) -> Option<Span> {
933        self.params.iter().any(|p| self.span.contains(p.span)).then(|| {
934            // `fn foo<A>(t: impl Trait)`
935            //          ^ suggest `, T: Trait` here
936            self.span.with_lo(self.span.hi() - BytePos(1)).shrink_to_lo()
937        })
938    }
939
940    /// `Span` where further predicates would be suggested, accounting for trailing commas, like
941    ///  in `fn foo<T>(t: T) where T: Foo,` so we don't suggest two trailing commas.
942    pub fn tail_span_for_predicate_suggestion(&self) -> Span {
943        let end = self.where_clause_span.shrink_to_hi();
944        if self.has_where_clause_predicates {
945            self.predicates
946                .iter()
947                .rfind(|&p| p.kind.in_where_clause())
948                .map_or(end, |p| p.span)
949                .shrink_to_hi()
950                .to(end)
951        } else {
952            end
953        }
954    }
955
956    pub fn add_where_or_trailing_comma(&self) -> &'static str {
957        if self.has_where_clause_predicates {
958            ","
959        } else if self.where_clause_span.is_empty() {
960            " where"
961        } else {
962            // No where clause predicates, but we have `where` token
963            ""
964        }
965    }
966
967    pub fn bounds_for_param(
968        &self,
969        param_def_id: LocalDefId,
970    ) -> impl Iterator<Item = &WhereBoundPredicate<'hir>> {
971        self.predicates.iter().filter_map(move |pred| match pred.kind {
972            WherePredicateKind::BoundPredicate(bp)
973                if bp.is_param_bound(param_def_id.to_def_id()) =>
974            {
975                Some(bp)
976            }
977            _ => None,
978        })
979    }
980
981    pub fn outlives_for_param(
982        &self,
983        param_def_id: LocalDefId,
984    ) -> impl Iterator<Item = &WhereRegionPredicate<'_>> {
985        self.predicates.iter().filter_map(move |pred| match pred.kind {
986            WherePredicateKind::RegionPredicate(rp) if rp.is_param_bound(param_def_id) => Some(rp),
987            _ => None,
988        })
989    }
990
991    /// Returns a suggestable empty span right after the "final" bound of the generic parameter.
992    ///
993    /// If that bound needs to be wrapped in parentheses to avoid ambiguity with
994    /// subsequent bounds, it also returns an empty span for an open parenthesis
995    /// as the second component.
996    ///
997    /// E.g., adding `+ 'static` after `Fn() -> dyn Future<Output = ()>` or
998    /// `Fn() -> &'static dyn Debug` requires parentheses:
999    /// `Fn() -> (dyn Future<Output = ()>) + 'static` and
1000    /// `Fn() -> &'static (dyn Debug) + 'static`, respectively.
1001    pub fn bounds_span_for_suggestions(
1002        &self,
1003        param_def_id: LocalDefId,
1004    ) -> Option<(Span, Option<Span>)> {
1005        self.bounds_for_param(param_def_id).flat_map(|bp| bp.bounds.iter().rev()).find_map(
1006            |bound| {
1007                let span_for_parentheses = if let Some(trait_ref) = bound.trait_ref()
1008                    && let [.., segment] = trait_ref.path.segments
1009                    && let Some(ret_ty) = segment.args().paren_sugar_output()
1010                    && let ret_ty = ret_ty.peel_refs()
1011                    && let TyKind::TraitObject(_, tagged_ptr) = ret_ty.kind
1012                    && let TraitObjectSyntax::Dyn = tagged_ptr.tag()
1013                    && ret_ty.span.can_be_used_for_suggestions()
1014                {
1015                    Some(ret_ty.span)
1016                } else {
1017                    None
1018                };
1019
1020                span_for_parentheses.map_or_else(
1021                    || {
1022                        // We include bounds that come from a `#[derive(_)]` but point at the user's
1023                        // code, as we use this method to get a span appropriate for suggestions.
1024                        let bs = bound.span();
1025                        // We use `from_expansion` instead of `can_be_used_for_suggestions` because
1026                        // the trait bound from imperfect derives do point at the type parameter,
1027                        // but expanded to a where clause, so we want to ignore those. This is only
1028                        // true for derive intrinsics.
1029                        bs.from_expansion().not().then(|| (bs.shrink_to_hi(), None))
1030                    },
1031                    |span| Some((span.shrink_to_hi(), Some(span.shrink_to_lo()))),
1032                )
1033            },
1034        )
1035    }
1036
1037    pub fn span_for_predicate_removal(&self, pos: usize) -> Span {
1038        let predicate = &self.predicates[pos];
1039        let span = predicate.span;
1040
1041        if !predicate.kind.in_where_clause() {
1042            // <T: ?Sized, U>
1043            //   ^^^^^^^^
1044            return span;
1045        }
1046
1047        // We need to find out which comma to remove.
1048        if pos < self.predicates.len() - 1 {
1049            let next_pred = &self.predicates[pos + 1];
1050            if next_pred.kind.in_where_clause() {
1051                // where T: ?Sized, Foo: Bar,
1052                //       ^^^^^^^^^^^
1053                return span.until(next_pred.span);
1054            }
1055        }
1056
1057        if pos > 0 {
1058            let prev_pred = &self.predicates[pos - 1];
1059            if prev_pred.kind.in_where_clause() {
1060                // where Foo: Bar, T: ?Sized,
1061                //               ^^^^^^^^^^^
1062                return prev_pred.span.shrink_to_hi().to(span);
1063            }
1064        }
1065
1066        // This is the only predicate in the where clause.
1067        // where T: ?Sized
1068        // ^^^^^^^^^^^^^^^
1069        self.where_clause_span
1070    }
1071
1072    pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) -> Span {
1073        let predicate = &self.predicates[predicate_pos];
1074        let bounds = predicate.kind.bounds();
1075
1076        if bounds.len() == 1 {
1077            return self.span_for_predicate_removal(predicate_pos);
1078        }
1079
1080        let bound_span = bounds[bound_pos].span();
1081        if bound_pos < bounds.len() - 1 {
1082            // If there's another bound after the current bound
1083            // include the following '+' e.g.:
1084            //
1085            //  `T: Foo + CurrentBound + Bar`
1086            //            ^^^^^^^^^^^^^^^
1087            bound_span.to(bounds[bound_pos + 1].span().shrink_to_lo())
1088        } else {
1089            // If the current bound is the last bound
1090            // include the preceding '+' E.g.:
1091            //
1092            //  `T: Foo + Bar + CurrentBound`
1093            //               ^^^^^^^^^^^^^^^
1094            bound_span.with_lo(bounds[bound_pos - 1].span().hi())
1095        }
1096    }
1097}
1098
1099/// A single predicate in a where-clause.
1100#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WherePredicate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "WherePredicate", "hir_id", &self.hir_id, "span", &self.span,
            "kind", &&self.kind)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for WherePredicate<'hir> {
    #[inline]
    fn clone(&self) -> WherePredicate<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir WherePredicateKind<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WherePredicate<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            WherePredicate<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    WherePredicate {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1101pub struct WherePredicate<'hir> {
1102    #[stable_hasher(ignore)]
1103    pub hir_id: HirId,
1104    pub span: Span,
1105    pub kind: &'hir WherePredicateKind<'hir>,
1106}
1107
1108/// The kind of a single predicate in a where-clause.
1109#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WherePredicateKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            WherePredicateKind::BoundPredicate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "BoundPredicate", &__self_0),
            WherePredicateKind::RegionPredicate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "RegionPredicate", &__self_0),
            WherePredicateKind::EqPredicate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "EqPredicate", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for WherePredicateKind<'hir> {
    #[inline]
    fn clone(&self) -> WherePredicateKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<WhereBoundPredicate<'hir>>;
        let _: ::core::clone::AssertParamIsClone<WhereRegionPredicate<'hir>>;
        let _: ::core::clone::AssertParamIsClone<WhereEqPredicate<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WherePredicateKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            WherePredicateKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    WherePredicateKind::BoundPredicate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    WherePredicateKind::RegionPredicate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    WherePredicateKind::EqPredicate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1110pub enum WherePredicateKind<'hir> {
1111    /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
1112    BoundPredicate(WhereBoundPredicate<'hir>),
1113    /// A lifetime predicate (e.g., `'a: 'b + 'c`).
1114    RegionPredicate(WhereRegionPredicate<'hir>),
1115    /// An equality predicate (unsupported).
1116    EqPredicate(WhereEqPredicate<'hir>),
1117}
1118
1119impl<'hir> WherePredicateKind<'hir> {
1120    pub fn in_where_clause(&self) -> bool {
1121        match self {
1122            WherePredicateKind::BoundPredicate(p) => p.origin == PredicateOrigin::WhereClause,
1123            WherePredicateKind::RegionPredicate(p) => p.in_where_clause,
1124            WherePredicateKind::EqPredicate(_) => false,
1125        }
1126    }
1127
1128    pub fn bounds(&self) -> GenericBounds<'hir> {
1129        match self {
1130            WherePredicateKind::BoundPredicate(p) => p.bounds,
1131            WherePredicateKind::RegionPredicate(p) => p.bounds,
1132            WherePredicateKind::EqPredicate(_) => &[],
1133        }
1134    }
1135}
1136
1137#[derive(#[automatically_derived]
impl ::core::marker::Copy for PredicateOrigin { }Copy, #[automatically_derived]
impl ::core::clone::Clone for PredicateOrigin {
    #[inline]
    fn clone(&self) -> PredicateOrigin { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for PredicateOrigin {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                PredicateOrigin::WhereClause => "WhereClause",
                PredicateOrigin::GenericParam => "GenericParam",
                PredicateOrigin::ImplTrait => "ImplTrait",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for PredicateOrigin where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    PredicateOrigin::WhereClause => {}
                    PredicateOrigin::GenericParam => {}
                    PredicateOrigin::ImplTrait => {}
                }
            }
        }
    };HashStable_Generic, #[automatically_derived]
impl ::core::cmp::PartialEq for PredicateOrigin {
    #[inline]
    fn eq(&self, other: &PredicateOrigin) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for PredicateOrigin {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq)]
1138pub enum PredicateOrigin {
1139    WhereClause,
1140    GenericParam,
1141    ImplTrait,
1142}
1143
1144/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
1145#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereBoundPredicate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "WhereBoundPredicate", "origin", &self.origin,
            "bound_generic_params", &self.bound_generic_params, "bounded_ty",
            &self.bounded_ty, "bounds", &&self.bounds)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for WhereBoundPredicate<'hir> {
    #[inline]
    fn clone(&self) -> WhereBoundPredicate<'hir> {
        let _: ::core::clone::AssertParamIsClone<PredicateOrigin>;
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WhereBoundPredicate<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            WhereBoundPredicate<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    WhereBoundPredicate {
                        origin: ref __binding_0,
                        bound_generic_params: ref __binding_1,
                        bounded_ty: ref __binding_2,
                        bounds: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1146pub struct WhereBoundPredicate<'hir> {
1147    /// Origin of the predicate.
1148    pub origin: PredicateOrigin,
1149    /// Any generics from a `for` binding.
1150    pub bound_generic_params: &'hir [GenericParam<'hir>],
1151    /// The type being bounded.
1152    pub bounded_ty: &'hir Ty<'hir>,
1153    /// Trait and lifetime bounds (e.g., `Clone + Send + 'static`).
1154    pub bounds: GenericBounds<'hir>,
1155}
1156
1157impl<'hir> WhereBoundPredicate<'hir> {
1158    /// Returns `true` if `param_def_id` matches the `bounded_ty` of this predicate.
1159    pub fn is_param_bound(&self, param_def_id: DefId) -> bool {
1160        self.bounded_ty.as_generic_param().is_some_and(|(def_id, _)| def_id == param_def_id)
1161    }
1162}
1163
1164/// A lifetime predicate (e.g., `'a: 'b + 'c`).
1165#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereRegionPredicate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "WhereRegionPredicate", "in_where_clause", &self.in_where_clause,
            "lifetime", &self.lifetime, "bounds", &&self.bounds)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for WhereRegionPredicate<'hir> {
    #[inline]
    fn clone(&self) -> WhereRegionPredicate<'hir> {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WhereRegionPredicate<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            WhereRegionPredicate<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    WhereRegionPredicate {
                        in_where_clause: ref __binding_0,
                        lifetime: ref __binding_1,
                        bounds: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1166pub struct WhereRegionPredicate<'hir> {
1167    pub in_where_clause: bool,
1168    pub lifetime: &'hir Lifetime,
1169    pub bounds: GenericBounds<'hir>,
1170}
1171
1172impl<'hir> WhereRegionPredicate<'hir> {
1173    /// Returns `true` if `param_def_id` matches the `lifetime` of this predicate.
1174    fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
1175        self.lifetime.kind == LifetimeKind::Param(param_def_id)
1176    }
1177}
1178
1179/// An equality predicate (e.g., `T = int`); currently unsupported.
1180#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for WhereEqPredicate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "WhereEqPredicate", "lhs_ty", &self.lhs_ty, "rhs_ty",
            &&self.rhs_ty)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for WhereEqPredicate<'hir> {
    #[inline]
    fn clone(&self) -> WhereEqPredicate<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WhereEqPredicate<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            WhereEqPredicate<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    WhereEqPredicate {
                        lhs_ty: ref __binding_0, rhs_ty: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1181pub struct WhereEqPredicate<'hir> {
1182    pub lhs_ty: &'hir Ty<'hir>,
1183    pub rhs_ty: &'hir Ty<'hir>,
1184}
1185
1186/// HIR node coupled with its parent's id in the same HIR owner.
1187///
1188/// The parent is trash when the node is a HIR owner.
1189#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for ParentedNode<'tcx> {
    #[inline]
    fn clone(&self) -> ParentedNode<'tcx> {
        let _: ::core::clone::AssertParamIsClone<ItemLocalId>;
        let _: ::core::clone::AssertParamIsClone<Node<'tcx>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::marker::Copy for ParentedNode<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for ParentedNode<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "ParentedNode",
            "parent", &self.parent, "node", &&self.node)
    }
}Debug)]
1190pub struct ParentedNode<'tcx> {
1191    pub parent: ItemLocalId,
1192    pub node: Node<'tcx>,
1193}
1194
1195/// Arguments passed to an attribute macro.
1196#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttrArgs {
    #[inline]
    fn clone(&self) -> AttrArgs {
        match self {
            AttrArgs::Empty => AttrArgs::Empty,
            AttrArgs::Delimited(__self_0) =>
                AttrArgs::Delimited(::core::clone::Clone::clone(__self_0)),
            AttrArgs::Eq { eq_span: __self_0, expr: __self_1 } =>
                AttrArgs::Eq {
                    eq_span: ::core::clone::Clone::clone(__self_0),
                    expr: ::core::clone::Clone::clone(__self_1),
                },
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttrArgs {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AttrArgs::Empty => ::core::fmt::Formatter::write_str(f, "Empty"),
            AttrArgs::Delimited(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Delimited", &__self_0),
            AttrArgs::Eq { eq_span: __self_0, expr: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Eq",
                    "eq_span", __self_0, "expr", &__self_1),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AttrArgs where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    AttrArgs::Empty => {}
                    AttrArgs::Delimited(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    AttrArgs::Eq {
                        eq_span: ref __binding_0, expr: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for AttrArgs {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        AttrArgs::Empty => { 0usize }
                        AttrArgs::Delimited(ref __binding_0) => { 1usize }
                        AttrArgs::Eq {
                            eq_span: ref __binding_0, expr: ref __binding_1 } => {
                            2usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    AttrArgs::Empty => {}
                    AttrArgs::Delimited(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    AttrArgs::Eq {
                        eq_span: ref __binding_0, expr: ref __binding_1 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for AttrArgs {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { AttrArgs::Empty }
                    1usize => {
                        AttrArgs::Delimited(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        AttrArgs::Eq {
                            eq_span: ::rustc_serialize::Decodable::decode(__decoder),
                            expr: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AttrArgs`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
1197pub enum AttrArgs {
1198    /// No arguments: `#[attr]`.
1199    Empty,
1200    /// Delimited arguments: `#[attr()/[]/{}]`.
1201    Delimited(DelimArgs),
1202    /// Arguments of a key-value attribute: `#[attr = "value"]`.
1203    Eq {
1204        /// Span of the `=` token.
1205        eq_span: Span,
1206        /// The "value".
1207        expr: MetaItemLit,
1208    },
1209}
1210
1211#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttrPath {
    #[inline]
    fn clone(&self) -> AttrPath {
        AttrPath {
            segments: ::core::clone::Clone::clone(&self.segments),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttrPath {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "AttrPath",
            "segments", &self.segments, "span", &&self.span)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AttrPath where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    AttrPath { segments: ref __binding_0, span: ref __binding_1
                        } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for AttrPath {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    AttrPath { segments: ref __binding_0, span: ref __binding_1
                        } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for AttrPath {
            fn decode(__decoder: &mut __D) -> Self {
                AttrPath {
                    segments: ::rustc_serialize::Decodable::decode(__decoder),
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable)]
1212pub struct AttrPath {
1213    pub segments: Box<[Symbol]>,
1214    pub span: Span,
1215}
1216
1217impl IntoDiagArg for AttrPath {
1218    fn into_diag_arg(self, path: &mut Option<std::path::PathBuf>) -> DiagArgValue {
1219        self.to_string().into_diag_arg(path)
1220    }
1221}
1222
1223impl AttrPath {
1224    pub fn from_ast(path: &ast::Path, lower_span: impl Copy + Fn(Span) -> Span) -> Self {
1225        AttrPath {
1226            segments: path
1227                .segments
1228                .iter()
1229                .map(|i| i.ident.name)
1230                .collect::<Vec<_>>()
1231                .into_boxed_slice(),
1232            span: lower_span(path.span),
1233        }
1234    }
1235}
1236
1237impl fmt::Display for AttrPath {
1238    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1239        f.write_fmt(format_args!("{0}",
        join_path_idents(self.segments.iter().map(|i|
                    Ident { name: *i, span: DUMMY_SP }))))write!(
1240            f,
1241            "{}",
1242            join_path_idents(self.segments.iter().map(|i| Ident { name: *i, span: DUMMY_SP }))
1243        )
1244    }
1245}
1246
1247#[derive(#[automatically_derived]
impl ::core::clone::Clone for AttrItem {
    #[inline]
    fn clone(&self) -> AttrItem {
        AttrItem {
            path: ::core::clone::Clone::clone(&self.path),
            args: ::core::clone::Clone::clone(&self.args),
            id: ::core::clone::Clone::clone(&self.id),
            style: ::core::clone::Clone::clone(&self.style),
            span: ::core::clone::Clone::clone(&self.span),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AttrItem {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "AttrItem",
            "path", &self.path, "args", &self.args, "id", &self.id, "style",
            &self.style, "span", &&self.span)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AttrItem where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    AttrItem {
                        path: ref __binding_0,
                        args: ref __binding_1,
                        id: ref __binding_2,
                        style: ref __binding_3,
                        span: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for AttrItem {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    AttrItem {
                        path: ref __binding_0,
                        args: ref __binding_1,
                        id: ref __binding_2,
                        style: ref __binding_3,
                        span: ref __binding_4 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for AttrItem {
            fn decode(__decoder: &mut __D) -> Self {
                AttrItem {
                    path: ::rustc_serialize::Decodable::decode(__decoder),
                    args: ::rustc_serialize::Decodable::decode(__decoder),
                    id: ::rustc_serialize::Decodable::decode(__decoder),
                    style: ::rustc_serialize::Decodable::decode(__decoder),
                    span: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable)]
1248pub struct AttrItem {
1249    // Not lowered to hir::Path because we have no NodeId to resolve to.
1250    pub path: AttrPath,
1251    pub args: AttrArgs,
1252    pub id: HashIgnoredAttrId,
1253    /// Denotes if the attribute decorates the following construct (outer)
1254    /// or the construct this attribute is contained within (inner).
1255    pub style: AttrStyle,
1256    /// Span of the entire attribute
1257    pub span: Span,
1258}
1259
1260/// The derived implementation of [`HashStable_Generic`] on [`Attribute`]s shouldn't hash
1261/// [`AttrId`]s. By wrapping them in this, we make sure we never do.
1262#[derive(#[automatically_derived]
impl ::core::marker::Copy for HashIgnoredAttrId { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for HashIgnoredAttrId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "HashIgnoredAttrId", "attr_id", &&self.attr_id)
    }
}Debug, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for HashIgnoredAttrId {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    HashIgnoredAttrId { attr_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for HashIgnoredAttrId {
            fn decode(__decoder: &mut __D) -> Self {
                HashIgnoredAttrId {
                    attr_id: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::clone::Clone for HashIgnoredAttrId {
    #[inline]
    fn clone(&self) -> HashIgnoredAttrId {
        let _: ::core::clone::AssertParamIsClone<AttrId>;
        *self
    }
}Clone)]
1263pub struct HashIgnoredAttrId {
1264    pub attr_id: AttrId,
1265}
1266
1267#[derive(#[automatically_derived]
impl ::core::clone::Clone for Attribute {
    #[inline]
    fn clone(&self) -> Attribute {
        match self {
            Attribute::Parsed(__self_0) =>
                Attribute::Parsed(::core::clone::Clone::clone(__self_0)),
            Attribute::Unparsed(__self_0) =>
                Attribute::Unparsed(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Attribute {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Attribute::Parsed(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Parsed",
                    &__self_0),
            Attribute::Unparsed(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Unparsed", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for Attribute {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        Attribute::Parsed(ref __binding_0) => { 0usize }
                        Attribute::Unparsed(ref __binding_0) => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    Attribute::Parsed(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    Attribute::Unparsed(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for Attribute {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        Attribute::Parsed(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        Attribute::Unparsed(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Attribute`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Attribute where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    Attribute::Parsed(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Attribute::Unparsed(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1268pub enum Attribute {
1269    /// A parsed built-in attribute.
1270    ///
1271    /// Each attribute has a span connected to it. However, you must be somewhat careful using it.
1272    /// That's because sometimes we merge multiple attributes together, like when an item has
1273    /// multiple `repr` attributes. In this case the span might not be very useful.
1274    Parsed(AttributeKind),
1275
1276    /// An attribute that could not be parsed, out of a token-like representation.
1277    /// This is the case for custom tool attributes.
1278    Unparsed(Box<AttrItem>),
1279}
1280
1281impl Attribute {
1282    pub fn get_normal_item(&self) -> &AttrItem {
1283        match &self {
1284            Attribute::Unparsed(normal) => &normal,
1285            _ => { ::core::panicking::panic_fmt(format_args!("unexpected parsed attribute")); }panic!("unexpected parsed attribute"),
1286        }
1287    }
1288
1289    pub fn unwrap_normal_item(self) -> AttrItem {
1290        match self {
1291            Attribute::Unparsed(normal) => *normal,
1292            _ => { ::core::panicking::panic_fmt(format_args!("unexpected parsed attribute")); }panic!("unexpected parsed attribute"),
1293        }
1294    }
1295
1296    pub fn value_lit(&self) -> Option<&MetaItemLit> {
1297        match &self {
1298            Attribute::Unparsed(n) => match n.as_ref() {
1299                AttrItem { args: AttrArgs::Eq { eq_span: _, expr }, .. } => Some(expr),
1300                _ => None,
1301            },
1302            _ => None,
1303        }
1304    }
1305
1306    pub fn is_parsed_attr(&self) -> bool {
1307        match self {
1308            Attribute::Parsed(_) => true,
1309            Attribute::Unparsed(_) => false,
1310        }
1311    }
1312}
1313
1314impl AttributeExt for Attribute {
1315    #[inline]
1316    fn id(&self) -> AttrId {
1317        match &self {
1318            Attribute::Unparsed(u) => u.id.attr_id,
1319            _ => ::core::panicking::panic("explicit panic")panic!(),
1320        }
1321    }
1322
1323    #[inline]
1324    fn meta_item_list(&self) -> Option<ThinVec<ast::MetaItemInner>> {
1325        match &self {
1326            Attribute::Unparsed(n) => match n.as_ref() {
1327                AttrItem { args: AttrArgs::Delimited(d), .. } => {
1328                    ast::MetaItemKind::list_from_tokens(d.tokens.clone())
1329                }
1330                _ => None,
1331            },
1332            _ => None,
1333        }
1334    }
1335
1336    #[inline]
1337    fn value_str(&self) -> Option<Symbol> {
1338        self.value_lit().and_then(|x| x.value_str())
1339    }
1340
1341    #[inline]
1342    fn value_span(&self) -> Option<Span> {
1343        self.value_lit().map(|i| i.span)
1344    }
1345
1346    /// For a single-segment attribute, returns its name; otherwise, returns `None`.
1347    #[inline]
1348    fn name(&self) -> Option<Symbol> {
1349        match &self {
1350            Attribute::Unparsed(n) => {
1351                if let [ident] = n.path.segments.as_ref() {
1352                    Some(*ident)
1353                } else {
1354                    None
1355                }
1356            }
1357            _ => None,
1358        }
1359    }
1360
1361    #[inline]
1362    fn path_matches(&self, name: &[Symbol]) -> bool {
1363        match &self {
1364            Attribute::Unparsed(n) => n.path.segments.iter().eq(name),
1365            _ => false,
1366        }
1367    }
1368
1369    #[inline]
1370    fn is_doc_comment(&self) -> Option<Span> {
1371        if let Attribute::Parsed(AttributeKind::DocComment { span, .. }) = self {
1372            Some(*span)
1373        } else {
1374            None
1375        }
1376    }
1377
1378    #[inline]
1379    fn span(&self) -> Span {
1380        match &self {
1381            Attribute::Unparsed(u) => u.span,
1382            // FIXME: should not be needed anymore when all attrs are parsed
1383            Attribute::Parsed(AttributeKind::DocComment { span, .. }) => *span,
1384            Attribute::Parsed(AttributeKind::Deprecated { span, .. }) => *span,
1385            Attribute::Parsed(AttributeKind::CfgTrace(cfgs)) => cfgs[0].1,
1386            a => {
    ::core::panicking::panic_fmt(format_args!("can\'t get the span of an arbitrary parsed attribute: {0:?}",
            a));
}panic!("can't get the span of an arbitrary parsed attribute: {a:?}"),
1387        }
1388    }
1389
1390    #[inline]
1391    fn is_word(&self) -> bool {
1392        match &self {
1393            Attribute::Unparsed(n) => {
1394                #[allow(non_exhaustive_omitted_patterns)] match n.args {
    AttrArgs::Empty => true,
    _ => false,
}matches!(n.args, AttrArgs::Empty)
1395            }
1396            _ => false,
1397        }
1398    }
1399
1400    #[inline]
1401    fn symbol_path(&self) -> Option<SmallVec<[Symbol; 1]>> {
1402        match &self {
1403            Attribute::Unparsed(n) => Some(n.path.segments.iter().copied().collect()),
1404            _ => None,
1405        }
1406    }
1407
1408    fn path_span(&self) -> Option<Span> {
1409        match &self {
1410            Attribute::Unparsed(attr) => Some(attr.path.span),
1411            Attribute::Parsed(_) => None,
1412        }
1413    }
1414
1415    #[inline]
1416    fn doc_str(&self) -> Option<Symbol> {
1417        match &self {
1418            Attribute::Parsed(AttributeKind::DocComment { comment, .. }) => Some(*comment),
1419            _ => None,
1420        }
1421    }
1422
1423    #[inline]
1424    fn deprecation_note(&self) -> Option<Ident> {
1425        match &self {
1426            Attribute::Parsed(AttributeKind::Deprecated { deprecation, .. }) => deprecation.note,
1427            _ => None,
1428        }
1429    }
1430
1431    fn is_automatically_derived_attr(&self) -> bool {
1432        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::AutomaticallyDerived(..)) => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::AutomaticallyDerived(..)))
1433    }
1434
1435    #[inline]
1436    fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind)> {
1437        match &self {
1438            Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => {
1439                Some((*comment, *kind))
1440            }
1441            _ => None,
1442        }
1443    }
1444
1445    fn doc_resolution_scope(&self) -> Option<AttrStyle> {
1446        match self {
1447            Attribute::Parsed(AttributeKind::DocComment { style, .. }) => Some(*style),
1448            Attribute::Unparsed(attr) if self.has_name(sym::doc) && self.value_str().is_some() => {
1449                Some(attr.style)
1450            }
1451            _ => None,
1452        }
1453    }
1454
1455    fn is_proc_macro_attr(&self) -> bool {
1456        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::ProcMacro(..) |
        AttributeKind::ProcMacroAttribute(..) |
        AttributeKind::ProcMacroDerive { .. }) => true,
    _ => false,
}matches!(
1457            self,
1458            Attribute::Parsed(
1459                AttributeKind::ProcMacro(..)
1460                    | AttributeKind::ProcMacroAttribute(..)
1461                    | AttributeKind::ProcMacroDerive { .. }
1462            )
1463        )
1464    }
1465
1466    fn is_doc_hidden(&self) -> bool {
1467        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::Doc(d)) if d.hidden.is_some() => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::Doc(d)) if d.hidden.is_some())
1468    }
1469
1470    fn is_doc_keyword_or_attribute(&self) -> bool {
1471        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::Doc(d)) if
        d.attribute.is_some() || d.keyword.is_some() => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::Doc(d)) if d.attribute.is_some() || d.keyword.is_some())
1472    }
1473
1474    fn is_rustc_doc_primitive(&self) -> bool {
1475        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::RustcDocPrimitive(..)) => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::RustcDocPrimitive(..)))
1476    }
1477}
1478
1479// FIXME(fn_delegation): use function delegation instead of manually forwarding
1480impl Attribute {
1481    #[inline]
1482    pub fn id(&self) -> AttrId {
1483        AttributeExt::id(self)
1484    }
1485
1486    #[inline]
1487    pub fn name(&self) -> Option<Symbol> {
1488        AttributeExt::name(self)
1489    }
1490
1491    #[inline]
1492    pub fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>> {
1493        AttributeExt::meta_item_list(self)
1494    }
1495
1496    #[inline]
1497    pub fn value_str(&self) -> Option<Symbol> {
1498        AttributeExt::value_str(self)
1499    }
1500
1501    #[inline]
1502    pub fn value_span(&self) -> Option<Span> {
1503        AttributeExt::value_span(self)
1504    }
1505
1506    #[inline]
1507    pub fn path_matches(&self, name: &[Symbol]) -> bool {
1508        AttributeExt::path_matches(self, name)
1509    }
1510
1511    #[inline]
1512    pub fn is_doc_comment(&self) -> Option<Span> {
1513        AttributeExt::is_doc_comment(self)
1514    }
1515
1516    #[inline]
1517    pub fn has_name(&self, name: Symbol) -> bool {
1518        AttributeExt::has_name(self, name)
1519    }
1520
1521    #[inline]
1522    pub fn has_any_name(&self, names: &[Symbol]) -> bool {
1523        AttributeExt::has_any_name(self, names)
1524    }
1525
1526    #[inline]
1527    pub fn span(&self) -> Span {
1528        AttributeExt::span(self)
1529    }
1530
1531    #[inline]
1532    pub fn is_word(&self) -> bool {
1533        AttributeExt::is_word(self)
1534    }
1535
1536    #[inline]
1537    pub fn path(&self) -> SmallVec<[Symbol; 1]> {
1538        AttributeExt::path(self)
1539    }
1540
1541    #[inline]
1542    pub fn doc_str(&self) -> Option<Symbol> {
1543        AttributeExt::doc_str(self)
1544    }
1545
1546    #[inline]
1547    pub fn is_proc_macro_attr(&self) -> bool {
1548        AttributeExt::is_proc_macro_attr(self)
1549    }
1550
1551    #[inline]
1552    pub fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind)> {
1553        AttributeExt::doc_str_and_fragment_kind(self)
1554    }
1555}
1556
1557/// Attributes owned by a HIR owner.
1558#[derive(#[automatically_derived]
impl<'tcx> ::core::fmt::Debug for AttributeMap<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "AttributeMap",
            "map", &self.map, "define_opaque", &self.define_opaque,
            "opt_hash", &&self.opt_hash)
    }
}Debug)]
1559pub struct AttributeMap<'tcx> {
1560    pub map: SortedMap<ItemLocalId, &'tcx [Attribute]>,
1561    /// Preprocessed `#[define_opaque]` attribute.
1562    pub define_opaque: Option<&'tcx [(Span, LocalDefId)]>,
1563    // Only present when the crate hash is needed.
1564    pub opt_hash: Option<Fingerprint>,
1565}
1566
1567impl<'tcx> AttributeMap<'tcx> {
1568    pub const EMPTY: &'static AttributeMap<'static> = &AttributeMap {
1569        map: SortedMap::new(),
1570        opt_hash: Some(Fingerprint::ZERO),
1571        define_opaque: None,
1572    };
1573
1574    #[inline]
1575    pub fn get(&self, id: ItemLocalId) -> &'tcx [Attribute] {
1576        self.map.get(&id).copied().unwrap_or(&[])
1577    }
1578}
1579
1580/// Map of all HIR nodes inside the current owner.
1581/// These nodes are mapped by `ItemLocalId` alongside the index of their parent node.
1582/// The HIR tree, including bodies, is pre-hashed.
1583pub struct OwnerNodes<'tcx> {
1584    /// Pre-computed hash of the full HIR. Used in the crate hash. Only present
1585    /// when incr. comp. is enabled.
1586    pub opt_hash_including_bodies: Option<Fingerprint>,
1587    /// Full HIR for the current owner.
1588    // The zeroth node's parent should never be accessed: the owner's parent is computed by the
1589    // hir_owner_parent query. It is set to `ItemLocalId::INVALID` to force an ICE if accidentally
1590    // used.
1591    pub nodes: IndexVec<ItemLocalId, ParentedNode<'tcx>>,
1592    /// Content of local bodies.
1593    pub bodies: SortedMap<ItemLocalId, &'tcx Body<'tcx>>,
1594}
1595
1596impl<'tcx> OwnerNodes<'tcx> {
1597    pub fn node(&self) -> OwnerNode<'tcx> {
1598        // Indexing must ensure it is an OwnerNode.
1599        self.nodes[ItemLocalId::ZERO].node.as_owner().unwrap()
1600    }
1601}
1602
1603impl fmt::Debug for OwnerNodes<'_> {
1604    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1605        f.debug_struct("OwnerNodes")
1606            // Do not print all the pointers to all the nodes, as it would be unreadable.
1607            .field("node", &self.nodes[ItemLocalId::ZERO])
1608            .field(
1609                "parents",
1610                &fmt::from_fn(|f| {
1611                    f.debug_list()
1612                        .entries(self.nodes.iter_enumerated().map(|(id, parented_node)| {
1613                            fmt::from_fn(move |f| f.write_fmt(format_args!("({1:?}, {0:?})", parented_node.parent, id))write!(f, "({id:?}, {:?})", parented_node.parent))
1614                        }))
1615                        .finish()
1616                }),
1617            )
1618            .field("bodies", &self.bodies)
1619            .field("opt_hash_including_bodies", &self.opt_hash_including_bodies)
1620            .finish()
1621    }
1622}
1623
1624/// Full information resulting from lowering an AST node.
1625#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for OwnerInfo<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "OwnerInfo",
            "nodes", &self.nodes, "parenting", &self.parenting, "attrs",
            &self.attrs, "trait_map", &self.trait_map, "delayed_lints",
            &&self.delayed_lints)
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            OwnerInfo<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    OwnerInfo {
                        nodes: ref __binding_0,
                        parenting: ref __binding_1,
                        attrs: ref __binding_2,
                        trait_map: ref __binding_3,
                        delayed_lints: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1626pub struct OwnerInfo<'hir> {
1627    /// Contents of the HIR.
1628    pub nodes: OwnerNodes<'hir>,
1629    /// Map from each nested owner to its parent's local id.
1630    pub parenting: LocalDefIdMap<ItemLocalId>,
1631    /// Collected attributes of the HIR nodes.
1632    pub attrs: AttributeMap<'hir>,
1633    /// Map indicating what traits are in scope for places where this
1634    /// is relevant; generated by resolve.
1635    pub trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>,
1636
1637    /// Lints delayed during ast lowering to be emitted
1638    /// after hir has completely built
1639    pub delayed_lints: DelayedLints,
1640}
1641
1642impl<'tcx> OwnerInfo<'tcx> {
1643    #[inline]
1644    pub fn node(&self) -> OwnerNode<'tcx> {
1645        self.nodes.node()
1646    }
1647}
1648
1649#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for MaybeOwner<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for MaybeOwner<'tcx> {
    #[inline]
    fn clone(&self) -> MaybeOwner<'tcx> {
        let _: ::core::clone::AssertParamIsClone<&'tcx OwnerInfo<'tcx>>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for MaybeOwner<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            MaybeOwner::Owner(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Owner",
                    &__self_0),
            MaybeOwner::NonOwner(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NonOwner", &__self_0),
            MaybeOwner::Phantom =>
                ::core::fmt::Formatter::write_str(f, "Phantom"),
        }
    }
}Debug, const _: () =
    {
        impl<'tcx, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            MaybeOwner<'tcx> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    MaybeOwner::Owner(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    MaybeOwner::NonOwner(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    MaybeOwner::Phantom => {}
                }
            }
        }
    };HashStable_Generic)]
1650pub enum MaybeOwner<'tcx> {
1651    Owner(&'tcx OwnerInfo<'tcx>),
1652    NonOwner(HirId),
1653    /// Used as a placeholder for unused LocalDefId.
1654    Phantom,
1655}
1656
1657impl<'tcx> MaybeOwner<'tcx> {
1658    pub fn as_owner(self) -> Option<&'tcx OwnerInfo<'tcx>> {
1659        match self {
1660            MaybeOwner::Owner(i) => Some(i),
1661            MaybeOwner::NonOwner(_) | MaybeOwner::Phantom => None,
1662        }
1663    }
1664
1665    pub fn unwrap(self) -> &'tcx OwnerInfo<'tcx> {
1666        self.as_owner().unwrap_or_else(|| { ::core::panicking::panic_fmt(format_args!("Not a HIR owner")); }panic!("Not a HIR owner"))
1667    }
1668}
1669
1670/// The top-level data structure that stores the entire contents of
1671/// the crate currently being compiled.
1672///
1673/// For more details, see the [rustc dev guide].
1674///
1675/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
1676#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Crate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Crate",
            "owners", &self.owners, "opt_hir_hash", &&self.opt_hir_hash)
    }
}Debug)]
1677pub struct Crate<'hir> {
1678    pub owners: IndexVec<LocalDefId, MaybeOwner<'hir>>,
1679    // Only present when incr. comp. is enabled.
1680    pub opt_hir_hash: Option<Fingerprint>,
1681}
1682
1683#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Closure<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["def_id", "binder", "constness", "capture_clause",
                        "bound_generic_params", "fn_decl", "body", "fn_decl_span",
                        "fn_arg_span", "kind"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.def_id, &self.binder, &self.constness,
                        &self.capture_clause, &self.bound_generic_params,
                        &self.fn_decl, &self.body, &self.fn_decl_span,
                        &self.fn_arg_span, &&self.kind];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Closure",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Closure<'hir> {
    #[inline]
    fn clone(&self) -> Closure<'hir> {
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<ClosureBinder>;
        let _: ::core::clone::AssertParamIsClone<Constness>;
        let _: ::core::clone::AssertParamIsClone<CaptureBy>;
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<Option<Span>>;
        let _: ::core::clone::AssertParamIsClone<ClosureKind>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Closure<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Closure<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Closure {
                        def_id: ref __binding_0,
                        binder: ref __binding_1,
                        constness: ref __binding_2,
                        capture_clause: ref __binding_3,
                        bound_generic_params: ref __binding_4,
                        fn_decl: ref __binding_5,
                        body: ref __binding_6,
                        fn_decl_span: ref __binding_7,
                        fn_arg_span: ref __binding_8,
                        kind: ref __binding_9 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                        { __binding_7.hash_stable(__hcx, __hasher); }
                        { __binding_8.hash_stable(__hcx, __hasher); }
                        { __binding_9.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1684pub struct Closure<'hir> {
1685    pub def_id: LocalDefId,
1686    pub binder: ClosureBinder,
1687    pub constness: Constness,
1688    pub capture_clause: CaptureBy,
1689    pub bound_generic_params: &'hir [GenericParam<'hir>],
1690    pub fn_decl: &'hir FnDecl<'hir>,
1691    pub body: BodyId,
1692    /// The span of the declaration block: 'move |...| -> ...'
1693    pub fn_decl_span: Span,
1694    /// The span of the argument block `|...|`
1695    pub fn_arg_span: Option<Span>,
1696    pub kind: ClosureKind,
1697}
1698
1699#[derive(#[automatically_derived]
impl ::core::clone::Clone for ClosureKind {
    #[inline]
    fn clone(&self) -> ClosureKind {
        let _: ::core::clone::AssertParamIsClone<CoroutineKind>;
        let _: ::core::clone::AssertParamIsClone<CoroutineDesugaring>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ClosureKind {
    #[inline]
    fn eq(&self, other: &ClosureKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ClosureKind::Coroutine(__self_0),
                    ClosureKind::Coroutine(__arg1_0)) => __self_0 == __arg1_0,
                (ClosureKind::CoroutineClosure(__self_0),
                    ClosureKind::CoroutineClosure(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ClosureKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<CoroutineKind>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineDesugaring>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for ClosureKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ClosureKind::Closure =>
                ::core::fmt::Formatter::write_str(f, "Closure"),
            ClosureKind::Coroutine(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Coroutine", &__self_0),
            ClosureKind::CoroutineClosure(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "CoroutineClosure", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for ClosureKind { }Copy, #[automatically_derived]
impl ::core::hash::Hash for ClosureKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            ClosureKind::Coroutine(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ClosureKind::CoroutineClosure(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ClosureKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ClosureKind::Closure => {}
                    ClosureKind::Coroutine(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ClosureKind::CoroutineClosure(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for ClosureKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        ClosureKind::Closure => { 0usize }
                        ClosureKind::Coroutine(ref __binding_0) => { 1usize }
                        ClosureKind::CoroutineClosure(ref __binding_0) => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    ClosureKind::Closure => {}
                    ClosureKind::Coroutine(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ClosureKind::CoroutineClosure(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for ClosureKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { ClosureKind::Closure }
                    1usize => {
                        ClosureKind::Coroutine(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        ClosureKind::CoroutineClosure(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ClosureKind`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
1700pub enum ClosureKind {
1701    /// This is a plain closure expression.
1702    Closure,
1703    /// This is a coroutine expression -- i.e. a closure expression in which
1704    /// we've found a `yield`. These can arise either from "plain" coroutine
1705    ///  usage (e.g. `let x = || { yield (); }`) or from a desugared expression
1706    /// (e.g. `async` and `gen` blocks).
1707    Coroutine(CoroutineKind),
1708    /// This is a coroutine-closure, which is a special sugared closure that
1709    /// returns one of the sugared coroutine (`async`/`gen`/`async gen`). It
1710    /// additionally allows capturing the coroutine's upvars by ref, and therefore
1711    /// needs to be specially treated during analysis and borrowck.
1712    CoroutineClosure(CoroutineDesugaring),
1713}
1714
1715/// A block of statements `{ .. }`, which may have a label (in this case the
1716/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
1717/// the `rules` being anything but `DefaultBlock`.
1718#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Block<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["stmts", "expr", "hir_id", "rules", "span",
                        "targeted_by_break"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.stmts, &self.expr, &self.hir_id, &self.rules, &self.span,
                        &&self.targeted_by_break];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Block", names,
            values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Block<'hir> {
    #[inline]
    fn clone(&self) -> Block<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [Stmt<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<BlockCheckMode>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Block<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Block<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Block {
                        stmts: ref __binding_0,
                        expr: ref __binding_1,
                        hir_id: ref __binding_2,
                        rules: ref __binding_3,
                        span: ref __binding_4,
                        targeted_by_break: ref __binding_5 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1719pub struct Block<'hir> {
1720    /// Statements in a block.
1721    pub stmts: &'hir [Stmt<'hir>],
1722    /// An expression at the end of the block
1723    /// without a semicolon, if any.
1724    pub expr: Option<&'hir Expr<'hir>>,
1725    #[stable_hasher(ignore)]
1726    pub hir_id: HirId,
1727    /// Distinguishes between `unsafe { ... }` and `{ ... }`.
1728    pub rules: BlockCheckMode,
1729    /// The span includes the curly braces `{` and `}` around the block.
1730    pub span: Span,
1731    /// If true, then there may exist `break 'a` values that aim to
1732    /// break out of this block early.
1733    /// Used by `'label: {}` blocks and by `try {}` blocks.
1734    pub targeted_by_break: bool,
1735}
1736
1737impl<'hir> Block<'hir> {
1738    pub fn innermost_block(&self) -> &Block<'hir> {
1739        let mut block = self;
1740        while let Some(Expr { kind: ExprKind::Block(inner_block, _), .. }) = block.expr {
1741            block = inner_block;
1742        }
1743        block
1744    }
1745}
1746
1747#[derive(#[automatically_derived]
impl ::core::fmt::Debug for TyFieldPath {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "TyFieldPath",
            "variant", &self.variant, "field", &&self.field)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for TyFieldPath {
    #[inline]
    fn clone(&self) -> TyFieldPath {
        let _: ::core::clone::AssertParamIsClone<Option<Ident>>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for TyFieldPath { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for TyFieldPath where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TyFieldPath {
                        variant: ref __binding_0, field: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1748pub struct TyFieldPath {
1749    pub variant: Option<Ident>,
1750    pub field: Ident,
1751}
1752
1753#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TyPat<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "TyPat",
            "hir_id", &self.hir_id, "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TyPat<'hir> {
    #[inline]
    fn clone(&self) -> TyPat<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<TyPatKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TyPat<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TyPat<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TyPat {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1754pub struct TyPat<'hir> {
1755    #[stable_hasher(ignore)]
1756    pub hir_id: HirId,
1757    pub kind: TyPatKind<'hir>,
1758    pub span: Span,
1759}
1760
1761#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Pat<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "Pat", "hir_id",
            &self.hir_id, "kind", &self.kind, "span", &self.span,
            "default_binding_modes", &&self.default_binding_modes)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Pat<'hir> {
    #[inline]
    fn clone(&self) -> Pat<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<PatKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Pat<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Pat<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Pat {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2,
                        default_binding_modes: ref __binding_3 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1762pub struct Pat<'hir> {
1763    #[stable_hasher(ignore)]
1764    pub hir_id: HirId,
1765    pub kind: PatKind<'hir>,
1766    pub span: Span,
1767    /// Whether to use default binding modes.
1768    /// At present, this is false only for destructuring assignment.
1769    pub default_binding_modes: bool,
1770}
1771
1772impl<'hir> Pat<'hir> {
1773    fn walk_short_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) -> bool {
1774        if !it(self) {
1775            return false;
1776        }
1777
1778        use PatKind::*;
1779        match self.kind {
1780            Missing => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
1781            Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => true,
1782            Box(s) | Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => {
1783                s.walk_short_(it)
1784            }
1785            Struct(_, fields, _) => fields.iter().all(|field| field.pat.walk_short_(it)),
1786            TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().all(|p| p.walk_short_(it)),
1787            Slice(before, slice, after) => {
1788                before.iter().chain(slice).chain(after.iter()).all(|p| p.walk_short_(it))
1789            }
1790        }
1791    }
1792
1793    /// Walk the pattern in left-to-right order,
1794    /// short circuiting (with `.all(..)`) if `false` is returned.
1795    ///
1796    /// Note that when visiting e.g. `Tuple(ps)`,
1797    /// if visiting `ps[0]` returns `false`,
1798    /// then `ps[1]` will not be visited.
1799    pub fn walk_short(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) -> bool {
1800        self.walk_short_(&mut it)
1801    }
1802
1803    fn walk_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) {
1804        if !it(self) {
1805            return;
1806        }
1807
1808        use PatKind::*;
1809        match self.kind {
1810            Missing | Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => {}
1811            Box(s) | Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_(it),
1812            Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk_(it)),
1813            TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().for_each(|p| p.walk_(it)),
1814            Slice(before, slice, after) => {
1815                before.iter().chain(slice).chain(after.iter()).for_each(|p| p.walk_(it))
1816            }
1817        }
1818    }
1819
1820    /// Walk the pattern in left-to-right order.
1821    ///
1822    /// If `it(pat)` returns `false`, the children are not visited.
1823    pub fn walk(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) {
1824        self.walk_(&mut it)
1825    }
1826
1827    /// Walk the pattern in left-to-right order.
1828    ///
1829    /// If you always want to recurse, prefer this method over `walk`.
1830    pub fn walk_always(&self, mut it: impl FnMut(&Pat<'_>)) {
1831        self.walk(|p| {
1832            it(p);
1833            true
1834        })
1835    }
1836
1837    /// Whether this a never pattern.
1838    pub fn is_never_pattern(&self) -> bool {
1839        let mut is_never_pattern = false;
1840        self.walk(|pat| match &pat.kind {
1841            PatKind::Never => {
1842                is_never_pattern = true;
1843                false
1844            }
1845            PatKind::Or(s) => {
1846                is_never_pattern = s.iter().all(|p| p.is_never_pattern());
1847                false
1848            }
1849            _ => true,
1850        });
1851        is_never_pattern
1852    }
1853
1854    /// Whether this pattern constitutes a read of value of the scrutinee that
1855    /// it is matching against. This is used to determine whether we should
1856    /// perform `NeverToAny` coercions.
1857    ///
1858    /// See [`expr_guaranteed_to_constitute_read_for_never`][m] for the nuances of
1859    /// what happens when this returns true.
1860    ///
1861    /// [m]: ../../rustc_middle/ty/struct.TyCtxt.html#method.expr_guaranteed_to_constitute_read_for_never
1862    pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool {
1863        match self.kind {
1864            // Does not constitute a read.
1865            PatKind::Wild => false,
1866
1867            // The guard cannot affect if we make a read or not (it runs after the inner pattern
1868            // has matched), therefore it's irrelevant.
1869            PatKind::Guard(pat, _) => pat.is_guaranteed_to_constitute_read_for_never(),
1870
1871            // This is unnecessarily restrictive when the pattern that doesn't
1872            // constitute a read is unreachable.
1873            //
1874            // For example `match *never_ptr { value => {}, _ => {} }` or
1875            // `match *never_ptr { _ if false => {}, value => {} }`.
1876            //
1877            // It is however fine to be restrictive here; only returning `true`
1878            // can lead to unsoundness.
1879            PatKind::Or(subpats) => {
1880                subpats.iter().all(|pat| pat.is_guaranteed_to_constitute_read_for_never())
1881            }
1882
1883            // Does constitute a read, since it is equivalent to a discriminant read.
1884            PatKind::Never => true,
1885
1886            // All of these constitute a read, or match on something that isn't `!`,
1887            // which would require a `NeverToAny` coercion.
1888            PatKind::Missing
1889            | PatKind::Binding(_, _, _, _)
1890            | PatKind::Struct(_, _, _)
1891            | PatKind::TupleStruct(_, _, _)
1892            | PatKind::Tuple(_, _)
1893            | PatKind::Box(_)
1894            | PatKind::Ref(_, _, _)
1895            | PatKind::Deref(_)
1896            | PatKind::Expr(_)
1897            | PatKind::Range(_, _, _)
1898            | PatKind::Slice(_, _, _)
1899            | PatKind::Err(_) => true,
1900        }
1901    }
1902}
1903
1904/// A single field in a struct pattern.
1905///
1906/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
1907/// are treated the same as` x: x, y: ref y, z: ref mut z`,
1908/// except `is_shorthand` is true.
1909#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatField<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "PatField",
            "hir_id", &self.hir_id, "ident", &self.ident, "pat", &self.pat,
            "is_shorthand", &self.is_shorthand, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for PatField<'hir> {
    #[inline]
    fn clone(&self) -> PatField<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PatField<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PatField<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    PatField {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        pat: ref __binding_2,
                        is_shorthand: ref __binding_3,
                        span: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1910pub struct PatField<'hir> {
1911    #[stable_hasher(ignore)]
1912    pub hir_id: HirId,
1913    /// The identifier for the field.
1914    pub ident: Ident,
1915    /// The pattern the field is destructured to.
1916    pub pat: &'hir Pat<'hir>,
1917    pub is_shorthand: bool,
1918    pub span: Span,
1919}
1920
1921#[derive(#[automatically_derived]
impl ::core::marker::Copy for RangeEnd { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RangeEnd {
    #[inline]
    fn clone(&self) -> RangeEnd { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for RangeEnd {
    #[inline]
    fn eq(&self, other: &RangeEnd) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for RangeEnd {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RangeEnd::Included => "Included",
                RangeEnd::Excluded => "Excluded",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for RangeEnd where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    RangeEnd::Included => {}
                    RangeEnd::Excluded => {}
                }
            }
        }
    };HashStable_Generic, #[automatically_derived]
impl ::core::hash::Hash for RangeEnd {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::Eq for RangeEnd {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for RangeEnd {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        RangeEnd::Included => { 0usize }
                        RangeEnd::Excluded => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    RangeEnd::Included => {}
                    RangeEnd::Excluded => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for RangeEnd {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { RangeEnd::Included }
                    1usize => { RangeEnd::Excluded }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `RangeEnd`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
1922pub enum RangeEnd {
1923    Included,
1924    Excluded,
1925}
1926
1927impl fmt::Display for RangeEnd {
1928    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1929        f.write_str(match self {
1930            RangeEnd::Included => "..=",
1931            RangeEnd::Excluded => "..",
1932        })
1933    }
1934}
1935
1936// Equivalent to `Option<usize>`. That type takes up 16 bytes on 64-bit, but
1937// this type only takes up 4 bytes, at the cost of being restricted to a
1938// maximum value of `u32::MAX - 1`. In practice, this is more than enough.
1939#[derive(#[automatically_derived]
impl ::core::clone::Clone for DotDotPos {
    #[inline]
    fn clone(&self) -> DotDotPos {
        let _: ::core::clone::AssertParamIsClone<u32>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for DotDotPos { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for DotDotPos {
    #[inline]
    fn eq(&self, other: &DotDotPos) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for DotDotPos {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u32>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for DotDotPos {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.0, state)
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for DotDotPos where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    DotDotPos(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1940pub struct DotDotPos(u32);
1941
1942impl DotDotPos {
1943    /// Panics if n >= u32::MAX.
1944    pub fn new(n: Option<usize>) -> Self {
1945        match n {
1946            Some(n) => {
1947                if !(n < u32::MAX as usize) {
    ::core::panicking::panic("assertion failed: n < u32::MAX as usize")
};assert!(n < u32::MAX as usize);
1948                Self(n as u32)
1949            }
1950            None => Self(u32::MAX),
1951        }
1952    }
1953
1954    pub fn as_opt_usize(&self) -> Option<usize> {
1955        if self.0 == u32::MAX { None } else { Some(self.0 as usize) }
1956    }
1957}
1958
1959impl fmt::Debug for DotDotPos {
1960    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1961        self.as_opt_usize().fmt(f)
1962    }
1963}
1964
1965#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatExpr<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "PatExpr",
            "hir_id", &self.hir_id, "span", &self.span, "kind", &&self.kind)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for PatExpr<'hir> {
    #[inline]
    fn clone(&self) -> PatExpr<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<PatExprKind<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PatExpr<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PatExpr<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    PatExpr {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1966pub struct PatExpr<'hir> {
1967    #[stable_hasher(ignore)]
1968    pub hir_id: HirId,
1969    pub span: Span,
1970    pub kind: PatExprKind<'hir>,
1971}
1972
1973#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatExprKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PatExprKind::Lit { lit: __self_0, negated: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Lit",
                    "lit", __self_0, "negated", &__self_1),
            PatExprKind::Path(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for PatExprKind<'hir> {
    #[inline]
    fn clone(&self) -> PatExprKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<Lit>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PatExprKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PatExprKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    PatExprKind::Lit {
                        lit: ref __binding_0, negated: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    PatExprKind::Path(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1974pub enum PatExprKind<'hir> {
1975    Lit {
1976        lit: Lit,
1977        negated: bool,
1978    },
1979    /// A path pattern for a unit struct/variant or a (maybe-associated) constant.
1980    Path(QPath<'hir>),
1981}
1982
1983#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TyPatKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            TyPatKind::Range(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Range",
                    __self_0, &__self_1),
            TyPatKind::NotNull =>
                ::core::fmt::Formatter::write_str(f, "NotNull"),
            TyPatKind::Or(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Or",
                    &__self_0),
            TyPatKind::Err(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TyPatKind<'hir> {
    #[inline]
    fn clone(&self) -> TyPatKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [TyPat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TyPatKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TyPatKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    TyPatKind::Range(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyPatKind::NotNull => {}
                    TyPatKind::Or(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyPatKind::Err(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1984pub enum TyPatKind<'hir> {
1985    /// A range pattern (e.g., `1..=2` or `1..2`).
1986    Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>),
1987
1988    /// A pattern that excludes null pointers
1989    NotNull,
1990
1991    /// A list of patterns where only one needs to be satisfied
1992    Or(&'hir [TyPat<'hir>]),
1993
1994    /// A placeholder for a pattern that wasn't well formed in some way.
1995    Err(ErrorGuaranteed),
1996}
1997
1998#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for PatKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PatKind::Missing =>
                ::core::fmt::Formatter::write_str(f, "Missing"),
            PatKind::Wild => ::core::fmt::Formatter::write_str(f, "Wild"),
            PatKind::Binding(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f,
                    "Binding", __self_0, __self_1, __self_2, &__self_3),
            PatKind::Struct(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
                    __self_0, __self_1, &__self_2),
            PatKind::TupleStruct(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "TupleStruct", __self_0, __self_1, &__self_2),
            PatKind::Or(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Or",
                    &__self_0),
            PatKind::Never => ::core::fmt::Formatter::write_str(f, "Never"),
            PatKind::Tuple(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Tuple",
                    __self_0, &__self_1),
            PatKind::Box(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Box",
                    &__self_0),
            PatKind::Deref(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Deref",
                    &__self_0),
            PatKind::Ref(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Ref",
                    __self_0, __self_1, &__self_2),
            PatKind::Expr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
                    &__self_0),
            PatKind::Guard(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Guard",
                    __self_0, &__self_1),
            PatKind::Range(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Range",
                    __self_0, __self_1, &__self_2),
            PatKind::Slice(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Slice",
                    __self_0, __self_1, &__self_2),
            PatKind::Err(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for PatKind<'hir> {
    #[inline]
    fn clone(&self) -> PatKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<BindingMode>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Pat<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [PatField<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<Option<Span>>;
        let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<DotDotPos>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Pinnedness>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        let _: ::core::clone::AssertParamIsClone<&'hir PatExpr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir PatExpr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir PatExpr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<RangeEnd>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Pat<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Pat<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PatKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PatKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    PatKind::Missing => {}
                    PatKind::Wild => {}
                    PatKind::Binding(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::TupleStruct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Or(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Never => {}
                    PatKind::Tuple(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Box(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Deref(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Ref(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Expr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Guard(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Range(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Slice(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    PatKind::Err(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
1999pub enum PatKind<'hir> {
2000    /// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`.
2001    Missing,
2002
2003    /// Represents a wildcard pattern (i.e., `_`).
2004    Wild,
2005
2006    /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`.
2007    /// The `HirId` is the canonical ID for the variable being bound,
2008    /// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID),
2009    /// which is the pattern ID of the first `x`.
2010    ///
2011    /// The `BindingMode` is what's provided by the user, before match
2012    /// ergonomics are applied. For the binding mode actually in use,
2013    /// see [`TypeckResults::extract_binding_mode`].
2014    ///
2015    /// [`TypeckResults::extract_binding_mode`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.extract_binding_mode
2016    Binding(BindingMode, HirId, Ident, Option<&'hir Pat<'hir>>),
2017
2018    /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
2019    /// The `Option` contains the span of a possible `..`.
2020    Struct(QPath<'hir>, &'hir [PatField<'hir>], Option<Span>),
2021
2022    /// A tuple struct/variant pattern `Variant(x, y, .., z)`.
2023    /// If the `..` pattern fragment is present, then `DotDotPos` denotes its position.
2024    /// `0 <= position <= subpats.len()`
2025    TupleStruct(QPath<'hir>, &'hir [Pat<'hir>], DotDotPos),
2026
2027    /// An or-pattern `A | B | C`.
2028    /// Invariant: `pats.len() >= 2`.
2029    Or(&'hir [Pat<'hir>]),
2030
2031    /// A never pattern `!`.
2032    Never,
2033
2034    /// A tuple pattern (e.g., `(a, b)`).
2035    /// If the `..` pattern fragment is present, then `DotDotPos` denotes its position.
2036    /// `0 <= position <= subpats.len()`
2037    Tuple(&'hir [Pat<'hir>], DotDotPos),
2038
2039    /// A `box` pattern.
2040    Box(&'hir Pat<'hir>),
2041
2042    /// A `deref` pattern (currently `deref!()` macro-based syntax).
2043    Deref(&'hir Pat<'hir>),
2044
2045    /// A reference pattern (e.g., `&mut (a, b)`).
2046    Ref(&'hir Pat<'hir>, Pinnedness, Mutability),
2047
2048    /// A literal, const block or path.
2049    Expr(&'hir PatExpr<'hir>),
2050
2051    /// A guard pattern (e.g., `x if guard(x)`).
2052    Guard(&'hir Pat<'hir>, &'hir Expr<'hir>),
2053
2054    /// A range pattern (e.g., `1..=2` or `1..2`).
2055    Range(Option<&'hir PatExpr<'hir>>, Option<&'hir PatExpr<'hir>>, RangeEnd),
2056
2057    /// A slice pattern, `[before_0, ..., before_n, (slice, after_0, ..., after_n)?]`.
2058    ///
2059    /// Here, `slice` is lowered from the syntax `($binding_mode $ident @)? ..`.
2060    /// If `slice` exists, then `after` can be non-empty.
2061    ///
2062    /// The representation for e.g., `[a, b, .., c, d]` is:
2063    /// ```ignore (illustrative)
2064    /// PatKind::Slice([Binding(a), Binding(b)], Some(Wild), [Binding(c), Binding(d)])
2065    /// ```
2066    Slice(&'hir [Pat<'hir>], Option<&'hir Pat<'hir>>, &'hir [Pat<'hir>]),
2067
2068    /// A placeholder for a pattern that wasn't well formed in some way.
2069    Err(ErrorGuaranteed),
2070}
2071
2072/// A statement.
2073#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Stmt<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Stmt",
            "hir_id", &self.hir_id, "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Stmt<'hir> {
    #[inline]
    fn clone(&self) -> Stmt<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<StmtKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Stmt<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Stmt<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Stmt {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2074pub struct Stmt<'hir> {
2075    #[stable_hasher(ignore)]
2076    pub hir_id: HirId,
2077    pub kind: StmtKind<'hir>,
2078    pub span: Span,
2079}
2080
2081/// The contents of a statement.
2082#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for StmtKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            StmtKind::Let(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Let",
                    &__self_0),
            StmtKind::Item(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
                    &__self_0),
            StmtKind::Expr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
                    &__self_0),
            StmtKind::Semi(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Semi",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for StmtKind<'hir> {
    #[inline]
    fn clone(&self) -> StmtKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir LetStmt<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ItemId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for StmtKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            StmtKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    StmtKind::Let(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    StmtKind::Item(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    StmtKind::Expr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    StmtKind::Semi(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2083pub enum StmtKind<'hir> {
2084    /// A local (`let`) binding.
2085    Let(&'hir LetStmt<'hir>),
2086
2087    /// An item binding.
2088    Item(ItemId),
2089
2090    /// An expression without a trailing semi-colon (must have unit type).
2091    Expr(&'hir Expr<'hir>),
2092
2093    /// An expression with a trailing semi-colon (may have any type).
2094    Semi(&'hir Expr<'hir>),
2095}
2096
2097/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
2098#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for LetStmt<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["super_", "pat", "ty", "init", "els", "hir_id", "span",
                        "source"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.super_, &self.pat, &self.ty, &self.init, &self.els,
                        &self.hir_id, &self.span, &&self.source];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "LetStmt",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for LetStmt<'hir> {
    #[inline]
    fn clone(&self) -> LetStmt<'hir> {
        let _: ::core::clone::AssertParamIsClone<Option<Span>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Block<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<LocalSource>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for LetStmt<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            LetStmt<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    LetStmt {
                        super_: ref __binding_0,
                        pat: ref __binding_1,
                        ty: ref __binding_2,
                        init: ref __binding_3,
                        els: ref __binding_4,
                        hir_id: ref __binding_5,
                        span: ref __binding_6,
                        source: ref __binding_7 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_6.hash_stable(__hcx, __hasher); }
                        { __binding_7.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2099pub struct LetStmt<'hir> {
2100    /// Span of `super` in `super let`.
2101    pub super_: Option<Span>,
2102    pub pat: &'hir Pat<'hir>,
2103    /// Type annotation, if any (otherwise the type will be inferred).
2104    pub ty: Option<&'hir Ty<'hir>>,
2105    /// Initializer expression to set the value, if any.
2106    pub init: Option<&'hir Expr<'hir>>,
2107    /// Else block for a `let...else` binding.
2108    pub els: Option<&'hir Block<'hir>>,
2109    #[stable_hasher(ignore)]
2110    pub hir_id: HirId,
2111    pub span: Span,
2112    /// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
2113    /// desugaring, or `AssignDesugar` if it is the result of a complex
2114    /// assignment desugaring. Otherwise will be `Normal`.
2115    pub source: LocalSource,
2116}
2117
2118/// Represents a single arm of a `match` expression, e.g.
2119/// `<pat> (if <guard>) => <body>`.
2120#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Arm<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "Arm", "hir_id",
            &self.hir_id, "span", &self.span, "pat", &self.pat, "guard",
            &self.guard, "body", &&self.body)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Arm<'hir> {
    #[inline]
    fn clone(&self) -> Arm<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Arm<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Arm<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Arm {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        pat: ref __binding_2,
                        guard: ref __binding_3,
                        body: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2121pub struct Arm<'hir> {
2122    #[stable_hasher(ignore)]
2123    pub hir_id: HirId,
2124    pub span: Span,
2125    /// If this pattern and the optional guard matches, then `body` is evaluated.
2126    pub pat: &'hir Pat<'hir>,
2127    /// Optional guard clause.
2128    pub guard: Option<&'hir Expr<'hir>>,
2129    /// The expression the arm evaluates to if this arm matches.
2130    pub body: &'hir Expr<'hir>,
2131}
2132
2133/// Represents a `let <pat>[: <ty>] = <expr>` expression (not a [`LetStmt`]), occurring in an `if-let`
2134/// or `let-else`, evaluating to a boolean. Typically the pattern is refutable.
2135///
2136/// In an `if let`, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of
2137/// the desugaring to if-let. Only let-else supports the type annotation at present.
2138#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for LetExpr<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "LetExpr",
            "span", &self.span, "pat", &self.pat, "ty", &self.ty, "init",
            &self.init, "recovered", &&self.recovered)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for LetExpr<'hir> {
    #[inline]
    fn clone(&self) -> LetExpr<'hir> {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ast::Recovered>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for LetExpr<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            LetExpr<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    LetExpr {
                        span: ref __binding_0,
                        pat: ref __binding_1,
                        ty: ref __binding_2,
                        init: ref __binding_3,
                        recovered: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2139pub struct LetExpr<'hir> {
2140    pub span: Span,
2141    pub pat: &'hir Pat<'hir>,
2142    pub ty: Option<&'hir Ty<'hir>>,
2143    pub init: &'hir Expr<'hir>,
2144    /// `Recovered::Yes` when this let expressions is not in a syntactically valid location.
2145    /// Used to prevent building MIR in such situations.
2146    pub recovered: ast::Recovered,
2147}
2148
2149#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ExprField<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "ExprField",
            "hir_id", &self.hir_id, "ident", &self.ident, "expr", &self.expr,
            "span", &self.span, "is_shorthand", &&self.is_shorthand)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ExprField<'hir> {
    #[inline]
    fn clone(&self) -> ExprField<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ExprField<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ExprField<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ExprField {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        expr: ref __binding_2,
                        span: ref __binding_3,
                        is_shorthand: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2150pub struct ExprField<'hir> {
2151    #[stable_hasher(ignore)]
2152    pub hir_id: HirId,
2153    pub ident: Ident,
2154    pub expr: &'hir Expr<'hir>,
2155    pub span: Span,
2156    pub is_shorthand: bool,
2157}
2158
2159#[derive(#[automatically_derived]
impl ::core::marker::Copy for BlockCheckMode { }Copy, #[automatically_derived]
impl ::core::clone::Clone for BlockCheckMode {
    #[inline]
    fn clone(&self) -> BlockCheckMode {
        let _: ::core::clone::AssertParamIsClone<UnsafeSource>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for BlockCheckMode {
    #[inline]
    fn eq(&self, other: &BlockCheckMode) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (BlockCheckMode::UnsafeBlock(__self_0),
                    BlockCheckMode::UnsafeBlock(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for BlockCheckMode {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            BlockCheckMode::DefaultBlock =>
                ::core::fmt::Formatter::write_str(f, "DefaultBlock"),
            BlockCheckMode::UnsafeBlock(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "UnsafeBlock", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for BlockCheckMode where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    BlockCheckMode::DefaultBlock => {}
                    BlockCheckMode::UnsafeBlock(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2160pub enum BlockCheckMode {
2161    DefaultBlock,
2162    UnsafeBlock(UnsafeSource),
2163}
2164
2165#[derive(#[automatically_derived]
impl ::core::marker::Copy for UnsafeSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UnsafeSource {
    #[inline]
    fn clone(&self) -> UnsafeSource { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for UnsafeSource {
    #[inline]
    fn eq(&self, other: &UnsafeSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for UnsafeSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                UnsafeSource::CompilerGenerated => "CompilerGenerated",
                UnsafeSource::UserProvided => "UserProvided",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for UnsafeSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    UnsafeSource::CompilerGenerated => {}
                    UnsafeSource::UserProvided => {}
                }
            }
        }
    };HashStable_Generic)]
2166pub enum UnsafeSource {
2167    CompilerGenerated,
2168    UserProvided,
2169}
2170
2171#[derive(#[automatically_derived]
impl ::core::marker::Copy for BodyId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for BodyId {
    #[inline]
    fn clone(&self) -> BodyId {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for BodyId {
    #[inline]
    fn eq(&self, other: &BodyId) -> bool { self.hir_id == other.hir_id }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for BodyId {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<HirId>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for BodyId {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.hir_id, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for BodyId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "BodyId",
            "hir_id", &&self.hir_id)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for BodyId where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    BodyId { hir_id: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2172pub struct BodyId {
2173    pub hir_id: HirId,
2174}
2175
2176/// The body of a function, closure, or constant value. In the case of
2177/// a function, the body contains not only the function body itself
2178/// (which is an expression), but also the argument patterns, since
2179/// those are something that the caller doesn't really care about.
2180///
2181/// # Examples
2182///
2183/// ```
2184/// fn foo((x, y): (u32, u32)) -> u32 {
2185///     x + y
2186/// }
2187/// ```
2188///
2189/// Here, the `Body` associated with `foo()` would contain:
2190///
2191/// - an `params` array containing the `(x, y)` pattern
2192/// - a `value` containing the `x + y` expression (maybe wrapped in a block)
2193/// - `coroutine_kind` would be `None`
2194///
2195/// All bodies have an **owner**, which can be accessed via the HIR
2196/// map using `body_owner_def_id()`.
2197#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Body<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Body",
            "params", &self.params, "value", &&self.value)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Body<'hir> {
    #[inline]
    fn clone(&self) -> Body<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [Param<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Body<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Body<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Body { params: ref __binding_0, value: ref __binding_1 } =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2198pub struct Body<'hir> {
2199    pub params: &'hir [Param<'hir>],
2200    pub value: &'hir Expr<'hir>,
2201}
2202
2203impl<'hir> Body<'hir> {
2204    pub fn id(&self) -> BodyId {
2205        BodyId { hir_id: self.value.hir_id }
2206    }
2207}
2208
2209/// The type of source expression that caused this coroutine to be created.
2210#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoroutineKind {
    #[inline]
    fn clone(&self) -> CoroutineKind {
        let _: ::core::clone::AssertParamIsClone<CoroutineDesugaring>;
        let _: ::core::clone::AssertParamIsClone<CoroutineSource>;
        let _: ::core::clone::AssertParamIsClone<Movability>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineKind {
    #[inline]
    fn eq(&self, other: &CoroutineKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (CoroutineKind::Desugared(__self_0, __self_1),
                    CoroutineKind::Desugared(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (CoroutineKind::Coroutine(__self_0),
                    CoroutineKind::Coroutine(__arg1_0)) => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<CoroutineDesugaring>;
        let _: ::core::cmp::AssertParamIsEq<CoroutineSource>;
        let _: ::core::cmp::AssertParamIsEq<Movability>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            CoroutineKind::Desugared(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Desugared", __self_0, &__self_1),
            CoroutineKind::Coroutine(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Coroutine", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for CoroutineKind { }Copy, #[automatically_derived]
impl ::core::hash::Hash for CoroutineKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            CoroutineKind::Desugared(__self_0, __self_1) => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            CoroutineKind::Coroutine(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for CoroutineKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    CoroutineKind::Coroutine(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for CoroutineKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
                            => {
                            0usize
                        }
                        CoroutineKind::Coroutine(ref __binding_0) => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    CoroutineKind::Coroutine(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for CoroutineKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        CoroutineKind::Desugared(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        CoroutineKind::Coroutine(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineKind`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
2211pub enum CoroutineKind {
2212    /// A coroutine that comes from a desugaring.
2213    Desugared(CoroutineDesugaring, CoroutineSource),
2214
2215    /// A coroutine literal created via a `yield` inside a closure.
2216    Coroutine(Movability),
2217}
2218
2219impl CoroutineKind {
2220    pub fn movability(self) -> Movability {
2221        match self {
2222            CoroutineKind::Desugared(CoroutineDesugaring::Async, _)
2223            | CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _) => Movability::Static,
2224            CoroutineKind::Desugared(CoroutineDesugaring::Gen, _) => Movability::Movable,
2225            CoroutineKind::Coroutine(mov) => mov,
2226        }
2227    }
2228
2229    pub fn is_fn_like(self) -> bool {
2230        #[allow(non_exhaustive_omitted_patterns)] match self {
    CoroutineKind::Desugared(_, CoroutineSource::Fn) => true,
    _ => false,
}matches!(self, CoroutineKind::Desugared(_, CoroutineSource::Fn))
2231    }
2232
2233    pub fn to_plural_string(&self) -> String {
2234        match self {
2235            CoroutineKind::Desugared(d, CoroutineSource::Fn) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}fn bodies", d))
    })format!("{d:#}fn bodies"),
2236            CoroutineKind::Desugared(d, CoroutineSource::Block) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}blocks", d))
    })format!("{d:#}blocks"),
2237            CoroutineKind::Desugared(d, CoroutineSource::Closure) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}closure bodies", d))
    })format!("{d:#}closure bodies"),
2238            CoroutineKind::Coroutine(_) => "coroutines".to_string(),
2239        }
2240    }
2241}
2242
2243impl fmt::Display for CoroutineKind {
2244    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2245        match self {
2246            CoroutineKind::Desugared(d, k) => {
2247                d.fmt(f)?;
2248                k.fmt(f)
2249            }
2250            CoroutineKind::Coroutine(_) => f.write_str("coroutine"),
2251        }
2252    }
2253}
2254
2255/// In the case of a coroutine created as part of an async/gen construct,
2256/// which kind of async/gen construct caused it to be created?
2257///
2258/// This helps error messages but is also used to drive coercions in
2259/// type-checking (see #60424).
2260#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoroutineSource {
    #[inline]
    fn clone(&self) -> CoroutineSource { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineSource {
    #[inline]
    fn eq(&self, other: &CoroutineSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for CoroutineSource {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CoroutineSource::Block => "Block",
                CoroutineSource::Closure => "Closure",
                CoroutineSource::Fn => "Fn",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for CoroutineSource { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for CoroutineSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    CoroutineSource::Block => {}
                    CoroutineSource::Closure => {}
                    CoroutineSource::Fn => {}
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for CoroutineSource {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        CoroutineSource::Block => { 0usize }
                        CoroutineSource::Closure => { 1usize }
                        CoroutineSource::Fn => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    CoroutineSource::Block => {}
                    CoroutineSource::Closure => {}
                    CoroutineSource::Fn => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for CoroutineSource {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { CoroutineSource::Block }
                    1usize => { CoroutineSource::Closure }
                    2usize => { CoroutineSource::Fn }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineSource`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
2261pub enum CoroutineSource {
2262    /// An explicit `async`/`gen` block written by the user.
2263    Block,
2264
2265    /// An explicit `async`/`gen` closure written by the user.
2266    Closure,
2267
2268    /// The `async`/`gen` block generated as the body of an async/gen function.
2269    Fn,
2270}
2271
2272impl fmt::Display for CoroutineSource {
2273    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2274        match self {
2275            CoroutineSource::Block => "block",
2276            CoroutineSource::Closure => "closure body",
2277            CoroutineSource::Fn => "fn body",
2278        }
2279        .fmt(f)
2280    }
2281}
2282
2283#[derive(#[automatically_derived]
impl ::core::clone::Clone for CoroutineDesugaring {
    #[inline]
    fn clone(&self) -> CoroutineDesugaring { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for CoroutineDesugaring {
    #[inline]
    fn eq(&self, other: &CoroutineDesugaring) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CoroutineDesugaring {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for CoroutineDesugaring {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CoroutineDesugaring::Async => "Async",
                CoroutineDesugaring::Gen => "Gen",
                CoroutineDesugaring::AsyncGen => "AsyncGen",
            })
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for CoroutineDesugaring { }Copy, #[automatically_derived]
impl ::core::hash::Hash for CoroutineDesugaring {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for CoroutineDesugaring where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    CoroutineDesugaring::Async => {}
                    CoroutineDesugaring::Gen => {}
                    CoroutineDesugaring::AsyncGen => {}
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for CoroutineDesugaring {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        CoroutineDesugaring::Async => { 0usize }
                        CoroutineDesugaring::Gen => { 1usize }
                        CoroutineDesugaring::AsyncGen => { 2usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    CoroutineDesugaring::Async => {}
                    CoroutineDesugaring::Gen => {}
                    CoroutineDesugaring::AsyncGen => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for CoroutineDesugaring {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { CoroutineDesugaring::Async }
                    1usize => { CoroutineDesugaring::Gen }
                    2usize => { CoroutineDesugaring::AsyncGen }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `CoroutineDesugaring`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
2284pub enum CoroutineDesugaring {
2285    /// An explicit `async` block or the body of an `async` function.
2286    Async,
2287
2288    /// An explicit `gen` block or the body of a `gen` function.
2289    Gen,
2290
2291    /// An explicit `async gen` block or the body of an `async gen` function,
2292    /// which is able to both `yield` and `.await`.
2293    AsyncGen,
2294}
2295
2296impl fmt::Display for CoroutineDesugaring {
2297    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2298        match self {
2299            CoroutineDesugaring::Async => {
2300                if f.alternate() {
2301                    f.write_str("`async` ")?;
2302                } else {
2303                    f.write_str("async ")?
2304                }
2305            }
2306            CoroutineDesugaring::Gen => {
2307                if f.alternate() {
2308                    f.write_str("`gen` ")?;
2309                } else {
2310                    f.write_str("gen ")?
2311                }
2312            }
2313            CoroutineDesugaring::AsyncGen => {
2314                if f.alternate() {
2315                    f.write_str("`async gen` ")?;
2316                } else {
2317                    f.write_str("async gen ")?
2318                }
2319            }
2320        }
2321
2322        Ok(())
2323    }
2324}
2325
2326#[derive(#[automatically_derived]
impl ::core::marker::Copy for BodyOwnerKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for BodyOwnerKind {
    #[inline]
    fn clone(&self) -> BodyOwnerKind {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for BodyOwnerKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            BodyOwnerKind::Fn => ::core::fmt::Formatter::write_str(f, "Fn"),
            BodyOwnerKind::Closure =>
                ::core::fmt::Formatter::write_str(f, "Closure"),
            BodyOwnerKind::Const { inline: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "inline", &__self_0),
            BodyOwnerKind::Static(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Static",
                    &__self_0),
            BodyOwnerKind::GlobalAsm =>
                ::core::fmt::Formatter::write_str(f, "GlobalAsm"),
        }
    }
}Debug)]
2327pub enum BodyOwnerKind {
2328    /// Functions and methods.
2329    Fn,
2330
2331    /// Closures
2332    Closure,
2333
2334    /// Constants and associated constants, also including inline constants.
2335    Const { inline: bool },
2336
2337    /// Initializer of a `static` item.
2338    Static(Mutability),
2339
2340    /// Fake body for a global asm to store its const-like value types.
2341    GlobalAsm,
2342}
2343
2344impl BodyOwnerKind {
2345    pub fn is_fn_or_closure(self) -> bool {
2346        match self {
2347            BodyOwnerKind::Fn | BodyOwnerKind::Closure => true,
2348            BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(_) | BodyOwnerKind::GlobalAsm => {
2349                false
2350            }
2351        }
2352    }
2353}
2354
2355/// The kind of an item that requires const-checking.
2356#[derive(#[automatically_derived]
impl ::core::clone::Clone for ConstContext {
    #[inline]
    fn clone(&self) -> ConstContext {
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ConstContext { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for ConstContext {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ConstContext::ConstFn =>
                ::core::fmt::Formatter::write_str(f, "ConstFn"),
            ConstContext::Static(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Static",
                    &__self_0),
            ConstContext::Const { inline: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "inline", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for ConstContext {
    #[inline]
    fn eq(&self, other: &ConstContext) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ConstContext::Static(__self_0),
                    ConstContext::Static(__arg1_0)) => __self_0 == __arg1_0,
                (ConstContext::Const { inline: __self_0 },
                    ConstContext::Const { inline: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ConstContext {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Mutability>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq)]
2357pub enum ConstContext {
2358    /// A `const fn`.
2359    ConstFn,
2360
2361    /// A `static` or `static mut`.
2362    Static(Mutability),
2363
2364    /// A `const`, associated `const`, or other const context.
2365    ///
2366    /// Other contexts include:
2367    /// - Array length expressions
2368    /// - Enum discriminants
2369    /// - Const generics
2370    ///
2371    /// For the most part, other contexts are treated just like a regular `const`, so they are
2372    /// lumped into the same category.
2373    Const { inline: bool },
2374}
2375
2376impl ConstContext {
2377    /// A description of this const context that can appear between backticks in an error message.
2378    ///
2379    /// E.g. `const` or `static mut`.
2380    pub fn keyword_name(self) -> &'static str {
2381        match self {
2382            Self::Const { .. } => "const",
2383            Self::Static(Mutability::Not) => "static",
2384            Self::Static(Mutability::Mut) => "static mut",
2385            Self::ConstFn => "const fn",
2386        }
2387    }
2388}
2389
2390/// A colloquial, trivially pluralizable description of this const context for use in error
2391/// messages.
2392impl fmt::Display for ConstContext {
2393    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2394        match *self {
2395            Self::Const { .. } => f.write_fmt(format_args!("constant"))write!(f, "constant"),
2396            Self::Static(_) => f.write_fmt(format_args!("static"))write!(f, "static"),
2397            Self::ConstFn => f.write_fmt(format_args!("constant function"))write!(f, "constant function"),
2398        }
2399    }
2400}
2401
2402impl IntoDiagArg for ConstContext {
2403    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
2404        DiagArgValue::Str(Cow::Borrowed(match self {
2405            ConstContext::ConstFn => "const_fn",
2406            ConstContext::Static(_) => "static",
2407            ConstContext::Const { .. } => "const",
2408        }))
2409    }
2410}
2411
2412/// A literal.
2413pub type Lit = Spanned<LitKind>;
2414
2415/// A constant (expression) that's not an item or associated item,
2416/// but needs its own `DefId` for type-checking, const-eval, etc.
2417/// These are usually found nested inside types (e.g., array lengths)
2418/// or expressions (e.g., repeat counts), and also used to define
2419/// explicit discriminant values for enum variants.
2420///
2421/// You can check if this anon const is a default in a const param
2422/// `const N: usize = { ... }` with `tcx.hir_opt_const_param_default_param_def_id(..)`
2423#[derive(#[automatically_derived]
impl ::core::marker::Copy for AnonConst { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AnonConst {
    #[inline]
    fn clone(&self) -> AnonConst {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AnonConst {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "AnonConst",
            "hir_id", &self.hir_id, "def_id", &self.def_id, "body",
            &self.body, "span", &&self.span)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AnonConst where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    AnonConst {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        body: ref __binding_2,
                        span: ref __binding_3 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2424pub struct AnonConst {
2425    #[stable_hasher(ignore)]
2426    pub hir_id: HirId,
2427    pub def_id: LocalDefId,
2428    pub body: BodyId,
2429    pub span: Span,
2430}
2431
2432/// An inline constant expression `const { something }`.
2433#[derive(#[automatically_derived]
impl ::core::marker::Copy for ConstBlock { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ConstBlock {
    #[inline]
    fn clone(&self) -> ConstBlock {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ConstBlock {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "ConstBlock",
            "hir_id", &self.hir_id, "def_id", &self.def_id, "body",
            &&self.body)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ConstBlock where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ConstBlock {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        body: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2434pub struct ConstBlock {
2435    #[stable_hasher(ignore)]
2436    pub hir_id: HirId,
2437    pub def_id: LocalDefId,
2438    pub body: BodyId,
2439}
2440
2441/// An expression.
2442///
2443/// For more details, see the [rust lang reference].
2444/// Note that the reference does not document nightly-only features.
2445/// There may be also slight differences in the names and representation of AST nodes between
2446/// the compiler and the reference.
2447///
2448/// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html
2449#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Expr<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Expr",
            "hir_id", &self.hir_id, "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Expr<'hir> {
    #[inline]
    fn clone(&self) -> Expr<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<ExprKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Expr<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Expr<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Expr {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2450pub struct Expr<'hir> {
2451    #[stable_hasher(ignore)]
2452    pub hir_id: HirId,
2453    pub kind: ExprKind<'hir>,
2454    pub span: Span,
2455}
2456
2457impl Expr<'_> {
2458    pub fn precedence(&self, has_attr: &dyn Fn(HirId) -> bool) -> ExprPrecedence {
2459        let prefix_attrs_precedence = || -> ExprPrecedence {
2460            if has_attr(self.hir_id) { ExprPrecedence::Prefix } else { ExprPrecedence::Unambiguous }
2461        };
2462
2463        match &self.kind {
2464            ExprKind::Closure(closure) => {
2465                match closure.fn_decl.output {
2466                    FnRetTy::DefaultReturn(_) => ExprPrecedence::Jump,
2467                    FnRetTy::Return(_) => prefix_attrs_precedence(),
2468                }
2469            }
2470
2471            ExprKind::Break(..)
2472            | ExprKind::Ret(..)
2473            | ExprKind::Yield(..)
2474            | ExprKind::Become(..) => ExprPrecedence::Jump,
2475
2476            // Binop-like expr kinds, handled by `AssocOp`.
2477            ExprKind::Binary(op, ..) => op.node.precedence(),
2478            ExprKind::Cast(..) => ExprPrecedence::Cast,
2479
2480            ExprKind::Assign(..) |
2481            ExprKind::AssignOp(..) => ExprPrecedence::Assign,
2482
2483            // Unary, prefix
2484            ExprKind::AddrOf(..)
2485            // Here `let pats = expr` has `let pats =` as a "unary" prefix of `expr`.
2486            // However, this is not exactly right. When `let _ = a` is the LHS of a binop we
2487            // need parens sometimes. E.g. we can print `(let _ = a) && b` as `let _ = a && b`
2488            // but we need to print `(let _ = a) < b` as-is with parens.
2489            | ExprKind::Let(..)
2490            | ExprKind::Unary(..) => ExprPrecedence::Prefix,
2491
2492            // Need parens if and only if there are prefix attributes.
2493            ExprKind::Array(_)
2494            | ExprKind::Block(..)
2495            | ExprKind::Call(..)
2496            | ExprKind::ConstBlock(_)
2497            | ExprKind::Continue(..)
2498            | ExprKind::Field(..)
2499            | ExprKind::If(..)
2500            | ExprKind::Index(..)
2501            | ExprKind::InlineAsm(..)
2502            | ExprKind::Lit(_)
2503            | ExprKind::Loop(..)
2504            | ExprKind::Match(..)
2505            | ExprKind::MethodCall(..)
2506            | ExprKind::OffsetOf(..)
2507            | ExprKind::Path(..)
2508            | ExprKind::Repeat(..)
2509            | ExprKind::Struct(..)
2510            | ExprKind::Tup(_)
2511            | ExprKind::Type(..)
2512            | ExprKind::UnsafeBinderCast(..)
2513            | ExprKind::Use(..)
2514            | ExprKind::Err(_) => prefix_attrs_precedence(),
2515
2516            ExprKind::DropTemps(expr, ..) => expr.precedence(has_attr),
2517        }
2518    }
2519
2520    /// Whether this looks like a place expr, without checking for deref
2521    /// adjustments.
2522    /// This will return `true` in some potentially surprising cases such as
2523    /// `CONSTANT.field`.
2524    pub fn is_syntactic_place_expr(&self) -> bool {
2525        self.is_place_expr(|_| true)
2526    }
2527
2528    /// Whether this is a place expression.
2529    ///
2530    /// `allow_projections_from` should return `true` if indexing a field or index expression based
2531    /// on the given expression should be considered a place expression.
2532    pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
2533        match self.kind {
2534            ExprKind::Path(QPath::Resolved(_, ref path)) => {
2535                #[allow(non_exhaustive_omitted_patterns)] match path.res {
    Res::Local(..) | Res::Def(DefKind::Static { .. }, _) | Res::Err => true,
    _ => false,
}matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static { .. }, _) | Res::Err)
2536            }
2537
2538            // Type ascription inherits its place expression kind from its
2539            // operand. See:
2540            // https://github.com/rust-lang/rfcs/blob/master/text/0803-type-ascription.md#type-ascription-and-temporaries
2541            ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
2542
2543            // Unsafe binder cast preserves place-ness of the sub-expression.
2544            ExprKind::UnsafeBinderCast(_, e, _) => e.is_place_expr(allow_projections_from),
2545
2546            ExprKind::Unary(UnOp::Deref, _) => true,
2547
2548            ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _, _) => {
2549                allow_projections_from(base) || base.is_place_expr(allow_projections_from)
2550            }
2551
2552            // Suppress errors for bad expressions.
2553            ExprKind::Err(_guar)
2554            | ExprKind::Let(&LetExpr { recovered: ast::Recovered::Yes(_guar), .. }) => true,
2555
2556            // Partially qualified paths in expressions can only legally
2557            // refer to associated items which are always rvalues.
2558            ExprKind::Path(QPath::TypeRelative(..))
2559            | ExprKind::Call(..)
2560            | ExprKind::MethodCall(..)
2561            | ExprKind::Use(..)
2562            | ExprKind::Struct(..)
2563            | ExprKind::Tup(..)
2564            | ExprKind::If(..)
2565            | ExprKind::Match(..)
2566            | ExprKind::Closure { .. }
2567            | ExprKind::Block(..)
2568            | ExprKind::Repeat(..)
2569            | ExprKind::Array(..)
2570            | ExprKind::Break(..)
2571            | ExprKind::Continue(..)
2572            | ExprKind::Ret(..)
2573            | ExprKind::Become(..)
2574            | ExprKind::Let(..)
2575            | ExprKind::Loop(..)
2576            | ExprKind::Assign(..)
2577            | ExprKind::InlineAsm(..)
2578            | ExprKind::OffsetOf(..)
2579            | ExprKind::AssignOp(..)
2580            | ExprKind::Lit(_)
2581            | ExprKind::ConstBlock(..)
2582            | ExprKind::Unary(..)
2583            | ExprKind::AddrOf(..)
2584            | ExprKind::Binary(..)
2585            | ExprKind::Yield(..)
2586            | ExprKind::Cast(..)
2587            | ExprKind::DropTemps(..) => false,
2588        }
2589    }
2590
2591    /// If this is a desugared range expression,
2592    /// returns the span of the range without desugaring context.
2593    pub fn range_span(&self) -> Option<Span> {
2594        is_range_literal(self).then(|| self.span.parent_callsite().unwrap())
2595    }
2596
2597    /// Check if expression is an integer literal that can be used
2598    /// where `usize` is expected.
2599    pub fn is_size_lit(&self) -> bool {
2600        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    ExprKind::Lit(Lit {
        node: LitKind::Int(_,
            LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)), ..
        }) => true,
    _ => false,
}matches!(
2601            self.kind,
2602            ExprKind::Lit(Lit {
2603                node: LitKind::Int(_, LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)),
2604                ..
2605            })
2606        )
2607    }
2608
2609    /// If `Self.kind` is `ExprKind::DropTemps(expr)`, drill down until we get a non-`DropTemps`
2610    /// `Expr`. This is used in suggestions to ignore this `ExprKind` as it is semantically
2611    /// silent, only signaling the ownership system. By doing this, suggestions that check the
2612    /// `ExprKind` of any given `Expr` for presentation don't have to care about `DropTemps`
2613    /// beyond remembering to call this function before doing analysis on it.
2614    pub fn peel_drop_temps(&self) -> &Self {
2615        let mut expr = self;
2616        while let ExprKind::DropTemps(inner) = &expr.kind {
2617            expr = inner;
2618        }
2619        expr
2620    }
2621
2622    pub fn peel_blocks(&self) -> &Self {
2623        let mut expr = self;
2624        while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
2625            expr = inner;
2626        }
2627        expr
2628    }
2629
2630    pub fn peel_borrows(&self) -> &Self {
2631        let mut expr = self;
2632        while let ExprKind::AddrOf(.., inner) = &expr.kind {
2633            expr = inner;
2634        }
2635        expr
2636    }
2637
2638    pub fn can_have_side_effects(&self) -> bool {
2639        match self.peel_drop_temps().kind {
2640            ExprKind::Path(_) | ExprKind::Lit(_) | ExprKind::OffsetOf(..) | ExprKind::Use(..) => {
2641                false
2642            }
2643            ExprKind::Type(base, _)
2644            | ExprKind::Unary(_, base)
2645            | ExprKind::Field(base, _)
2646            | ExprKind::Index(base, _, _)
2647            | ExprKind::AddrOf(.., base)
2648            | ExprKind::Cast(base, _)
2649            | ExprKind::UnsafeBinderCast(_, base, _) => {
2650                // This isn't exactly true for `Index` and all `Unary`, but we are using this
2651                // method exclusively for diagnostics and there's a *cultural* pressure against
2652                // them being used only for its side-effects.
2653                base.can_have_side_effects()
2654            }
2655            ExprKind::Binary(_, lhs, rhs) => {
2656                // This isn't exactly true for all `Binary`, but we are using this
2657                // method exclusively for diagnostics and there's a *cultural* pressure against
2658                // them being used only for its side-effects.
2659                lhs.can_have_side_effects() || rhs.can_have_side_effects()
2660            }
2661            ExprKind::Struct(_, fields, init) => {
2662                let init_side_effects = match init {
2663                    StructTailExpr::Base(init) => init.can_have_side_effects(),
2664                    StructTailExpr::DefaultFields(_)
2665                    | StructTailExpr::None
2666                    | StructTailExpr::NoneWithError(_) => false,
2667                };
2668                fields.iter().map(|field| field.expr).any(|e| e.can_have_side_effects())
2669                    || init_side_effects
2670            }
2671
2672            ExprKind::Array(args)
2673            | ExprKind::Tup(args)
2674            | ExprKind::Call(
2675                Expr {
2676                    kind:
2677                        ExprKind::Path(QPath::Resolved(
2678                            None,
2679                            Path { res: Res::Def(DefKind::Ctor(_, CtorKind::Fn), _), .. },
2680                        )),
2681                    ..
2682                },
2683                args,
2684            ) => args.iter().any(|arg| arg.can_have_side_effects()),
2685            ExprKind::Repeat(arg, _) => arg.can_have_side_effects(),
2686            ExprKind::If(..)
2687            | ExprKind::Match(..)
2688            | ExprKind::MethodCall(..)
2689            | ExprKind::Call(..)
2690            | ExprKind::Closure { .. }
2691            | ExprKind::Block(..)
2692            | ExprKind::Break(..)
2693            | ExprKind::Continue(..)
2694            | ExprKind::Ret(..)
2695            | ExprKind::Become(..)
2696            | ExprKind::Let(..)
2697            | ExprKind::Loop(..)
2698            | ExprKind::Assign(..)
2699            | ExprKind::InlineAsm(..)
2700            | ExprKind::AssignOp(..)
2701            | ExprKind::ConstBlock(..)
2702            | ExprKind::Yield(..)
2703            | ExprKind::DropTemps(..)
2704            | ExprKind::Err(_) => true,
2705        }
2706    }
2707
2708    /// To a first-order approximation, is this a pattern?
2709    pub fn is_approximately_pattern(&self) -> bool {
2710        match &self.kind {
2711            ExprKind::Array(_)
2712            | ExprKind::Call(..)
2713            | ExprKind::Tup(_)
2714            | ExprKind::Lit(_)
2715            | ExprKind::Path(_)
2716            | ExprKind::Struct(..) => true,
2717            _ => false,
2718        }
2719    }
2720
2721    /// Whether this and the `other` expression are the same for purposes of an indexing operation.
2722    ///
2723    /// This is only used for diagnostics to see if we have things like `foo[i]` where `foo` is
2724    /// borrowed multiple times with `i`.
2725    pub fn equivalent_for_indexing(&self, other: &Expr<'_>) -> bool {
2726        match (self.kind, other.kind) {
2727            (ExprKind::Lit(lit1), ExprKind::Lit(lit2)) => lit1.node == lit2.node,
2728            (
2729                ExprKind::Path(QPath::Resolved(None, path1)),
2730                ExprKind::Path(QPath::Resolved(None, path2)),
2731            ) => path1.res == path2.res,
2732            (
2733                ExprKind::Struct(
2734                    &QPath::Resolved(None, &Path { res: Res::Def(_, path1_def_id), .. }),
2735                    args1,
2736                    StructTailExpr::None,
2737                ),
2738                ExprKind::Struct(
2739                    &QPath::Resolved(None, &Path { res: Res::Def(_, path2_def_id), .. }),
2740                    args2,
2741                    StructTailExpr::None,
2742                ),
2743            ) => {
2744                path2_def_id == path1_def_id
2745                    && is_range_literal(self)
2746                    && is_range_literal(other)
2747                    && std::iter::zip(args1, args2)
2748                        .all(|(a, b)| a.expr.equivalent_for_indexing(b.expr))
2749            }
2750            _ => false,
2751        }
2752    }
2753
2754    pub fn method_ident(&self) -> Option<Ident> {
2755        match self.kind {
2756            ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
2757            ExprKind::Unary(_, expr) | ExprKind::AddrOf(.., expr) => expr.method_ident(),
2758            _ => None,
2759        }
2760    }
2761}
2762
2763/// Checks if the specified expression is a built-in range literal.
2764/// (See: `LoweringContext::lower_expr()`).
2765pub fn is_range_literal(expr: &Expr<'_>) -> bool {
2766    if let ExprKind::Struct(QPath::Resolved(None, path), _, StructTailExpr::None) = expr.kind
2767        && let [.., segment] = path.segments
2768        && let sym::RangeFrom
2769        | sym::RangeFull
2770        | sym::Range
2771        | sym::RangeToInclusive
2772        | sym::RangeTo
2773        | sym::RangeFromCopy
2774        | sym::RangeCopy
2775        | sym::RangeInclusiveCopy
2776        | sym::RangeToInclusiveCopy = segment.ident.name
2777        && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2778    {
2779        true
2780    } else if let ExprKind::Call(func, _) = &expr.kind
2781        && let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
2782        && let [.., segment] = path.segments
2783        && let sym::range_inclusive_new = segment.ident.name
2784        && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2785    {
2786        true
2787    } else {
2788        false
2789    }
2790}
2791
2792/// Checks if the specified expression needs parentheses for prefix
2793/// or postfix suggestions to be valid.
2794/// For example, `a + b` requires parentheses to suggest `&(a + b)`,
2795/// but just `a` does not.
2796/// Similarly, `(a + b).c()` also requires parentheses.
2797/// This should not be used for other types of suggestions.
2798pub fn expr_needs_parens(expr: &Expr<'_>) -> bool {
2799    match expr.kind {
2800        // parenthesize if needed (Issue #46756)
2801        ExprKind::Cast(_, _) | ExprKind::Binary(_, _, _) => true,
2802        // parenthesize borrows of range literals (Issue #54505)
2803        _ if is_range_literal(expr) => true,
2804        _ => false,
2805    }
2806}
2807
2808#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ExprKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ExprKind::ConstBlock(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ConstBlock", &__self_0),
            ExprKind::Array(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Array",
                    &__self_0),
            ExprKind::Call(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Call",
                    __self_0, &__self_1),
            ExprKind::MethodCall(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f,
                    "MethodCall", __self_0, __self_1, __self_2, &__self_3),
            ExprKind::Use(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
                    __self_0, &__self_1),
            ExprKind::Tup(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
                    &__self_0),
            ExprKind::Binary(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Binary",
                    __self_0, __self_1, &__self_2),
            ExprKind::Unary(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Unary",
                    __self_0, &__self_1),
            ExprKind::Lit(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Lit",
                    &__self_0),
            ExprKind::Cast(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Cast",
                    __self_0, &__self_1),
            ExprKind::Type(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Type",
                    __self_0, &__self_1),
            ExprKind::DropTemps(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "DropTemps", &__self_0),
            ExprKind::Let(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Let",
                    &__self_0),
            ExprKind::If(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "If",
                    __self_0, __self_1, &__self_2),
            ExprKind::Loop(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f, "Loop",
                    __self_0, __self_1, __self_2, &__self_3),
            ExprKind::Match(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Match",
                    __self_0, __self_1, &__self_2),
            ExprKind::Closure(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Closure", &__self_0),
            ExprKind::Block(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Block",
                    __self_0, &__self_1),
            ExprKind::Assign(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Assign",
                    __self_0, __self_1, &__self_2),
            ExprKind::AssignOp(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "AssignOp", __self_0, __self_1, &__self_2),
            ExprKind::Field(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Field",
                    __self_0, &__self_1),
            ExprKind::Index(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Index",
                    __self_0, __self_1, &__self_2),
            ExprKind::Path(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
                    &__self_0),
            ExprKind::AddrOf(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "AddrOf",
                    __self_0, __self_1, &__self_2),
            ExprKind::Break(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Break",
                    __self_0, &__self_1),
            ExprKind::Continue(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Continue", &__self_0),
            ExprKind::Ret(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ret",
                    &__self_0),
            ExprKind::Become(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Become",
                    &__self_0),
            ExprKind::InlineAsm(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "InlineAsm", &__self_0),
            ExprKind::OffsetOf(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "OffsetOf", __self_0, &__self_1),
            ExprKind::Struct(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
                    __self_0, __self_1, &__self_2),
            ExprKind::Repeat(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Repeat",
                    __self_0, &__self_1),
            ExprKind::Yield(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Yield",
                    __self_0, &__self_1),
            ExprKind::UnsafeBinderCast(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "UnsafeBinderCast", __self_0, __self_1, &__self_2),
            ExprKind::Err(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ExprKind<'hir> {
    #[inline]
    fn clone(&self) -> ExprKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<ConstBlock>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Expr<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<BinOp>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<UnOp>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Lit>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir LetExpr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<Label>>;
        let _: ::core::clone::AssertParamIsClone<LoopSource>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Arm<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<MatchSource>;
        let _: ::core::clone::AssertParamIsClone<&'hir Closure<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<Label>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<AssignOp>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<BorrowKind>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Destination>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir InlineAsm<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Ident]>;
        let _: ::core::clone::AssertParamIsClone<&'hir QPath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [ExprField<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<StructTailExpr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<YieldSource>;
        let _: ::core::clone::AssertParamIsClone<UnsafeBinderCastKind>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<rustc_span::ErrorGuaranteed>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ExprKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ExprKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ExprKind::ConstBlock(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Array(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Call(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::MethodCall(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Tup(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Binary(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Unary(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Lit(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Cast(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Type(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::DropTemps(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Let(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::If(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Loop(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Match(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Closure(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Block(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Assign(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::AssignOp(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Field(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Index(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Path(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::AddrOf(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Break(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Continue(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Ret(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Become(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::InlineAsm(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::OffsetOf(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Repeat(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Yield(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::UnsafeBinderCast(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ExprKind::Err(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2809pub enum ExprKind<'hir> {
2810    /// Allow anonymous constants from an inline `const` block
2811    ConstBlock(ConstBlock),
2812    /// An array (e.g., `[a, b, c, d]`).
2813    Array(&'hir [Expr<'hir>]),
2814    /// A function call.
2815    ///
2816    /// The first field resolves to the function itself (usually an `ExprKind::Path`),
2817    /// and the second field is the list of arguments.
2818    /// This also represents calling the constructor of
2819    /// tuple-like ADTs such as tuple structs and enum variants.
2820    Call(&'hir Expr<'hir>, &'hir [Expr<'hir>]),
2821    /// A method call (e.g., `x.foo::<'static, Bar, Baz>(a, b, c, d)`).
2822    ///
2823    /// The `PathSegment` represents the method name and its generic arguments
2824    /// (within the angle brackets).
2825    /// The `&Expr` is the expression that evaluates
2826    /// to the object on which the method is being called on (the receiver),
2827    /// and the `&[Expr]` is the rest of the arguments.
2828    /// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
2829    /// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, x, [a, b, c, d], span)`.
2830    /// The final `Span` represents the span of the function and arguments
2831    /// (e.g. `foo::<Bar, Baz>(a, b, c, d)` in `x.foo::<Bar, Baz>(a, b, c, d)`
2832    ///
2833    /// To resolve the called method to a `DefId`, call [`type_dependent_def_id`] with
2834    /// the `hir_id` of the `MethodCall` node itself.
2835    ///
2836    /// [`type_dependent_def_id`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.type_dependent_def_id
2837    MethodCall(&'hir PathSegment<'hir>, &'hir Expr<'hir>, &'hir [Expr<'hir>], Span),
2838    /// An use expression (e.g., `var.use`).
2839    Use(&'hir Expr<'hir>, Span),
2840    /// A tuple (e.g., `(a, b, c, d)`).
2841    Tup(&'hir [Expr<'hir>]),
2842    /// A binary operation (e.g., `a + b`, `a * b`).
2843    Binary(BinOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2844    /// A unary operation (e.g., `!x`, `*x`).
2845    Unary(UnOp, &'hir Expr<'hir>),
2846    /// A literal (e.g., `1`, `"foo"`).
2847    Lit(Lit),
2848    /// A cast (e.g., `foo as f64`).
2849    Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
2850    /// A type ascription (e.g., `x: Foo`). See RFC 3307.
2851    Type(&'hir Expr<'hir>, &'hir Ty<'hir>),
2852    /// Wraps the expression in a terminating scope.
2853    /// This makes it semantically equivalent to `{ let _t = expr; _t }`.
2854    ///
2855    /// This construct only exists to tweak the drop order in AST lowering.
2856    /// An example of that is the desugaring of `for` loops.
2857    DropTemps(&'hir Expr<'hir>),
2858    /// A `let $pat = $expr` expression.
2859    ///
2860    /// These are not [`LetStmt`] and only occur as expressions.
2861    /// The `let Some(x) = foo()` in `if let Some(x) = foo()` is an example of `Let(..)`.
2862    Let(&'hir LetExpr<'hir>),
2863    /// An `if` block, with an optional else block.
2864    ///
2865    /// I.e., `if <expr> { <expr> } else { <expr> }`.
2866    ///
2867    /// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
2868    /// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
2869    /// Note that using an `Expr` instead of a `Block` for the "then" part is intentional,
2870    /// as it simplifies the type coercion machinery.
2871    If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
2872    /// A conditionless loop (can be exited with `break`, `continue`, or `return`).
2873    ///
2874    /// I.e., `'label: loop { <block> }`.
2875    ///
2876    /// The `Span` is the loop header (`for x in y`/`while let pat = expr`).
2877    Loop(&'hir Block<'hir>, Option<Label>, LoopSource, Span),
2878    /// A `match` block, with a source that indicates whether or not it is
2879    /// the result of a desugaring, and if so, which kind.
2880    Match(&'hir Expr<'hir>, &'hir [Arm<'hir>], MatchSource),
2881    /// A closure (e.g., `move |a, b, c| {a + b + c}`).
2882    ///
2883    /// The `Span` is the argument block `|...|`.
2884    ///
2885    /// This may also be a coroutine literal or an `async block` as indicated by the
2886    /// `Option<Movability>`.
2887    Closure(&'hir Closure<'hir>),
2888    /// A block (e.g., `'label: { ... }`).
2889    Block(&'hir Block<'hir>, Option<Label>),
2890
2891    /// An assignment (e.g., `a = foo()`).
2892    Assign(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2893    /// An assignment with an operator.
2894    ///
2895    /// E.g., `a += 1`.
2896    AssignOp(AssignOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2897    /// Access of a named (e.g., `obj.foo`) or unnamed (e.g., `obj.0`) struct or tuple field.
2898    Field(&'hir Expr<'hir>, Ident),
2899    /// An indexing operation (`foo[2]`).
2900    /// Similar to [`ExprKind::MethodCall`], the final `Span` represents the span of the brackets
2901    /// and index.
2902    Index(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2903
2904    /// Path to a definition, possibly containing lifetime or type parameters.
2905    Path(QPath<'hir>),
2906
2907    /// A referencing operation (i.e., `&a` or `&mut a`).
2908    AddrOf(BorrowKind, Mutability, &'hir Expr<'hir>),
2909    /// A `break`, with an optional label to break.
2910    Break(Destination, Option<&'hir Expr<'hir>>),
2911    /// A `continue`, with an optional label.
2912    Continue(Destination),
2913    /// A `return`, with an optional value to be returned.
2914    Ret(Option<&'hir Expr<'hir>>),
2915    /// A `become`, with the value to be returned.
2916    Become(&'hir Expr<'hir>),
2917
2918    /// Inline assembly (from `asm!`), with its outputs and inputs.
2919    InlineAsm(&'hir InlineAsm<'hir>),
2920
2921    /// Field offset (`offset_of!`)
2922    OffsetOf(&'hir Ty<'hir>, &'hir [Ident]),
2923
2924    /// A struct or struct-like variant literal expression.
2925    ///
2926    /// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`,
2927    /// where `base` is the `Option<Expr>`.
2928    Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], StructTailExpr<'hir>),
2929
2930    /// An array literal constructed from one repeated element.
2931    ///
2932    /// E.g., `[1; 5]`. The first expression is the element
2933    /// to be repeated; the second is the number of times to repeat it.
2934    Repeat(&'hir Expr<'hir>, &'hir ConstArg<'hir>),
2935
2936    /// A suspension point for coroutines (i.e., `yield <expr>`).
2937    Yield(&'hir Expr<'hir>, YieldSource),
2938
2939    /// Operators which can be used to interconvert `unsafe` binder types.
2940    /// e.g. `unsafe<'a> &'a i32` <=> `&i32`.
2941    UnsafeBinderCast(UnsafeBinderCastKind, &'hir Expr<'hir>, Option<&'hir Ty<'hir>>),
2942
2943    /// A placeholder for an expression that wasn't syntactically well formed in some way.
2944    Err(rustc_span::ErrorGuaranteed),
2945}
2946
2947#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for StructTailExpr<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            StructTailExpr::None =>
                ::core::fmt::Formatter::write_str(f, "None"),
            StructTailExpr::Base(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Base",
                    &__self_0),
            StructTailExpr::DefaultFields(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "DefaultFields", &__self_0),
            StructTailExpr::NoneWithError(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NoneWithError", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for StructTailExpr<'hir> {
    #[inline]
    fn clone(&self) -> StructTailExpr<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<ErrorGuaranteed>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for StructTailExpr<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            StructTailExpr<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    StructTailExpr::None => {}
                    StructTailExpr::Base(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    StructTailExpr::DefaultFields(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    StructTailExpr::NoneWithError(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2948pub enum StructTailExpr<'hir> {
2949    /// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`.
2950    None,
2951    /// A struct expression with a "base", an expression of the same type as the outer struct that
2952    /// will be used to populate any fields not explicitly mentioned: `Foo { ..base }`
2953    Base(&'hir Expr<'hir>),
2954    /// A struct expression with a `..` tail but no "base" expression. The values from the struct
2955    /// fields' default values will be used to populate any fields not explicitly mentioned:
2956    /// `Foo { .. }`.
2957    DefaultFields(Span),
2958    /// No trailing `..` was written, and also, a parse error occurred inside the struct braces.
2959    ///
2960    /// This struct should be treated similarly to as if it had an `..` in it,
2961    /// in particular rather than reporting missing fields, because the parse error
2962    /// makes which fields the struct was intended to have not fully known.
2963    NoneWithError(ErrorGuaranteed),
2964}
2965
2966/// Represents an optionally `Self`-qualified value/type path or associated extension.
2967///
2968/// To resolve the path to a `DefId`, call [`qpath_res`].
2969///
2970/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
2971#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for QPath<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            QPath::Resolved(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "Resolved", __self_0, &__self_1),
            QPath::TypeRelative(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "TypeRelative", __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for QPath<'hir> {
    #[inline]
    fn clone(&self) -> QPath<'hir> {
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for QPath<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            QPath<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    QPath::Resolved(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    QPath::TypeRelative(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
2972pub enum QPath<'hir> {
2973    /// Path to a definition, optionally "fully-qualified" with a `Self`
2974    /// type, if the path points to an associated item in a trait.
2975    ///
2976    /// E.g., an unqualified path like `Clone::clone` has `None` for `Self`,
2977    /// while `<Vec<T> as Clone>::clone` has `Some(Vec<T>)` for `Self`,
2978    /// even though they both have the same two-segment `Clone::clone` `Path`.
2979    Resolved(Option<&'hir Ty<'hir>>, &'hir Path<'hir>),
2980
2981    /// Type-related paths (e.g., `<T>::default` or `<T>::Output`).
2982    /// Will be resolved by type-checking to an associated item.
2983    ///
2984    /// UFCS source paths can desugar into this, with `Vec::new` turning into
2985    /// `<Vec>::new`, and `T::X::Y::method` into `<<<T>::X>::Y>::method`,
2986    /// the `X` and `Y` nodes each being a `TyKind::Path(QPath::TypeRelative(..))`.
2987    TypeRelative(&'hir Ty<'hir>, &'hir PathSegment<'hir>),
2988}
2989
2990impl<'hir> QPath<'hir> {
2991    /// Returns the span of this `QPath`.
2992    pub fn span(&self) -> Span {
2993        match *self {
2994            QPath::Resolved(_, path) => path.span,
2995            QPath::TypeRelative(qself, ps) => qself.span.to(ps.ident.span),
2996        }
2997    }
2998
2999    /// Returns the span of the qself of this `QPath`. For example, `()` in
3000    /// `<() as Trait>::method`.
3001    pub fn qself_span(&self) -> Span {
3002        match *self {
3003            QPath::Resolved(_, path) => path.span,
3004            QPath::TypeRelative(qself, _) => qself.span,
3005        }
3006    }
3007}
3008
3009/// Hints at the original code for a let statement.
3010#[derive(#[automatically_derived]
impl ::core::marker::Copy for LocalSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LocalSource {
    #[inline]
    fn clone(&self) -> LocalSource { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LocalSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                LocalSource::Normal => "Normal",
                LocalSource::AsyncFn => "AsyncFn",
                LocalSource::AwaitDesugar => "AwaitDesugar",
                LocalSource::AssignDesugar => "AssignDesugar",
                LocalSource::Contract => "Contract",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LocalSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LocalSource::Normal => {}
                    LocalSource::AsyncFn => {}
                    LocalSource::AwaitDesugar => {}
                    LocalSource::AssignDesugar => {}
                    LocalSource::Contract => {}
                }
            }
        }
    };HashStable_Generic)]
3011pub enum LocalSource {
3012    /// A `match _ { .. }`.
3013    Normal,
3014    /// When lowering async functions, we create locals within the `async move` so that
3015    /// all parameters are dropped after the future is polled.
3016    ///
3017    /// ```ignore (pseudo-Rust)
3018    /// async fn foo(<pattern> @ x: Type) {
3019    ///     async move {
3020    ///         let <pattern> = x;
3021    ///     }
3022    /// }
3023    /// ```
3024    AsyncFn,
3025    /// A desugared `<expr>.await`.
3026    AwaitDesugar,
3027    /// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
3028    AssignDesugar,
3029    /// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return.
3030    Contract,
3031}
3032
3033/// Hints at the original code for a `match _ { .. }`.
3034#[derive(#[automatically_derived]
impl ::core::marker::Copy for MatchSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for MatchSource {
    #[inline]
    fn clone(&self) -> MatchSource {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for MatchSource {
    #[inline]
    fn eq(&self, other: &MatchSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (MatchSource::TryDesugar(__self_0),
                    MatchSource::TryDesugar(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MatchSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<HirId>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for MatchSource {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            MatchSource::TryDesugar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for MatchSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            MatchSource::Normal =>
                ::core::fmt::Formatter::write_str(f, "Normal"),
            MatchSource::Postfix =>
                ::core::fmt::Formatter::write_str(f, "Postfix"),
            MatchSource::ForLoopDesugar =>
                ::core::fmt::Formatter::write_str(f, "ForLoopDesugar"),
            MatchSource::TryDesugar(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TryDesugar", &__self_0),
            MatchSource::AwaitDesugar =>
                ::core::fmt::Formatter::write_str(f, "AwaitDesugar"),
            MatchSource::FormatArgs =>
                ::core::fmt::Formatter::write_str(f, "FormatArgs"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for MatchSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    MatchSource::Normal => {}
                    MatchSource::Postfix => {}
                    MatchSource::ForLoopDesugar => {}
                    MatchSource::TryDesugar(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    MatchSource::AwaitDesugar => {}
                    MatchSource::FormatArgs => {}
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for MatchSource {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        MatchSource::Normal => { 0usize }
                        MatchSource::Postfix => { 1usize }
                        MatchSource::ForLoopDesugar => { 2usize }
                        MatchSource::TryDesugar(ref __binding_0) => { 3usize }
                        MatchSource::AwaitDesugar => { 4usize }
                        MatchSource::FormatArgs => { 5usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    MatchSource::Normal => {}
                    MatchSource::Postfix => {}
                    MatchSource::ForLoopDesugar => {}
                    MatchSource::TryDesugar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    MatchSource::AwaitDesugar => {}
                    MatchSource::FormatArgs => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for MatchSource {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { MatchSource::Normal }
                    1usize => { MatchSource::Postfix }
                    2usize => { MatchSource::ForLoopDesugar }
                    3usize => {
                        MatchSource::TryDesugar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    4usize => { MatchSource::AwaitDesugar }
                    5usize => { MatchSource::FormatArgs }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `MatchSource`, expected 0..6, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
3035pub enum MatchSource {
3036    /// A `match _ { .. }`.
3037    Normal,
3038    /// A `expr.match { .. }`.
3039    Postfix,
3040    /// A desugared `for _ in _ { .. }` loop.
3041    ForLoopDesugar,
3042    /// A desugared `?` operator.
3043    TryDesugar(HirId),
3044    /// A desugared `<expr>.await`.
3045    AwaitDesugar,
3046    /// A desugared `format_args!()`.
3047    FormatArgs,
3048}
3049
3050impl MatchSource {
3051    #[inline]
3052    pub const fn name(self) -> &'static str {
3053        use MatchSource::*;
3054        match self {
3055            Normal => "match",
3056            Postfix => ".match",
3057            ForLoopDesugar => "for",
3058            TryDesugar(_) => "?",
3059            AwaitDesugar => ".await",
3060            FormatArgs => "format_args!()",
3061        }
3062    }
3063}
3064
3065/// The loop type that yielded an `ExprKind::Loop`.
3066#[derive(#[automatically_derived]
impl ::core::marker::Copy for LoopSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LoopSource {
    #[inline]
    fn clone(&self) -> LoopSource { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for LoopSource {
    #[inline]
    fn eq(&self, other: &LoopSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for LoopSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                LoopSource::Loop => "Loop",
                LoopSource::While => "While",
                LoopSource::ForLoop => "ForLoop",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LoopSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LoopSource::Loop => {}
                    LoopSource::While => {}
                    LoopSource::ForLoop => {}
                }
            }
        }
    };HashStable_Generic)]
3067pub enum LoopSource {
3068    /// A `loop { .. }` loop.
3069    Loop,
3070    /// A `while _ { .. }` loop.
3071    While,
3072    /// A `for _ in _ { .. }` loop.
3073    ForLoop,
3074}
3075
3076impl LoopSource {
3077    pub fn name(self) -> &'static str {
3078        match self {
3079            LoopSource::Loop => "loop",
3080            LoopSource::While => "while",
3081            LoopSource::ForLoop => "for",
3082        }
3083    }
3084}
3085
3086#[derive(#[automatically_derived]
impl ::core::marker::Copy for LoopIdError { }Copy, #[automatically_derived]
impl ::core::clone::Clone for LoopIdError {
    #[inline]
    fn clone(&self) -> LoopIdError { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for LoopIdError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                LoopIdError::OutsideLoopScope => "OutsideLoopScope",
                LoopIdError::UnlabeledCfInWhileCondition =>
                    "UnlabeledCfInWhileCondition",
                LoopIdError::UnresolvedLabel => "UnresolvedLabel",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for LoopIdError {
    #[inline]
    fn eq(&self, other: &LoopIdError) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for LoopIdError where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    LoopIdError::OutsideLoopScope => {}
                    LoopIdError::UnlabeledCfInWhileCondition => {}
                    LoopIdError::UnresolvedLabel => {}
                }
            }
        }
    };HashStable_Generic)]
3087pub enum LoopIdError {
3088    OutsideLoopScope,
3089    UnlabeledCfInWhileCondition,
3090    UnresolvedLabel,
3091}
3092
3093impl fmt::Display for LoopIdError {
3094    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3095        f.write_str(match self {
3096            LoopIdError::OutsideLoopScope => "not inside loop scope",
3097            LoopIdError::UnlabeledCfInWhileCondition => {
3098                "unlabeled control flow (break or continue) in while condition"
3099            }
3100            LoopIdError::UnresolvedLabel => "label not found",
3101        })
3102    }
3103}
3104
3105#[derive(#[automatically_derived]
impl ::core::marker::Copy for Destination { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Destination {
    #[inline]
    fn clone(&self) -> Destination {
        let _: ::core::clone::AssertParamIsClone<Option<Label>>;
        let _: ::core::clone::AssertParamIsClone<Result<HirId, LoopIdError>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for Destination {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Destination",
            "label", &self.label, "target_id", &&self.target_id)
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for Destination {
    #[inline]
    fn eq(&self, other: &Destination) -> bool {
        self.label == other.label && self.target_id == other.target_id
    }
}PartialEq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Destination where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Destination {
                        label: ref __binding_0, target_id: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3106pub struct Destination {
3107    /// This is `Some(_)` iff there is an explicit user-specified 'label
3108    pub label: Option<Label>,
3109
3110    /// These errors are caught and then reported during the diagnostics pass in
3111    /// `librustc_passes/loops.rs`
3112    pub target_id: Result<HirId, LoopIdError>,
3113}
3114
3115/// The yield kind that caused an `ExprKind::Yield`.
3116#[derive(#[automatically_derived]
impl ::core::marker::Copy for YieldSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for YieldSource {
    #[inline]
    fn clone(&self) -> YieldSource {
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for YieldSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            YieldSource::Await { expr: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Await",
                    "expr", &__self_0),
            YieldSource::Yield =>
                ::core::fmt::Formatter::write_str(f, "Yield"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for YieldSource where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    YieldSource::Await { expr: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    YieldSource::Yield => {}
                }
            }
        }
    };HashStable_Generic)]
3117pub enum YieldSource {
3118    /// An `<expr>.await`.
3119    Await { expr: Option<HirId> },
3120    /// A plain `yield`.
3121    Yield,
3122}
3123
3124impl fmt::Display for YieldSource {
3125    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3126        f.write_str(match self {
3127            YieldSource::Await { .. } => "`await`",
3128            YieldSource::Yield => "`yield`",
3129        })
3130    }
3131}
3132
3133// N.B., if you change this, you'll probably want to change the corresponding
3134// type structure in middle/ty.rs as well.
3135#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for MutTy<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "MutTy", "ty",
            &self.ty, "mutbl", &&self.mutbl)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for MutTy<'hir> {
    #[inline]
    fn clone(&self) -> MutTy<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for MutTy<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            MutTy<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    MutTy { ty: ref __binding_0, mutbl: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3136pub struct MutTy<'hir> {
3137    pub ty: &'hir Ty<'hir>,
3138    pub mutbl: Mutability,
3139}
3140
3141/// Represents a function's signature in a trait declaration,
3142/// trait implementation, or a free function.
3143#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnSig<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "FnSig",
            "header", &self.header, "decl", &self.decl, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for FnSig<'hir> {
    #[inline]
    fn clone(&self) -> FnSig<'hir> {
        let _: ::core::clone::AssertParamIsClone<FnHeader>;
        let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FnSig<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            FnSig<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    FnSig {
                        header: ref __binding_0,
                        decl: ref __binding_1,
                        span: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3144pub struct FnSig<'hir> {
3145    pub header: FnHeader,
3146    pub decl: &'hir FnDecl<'hir>,
3147    pub span: Span,
3148}
3149
3150// The bodies for items are stored "out of line", in a separate
3151// hashmap in the `Crate`. Here we just record the hir-id of the item
3152// so it can fetched later.
3153#[derive(#[automatically_derived]
impl ::core::marker::Copy for TraitItemId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for TraitItemId {
    #[inline]
    fn clone(&self) -> TraitItemId {
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for TraitItemId {
    #[inline]
    fn eq(&self, other: &TraitItemId) -> bool {
        self.owner_id == other.owner_id
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for TraitItemId {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<OwnerId>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for TraitItemId {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    TraitItemId { owner_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for TraitItemId {
            fn decode(__decoder: &mut __D) -> Self {
                TraitItemId {
                    owner_id: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for TraitItemId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "TraitItemId",
            "owner_id", &&self.owner_id)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for TraitItemId where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3154pub struct TraitItemId {
3155    pub owner_id: OwnerId,
3156}
3157
3158impl TraitItemId {
3159    #[inline]
3160    pub fn hir_id(&self) -> HirId {
3161        // Items are always HIR owners.
3162        HirId::make_owner(self.owner_id.def_id)
3163    }
3164}
3165
3166/// Represents an item declaration within a trait declaration,
3167/// possibly including a default implementation. A trait item is
3168/// either required (meaning it doesn't have an implementation, just a
3169/// signature) or provided (meaning it has a default implementation).
3170#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitItem<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ident", "owner_id", "generics", "kind", "span", "defaultness",
                        "has_delayed_lints"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ident, &self.owner_id, &self.generics, &self.kind,
                        &self.span, &self.defaultness, &&self.has_delayed_lints];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "TraitItem",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitItem<'hir> {
    #[inline]
    fn clone(&self) -> TraitItem<'hir> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<TraitItemKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<Defaultness>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitItem<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitItem<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitItem {
                        ident: ref __binding_0,
                        owner_id: ref __binding_1,
                        generics: ref __binding_2,
                        kind: ref __binding_3,
                        span: ref __binding_4,
                        defaultness: ref __binding_5,
                        has_delayed_lints: ref __binding_6 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3171pub struct TraitItem<'hir> {
3172    pub ident: Ident,
3173    pub owner_id: OwnerId,
3174    pub generics: &'hir Generics<'hir>,
3175    pub kind: TraitItemKind<'hir>,
3176    pub span: Span,
3177    pub defaultness: Defaultness,
3178    pub has_delayed_lints: bool,
3179}
3180
3181macro_rules! expect_methods_self_kind {
3182    ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3183        $(
3184            #[track_caller]
3185            pub fn $name(&self) -> $ret_ty {
3186                let $pat = &self.kind else { expect_failed(stringify!($name), self) };
3187                $ret_val
3188            }
3189        )*
3190    }
3191}
3192
3193macro_rules! expect_methods_self {
3194    ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3195        $(
3196            #[track_caller]
3197            pub fn $name(&self) -> $ret_ty {
3198                let $pat = self else { expect_failed(stringify!($name), self) };
3199                $ret_val
3200            }
3201        )*
3202    }
3203}
3204
3205#[track_caller]
3206fn expect_failed<T: fmt::Debug>(ident: &'static str, found: T) -> ! {
3207    {
    ::core::panicking::panic_fmt(format_args!("{0}: found {1:?}", ident,
            found));
}panic!("{ident}: found {found:?}")
3208}
3209
3210impl<'hir> TraitItem<'hir> {
3211    #[inline]
3212    pub fn hir_id(&self) -> HirId {
3213        // Items are always HIR owners.
3214        HirId::make_owner(self.owner_id.def_id)
3215    }
3216
3217    pub fn trait_item_id(&self) -> TraitItemId {
3218        TraitItemId { owner_id: self.owner_id }
3219    }
3220
3221    self
let TraitItemKind::Type(bounds, ty) =
    &self.kind else { expect_failed("expect_type", self) };
(bounds, *ty);expect_methods_self_kind! {
3222        expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3223            TraitItemKind::Const(ty, rhs, _), (ty, *rhs);
3224
3225        expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
3226            TraitItemKind::Fn(ty, trfn), (ty, trfn);
3227
3228        expect_type, (GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3229            TraitItemKind::Type(bounds, ty), (bounds, *ty);
3230    }
3231}
3232
3233/// Represents a trait method's body (or just argument names).
3234#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitFn<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            TraitFn::Required(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Required", &__self_0),
            TraitFn::Provided(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Provided", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitFn<'hir> {
    #[inline]
    fn clone(&self) -> TraitFn<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitFn<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitFn<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    TraitFn::Required(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TraitFn::Provided(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3235pub enum TraitFn<'hir> {
3236    /// No default body in the trait, just a signature.
3237    Required(&'hir [Option<Ident>]),
3238
3239    /// Both signature and body are provided in the trait.
3240    Provided(BodyId),
3241}
3242
3243#[derive(#[automatically_derived]
impl ::core::fmt::Debug for IsTypeConst {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                IsTypeConst::No => "No",
                IsTypeConst::Yes => "Yes",
            })
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for IsTypeConst {
    #[inline]
    fn clone(&self) -> IsTypeConst { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for IsTypeConst { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for IsTypeConst {
    #[inline]
    fn eq(&self, other: &IsTypeConst) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IsTypeConst {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for IsTypeConst where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self { IsTypeConst::No => {} IsTypeConst::Yes => {} }
            }
        }
    };HashStable_Generic)]
3244pub enum IsTypeConst {
3245    No,
3246    Yes,
3247}
3248
3249impl From<bool> for IsTypeConst {
3250    fn from(value: bool) -> Self {
3251        if value { Self::Yes } else { Self::No }
3252    }
3253}
3254
3255impl From<IsTypeConst> for bool {
3256    fn from(value: IsTypeConst) -> Self {
3257        #[allow(non_exhaustive_omitted_patterns)] match value {
    IsTypeConst::Yes => true,
    _ => false,
}matches!(value, IsTypeConst::Yes)
3258    }
3259}
3260
3261/// Represents a trait method or associated constant or type
3262#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitItemKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            TraitItemKind::Const(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Const",
                    __self_0, __self_1, &__self_2),
            TraitItemKind::Fn(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Fn",
                    __self_0, &__self_1),
            TraitItemKind::Type(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Type",
                    __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitItemKind<'hir> {
    #[inline]
    fn clone(&self) -> TraitItemKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<ConstItemRhs<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<IsTypeConst>;
        let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
        let _: ::core::clone::AssertParamIsClone<TraitFn<'hir>>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Ty<'hir>>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitItemKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitItemKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    TraitItemKind::Const(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    TraitItemKind::Fn(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TraitItemKind::Type(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3263pub enum TraitItemKind<'hir> {
3264    // FIXME(mgca) eventually want to move the option that is around `ConstItemRhs<'hir>`
3265    // into `ConstItemRhs`, much like `ast::ConstItemRhsKind`, but for now mark whether
3266    // this node is a TypeConst with a flag.
3267    /// An associated constant with an optional value (otherwise `impl`s must contain a value).
3268    Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>, IsTypeConst),
3269    /// An associated function with an optional body.
3270    Fn(FnSig<'hir>, TraitFn<'hir>),
3271    /// An associated type with (possibly empty) bounds and optional concrete
3272    /// type.
3273    Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3274}
3275
3276// The bodies for items are stored "out of line", in a separate
3277// hashmap in the `Crate`. Here we just record the hir-id of the item
3278// so it can fetched later.
3279#[derive(#[automatically_derived]
impl ::core::marker::Copy for ImplItemId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ImplItemId {
    #[inline]
    fn clone(&self) -> ImplItemId {
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ImplItemId {
    #[inline]
    fn eq(&self, other: &ImplItemId) -> bool {
        self.owner_id == other.owner_id
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ImplItemId {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<OwnerId>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for ImplItemId {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    ImplItemId { owner_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for ImplItemId {
            fn decode(__decoder: &mut __D) -> Self {
                ImplItemId {
                    owner_id: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for ImplItemId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "ImplItemId",
            "owner_id", &&self.owner_id)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ImplItemId where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ImplItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3280pub struct ImplItemId {
3281    pub owner_id: OwnerId,
3282}
3283
3284impl ImplItemId {
3285    #[inline]
3286    pub fn hir_id(&self) -> HirId {
3287        // Items are always HIR owners.
3288        HirId::make_owner(self.owner_id.def_id)
3289    }
3290}
3291
3292/// Represents an associated item within an impl block.
3293///
3294/// Refer to [`Impl`] for an impl block declaration.
3295#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplItem<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ident", "owner_id", "generics", "kind", "impl_kind", "span",
                        "has_delayed_lints"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ident, &self.owner_id, &self.generics, &self.kind,
                        &self.impl_kind, &self.span, &&self.has_delayed_lints];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "ImplItem",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ImplItem<'hir> {
    #[inline]
    fn clone(&self) -> ImplItem<'hir> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ImplItemKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ImplItemImplKind>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ImplItem<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ImplItem<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ImplItem {
                        ident: ref __binding_0,
                        owner_id: ref __binding_1,
                        generics: ref __binding_2,
                        kind: ref __binding_3,
                        impl_kind: ref __binding_4,
                        span: ref __binding_5,
                        has_delayed_lints: ref __binding_6 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3296pub struct ImplItem<'hir> {
3297    pub ident: Ident,
3298    pub owner_id: OwnerId,
3299    pub generics: &'hir Generics<'hir>,
3300    pub kind: ImplItemKind<'hir>,
3301    pub impl_kind: ImplItemImplKind,
3302    pub span: Span,
3303    pub has_delayed_lints: bool,
3304}
3305
3306#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ImplItemImplKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ImplItemImplKind::Inherent { vis_span: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Inherent", "vis_span", &__self_0),
            ImplItemImplKind::Trait {
                defaultness: __self_0, trait_item_def_id: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "Trait",
                    "defaultness", __self_0, "trait_item_def_id", &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for ImplItemImplKind {
    #[inline]
    fn clone(&self) -> ImplItemImplKind {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<Defaultness>;
        let _:
                ::core::clone::AssertParamIsClone<Result<DefId,
                ErrorGuaranteed>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ImplItemImplKind { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ImplItemImplKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ImplItemImplKind::Inherent { vis_span: ref __binding_0 } =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ImplItemImplKind::Trait {
                        defaultness: ref __binding_0,
                        trait_item_def_id: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3307pub enum ImplItemImplKind {
3308    Inherent {
3309        vis_span: Span,
3310    },
3311    Trait {
3312        defaultness: Defaultness,
3313        /// Item in the trait that this item implements
3314        trait_item_def_id: Result<DefId, ErrorGuaranteed>,
3315    },
3316}
3317
3318impl<'hir> ImplItem<'hir> {
3319    #[inline]
3320    pub fn hir_id(&self) -> HirId {
3321        // Items are always HIR owners.
3322        HirId::make_owner(self.owner_id.def_id)
3323    }
3324
3325    pub fn impl_item_id(&self) -> ImplItemId {
3326        ImplItemId { owner_id: self.owner_id }
3327    }
3328
3329    pub fn vis_span(&self) -> Option<Span> {
3330        match self.impl_kind {
3331            ImplItemImplKind::Trait { .. } => None,
3332            ImplItemImplKind::Inherent { vis_span, .. } => Some(vis_span),
3333        }
3334    }
3335
3336    self
let ImplItemKind::Type(ty) =
    &self.kind else { expect_failed("expect_type", self) };
ty;expect_methods_self_kind! {
3337        expect_const, (&'hir Ty<'hir>, ConstItemRhs<'hir>), ImplItemKind::Const(ty, rhs), (ty, *rhs);
3338        expect_fn,    (&FnSig<'hir>, BodyId),               ImplItemKind::Fn(ty, body),   (ty, *body);
3339        expect_type,  &'hir Ty<'hir>,                       ImplItemKind::Type(ty),       ty;
3340    }
3341}
3342
3343/// Represents various kinds of content within an `impl`.
3344#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplItemKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ImplItemKind::Const(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Const",
                    __self_0, &__self_1),
            ImplItemKind::Fn(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Fn",
                    __self_0, &__self_1),
            ImplItemKind::Type(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Type",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ImplItemKind<'hir> {
    #[inline]
    fn clone(&self) -> ImplItemKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ConstItemRhs<'hir>>;
        let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ImplItemKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ImplItemKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ImplItemKind::Const(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ImplItemKind::Fn(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ImplItemKind::Type(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3345pub enum ImplItemKind<'hir> {
3346    /// An associated constant of the given type, set to the constant result
3347    /// of the expression.
3348    Const(&'hir Ty<'hir>, ConstItemRhs<'hir>),
3349    /// An associated function implementation with the given signature and body.
3350    Fn(FnSig<'hir>, BodyId),
3351    /// An associated type.
3352    Type(&'hir Ty<'hir>),
3353}
3354
3355/// A constraint on an associated item.
3356///
3357/// ### Examples
3358///
3359/// * the `A = Ty` and `B = Ty` in `Trait<A = Ty, B = Ty>`
3360/// * the `G<Ty> = Ty` in `Trait<G<Ty> = Ty>`
3361/// * the `A: Bound` in `Trait<A: Bound>`
3362/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
3363/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`)
3364/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
3365#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for AssocItemConstraint<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f,
            "AssocItemConstraint", "hir_id", &self.hir_id, "ident",
            &self.ident, "gen_args", &self.gen_args, "kind", &self.kind,
            "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for AssocItemConstraint<'hir> {
    #[inline]
    fn clone(&self) -> AssocItemConstraint<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir GenericArgs<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<AssocItemConstraintKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for AssocItemConstraint<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            AssocItemConstraint<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    AssocItemConstraint {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        gen_args: ref __binding_2,
                        kind: ref __binding_3,
                        span: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3366pub struct AssocItemConstraint<'hir> {
3367    #[stable_hasher(ignore)]
3368    pub hir_id: HirId,
3369    pub ident: Ident,
3370    pub gen_args: &'hir GenericArgs<'hir>,
3371    pub kind: AssocItemConstraintKind<'hir>,
3372    pub span: Span,
3373}
3374
3375impl<'hir> AssocItemConstraint<'hir> {
3376    /// Obtain the type on the RHS of an assoc ty equality constraint if applicable.
3377    pub fn ty(self) -> Option<&'hir Ty<'hir>> {
3378        match self.kind {
3379            AssocItemConstraintKind::Equality { term: Term::Ty(ty) } => Some(ty),
3380            _ => None,
3381        }
3382    }
3383
3384    /// Obtain the const on the RHS of an assoc const equality constraint if applicable.
3385    pub fn ct(self) -> Option<&'hir ConstArg<'hir>> {
3386        match self.kind {
3387            AssocItemConstraintKind::Equality { term: Term::Const(ct) } => Some(ct),
3388            _ => None,
3389        }
3390    }
3391}
3392
3393#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Term<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Term::Ty(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ty",
                    &__self_0),
            Term::Const(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Const",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Term<'hir> {
    #[inline]
    fn clone(&self) -> Term<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Term<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Term<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    Term::Ty(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Term::Const(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3394pub enum Term<'hir> {
3395    Ty(&'hir Ty<'hir>),
3396    Const(&'hir ConstArg<'hir>),
3397}
3398
3399impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
3400    fn from(ty: &'hir Ty<'hir>) -> Self {
3401        Term::Ty(ty)
3402    }
3403}
3404
3405impl<'hir> From<&'hir ConstArg<'hir>> for Term<'hir> {
3406    fn from(c: &'hir ConstArg<'hir>) -> Self {
3407        Term::Const(c)
3408    }
3409}
3410
3411/// The kind of [associated item constraint][AssocItemConstraint].
3412#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for AssocItemConstraintKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            AssocItemConstraintKind::Equality { term: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Equality", "term", &__self_0),
            AssocItemConstraintKind::Bound { bounds: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Bound",
                    "bounds", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for AssocItemConstraintKind<'hir> {
    #[inline]
    fn clone(&self) -> AssocItemConstraintKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<Term<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericBound<'hir>]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for AssocItemConstraintKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            AssocItemConstraintKind<'hir> where
            __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    AssocItemConstraintKind::Equality { term: ref __binding_0 }
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    AssocItemConstraintKind::Bound { bounds: ref __binding_0 }
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3413pub enum AssocItemConstraintKind<'hir> {
3414    /// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait<AssocTy = Ty>`).
3415    ///
3416    /// Also known as an *associated item binding* (we *bind* an associated item to a term).
3417    ///
3418    /// Furthermore, associated type equality constraints can also be referred to as *associated type
3419    /// bindings*. Similarly with associated const equality constraints and *associated const bindings*.
3420    Equality { term: Term<'hir> },
3421    /// A bound on an associated type (e.g., `AssocTy: Bound` in `Trait<AssocTy: Bound>`).
3422    Bound { bounds: &'hir [GenericBound<'hir>] },
3423}
3424
3425impl<'hir> AssocItemConstraintKind<'hir> {
3426    pub fn descr(&self) -> &'static str {
3427        match self {
3428            AssocItemConstraintKind::Equality { .. } => "binding",
3429            AssocItemConstraintKind::Bound { .. } => "constraint",
3430        }
3431    }
3432}
3433
3434/// An uninhabited enum used to make `Infer` variants on [`Ty`] and [`ConstArg`] be
3435/// unreachable. Zero-Variant enums are guaranteed to have the same layout as the never
3436/// type.
3437#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AmbigArg {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match *self {}
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for AmbigArg {
    #[inline]
    fn clone(&self) -> AmbigArg { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for AmbigArg { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for AmbigArg where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {}
            }
        }
    };HashStable_Generic)]
3438pub enum AmbigArg {}
3439
3440/// Represents a type in the `HIR`.
3441///
3442/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3443/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
3444#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
    Ty<'hir, Unambig> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "Ty", "hir_id",
            &self.hir_id, "span", &self.span, "kind", &&self.kind)
    }
}Debug, #[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
    Ty<'hir, Unambig> {
    #[inline]
    fn clone(&self) -> Ty<'hir, Unambig> {
        Ty {
            hir_id: ::core::clone::Clone::clone(&self.hir_id),
            span: ::core::clone::Clone::clone(&self.span),
            kind: ::core::clone::Clone::clone(&self.kind),
        }
    }
}Clone, #[automatically_derived]
impl<'hir, Unambig: ::core::marker::Copy> ::core::marker::Copy for
    Ty<'hir, Unambig> {
}Copy, const _: () =
    {
        impl<'hir, Unambig, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Ty<'hir, Unambig> where __CTX: crate::HashStableContext,
            Unambig: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Ty {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3445#[repr(C)]
3446pub struct Ty<'hir, Unambig = ()> {
3447    #[stable_hasher(ignore)]
3448    pub hir_id: HirId,
3449    pub span: Span,
3450    pub kind: TyKind<'hir, Unambig>,
3451}
3452
3453impl<'hir> Ty<'hir, AmbigArg> {
3454    /// Converts a `Ty` in an ambiguous position to one in an unambiguous position.
3455    ///
3456    /// Functions accepting an unambiguous types may expect the [`TyKind::Infer`] variant
3457    /// to be used. Care should be taken to separately handle infer types when calling this
3458    /// function as it cannot be handled by downstream code making use of the returned ty.
3459    ///
3460    /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or
3461    /// specifically matching on [`GenericArg::Infer`] when handling generic arguments.
3462    ///
3463    /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer]
3464    pub fn as_unambig_ty(&self) -> &Ty<'hir> {
3465        // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is
3466        // the same across different ZST type arguments.
3467        let ptr = self as *const Ty<'hir, AmbigArg> as *const Ty<'hir, ()>;
3468        unsafe { &*ptr }
3469    }
3470}
3471
3472impl<'hir> Ty<'hir> {
3473    /// Converts a `Ty` in an unambiguous position to one in an ambiguous position. This is
3474    /// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions.
3475    ///
3476    /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if
3477    /// infer types are relevant to you then care should be taken to handle them separately.
3478    pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> {
3479        if let TyKind::Infer(()) = self.kind {
3480            return None;
3481        }
3482
3483        // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is
3484        // the same across different ZST type arguments. We also asserted that the `self` is
3485        // not a `TyKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`.
3486        let ptr = self as *const Ty<'hir> as *const Ty<'hir, AmbigArg>;
3487        Some(unsafe { &*ptr })
3488    }
3489}
3490
3491impl<'hir> Ty<'hir, AmbigArg> {
3492    pub fn peel_refs(&self) -> &Ty<'hir> {
3493        let mut final_ty = self.as_unambig_ty();
3494        while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3495            final_ty = ty;
3496        }
3497        final_ty
3498    }
3499}
3500
3501impl<'hir> Ty<'hir> {
3502    pub fn peel_refs(&self) -> &Self {
3503        let mut final_ty = self;
3504        while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3505            final_ty = ty;
3506        }
3507        final_ty
3508    }
3509
3510    /// Returns `true` if `param_def_id` matches the `bounded_ty` of this predicate.
3511    pub fn as_generic_param(&self) -> Option<(DefId, Ident)> {
3512        let TyKind::Path(QPath::Resolved(None, path)) = self.kind else {
3513            return None;
3514        };
3515        let [segment] = &path.segments else {
3516            return None;
3517        };
3518        match path.res {
3519            Res::Def(DefKind::TyParam, def_id) | Res::SelfTyParam { trait_: def_id } => {
3520                Some((def_id, segment.ident))
3521            }
3522            _ => None,
3523        }
3524    }
3525
3526    pub fn find_self_aliases(&self) -> Vec<Span> {
3527        use crate::intravisit::Visitor;
3528        struct MyVisitor(Vec<Span>);
3529        impl<'v> Visitor<'v> for MyVisitor {
3530            fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) {
3531                if #[allow(non_exhaustive_omitted_patterns)] match &t.kind {
    TyKind::Path(QPath::Resolved(_, Path {
        res: crate::def::Res::SelfTyAlias { .. }, .. })) => true,
    _ => false,
}matches!(
3532                    &t.kind,
3533                    TyKind::Path(QPath::Resolved(
3534                        _,
3535                        Path { res: crate::def::Res::SelfTyAlias { .. }, .. },
3536                    ))
3537                ) {
3538                    self.0.push(t.span);
3539                    return;
3540                }
3541                crate::intravisit::walk_ty(self, t);
3542            }
3543        }
3544
3545        let mut my_visitor = MyVisitor(::alloc::vec::Vec::new()vec![]);
3546        my_visitor.visit_ty_unambig(self);
3547        my_visitor.0
3548    }
3549
3550    /// Whether `ty` is a type with `_` placeholders that can be inferred. Used in diagnostics only to
3551    /// use inference to provide suggestions for the appropriate type if possible.
3552    pub fn is_suggestable_infer_ty(&self) -> bool {
3553        fn are_suggestable_generic_args(generic_args: &[GenericArg<'_>]) -> bool {
3554            generic_args.iter().any(|arg| match arg {
3555                GenericArg::Type(ty) => ty.as_unambig_ty().is_suggestable_infer_ty(),
3556                GenericArg::Infer(_) => true,
3557                _ => false,
3558            })
3559        }
3560        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_hir/src/hir.rs:3560",
                        "rustc_hir::hir", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_hir/src/hir.rs"),
                        ::tracing_core::__macro_support::Option::Some(3560u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_hir::hir"),
                        ::tracing_core::field::FieldSet::new(&["self"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                let mut iter = __CALLSITE.metadata().fields().iter();
                __CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
                                    ::tracing::__macro_support::Option::Some(&debug(&self) as
                                            &dyn Value))])
            });
    } else { ; }
};debug!(?self);
3561        match &self.kind {
3562            TyKind::Infer(()) => true,
3563            TyKind::Slice(ty) => ty.is_suggestable_infer_ty(),
3564            TyKind::Array(ty, length) => {
3565                ty.is_suggestable_infer_ty() || #[allow(non_exhaustive_omitted_patterns)] match length.kind {
    ConstArgKind::Infer(..) => true,
    _ => false,
}matches!(length.kind, ConstArgKind::Infer(..))
3566            }
3567            TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
3568            TyKind::Ptr(mut_ty) | TyKind::Ref(_, mut_ty) => mut_ty.ty.is_suggestable_infer_ty(),
3569            TyKind::Path(QPath::TypeRelative(ty, segment)) => {
3570                ty.is_suggestable_infer_ty() || are_suggestable_generic_args(segment.args().args)
3571            }
3572            TyKind::Path(QPath::Resolved(ty_opt, Path { segments, .. })) => {
3573                ty_opt.is_some_and(Self::is_suggestable_infer_ty)
3574                    || segments
3575                        .iter()
3576                        .any(|segment| are_suggestable_generic_args(segment.args().args))
3577            }
3578            _ => false,
3579        }
3580    }
3581}
3582
3583/// Not represented directly in the AST; referred to by name through a `ty_path`.
3584#[derive(#[automatically_derived]
impl ::core::marker::Copy for PrimTy { }Copy, #[automatically_derived]
impl ::core::clone::Clone for PrimTy {
    #[inline]
    fn clone(&self) -> PrimTy {
        let _: ::core::clone::AssertParamIsClone<IntTy>;
        let _: ::core::clone::AssertParamIsClone<UintTy>;
        let _: ::core::clone::AssertParamIsClone<FloatTy>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for PrimTy {
    #[inline]
    fn eq(&self, other: &PrimTy) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (PrimTy::Int(__self_0), PrimTy::Int(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (PrimTy::Uint(__self_0), PrimTy::Uint(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (PrimTy::Float(__self_0), PrimTy::Float(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for PrimTy {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<IntTy>;
        let _: ::core::cmp::AssertParamIsEq<UintTy>;
        let _: ::core::cmp::AssertParamIsEq<FloatTy>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for PrimTy {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        PrimTy::Int(ref __binding_0) => { 0usize }
                        PrimTy::Uint(ref __binding_0) => { 1usize }
                        PrimTy::Float(ref __binding_0) => { 2usize }
                        PrimTy::Str => { 3usize }
                        PrimTy::Bool => { 4usize }
                        PrimTy::Char => { 5usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    PrimTy::Int(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    PrimTy::Uint(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    PrimTy::Float(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    PrimTy::Str => {}
                    PrimTy::Bool => {}
                    PrimTy::Char => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for PrimTy {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        PrimTy::Int(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        PrimTy::Uint(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        PrimTy::Float(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    3usize => { PrimTy::Str }
                    4usize => { PrimTy::Bool }
                    5usize => { PrimTy::Char }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PrimTy`, expected 0..6, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::hash::Hash for PrimTy {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            PrimTy::Int(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            PrimTy::Uint(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            PrimTy::Float(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for PrimTy {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PrimTy::Int(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Int",
                    &__self_0),
            PrimTy::Uint(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Uint",
                    &__self_0),
            PrimTy::Float(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Float",
                    &__self_0),
            PrimTy::Str => ::core::fmt::Formatter::write_str(f, "Str"),
            PrimTy::Bool => ::core::fmt::Formatter::write_str(f, "Bool"),
            PrimTy::Char => ::core::fmt::Formatter::write_str(f, "Char"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for PrimTy where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    PrimTy::Int(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PrimTy::Uint(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PrimTy::Float(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PrimTy::Str => {}
                    PrimTy::Bool => {}
                    PrimTy::Char => {}
                }
            }
        }
    };HashStable_Generic)]
3585pub enum PrimTy {
3586    Int(IntTy),
3587    Uint(UintTy),
3588    Float(FloatTy),
3589    Str,
3590    Bool,
3591    Char,
3592}
3593
3594impl PrimTy {
3595    /// All of the primitive types
3596    pub const ALL: [Self; 19] = [
3597        // any changes here should also be reflected in `PrimTy::from_name`
3598        Self::Int(IntTy::I8),
3599        Self::Int(IntTy::I16),
3600        Self::Int(IntTy::I32),
3601        Self::Int(IntTy::I64),
3602        Self::Int(IntTy::I128),
3603        Self::Int(IntTy::Isize),
3604        Self::Uint(UintTy::U8),
3605        Self::Uint(UintTy::U16),
3606        Self::Uint(UintTy::U32),
3607        Self::Uint(UintTy::U64),
3608        Self::Uint(UintTy::U128),
3609        Self::Uint(UintTy::Usize),
3610        Self::Float(FloatTy::F16),
3611        Self::Float(FloatTy::F32),
3612        Self::Float(FloatTy::F64),
3613        Self::Float(FloatTy::F128),
3614        Self::Bool,
3615        Self::Char,
3616        Self::Str,
3617    ];
3618
3619    /// Like [`PrimTy::name`], but returns a &str instead of a symbol.
3620    ///
3621    /// Used by clippy.
3622    pub fn name_str(self) -> &'static str {
3623        match self {
3624            PrimTy::Int(i) => i.name_str(),
3625            PrimTy::Uint(u) => u.name_str(),
3626            PrimTy::Float(f) => f.name_str(),
3627            PrimTy::Str => "str",
3628            PrimTy::Bool => "bool",
3629            PrimTy::Char => "char",
3630        }
3631    }
3632
3633    pub fn name(self) -> Symbol {
3634        match self {
3635            PrimTy::Int(i) => i.name(),
3636            PrimTy::Uint(u) => u.name(),
3637            PrimTy::Float(f) => f.name(),
3638            PrimTy::Str => sym::str,
3639            PrimTy::Bool => sym::bool,
3640            PrimTy::Char => sym::char,
3641        }
3642    }
3643
3644    /// Returns the matching `PrimTy` for a `Symbol` such as "str" or "i32".
3645    /// Returns `None` if no matching type is found.
3646    pub fn from_name(name: Symbol) -> Option<Self> {
3647        let ty = match name {
3648            // any changes here should also be reflected in `PrimTy::ALL`
3649            sym::i8 => Self::Int(IntTy::I8),
3650            sym::i16 => Self::Int(IntTy::I16),
3651            sym::i32 => Self::Int(IntTy::I32),
3652            sym::i64 => Self::Int(IntTy::I64),
3653            sym::i128 => Self::Int(IntTy::I128),
3654            sym::isize => Self::Int(IntTy::Isize),
3655            sym::u8 => Self::Uint(UintTy::U8),
3656            sym::u16 => Self::Uint(UintTy::U16),
3657            sym::u32 => Self::Uint(UintTy::U32),
3658            sym::u64 => Self::Uint(UintTy::U64),
3659            sym::u128 => Self::Uint(UintTy::U128),
3660            sym::usize => Self::Uint(UintTy::Usize),
3661            sym::f16 => Self::Float(FloatTy::F16),
3662            sym::f32 => Self::Float(FloatTy::F32),
3663            sym::f64 => Self::Float(FloatTy::F64),
3664            sym::f128 => Self::Float(FloatTy::F128),
3665            sym::bool => Self::Bool,
3666            sym::char => Self::Char,
3667            sym::str => Self::Str,
3668            _ => return None,
3669        };
3670        Some(ty)
3671    }
3672}
3673
3674#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnPtrTy<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "FnPtrTy",
            "safety", &self.safety, "abi", &self.abi, "generic_params",
            &self.generic_params, "decl", &self.decl, "param_idents",
            &&self.param_idents)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for FnPtrTy<'hir> {
    #[inline]
    fn clone(&self) -> FnPtrTy<'hir> {
        let _: ::core::clone::AssertParamIsClone<Safety>;
        let _: ::core::clone::AssertParamIsClone<ExternAbi>;
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir FnDecl<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FnPtrTy<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            FnPtrTy<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    FnPtrTy {
                        safety: ref __binding_0,
                        abi: ref __binding_1,
                        generic_params: ref __binding_2,
                        decl: ref __binding_3,
                        param_idents: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3675pub struct FnPtrTy<'hir> {
3676    pub safety: Safety,
3677    pub abi: ExternAbi,
3678    pub generic_params: &'hir [GenericParam<'hir>],
3679    pub decl: &'hir FnDecl<'hir>,
3680    // `Option` because bare fn parameter identifiers are optional. We also end up
3681    // with `None` in some error cases, e.g. invalid parameter patterns.
3682    pub param_idents: &'hir [Option<Ident>],
3683}
3684
3685#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for UnsafeBinderTy<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "UnsafeBinderTy", "generic_params", &self.generic_params,
            "inner_ty", &&self.inner_ty)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for UnsafeBinderTy<'hir> {
    #[inline]
    fn clone(&self) -> UnsafeBinderTy<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for UnsafeBinderTy<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            UnsafeBinderTy<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    UnsafeBinderTy {
                        generic_params: ref __binding_0, inner_ty: ref __binding_1 }
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3686pub struct UnsafeBinderTy<'hir> {
3687    pub generic_params: &'hir [GenericParam<'hir>],
3688    pub inner_ty: &'hir Ty<'hir>,
3689}
3690
3691#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for OpaqueTy<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "OpaqueTy",
            "hir_id", &self.hir_id, "def_id", &self.def_id, "bounds",
            &self.bounds, "origin", &self.origin, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for OpaqueTy<'hir> {
    #[inline]
    fn clone(&self) -> OpaqueTy<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        let _: ::core::clone::AssertParamIsClone<OpaqueTyOrigin<LocalDefId>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for OpaqueTy<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            OpaqueTy<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    OpaqueTy {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        bounds: ref __binding_2,
                        origin: ref __binding_3,
                        span: ref __binding_4 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3692pub struct OpaqueTy<'hir> {
3693    #[stable_hasher(ignore)]
3694    pub hir_id: HirId,
3695    pub def_id: LocalDefId,
3696    pub bounds: GenericBounds<'hir>,
3697    pub origin: OpaqueTyOrigin<LocalDefId>,
3698    pub span: Span,
3699}
3700
3701#[derive(#[automatically_derived]
impl<T: ::core::fmt::Debug, U: ::core::fmt::Debug> ::core::fmt::Debug for
    PreciseCapturingArgKind<T, U> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            PreciseCapturingArgKind::Lifetime(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Lifetime", &__self_0),
            PreciseCapturingArgKind::Param(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Param",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<T: ::core::clone::Clone, U: ::core::clone::Clone> ::core::clone::Clone
    for PreciseCapturingArgKind<T, U> {
    #[inline]
    fn clone(&self) -> PreciseCapturingArgKind<T, U> {
        match self {
            PreciseCapturingArgKind::Lifetime(__self_0) =>
                PreciseCapturingArgKind::Lifetime(::core::clone::Clone::clone(__self_0)),
            PreciseCapturingArgKind::Param(__self_0) =>
                PreciseCapturingArgKind::Param(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<T: ::core::marker::Copy, U: ::core::marker::Copy> ::core::marker::Copy
    for PreciseCapturingArgKind<T, U> {
}Copy, const _: () =
    {
        impl<T, U, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PreciseCapturingArgKind<T, U> where
            __CTX: crate::HashStableContext,
            T: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
            U: ::rustc_data_structures::stable_hasher::HashStable<__CTX> {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    PreciseCapturingArgKind::Param(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<T, U, __E: ::rustc_span::SpanEncoder>
            ::rustc_serialize::Encodable<__E> for
            PreciseCapturingArgKind<T, U> where
            T: ::rustc_serialize::Encodable<__E>,
            U: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
                            0usize
                        }
                        PreciseCapturingArgKind::Param(ref __binding_0) => {
                            1usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    PreciseCapturingArgKind::Param(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<T, U, __D: ::rustc_span::SpanDecoder>
            ::rustc_serialize::Decodable<__D> for
            PreciseCapturingArgKind<T, U> where
            T: ::rustc_serialize::Decodable<__D>,
            U: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        PreciseCapturingArgKind::Lifetime(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        PreciseCapturingArgKind::Param(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PreciseCapturingArgKind`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
3702pub enum PreciseCapturingArgKind<T, U> {
3703    Lifetime(T),
3704    /// Non-lifetime argument (type or const)
3705    Param(U),
3706}
3707
3708pub type PreciseCapturingArg<'hir> =
3709    PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
3710
3711impl PreciseCapturingArg<'_> {
3712    pub fn hir_id(self) -> HirId {
3713        match self {
3714            PreciseCapturingArg::Lifetime(lt) => lt.hir_id,
3715            PreciseCapturingArg::Param(param) => param.hir_id,
3716        }
3717    }
3718
3719    pub fn name(self) -> Symbol {
3720        match self {
3721            PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
3722            PreciseCapturingArg::Param(param) => param.ident.name,
3723        }
3724    }
3725}
3726
3727/// We need to have a [`Node`] for the [`HirId`] that we attach the type/const param
3728/// resolution to. Lifetimes don't have this problem, and for them, it's actually
3729/// kind of detrimental to use a custom node type versus just using [`Lifetime`],
3730/// since resolve_bound_vars operates on `Lifetime`s.
3731#[derive(#[automatically_derived]
impl ::core::fmt::Debug for PreciseCapturingNonLifetimeArg {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "PreciseCapturingNonLifetimeArg", "hir_id", &self.hir_id, "ident",
            &self.ident, "res", &&self.res)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for PreciseCapturingNonLifetimeArg {
    #[inline]
    fn clone(&self) -> PreciseCapturingNonLifetimeArg {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<Res>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for PreciseCapturingNonLifetimeArg { }Copy, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for PreciseCapturingNonLifetimeArg where
            __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    PreciseCapturingNonLifetimeArg {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        res: ref __binding_2 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3732pub struct PreciseCapturingNonLifetimeArg {
3733    #[stable_hasher(ignore)]
3734    pub hir_id: HirId,
3735    pub ident: Ident,
3736    pub res: Res,
3737}
3738
3739#[derive(#[automatically_derived]
impl ::core::marker::Copy for RpitContext { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RpitContext {
    #[inline]
    fn clone(&self) -> RpitContext { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for RpitContext {
    #[inline]
    fn eq(&self, other: &RpitContext) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RpitContext {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for RpitContext {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RpitContext::Trait => "Trait",
                RpitContext::TraitImpl => "TraitImpl",
            })
    }
}Debug)]
3740#[derive(const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for RpitContext where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    RpitContext::Trait => {}
                    RpitContext::TraitImpl => {}
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for RpitContext {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        RpitContext::Trait => { 0usize }
                        RpitContext::TraitImpl => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    RpitContext::Trait => {}
                    RpitContext::TraitImpl => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for RpitContext {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { RpitContext::Trait }
                    1usize => { RpitContext::TraitImpl }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `RpitContext`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
3741pub enum RpitContext {
3742    Trait,
3743    TraitImpl,
3744}
3745
3746/// From whence the opaque type came.
3747#[derive(#[automatically_derived]
impl<D: ::core::marker::Copy> ::core::marker::Copy for OpaqueTyOrigin<D> { }Copy, #[automatically_derived]
impl<D: ::core::clone::Clone> ::core::clone::Clone for OpaqueTyOrigin<D> {
    #[inline]
    fn clone(&self) -> OpaqueTyOrigin<D> {
        match self {
            OpaqueTyOrigin::FnReturn {
                parent: __self_0, in_trait_or_impl: __self_1 } =>
                OpaqueTyOrigin::FnReturn {
                    parent: ::core::clone::Clone::clone(__self_0),
                    in_trait_or_impl: ::core::clone::Clone::clone(__self_1),
                },
            OpaqueTyOrigin::AsyncFn {
                parent: __self_0, in_trait_or_impl: __self_1 } =>
                OpaqueTyOrigin::AsyncFn {
                    parent: ::core::clone::Clone::clone(__self_0),
                    in_trait_or_impl: ::core::clone::Clone::clone(__self_1),
                },
            OpaqueTyOrigin::TyAlias { parent: __self_0, in_assoc_ty: __self_1
                } =>
                OpaqueTyOrigin::TyAlias {
                    parent: ::core::clone::Clone::clone(__self_0),
                    in_assoc_ty: ::core::clone::Clone::clone(__self_1),
                },
        }
    }
}Clone, #[automatically_derived]
impl<D: ::core::cmp::PartialEq> ::core::cmp::PartialEq for OpaqueTyOrigin<D> {
    #[inline]
    fn eq(&self, other: &OpaqueTyOrigin<D>) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (OpaqueTyOrigin::FnReturn {
                    parent: __self_0, in_trait_or_impl: __self_1 },
                    OpaqueTyOrigin::FnReturn {
                    parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (OpaqueTyOrigin::AsyncFn {
                    parent: __self_0, in_trait_or_impl: __self_1 },
                    OpaqueTyOrigin::AsyncFn {
                    parent: __arg1_0, in_trait_or_impl: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                (OpaqueTyOrigin::TyAlias {
                    parent: __self_0, in_assoc_ty: __self_1 },
                    OpaqueTyOrigin::TyAlias {
                    parent: __arg1_0, in_assoc_ty: __arg1_1 }) =>
                    __self_1 == __arg1_1 && __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl<D: ::core::cmp::Eq> ::core::cmp::Eq for OpaqueTyOrigin<D> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<D>;
        let _: ::core::cmp::AssertParamIsEq<Option<RpitContext>>;
        let _: ::core::cmp::AssertParamIsEq<Option<RpitContext>>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl<D: ::core::fmt::Debug> ::core::fmt::Debug for OpaqueTyOrigin<D> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            OpaqueTyOrigin::FnReturn {
                parent: __self_0, in_trait_or_impl: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "FnReturn", "parent", __self_0, "in_trait_or_impl",
                    &__self_1),
            OpaqueTyOrigin::AsyncFn {
                parent: __self_0, in_trait_or_impl: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "AsyncFn", "parent", __self_0, "in_trait_or_impl",
                    &__self_1),
            OpaqueTyOrigin::TyAlias { parent: __self_0, in_assoc_ty: __self_1
                } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "TyAlias", "parent", __self_0, "in_assoc_ty", &__self_1),
        }
    }
}Debug)]
3748#[derive(const _: () =
    {
        impl<D, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            OpaqueTyOrigin<D> where __CTX: crate::HashStableContext,
            D: ::rustc_data_structures::stable_hasher::HashStable<__CTX> {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    OpaqueTyOrigin::FnReturn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    OpaqueTyOrigin::AsyncFn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    OpaqueTyOrigin::TyAlias {
                        parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, const _: () =
    {
        impl<D, __E: ::rustc_span::SpanEncoder>
            ::rustc_serialize::Encodable<__E> for OpaqueTyOrigin<D> where
            D: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        OpaqueTyOrigin::FnReturn {
                            parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                            => {
                            0usize
                        }
                        OpaqueTyOrigin::AsyncFn {
                            parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                            => {
                            1usize
                        }
                        OpaqueTyOrigin::TyAlias {
                            parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
                            2usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    OpaqueTyOrigin::FnReturn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    OpaqueTyOrigin::AsyncFn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    OpaqueTyOrigin::TyAlias {
                        parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<D, __D: ::rustc_span::SpanDecoder>
            ::rustc_serialize::Decodable<__D> for OpaqueTyOrigin<D> where
            D: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        OpaqueTyOrigin::FnReturn {
                            parent: ::rustc_serialize::Decodable::decode(__decoder),
                            in_trait_or_impl: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    1usize => {
                        OpaqueTyOrigin::AsyncFn {
                            parent: ::rustc_serialize::Decodable::decode(__decoder),
                            in_trait_or_impl: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    2usize => {
                        OpaqueTyOrigin::TyAlias {
                            parent: ::rustc_serialize::Decodable::decode(__decoder),
                            in_assoc_ty: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `OpaqueTyOrigin`, expected 0..3, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable)]
3749pub enum OpaqueTyOrigin<D> {
3750    /// `-> impl Trait`
3751    FnReturn {
3752        /// The defining function.
3753        parent: D,
3754        // Whether this is an RPITIT (return position impl trait in trait)
3755        in_trait_or_impl: Option<RpitContext>,
3756    },
3757    /// `async fn`
3758    AsyncFn {
3759        /// The defining function.
3760        parent: D,
3761        // Whether this is an AFIT (async fn in trait)
3762        in_trait_or_impl: Option<RpitContext>,
3763    },
3764    /// type aliases: `type Foo = impl Trait;`
3765    TyAlias {
3766        /// The type alias or associated type parent of the TAIT/ATPIT
3767        parent: D,
3768        /// associated types in impl blocks for traits.
3769        in_assoc_ty: bool,
3770    },
3771}
3772
3773// Ids of parent (or child) path segment that contains user-specified args
3774#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DelegationGenerics {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "DelegationGenerics", "parent_args_segment_id",
            &self.parent_args_segment_id, "child_args_segment_id",
            &&self.child_args_segment_id)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for DelegationGenerics {
    #[inline]
    fn clone(&self) -> DelegationGenerics {
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for DelegationGenerics { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for DelegationGenerics {
    #[inline]
    fn eq(&self, other: &DelegationGenerics) -> bool {
        self.parent_args_segment_id == other.parent_args_segment_id &&
            self.child_args_segment_id == other.child_args_segment_id
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for DelegationGenerics {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Option<HirId>>;
        let _: ::core::cmp::AssertParamIsEq<Option<HirId>>;
    }
}Eq, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for DelegationGenerics where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    DelegationGenerics {
                        parent_args_segment_id: ref __binding_0,
                        child_args_segment_id: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3775pub struct DelegationGenerics {
3776    pub parent_args_segment_id: Option<HirId>,
3777    pub child_args_segment_id: Option<HirId>,
3778}
3779
3780#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InferDelegationKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            InferDelegationKind::Input(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Input",
                    &__self_0),
            InferDelegationKind::Output(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Output",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for InferDelegationKind<'hir> {
    #[inline]
    fn clone(&self) -> InferDelegationKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<usize>;
        let _: ::core::clone::AssertParamIsClone<&'hir DelegationGenerics>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for InferDelegationKind<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::cmp::PartialEq for InferDelegationKind<'hir> {
    #[inline]
    fn eq(&self, other: &InferDelegationKind<'hir>) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (InferDelegationKind::Input(__self_0),
                    InferDelegationKind::Input(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (InferDelegationKind::Output(__self_0),
                    InferDelegationKind::Output(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl<'hir> ::core::cmp::Eq for InferDelegationKind<'hir> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<usize>;
        let _: ::core::cmp::AssertParamIsEq<&'hir DelegationGenerics>;
    }
}Eq, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            InferDelegationKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    InferDelegationKind::Input(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    InferDelegationKind::Output(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3781pub enum InferDelegationKind<'hir> {
3782    Input(usize),
3783    // Place generics info here, as we always specify output type for delegations.
3784    Output(&'hir DelegationGenerics),
3785}
3786
3787/// The various kinds of types recognized by the compiler.
3788///
3789/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3790/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
3791// SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible
3792#[repr(u8, C)]
3793#[derive(#[automatically_derived]
impl<'hir, Unambig: ::core::fmt::Debug> ::core::fmt::Debug for
    TyKind<'hir, Unambig> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            TyKind::InferDelegation(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "InferDelegation", __self_0, &__self_1),
            TyKind::Slice(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Slice",
                    &__self_0),
            TyKind::Array(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Array",
                    __self_0, &__self_1),
            TyKind::Ptr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ptr",
                    &__self_0),
            TyKind::Ref(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Ref",
                    __self_0, &__self_1),
            TyKind::FnPtr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "FnPtr",
                    &__self_0),
            TyKind::UnsafeBinder(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "UnsafeBinder", &__self_0),
            TyKind::Never => ::core::fmt::Formatter::write_str(f, "Never"),
            TyKind::Tup(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Tup",
                    &__self_0),
            TyKind::Path(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Path",
                    &__self_0),
            TyKind::OpaqueDef(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "OpaqueDef", &__self_0),
            TyKind::TraitAscription(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TraitAscription", &__self_0),
            TyKind::TraitObject(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "TraitObject", __self_0, &__self_1),
            TyKind::Err(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
                    &__self_0),
            TyKind::Pat(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Pat",
                    __self_0, &__self_1),
            TyKind::FieldOf(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "FieldOf", __self_0, &__self_1),
            TyKind::Infer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir, Unambig: ::core::clone::Clone> ::core::clone::Clone for
    TyKind<'hir, Unambig> {
    #[inline]
    fn clone(&self) -> TyKind<'hir, Unambig> {
        match self {
            TyKind::InferDelegation(__self_0, __self_1) =>
                TyKind::InferDelegation(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::Slice(__self_0) =>
                TyKind::Slice(::core::clone::Clone::clone(__self_0)),
            TyKind::Array(__self_0, __self_1) =>
                TyKind::Array(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::Ptr(__self_0) =>
                TyKind::Ptr(::core::clone::Clone::clone(__self_0)),
            TyKind::Ref(__self_0, __self_1) =>
                TyKind::Ref(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::FnPtr(__self_0) =>
                TyKind::FnPtr(::core::clone::Clone::clone(__self_0)),
            TyKind::UnsafeBinder(__self_0) =>
                TyKind::UnsafeBinder(::core::clone::Clone::clone(__self_0)),
            TyKind::Never => TyKind::Never,
            TyKind::Tup(__self_0) =>
                TyKind::Tup(::core::clone::Clone::clone(__self_0)),
            TyKind::Path(__self_0) =>
                TyKind::Path(::core::clone::Clone::clone(__self_0)),
            TyKind::OpaqueDef(__self_0) =>
                TyKind::OpaqueDef(::core::clone::Clone::clone(__self_0)),
            TyKind::TraitAscription(__self_0) =>
                TyKind::TraitAscription(::core::clone::Clone::clone(__self_0)),
            TyKind::TraitObject(__self_0, __self_1) =>
                TyKind::TraitObject(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::Err(__self_0) =>
                TyKind::Err(::core::clone::Clone::clone(__self_0)),
            TyKind::Pat(__self_0, __self_1) =>
                TyKind::Pat(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::FieldOf(__self_0, __self_1) =>
                TyKind::FieldOf(::core::clone::Clone::clone(__self_0),
                    ::core::clone::Clone::clone(__self_1)),
            TyKind::Infer(__self_0) =>
                TyKind::Infer(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<'hir, Unambig: ::core::marker::Copy> ::core::marker::Copy for
    TyKind<'hir, Unambig> {
}Copy, const _: () =
    {
        impl<'hir, Unambig, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TyKind<'hir, Unambig> where __CTX: crate::HashStableContext,
            Unambig: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    TyKind::InferDelegation(ref __binding_0, ref __binding_1) =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Slice(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Array(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Ptr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Ref(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::FnPtr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::UnsafeBinder(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Never => {}
                    TyKind::Tup(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Path(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::OpaqueDef(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::TraitAscription(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::TraitObject(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Err(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Pat(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::FieldOf(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    TyKind::Infer(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3794pub enum TyKind<'hir, Unambig = ()> {
3795    /// Actual type should be inherited from `DefId` signature
3796    InferDelegation(DefId, InferDelegationKind<'hir>),
3797    /// A variable length slice (i.e., `[T]`).
3798    Slice(&'hir Ty<'hir>),
3799    /// A fixed length array (i.e., `[T; n]`).
3800    Array(&'hir Ty<'hir>, &'hir ConstArg<'hir>),
3801    /// A raw pointer (i.e., `*const T` or `*mut T`).
3802    Ptr(MutTy<'hir>),
3803    /// A reference (i.e., `&'a T` or `&'a mut T`).
3804    Ref(&'hir Lifetime, MutTy<'hir>),
3805    /// A function pointer (e.g., `fn(usize) -> bool`).
3806    FnPtr(&'hir FnPtrTy<'hir>),
3807    /// An unsafe binder type (e.g. `unsafe<'a> Foo<'a>`).
3808    UnsafeBinder(&'hir UnsafeBinderTy<'hir>),
3809    /// The never type (`!`).
3810    Never,
3811    /// A tuple (`(A, B, C, D, ...)`).
3812    Tup(&'hir [Ty<'hir>]),
3813    /// A path to a type definition (`module::module::...::Type`), or an
3814    /// associated type (e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`).
3815    ///
3816    /// Type parameters may be stored in each `PathSegment`.
3817    Path(QPath<'hir>),
3818    /// An opaque type definition itself. This is only used for `impl Trait`.
3819    OpaqueDef(&'hir OpaqueTy<'hir>),
3820    /// A trait ascription type, which is `impl Trait` within a local binding.
3821    TraitAscription(GenericBounds<'hir>),
3822    /// A trait object type `Bound1 + Bound2 + Bound3`
3823    /// where `Bound` is a trait or a lifetime.
3824    ///
3825    /// We use pointer tagging to represent a `&'hir Lifetime` and `TraitObjectSyntax` pair
3826    /// as otherwise this type being `repr(C)` would result in `TyKind` increasing in size.
3827    TraitObject(&'hir [PolyTraitRef<'hir>], TaggedRef<'hir, Lifetime, TraitObjectSyntax>),
3828    /// Placeholder for a type that has failed to be defined.
3829    Err(rustc_span::ErrorGuaranteed),
3830    /// Pattern types (`pattern_type!(u32 is 1..)`)
3831    Pat(&'hir Ty<'hir>, &'hir TyPat<'hir>),
3832    /// Field representing type (`field_of!(Struct, field)`).
3833    ///
3834    /// The optional ident is the variant when an enum is passed `field_of!(Enum, Variant.field)`.
3835    FieldOf(&'hir Ty<'hir>, &'hir TyFieldPath),
3836    /// `TyKind::Infer` means the type should be inferred instead of it having been
3837    /// specified. This can appear anywhere in a type.
3838    ///
3839    /// This variant is not always used to represent inference types, sometimes
3840    /// [`GenericArg::Infer`] is used instead.
3841    Infer(Unambig),
3842}
3843
3844#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InlineAsmOperand<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            InlineAsmOperand::In { reg: __self_0, expr: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f, "In",
                    "reg", __self_0, "expr", &__self_1),
            InlineAsmOperand::Out {
                reg: __self_0, late: __self_1, expr: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f, "Out",
                    "reg", __self_0, "late", __self_1, "expr", &__self_2),
            InlineAsmOperand::InOut {
                reg: __self_0, late: __self_1, expr: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f, "InOut",
                    "reg", __self_0, "late", __self_1, "expr", &__self_2),
            InlineAsmOperand::SplitInOut {
                reg: __self_0,
                late: __self_1,
                in_expr: __self_2,
                out_expr: __self_3 } =>
                ::core::fmt::Formatter::debug_struct_field4_finish(f,
                    "SplitInOut", "reg", __self_0, "late", __self_1, "in_expr",
                    __self_2, "out_expr", &__self_3),
            InlineAsmOperand::Const { anon_const: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "anon_const", &__self_0),
            InlineAsmOperand::SymFn { expr: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "SymFn",
                    "expr", &__self_0),
            InlineAsmOperand::SymStatic { path: __self_0, def_id: __self_1 }
                =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "SymStatic", "path", __self_0, "def_id", &__self_1),
            InlineAsmOperand::Label { block: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Label",
                    "block", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for InlineAsmOperand<'hir> {
    #[inline]
    fn clone(&self) -> InlineAsmOperand<'hir> {
        let _: ::core::clone::AssertParamIsClone<InlineAsmRegOrRegClass>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir Expr<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<ConstBlock>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<QPath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<DefId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for InlineAsmOperand<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            InlineAsmOperand<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    InlineAsmOperand::In {
                        reg: ref __binding_0, expr: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Out {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        expr: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::InOut {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        expr: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SplitInOut {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        in_expr: ref __binding_2,
                        out_expr: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Const { anon_const: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SymFn { expr: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SymStatic {
                        path: ref __binding_0, def_id: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Label { block: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3845pub enum InlineAsmOperand<'hir> {
3846    In {
3847        reg: InlineAsmRegOrRegClass,
3848        expr: &'hir Expr<'hir>,
3849    },
3850    Out {
3851        reg: InlineAsmRegOrRegClass,
3852        late: bool,
3853        expr: Option<&'hir Expr<'hir>>,
3854    },
3855    InOut {
3856        reg: InlineAsmRegOrRegClass,
3857        late: bool,
3858        expr: &'hir Expr<'hir>,
3859    },
3860    SplitInOut {
3861        reg: InlineAsmRegOrRegClass,
3862        late: bool,
3863        in_expr: &'hir Expr<'hir>,
3864        out_expr: Option<&'hir Expr<'hir>>,
3865    },
3866    Const {
3867        anon_const: ConstBlock,
3868    },
3869    SymFn {
3870        expr: &'hir Expr<'hir>,
3871    },
3872    SymStatic {
3873        path: QPath<'hir>,
3874        def_id: DefId,
3875    },
3876    Label {
3877        block: &'hir Block<'hir>,
3878    },
3879}
3880
3881impl<'hir> InlineAsmOperand<'hir> {
3882    pub fn reg(&self) -> Option<InlineAsmRegOrRegClass> {
3883        match *self {
3884            Self::In { reg, .. }
3885            | Self::Out { reg, .. }
3886            | Self::InOut { reg, .. }
3887            | Self::SplitInOut { reg, .. } => Some(reg),
3888            Self::Const { .. }
3889            | Self::SymFn { .. }
3890            | Self::SymStatic { .. }
3891            | Self::Label { .. } => None,
3892        }
3893    }
3894
3895    pub fn is_clobber(&self) -> bool {
3896        #[allow(non_exhaustive_omitted_patterns)] match self {
    InlineAsmOperand::Out {
        reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None } => true,
    _ => false,
}matches!(
3897            self,
3898            InlineAsmOperand::Out { reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None }
3899        )
3900    }
3901}
3902
3903#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InlineAsm<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["asm_macro", "template", "template_strs", "operands", "options",
                        "line_spans"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.asm_macro, &self.template, &self.template_strs,
                        &self.operands, &self.options, &&self.line_spans];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "InlineAsm",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for InlineAsm<'hir> {
    #[inline]
    fn clone(&self) -> InlineAsm<'hir> {
        let _: ::core::clone::AssertParamIsClone<ast::AsmMacro>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [InlineAsmTemplatePiece]>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [(Symbol,
                Option<Symbol>, Span)]>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir [(InlineAsmOperand<'hir>,
                Span)]>;
        let _: ::core::clone::AssertParamIsClone<InlineAsmOptions>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Span]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for InlineAsm<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            InlineAsm<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    InlineAsm {
                        asm_macro: ref __binding_0,
                        template: ref __binding_1,
                        template_strs: ref __binding_2,
                        operands: ref __binding_3,
                        options: ref __binding_4,
                        line_spans: ref __binding_5 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3904pub struct InlineAsm<'hir> {
3905    pub asm_macro: ast::AsmMacro,
3906    pub template: &'hir [InlineAsmTemplatePiece],
3907    pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
3908    pub operands: &'hir [(InlineAsmOperand<'hir>, Span)],
3909    pub options: InlineAsmOptions,
3910    pub line_spans: &'hir [Span],
3911}
3912
3913impl InlineAsm<'_> {
3914    pub fn contains_label(&self) -> bool {
3915        self.operands.iter().any(|x| #[allow(non_exhaustive_omitted_patterns)] match x.0 {
    InlineAsmOperand::Label { .. } => true,
    _ => false,
}matches!(x.0, InlineAsmOperand::Label { .. }))
3916    }
3917}
3918
3919/// Represents a parameter in a function header.
3920#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Param<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "Param",
            "hir_id", &self.hir_id, "pat", &self.pat, "ty_span",
            &self.ty_span, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Param<'hir> {
    #[inline]
    fn clone(&self) -> Param<'hir> {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Param<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Param<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Param {
                        hir_id: ref __binding_0,
                        pat: ref __binding_1,
                        ty_span: ref __binding_2,
                        span: ref __binding_3 } => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3921pub struct Param<'hir> {
3922    #[stable_hasher(ignore)]
3923    pub hir_id: HirId,
3924    pub pat: &'hir Pat<'hir>,
3925    pub ty_span: Span,
3926    pub span: Span,
3927}
3928
3929/// Represents the header (not the body) of a function declaration.
3930#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnDecl<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "FnDecl",
            "inputs", &self.inputs, "output", &self.output, "c_variadic",
            &self.c_variadic, "implicit_self", &self.implicit_self,
            "lifetime_elision_allowed", &&self.lifetime_elision_allowed)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for FnDecl<'hir> {
    #[inline]
    fn clone(&self) -> FnDecl<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [Ty<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<FnRetTy<'hir>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<ImplicitSelfKind>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FnDecl<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            FnDecl<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    FnDecl {
                        inputs: ref __binding_0,
                        output: ref __binding_1,
                        c_variadic: ref __binding_2,
                        implicit_self: ref __binding_3,
                        lifetime_elision_allowed: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
3931pub struct FnDecl<'hir> {
3932    /// The types of the function's parameters.
3933    ///
3934    /// Additional argument data is stored in the function's [body](Body::params).
3935    pub inputs: &'hir [Ty<'hir>],
3936    pub output: FnRetTy<'hir>,
3937    pub c_variadic: bool,
3938    /// Does the function have an implicit self?
3939    pub implicit_self: ImplicitSelfKind,
3940    /// Is lifetime elision allowed.
3941    pub lifetime_elision_allowed: bool,
3942}
3943
3944impl<'hir> FnDecl<'hir> {
3945    pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
3946        if let FnRetTy::Return(ty) = self.output
3947            && let TyKind::InferDelegation(sig_id, _) = ty.kind
3948        {
3949            return Some(sig_id);
3950        }
3951        None
3952    }
3953
3954    pub fn opt_delegation_generics(&self) -> Option<&'hir DelegationGenerics> {
3955        if let FnRetTy::Return(ty) = self.output
3956            && let TyKind::InferDelegation(_, kind) = ty.kind
3957            && let InferDelegationKind::Output(generics) = kind
3958        {
3959            return Some(generics);
3960        }
3961
3962        None
3963    }
3964}
3965
3966/// Represents what type of implicit self a function has, if any.
3967#[derive(#[automatically_derived]
impl ::core::marker::Copy for ImplicitSelfKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ImplicitSelfKind {
    #[inline]
    fn clone(&self) -> ImplicitSelfKind { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ImplicitSelfKind {
    #[inline]
    fn eq(&self, other: &ImplicitSelfKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ImplicitSelfKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for ImplicitSelfKind {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        ImplicitSelfKind::Imm => { 0usize }
                        ImplicitSelfKind::Mut => { 1usize }
                        ImplicitSelfKind::RefImm => { 2usize }
                        ImplicitSelfKind::RefMut => { 3usize }
                        ImplicitSelfKind::None => { 4usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    ImplicitSelfKind::Imm => {}
                    ImplicitSelfKind::Mut => {}
                    ImplicitSelfKind::RefImm => {}
                    ImplicitSelfKind::RefMut => {}
                    ImplicitSelfKind::None => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for ImplicitSelfKind {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { ImplicitSelfKind::Imm }
                    1usize => { ImplicitSelfKind::Mut }
                    2usize => { ImplicitSelfKind::RefImm }
                    3usize => { ImplicitSelfKind::RefMut }
                    4usize => { ImplicitSelfKind::None }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ImplicitSelfKind`, expected 0..5, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for ImplicitSelfKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                ImplicitSelfKind::Imm => "Imm",
                ImplicitSelfKind::Mut => "Mut",
                ImplicitSelfKind::RefImm => "RefImm",
                ImplicitSelfKind::RefMut => "RefMut",
                ImplicitSelfKind::None => "None",
            })
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ImplicitSelfKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ImplicitSelfKind::Imm => {}
                    ImplicitSelfKind::Mut => {}
                    ImplicitSelfKind::RefImm => {}
                    ImplicitSelfKind::RefMut => {}
                    ImplicitSelfKind::None => {}
                }
            }
        }
    };HashStable_Generic)]
3968pub enum ImplicitSelfKind {
3969    /// Represents a `fn x(self);`.
3970    Imm,
3971    /// Represents a `fn x(mut self);`.
3972    Mut,
3973    /// Represents a `fn x(&self);`.
3974    RefImm,
3975    /// Represents a `fn x(&mut self);`.
3976    RefMut,
3977    /// Represents when a function does not have a self argument or
3978    /// when a function has a `self: X` argument.
3979    None,
3980}
3981
3982impl ImplicitSelfKind {
3983    /// Does this represent an implicit self?
3984    pub fn has_implicit_self(&self) -> bool {
3985        !#[allow(non_exhaustive_omitted_patterns)] match *self {
    ImplicitSelfKind::None => true,
    _ => false,
}matches!(*self, ImplicitSelfKind::None)
3986    }
3987}
3988
3989#[derive(#[automatically_derived]
impl ::core::marker::Copy for IsAsync { }Copy, #[automatically_derived]
impl ::core::clone::Clone for IsAsync {
    #[inline]
    fn clone(&self) -> IsAsync {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for IsAsync {
    #[inline]
    fn eq(&self, other: &IsAsync) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (IsAsync::Async(__self_0), IsAsync::Async(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for IsAsync {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Span>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for IsAsync {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        IsAsync::Async(ref __binding_0) => { 0usize }
                        IsAsync::NotAsync => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    IsAsync::Async(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    IsAsync::NotAsync => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for IsAsync {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        IsAsync::Async(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => { IsAsync::NotAsync }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `IsAsync`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for IsAsync {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            IsAsync::Async(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Async",
                    &__self_0),
            IsAsync::NotAsync =>
                ::core::fmt::Formatter::write_str(f, "NotAsync"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for IsAsync where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    IsAsync::Async(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    IsAsync::NotAsync => {}
                }
            }
        }
    };HashStable_Generic)]
3990pub enum IsAsync {
3991    Async(Span),
3992    NotAsync,
3993}
3994
3995impl IsAsync {
3996    pub fn is_async(self) -> bool {
3997        #[allow(non_exhaustive_omitted_patterns)] match self {
    IsAsync::Async(_) => true,
    _ => false,
}matches!(self, IsAsync::Async(_))
3998    }
3999}
4000
4001#[derive(#[automatically_derived]
impl ::core::marker::Copy for Defaultness { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Defaultness {
    #[inline]
    fn clone(&self) -> Defaultness {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Defaultness {
    #[inline]
    fn eq(&self, other: &Defaultness) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Defaultness::Default { has_value: __self_0 },
                    Defaultness::Default { has_value: __arg1_0 }) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Defaultness {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for Defaultness {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Defaultness::Default { has_value: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "Default", "has_value", &__self_0),
            Defaultness::Final =>
                ::core::fmt::Formatter::write_str(f, "Final"),
        }
    }
}Debug, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for Defaultness {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        Defaultness::Default { has_value: ref __binding_0 } => {
                            0usize
                        }
                        Defaultness::Final => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    Defaultness::Default { has_value: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    Defaultness::Final => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for Defaultness {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        Defaultness::Default {
                            has_value: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    1usize => { Defaultness::Final }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Defaultness`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Defaultness where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    Defaultness::Default { has_value: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Defaultness::Final => {}
                }
            }
        }
    };HashStable_Generic)]
4002#[derive(#[automatically_derived]
impl ::core::default::Default for Defaultness {
    #[inline]
    fn default() -> Defaultness { Self::Final }
}Default)]
4003pub enum Defaultness {
4004    Default {
4005        has_value: bool,
4006    },
4007    #[default]
4008    Final,
4009}
4010
4011impl Defaultness {
4012    pub fn has_value(&self) -> bool {
4013        match *self {
4014            Defaultness::Default { has_value } => has_value,
4015            Defaultness::Final => true,
4016        }
4017    }
4018
4019    pub fn is_final(&self) -> bool {
4020        *self == Defaultness::Final
4021    }
4022
4023    pub fn is_default(&self) -> bool {
4024        #[allow(non_exhaustive_omitted_patterns)] match *self {
    Defaultness::Default { .. } => true,
    _ => false,
}matches!(*self, Defaultness::Default { .. })
4025    }
4026}
4027
4028#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FnRetTy<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            FnRetTy::DefaultReturn(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "DefaultReturn", &__self_0),
            FnRetTy::Return(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Return",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for FnRetTy<'hir> {
    #[inline]
    fn clone(&self) -> FnRetTy<'hir> {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FnRetTy<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            FnRetTy<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    FnRetTy::DefaultReturn(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    FnRetTy::Return(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4029pub enum FnRetTy<'hir> {
4030    /// Return type is not specified.
4031    ///
4032    /// Functions default to `()` and
4033    /// closures default to inference. Span points to where return
4034    /// type would be inserted.
4035    DefaultReturn(Span),
4036    /// Everything else.
4037    Return(&'hir Ty<'hir>),
4038}
4039
4040impl<'hir> FnRetTy<'hir> {
4041    #[inline]
4042    pub fn span(&self) -> Span {
4043        match *self {
4044            Self::DefaultReturn(span) => span,
4045            Self::Return(ref ty) => ty.span,
4046        }
4047    }
4048
4049    pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
4050        if let Self::Return(ty) = self
4051            && ty.is_suggestable_infer_ty()
4052        {
4053            return Some(*ty);
4054        }
4055        None
4056    }
4057}
4058
4059/// Represents `for<...>` binder before a closure
4060#[derive(#[automatically_derived]
impl ::core::marker::Copy for ClosureBinder { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ClosureBinder {
    #[inline]
    fn clone(&self) -> ClosureBinder {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ClosureBinder {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ClosureBinder::Default =>
                ::core::fmt::Formatter::write_str(f, "Default"),
            ClosureBinder::For { span: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "For",
                    "span", &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ClosureBinder where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ClosureBinder::Default => {}
                    ClosureBinder::For { span: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4061pub enum ClosureBinder {
4062    /// Binder is not specified.
4063    Default,
4064    /// Binder is specified.
4065    ///
4066    /// Span points to the whole `for<...>`.
4067    For { span: Span },
4068}
4069
4070#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Mod<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "Mod", "spans",
            &self.spans, "item_ids", &&self.item_ids)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Mod<'hir> {
    #[inline]
    fn clone(&self) -> Mod<'hir> {
        let _: ::core::clone::AssertParamIsClone<ModSpans>;
        let _: ::core::clone::AssertParamIsClone<&'hir [ItemId]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Mod<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Mod<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Mod { spans: ref __binding_0, item_ids: ref __binding_1 } =>
                        {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4071pub struct Mod<'hir> {
4072    pub spans: ModSpans,
4073    pub item_ids: &'hir [ItemId],
4074}
4075
4076#[derive(#[automatically_derived]
impl ::core::marker::Copy for ModSpans { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ModSpans {
    #[inline]
    fn clone(&self) -> ModSpans {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ModSpans {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "ModSpans",
            "inner_span", &self.inner_span, "inject_use_span",
            &&self.inject_use_span)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ModSpans where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ModSpans {
                        inner_span: ref __binding_0,
                        inject_use_span: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4077pub struct ModSpans {
4078    /// A span from the first token past `{` to the last token until `}`.
4079    /// For `mod foo;`, the inner span ranges from the first token
4080    /// to the last token in the external file.
4081    pub inner_span: Span,
4082    pub inject_use_span: Span,
4083}
4084
4085#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for EnumDef<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "EnumDef",
            "variants", &&self.variants)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for EnumDef<'hir> {
    #[inline]
    fn clone(&self) -> EnumDef<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [Variant<'hir>]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for EnumDef<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            EnumDef<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    EnumDef { variants: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4086pub struct EnumDef<'hir> {
4087    pub variants: &'hir [Variant<'hir>],
4088}
4089
4090#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Variant<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ident", "hir_id", "def_id", "data", "disr_expr", "span"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ident, &self.hir_id, &self.def_id, &self.data,
                        &self.disr_expr, &&self.span];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Variant",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Variant<'hir> {
    #[inline]
    fn clone(&self) -> Variant<'hir> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir AnonConst>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Variant<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Variant<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Variant {
                        ident: ref __binding_0,
                        hir_id: ref __binding_1,
                        def_id: ref __binding_2,
                        data: ref __binding_3,
                        disr_expr: ref __binding_4,
                        span: ref __binding_5 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4091pub struct Variant<'hir> {
4092    /// Name of the variant.
4093    pub ident: Ident,
4094    /// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
4095    #[stable_hasher(ignore)]
4096    pub hir_id: HirId,
4097    pub def_id: LocalDefId,
4098    /// Fields and constructor id of the variant.
4099    pub data: VariantData<'hir>,
4100    /// Explicit discriminant (e.g., `Foo = 1`).
4101    pub disr_expr: Option<&'hir AnonConst>,
4102    /// Span
4103    pub span: Span,
4104}
4105
4106#[derive(#[automatically_derived]
impl ::core::marker::Copy for UseKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for UseKind {
    #[inline]
    fn clone(&self) -> UseKind {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for UseKind {
    #[inline]
    fn eq(&self, other: &UseKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (UseKind::Single(__self_0), UseKind::Single(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::fmt::Debug for UseKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            UseKind::Single(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Single",
                    &__self_0),
            UseKind::Glob => ::core::fmt::Formatter::write_str(f, "Glob"),
            UseKind::ListStem =>
                ::core::fmt::Formatter::write_str(f, "ListStem"),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for UseKind where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    UseKind::Single(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    UseKind::Glob => {}
                    UseKind::ListStem => {}
                }
            }
        }
    };HashStable_Generic)]
4107pub enum UseKind {
4108    /// One import, e.g., `use foo::bar` or `use foo::bar as baz`.
4109    /// Also produced for each element of a list `use`, e.g.
4110    /// `use foo::{a, b}` lowers to `use foo::a; use foo::b;`.
4111    ///
4112    /// The identifier is the name defined by the import. E.g. for `use
4113    /// foo::bar` it is `bar`, for `use foo::bar as baz` it is `baz`.
4114    Single(Ident),
4115
4116    /// Glob import, e.g., `use foo::*`.
4117    Glob,
4118
4119    /// Degenerate list import, e.g., `use foo::{a, b}` produces
4120    /// an additional `use foo::{}` for performing checks such as
4121    /// unstable feature gating. May be removed in the future.
4122    ListStem,
4123}
4124
4125/// References to traits in impls.
4126///
4127/// `resolve` maps each `TraitRef`'s `ref_id` to its defining trait; that's all
4128/// that the `ref_id` is for. Note that `ref_id`'s value is not the `HirId` of the
4129/// trait being referred to but just a unique `HirId` that serves as a key
4130/// within the resolution map.
4131#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitRef<'hir> {
    #[inline]
    fn clone(&self) -> TraitRef<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir>>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitRef<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "TraitRef",
            "path", &self.path, "hir_ref_id", &&self.hir_ref_id)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitRef<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitRef<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitRef {
                        path: ref __binding_0, hir_ref_id: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        {}
                    }
                }
            }
        }
    };HashStable_Generic)]
4132pub struct TraitRef<'hir> {
4133    pub path: &'hir Path<'hir>,
4134    // Don't hash the `ref_id`. It is tracked via the thing it is used to access.
4135    #[stable_hasher(ignore)]
4136    pub hir_ref_id: HirId,
4137}
4138
4139impl TraitRef<'_> {
4140    /// Gets the `DefId` of the referenced trait. It _must_ actually be a trait or trait alias.
4141    pub fn trait_def_id(&self) -> Option<DefId> {
4142        match self.path.res {
4143            Res::Def(DefKind::Trait | DefKind::TraitAlias, did) => Some(did),
4144            Res::Err => None,
4145            res => {
    ::core::panicking::panic_fmt(format_args!("{0:?} did not resolve to a trait or trait alias",
            res));
}panic!("{res:?} did not resolve to a trait or trait alias"),
4146        }
4147    }
4148}
4149
4150#[derive(#[automatically_derived]
impl<'hir> ::core::clone::Clone for PolyTraitRef<'hir> {
    #[inline]
    fn clone(&self) -> PolyTraitRef<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [GenericParam<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<TraitBoundModifiers>;
        let _: ::core::clone::AssertParamIsClone<TraitRef<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for PolyTraitRef<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "PolyTraitRef",
            "bound_generic_params", &self.bound_generic_params, "modifiers",
            &self.modifiers, "trait_ref", &self.trait_ref, "span",
            &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::marker::Copy for PolyTraitRef<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            PolyTraitRef<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    PolyTraitRef {
                        bound_generic_params: ref __binding_0,
                        modifiers: ref __binding_1,
                        trait_ref: ref __binding_2,
                        span: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4151pub struct PolyTraitRef<'hir> {
4152    /// The `'a` in `for<'a> Foo<&'a T>`.
4153    pub bound_generic_params: &'hir [GenericParam<'hir>],
4154
4155    /// The constness and polarity of the trait ref.
4156    ///
4157    /// The `async` modifier is lowered directly into a different trait for now.
4158    pub modifiers: TraitBoundModifiers,
4159
4160    /// The `Foo<&'a T>` in `for<'a> Foo<&'a T>`.
4161    pub trait_ref: TraitRef<'hir>,
4162
4163    pub span: Span,
4164}
4165
4166#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for FieldDef<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["span", "vis_span", "ident", "hir_id", "def_id", "ty", "safety",
                        "default"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.span, &self.vis_span, &self.ident, &self.hir_id,
                        &self.def_id, &self.ty, &self.safety, &&self.default];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "FieldDef",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for FieldDef<'hir> {
    #[inline]
    fn clone(&self) -> FieldDef<'hir> {
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Safety>;
        let _: ::core::clone::AssertParamIsClone<Option<&'hir AnonConst>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FieldDef<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            FieldDef<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    FieldDef {
                        span: ref __binding_0,
                        vis_span: ref __binding_1,
                        ident: ref __binding_2,
                        hir_id: ref __binding_3,
                        def_id: ref __binding_4,
                        ty: ref __binding_5,
                        safety: ref __binding_6,
                        default: ref __binding_7 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                        { __binding_7.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4167pub struct FieldDef<'hir> {
4168    pub span: Span,
4169    pub vis_span: Span,
4170    pub ident: Ident,
4171    #[stable_hasher(ignore)]
4172    pub hir_id: HirId,
4173    pub def_id: LocalDefId,
4174    pub ty: &'hir Ty<'hir>,
4175    pub safety: Safety,
4176    pub default: Option<&'hir AnonConst>,
4177}
4178
4179impl FieldDef<'_> {
4180    // Still necessary in couple of places
4181    pub fn is_positional(&self) -> bool {
4182        self.ident.as_str().as_bytes()[0].is_ascii_digit()
4183    }
4184}
4185
4186/// Fields and constructor IDs of enum variants and structs.
4187#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for VariantData<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            VariantData::Struct { fields: __self_0, recovered: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Struct", "fields", __self_0, "recovered", &__self_1),
            VariantData::Tuple(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Tuple",
                    __self_0, __self_1, &__self_2),
            VariantData::Unit(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Unit",
                    __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for VariantData<'hir> {
    #[inline]
    fn clone(&self) -> VariantData<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir [FieldDef<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<ast::Recovered>;
        let _: ::core::clone::AssertParamIsClone<&'hir [FieldDef<'hir>]>;
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<LocalDefId>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for VariantData<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            VariantData<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    VariantData::Struct {
                        fields: ref __binding_0, recovered: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    VariantData::Tuple(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        {}
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    VariantData::Unit(ref __binding_0, ref __binding_1) => {
                        {}
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4188pub enum VariantData<'hir> {
4189    /// A struct variant.
4190    ///
4191    /// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
4192    Struct { fields: &'hir [FieldDef<'hir>], recovered: ast::Recovered },
4193    /// A tuple variant.
4194    ///
4195    /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
4196    Tuple(&'hir [FieldDef<'hir>], #[stable_hasher(ignore)] HirId, LocalDefId),
4197    /// A unit variant.
4198    ///
4199    /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`.
4200    Unit(#[stable_hasher(ignore)] HirId, LocalDefId),
4201}
4202
4203impl<'hir> VariantData<'hir> {
4204    /// Return the fields of this variant.
4205    pub fn fields(&self) -> &'hir [FieldDef<'hir>] {
4206        match *self {
4207            VariantData::Struct { fields, .. } | VariantData::Tuple(fields, ..) => fields,
4208            _ => &[],
4209        }
4210    }
4211
4212    pub fn ctor(&self) -> Option<(CtorKind, HirId, LocalDefId)> {
4213        match *self {
4214            VariantData::Tuple(_, hir_id, def_id) => Some((CtorKind::Fn, hir_id, def_id)),
4215            VariantData::Unit(hir_id, def_id) => Some((CtorKind::Const, hir_id, def_id)),
4216            VariantData::Struct { .. } => None,
4217        }
4218    }
4219
4220    #[inline]
4221    pub fn ctor_kind(&self) -> Option<CtorKind> {
4222        self.ctor().map(|(kind, ..)| kind)
4223    }
4224
4225    /// Return the `HirId` of this variant's constructor, if it has one.
4226    #[inline]
4227    pub fn ctor_hir_id(&self) -> Option<HirId> {
4228        self.ctor().map(|(_, hir_id, _)| hir_id)
4229    }
4230
4231    /// Return the `LocalDefId` of this variant's constructor, if it has one.
4232    #[inline]
4233    pub fn ctor_def_id(&self) -> Option<LocalDefId> {
4234        self.ctor().map(|(.., def_id)| def_id)
4235    }
4236}
4237
4238// The bodies for items are stored "out of line", in a separate
4239// hashmap in the `Crate`. Here we just record the hir-id of the item
4240// so it can fetched later.
4241#[derive(#[automatically_derived]
impl ::core::marker::Copy for ItemId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ItemId {
    #[inline]
    fn clone(&self) -> ItemId {
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ItemId {
    #[inline]
    fn eq(&self, other: &ItemId) -> bool { self.owner_id == other.owner_id }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ItemId {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<OwnerId>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for ItemId {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    ItemId { owner_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for ItemId {
            fn decode(__decoder: &mut __D) -> Self {
                ItemId {
                    owner_id: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for ItemId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "ItemId",
            "owner_id", &&self.owner_id)
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for ItemId {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.owner_id, state)
    }
}Hash, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ItemId where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4242pub struct ItemId {
4243    pub owner_id: OwnerId,
4244}
4245
4246impl ItemId {
4247    #[inline]
4248    pub fn hir_id(&self) -> HirId {
4249        // Items are always HIR owners.
4250        HirId::make_owner(self.owner_id.def_id)
4251    }
4252}
4253
4254/// An item
4255///
4256/// For more details, see the [rust lang reference].
4257/// Note that the reference does not document nightly-only features.
4258/// There may be also slight differences in the names and representation of AST nodes between
4259/// the compiler and the reference.
4260///
4261/// [rust lang reference]: https://doc.rust-lang.org/reference/items.html
4262#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Item<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["owner_id", "kind", "span", "vis_span", "has_delayed_lints",
                        "eii"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.owner_id, &self.kind, &self.span, &self.vis_span,
                        &self.has_delayed_lints, &&self.eii];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Item", names,
            values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Item<'hir> {
    #[inline]
    fn clone(&self) -> Item<'hir> {
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        let _: ::core::clone::AssertParamIsClone<ItemKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Item<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Item<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Item {
                        owner_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2,
                        vis_span: ref __binding_3,
                        has_delayed_lints: ref __binding_4,
                        eii: ref __binding_5 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4263pub struct Item<'hir> {
4264    pub owner_id: OwnerId,
4265    pub kind: ItemKind<'hir>,
4266    pub span: Span,
4267    pub vis_span: Span,
4268    pub has_delayed_lints: bool,
4269    /// hint to speed up collection: true if the item is a static or function and has
4270    /// either an `EiiImpls` or `EiiExternTarget` attribute
4271    pub eii: bool,
4272}
4273
4274impl<'hir> Item<'hir> {
4275    #[inline]
4276    pub fn hir_id(&self) -> HirId {
4277        // Items are always HIR owners.
4278        HirId::make_owner(self.owner_id.def_id)
4279    }
4280
4281    pub fn item_id(&self) -> ItemId {
4282        ItemId { owner_id: self.owner_id }
4283    }
4284
4285    /// Check if this is an [`ItemKind::Enum`], [`ItemKind::Struct`] or
4286    /// [`ItemKind::Union`].
4287    pub fn is_adt(&self) -> bool {
4288        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..) => true,
    _ => false,
}matches!(self.kind, ItemKind::Enum(..) | ItemKind::Struct(..) | ItemKind::Union(..))
4289    }
4290
4291    /// Check if this is an [`ItemKind::Struct`] or [`ItemKind::Union`].
4292    pub fn is_struct_or_union(&self) -> bool {
4293        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    ItemKind::Struct(..) | ItemKind::Union(..) => true,
    _ => false,
}matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..))
4294    }
4295
4296    self
let ItemKind::Impl(imp) =
    &self.kind else { expect_failed("expect_impl", self) };
imp;expect_methods_self_kind! {
4297        expect_extern_crate, (Option<Symbol>, Ident),
4298            ItemKind::ExternCrate(s, ident), (*s, *ident);
4299
4300        expect_use, (&'hir UsePath<'hir>, UseKind), ItemKind::Use(p, uk), (p, *uk);
4301
4302        expect_static, (Mutability, Ident, &'hir Ty<'hir>, BodyId),
4303            ItemKind::Static(mutbl, ident, ty, body), (*mutbl, *ident, ty, *body);
4304
4305        expect_const, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4306            ItemKind::Const(ident, generics, ty, rhs), (*ident, generics, ty, *rhs);
4307
4308        expect_fn, (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId),
4309            ItemKind::Fn { ident, sig, generics, body, .. }, (*ident, sig, generics, *body);
4310
4311        expect_macro, (Ident, &ast::MacroDef, MacroKinds),
4312            ItemKind::Macro(ident, def, mk), (*ident, def, *mk);
4313
4314        expect_mod, (Ident, &'hir Mod<'hir>), ItemKind::Mod(ident, m), (*ident, m);
4315
4316        expect_foreign_mod, (ExternAbi, &'hir [ForeignItemId]),
4317            ItemKind::ForeignMod { abi, items }, (*abi, items);
4318
4319        expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;
4320
4321        expect_ty_alias, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4322            ItemKind::TyAlias(ident, generics, ty), (*ident, generics, ty);
4323
4324        expect_enum, (Ident, &'hir Generics<'hir>, &EnumDef<'hir>),
4325            ItemKind::Enum(ident, generics, def), (*ident, generics, def);
4326
4327        expect_struct, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4328            ItemKind::Struct(ident, generics, data), (*ident, generics, data);
4329
4330        expect_union, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4331            ItemKind::Union(ident, generics, data), (*ident, generics, data);
4332
4333        expect_trait,
4334            (
4335                Constness,
4336                IsAuto,
4337                Safety,
4338                Ident,
4339                &'hir Generics<'hir>,
4340                GenericBounds<'hir>,
4341                &'hir [TraitItemId]
4342            ),
4343            ItemKind::Trait(constness, is_auto, safety, ident, generics, bounds, items),
4344            (*constness, *is_auto, *safety, *ident, generics, bounds, items);
4345
4346        expect_trait_alias, (Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4347            ItemKind::TraitAlias(constness, ident, generics, bounds), (*constness, *ident, generics, bounds);
4348
4349        expect_impl, &Impl<'hir>, ItemKind::Impl(imp), imp;
4350    }
4351}
4352
4353#[derive(#[automatically_derived]
impl ::core::marker::Copy for Safety { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Safety {
    #[inline]
    fn clone(&self) -> Safety { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Safety {
    #[inline]
    fn eq(&self, other: &Safety) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Safety {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Safety {
    #[inline]
    fn partial_cmp(&self, other: &Safety)
        -> ::core::option::Option<::core::cmp::Ordering> {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for Safety {
    #[inline]
    fn cmp(&self, other: &Safety) -> ::core::cmp::Ordering {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Safety {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::fmt::Debug for Safety {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Safety::Unsafe => "Unsafe",
                Safety::Safe => "Safe",
            })
    }
}Debug)]
4354#[derive(const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for Safety {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        Safety::Unsafe => { 0usize }
                        Safety::Safe => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self { Safety::Unsafe => {} Safety::Safe => {} }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for Safety {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { Safety::Unsafe }
                    1usize => { Safety::Safe }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Safety`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Safety where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self { Safety::Unsafe => {} Safety::Safe => {} }
            }
        }
    };HashStable_Generic, #[automatically_derived]
impl ::core::default::Default for Safety {
    #[inline]
    fn default() -> Safety { Self::Unsafe }
}Default)]
4355pub enum Safety {
4356    /// This is the default variant, because the compiler messing up
4357    /// metadata encoding and failing to encode a `Safe` flag, means
4358    /// downstream crates think a thing is `Unsafe` instead of silently
4359    /// treating an unsafe thing as safe.
4360    #[default]
4361    Unsafe,
4362    Safe,
4363}
4364
4365impl Safety {
4366    pub fn prefix_str(self) -> &'static str {
4367        match self {
4368            Self::Unsafe => "unsafe ",
4369            Self::Safe => "",
4370        }
4371    }
4372
4373    #[inline]
4374    pub fn is_unsafe(self) -> bool {
4375        !self.is_safe()
4376    }
4377
4378    #[inline]
4379    pub fn is_safe(self) -> bool {
4380        match self {
4381            Self::Unsafe => false,
4382            Self::Safe => true,
4383        }
4384    }
4385}
4386
4387impl fmt::Display for Safety {
4388    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4389        f.write_str(match *self {
4390            Self::Unsafe => "unsafe",
4391            Self::Safe => "safe",
4392        })
4393    }
4394}
4395
4396#[derive(#[automatically_derived]
impl ::core::marker::Copy for Constness { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Constness {
    #[inline]
    fn clone(&self) -> Constness { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Constness {
    #[inline]
    fn eq(&self, other: &Constness) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Constness {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for Constness {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                Constness::Const => "Const",
                Constness::NotConst => "NotConst",
            })
    }
}Debug, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for Constness {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        Constness::Const => { 0usize }
                        Constness::NotConst => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    Constness::Const => {}
                    Constness::NotConst => {}
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for Constness {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { Constness::Const }
                    1usize => { Constness::NotConst }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `Constness`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Constness where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    Constness::Const => {}
                    Constness::NotConst => {}
                }
            }
        }
    };HashStable_Generic)]
4397#[derive(#[automatically_derived]
impl ::core::default::Default for Constness {
    #[inline]
    fn default() -> Constness { Self::Const }
}Default)]
4398pub enum Constness {
4399    #[default]
4400    Const,
4401    NotConst,
4402}
4403
4404impl fmt::Display for Constness {
4405    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4406        f.write_str(match *self {
4407            Self::Const => "const",
4408            Self::NotConst => "non-const",
4409        })
4410    }
4411}
4412
4413/// The actual safety specified in syntax. We may treat
4414/// its safety different within the type system to create a
4415/// "sound by default" system that needs checking this enum
4416/// explicitly to allow unsafe operations.
4417#[derive(#[automatically_derived]
impl ::core::marker::Copy for HeaderSafety { }Copy, #[automatically_derived]
impl ::core::clone::Clone for HeaderSafety {
    #[inline]
    fn clone(&self) -> HeaderSafety {
        let _: ::core::clone::AssertParamIsClone<Safety>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for HeaderSafety {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            HeaderSafety::SafeTargetFeatures =>
                ::core::fmt::Formatter::write_str(f, "SafeTargetFeatures"),
            HeaderSafety::Normal(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Normal",
                    &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for HeaderSafety where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    HeaderSafety::SafeTargetFeatures => {}
                    HeaderSafety::Normal(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic, #[automatically_derived]
impl ::core::cmp::PartialEq for HeaderSafety {
    #[inline]
    fn eq(&self, other: &HeaderSafety) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (HeaderSafety::Normal(__self_0),
                    HeaderSafety::Normal(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for HeaderSafety {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Safety>;
    }
}Eq)]
4418pub enum HeaderSafety {
4419    /// A safe function annotated with `#[target_features]`.
4420    /// The type system treats this function as an unsafe function,
4421    /// but safety checking will check this enum to treat it as safe
4422    /// and allowing calling other safe target feature functions with
4423    /// the same features without requiring an additional unsafe block.
4424    SafeTargetFeatures,
4425    Normal(Safety),
4426}
4427
4428impl From<Safety> for HeaderSafety {
4429    fn from(v: Safety) -> Self {
4430        Self::Normal(v)
4431    }
4432}
4433
4434#[derive(#[automatically_derived]
impl ::core::marker::Copy for FnHeader { }Copy, #[automatically_derived]
impl ::core::clone::Clone for FnHeader {
    #[inline]
    fn clone(&self) -> FnHeader {
        let _: ::core::clone::AssertParamIsClone<HeaderSafety>;
        let _: ::core::clone::AssertParamIsClone<Constness>;
        let _: ::core::clone::AssertParamIsClone<IsAsync>;
        let _: ::core::clone::AssertParamIsClone<ExternAbi>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for FnHeader {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "FnHeader",
            "safety", &self.safety, "constness", &self.constness, "asyncness",
            &self.asyncness, "abi", &&self.abi)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for FnHeader where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    FnHeader {
                        safety: ref __binding_0,
                        constness: ref __binding_1,
                        asyncness: ref __binding_2,
                        abi: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4435pub struct FnHeader {
4436    pub safety: HeaderSafety,
4437    pub constness: Constness,
4438    pub asyncness: IsAsync,
4439    pub abi: ExternAbi,
4440}
4441
4442impl FnHeader {
4443    pub fn is_async(&self) -> bool {
4444        #[allow(non_exhaustive_omitted_patterns)] match self.asyncness {
    IsAsync::Async(_) => true,
    _ => false,
}matches!(self.asyncness, IsAsync::Async(_))
4445    }
4446
4447    pub fn is_const(&self) -> bool {
4448        #[allow(non_exhaustive_omitted_patterns)] match self.constness {
    Constness::Const => true,
    _ => false,
}matches!(self.constness, Constness::Const)
4449    }
4450
4451    pub fn is_unsafe(&self) -> bool {
4452        self.safety().is_unsafe()
4453    }
4454
4455    pub fn is_safe(&self) -> bool {
4456        self.safety().is_safe()
4457    }
4458
4459    pub fn safety(&self) -> Safety {
4460        match self.safety {
4461            HeaderSafety::SafeTargetFeatures => Safety::Unsafe,
4462            HeaderSafety::Normal(safety) => safety,
4463        }
4464    }
4465}
4466
4467#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ItemKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ItemKind::ExternCrate(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f,
                    "ExternCrate", __self_0, &__self_1),
            ItemKind::Use(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Use",
                    __self_0, &__self_1),
            ItemKind::Static(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f, "Static",
                    __self_0, __self_1, __self_2, &__self_3),
            ItemKind::Const(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f, "Const",
                    __self_0, __self_1, __self_2, &__self_3),
            ItemKind::Fn {
                sig: __self_0,
                ident: __self_1,
                generics: __self_2,
                body: __self_3,
                has_body: __self_4 } =>
                ::core::fmt::Formatter::debug_struct_field5_finish(f, "Fn",
                    "sig", __self_0, "ident", __self_1, "generics", __self_2,
                    "body", __self_3, "has_body", &__self_4),
            ItemKind::Macro(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Macro",
                    __self_0, __self_1, &__self_2),
            ItemKind::Mod(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Mod",
                    __self_0, &__self_1),
            ItemKind::ForeignMod { abi: __self_0, items: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "ForeignMod", "abi", __self_0, "items", &__self_1),
            ItemKind::GlobalAsm { asm: __self_0, fake_body: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "GlobalAsm", "asm", __self_0, "fake_body", &__self_1),
            ItemKind::TyAlias(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f,
                    "TyAlias", __self_0, __self_1, &__self_2),
            ItemKind::Enum(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Enum",
                    __self_0, __self_1, &__self_2),
            ItemKind::Struct(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Struct",
                    __self_0, __self_1, &__self_2),
            ItemKind::Union(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Union",
                    __self_0, __self_1, &__self_2),
            ItemKind::Trait(__self_0, __self_1, __self_2, __self_3, __self_4,
                __self_5, __self_6) => {
                let values: &[&dyn ::core::fmt::Debug] =
                    &[__self_0, __self_1, __self_2, __self_3, __self_4,
                                __self_5, &__self_6];
                ::core::fmt::Formatter::debug_tuple_fields_finish(f, "Trait",
                    values)
            }
            ItemKind::TraitAlias(__self_0, __self_1, __self_2, __self_3) =>
                ::core::fmt::Formatter::debug_tuple_field4_finish(f,
                    "TraitAlias", __self_0, __self_1, __self_2, &__self_3),
            ItemKind::Impl(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Impl",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ItemKind<'hir> {
    #[inline]
    fn clone(&self) -> ItemKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<Option<Symbol>>;
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<&'hir UsePath<'hir>>;
        let _: ::core::clone::AssertParamIsClone<UseKind>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<BodyId>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ConstItemRhs<'hir>>;
        let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<&'hir ast::MacroDef>;
        let _: ::core::clone::AssertParamIsClone<MacroKinds>;
        let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
        let _: ::core::clone::AssertParamIsClone<ExternAbi>;
        let _: ::core::clone::AssertParamIsClone<&'hir [ForeignItemId]>;
        let _: ::core::clone::AssertParamIsClone<&'hir InlineAsm<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<EnumDef<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<VariantData<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Constness>;
        let _: ::core::clone::AssertParamIsClone<IsAuto>;
        let _: ::core::clone::AssertParamIsClone<Safety>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [TraitItemId]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<GenericBounds<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Impl<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ItemKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ItemKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ItemKind::ExternCrate(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Static(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Const(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Fn {
                        sig: ref __binding_0,
                        ident: ref __binding_1,
                        generics: ref __binding_2,
                        body: ref __binding_3,
                        has_body: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Macro(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Mod(ref __binding_0, ref __binding_1) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::ForeignMod {
                        abi: ref __binding_0, items: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::GlobalAsm {
                        asm: ref __binding_0, fake_body: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::TyAlias(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Enum(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Union(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Trait(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3, ref __binding_4,
                        ref __binding_5, ref __binding_6) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                        { __binding_6.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::TraitAlias(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                    ItemKind::Impl(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4468pub enum ItemKind<'hir> {
4469    /// An `extern crate` item, with optional *original* crate name if the crate was renamed.
4470    ///
4471    /// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
4472    ExternCrate(Option<Symbol>, Ident),
4473
4474    /// `use foo::bar::*;` or `use foo::bar::baz as quux;`
4475    ///
4476    /// or just
4477    ///
4478    /// `use foo::bar::baz;` (with `as baz` implicitly on the right).
4479    Use(&'hir UsePath<'hir>, UseKind),
4480
4481    /// A `static` item.
4482    Static(Mutability, Ident, &'hir Ty<'hir>, BodyId),
4483    /// A `const` item.
4484    Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4485    /// A function declaration.
4486    Fn {
4487        sig: FnSig<'hir>,
4488        ident: Ident,
4489        generics: &'hir Generics<'hir>,
4490        body: BodyId,
4491        /// Whether this function actually has a body.
4492        /// For functions without a body, `body` is synthesized (to avoid ICEs all over the
4493        /// compiler), but that code should never be translated.
4494        has_body: bool,
4495    },
4496    /// A MBE macro definition (`macro_rules!` or `macro`).
4497    Macro(Ident, &'hir ast::MacroDef, MacroKinds),
4498    /// A module.
4499    Mod(Ident, &'hir Mod<'hir>),
4500    /// An external module, e.g. `extern { .. }`.
4501    ForeignMod { abi: ExternAbi, items: &'hir [ForeignItemId] },
4502    /// Module-level inline assembly (from `global_asm!`).
4503    GlobalAsm {
4504        asm: &'hir InlineAsm<'hir>,
4505        /// A fake body which stores typeck results for the global asm's sym_fn
4506        /// operands, which are represented as path expressions. This body contains
4507        /// a single [`ExprKind::InlineAsm`] which points to the asm in the field
4508        /// above, and which is typechecked like a inline asm expr just for the
4509        /// typeck results.
4510        fake_body: BodyId,
4511    },
4512    /// A type alias, e.g., `type Foo = Bar<u8>`.
4513    TyAlias(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4514    /// An enum definition, e.g., `enum Foo<A, B> { C<A>, D<B> }`.
4515    Enum(Ident, &'hir Generics<'hir>, EnumDef<'hir>),
4516    /// A struct definition, e.g., `struct Foo<A> {x: A}`.
4517    Struct(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4518    /// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`.
4519    Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4520    /// A trait definition.
4521    Trait(
4522        Constness,
4523        IsAuto,
4524        Safety,
4525        Ident,
4526        &'hir Generics<'hir>,
4527        GenericBounds<'hir>,
4528        &'hir [TraitItemId],
4529    ),
4530    /// A trait alias.
4531    TraitAlias(Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4532
4533    /// An implementation, e.g., `impl<A> Trait for Foo { .. }`.
4534    Impl(Impl<'hir>),
4535}
4536
4537/// Represents an impl block declaration.
4538///
4539/// E.g., `impl $Type { .. }` or `impl $Trait for $Type { .. }`
4540/// Refer to [`ImplItem`] for an associated item within an impl block.
4541#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for Impl<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "Impl",
            "generics", &self.generics, "of_trait", &self.of_trait, "self_ty",
            &self.self_ty, "items", &self.items, "constness",
            &&self.constness)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Impl<'hir> {
    #[inline]
    fn clone(&self) -> Impl<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<Option<&'hir TraitImplHeader<'hir>>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [ImplItemId]>;
        let _: ::core::clone::AssertParamIsClone<Constness>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Impl<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Impl<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Impl {
                        generics: ref __binding_0,
                        of_trait: ref __binding_1,
                        self_ty: ref __binding_2,
                        items: ref __binding_3,
                        constness: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4542pub struct Impl<'hir> {
4543    pub generics: &'hir Generics<'hir>,
4544    pub of_trait: Option<&'hir TraitImplHeader<'hir>>,
4545    pub self_ty: &'hir Ty<'hir>,
4546    pub items: &'hir [ImplItemId],
4547    pub constness: Constness,
4548}
4549
4550#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitImplHeader<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f,
            "TraitImplHeader", "safety", &self.safety, "polarity",
            &self.polarity, "defaultness", &self.defaultness,
            "defaultness_span", &self.defaultness_span, "trait_ref",
            &&self.trait_ref)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitImplHeader<'hir> {
    #[inline]
    fn clone(&self) -> TraitImplHeader<'hir> {
        let _: ::core::clone::AssertParamIsClone<Safety>;
        let _: ::core::clone::AssertParamIsClone<ImplPolarity>;
        let _: ::core::clone::AssertParamIsClone<Defaultness>;
        let _: ::core::clone::AssertParamIsClone<Option<Span>>;
        let _: ::core::clone::AssertParamIsClone<TraitRef<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitImplHeader<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitImplHeader<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitImplHeader {
                        safety: ref __binding_0,
                        polarity: ref __binding_1,
                        defaultness: ref __binding_2,
                        defaultness_span: ref __binding_3,
                        trait_ref: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4551pub struct TraitImplHeader<'hir> {
4552    pub safety: Safety,
4553    pub polarity: ImplPolarity,
4554    pub defaultness: Defaultness,
4555    // We do not put a `Span` in `Defaultness` because it breaks foreign crate metadata
4556    // decoding as `Span`s cannot be decoded when a `Session` is not available.
4557    pub defaultness_span: Option<Span>,
4558    pub trait_ref: TraitRef<'hir>,
4559}
4560
4561impl ItemKind<'_> {
4562    pub fn ident(&self) -> Option<Ident> {
4563        match *self {
4564            ItemKind::ExternCrate(_, ident)
4565            | ItemKind::Use(_, UseKind::Single(ident))
4566            | ItemKind::Static(_, ident, ..)
4567            | ItemKind::Const(ident, ..)
4568            | ItemKind::Fn { ident, .. }
4569            | ItemKind::Macro(ident, ..)
4570            | ItemKind::Mod(ident, ..)
4571            | ItemKind::TyAlias(ident, ..)
4572            | ItemKind::Enum(ident, ..)
4573            | ItemKind::Struct(ident, ..)
4574            | ItemKind::Union(ident, ..)
4575            | ItemKind::Trait(_, _, _, ident, ..)
4576            | ItemKind::TraitAlias(_, ident, ..) => Some(ident),
4577
4578            ItemKind::Use(_, UseKind::Glob | UseKind::ListStem)
4579            | ItemKind::ForeignMod { .. }
4580            | ItemKind::GlobalAsm { .. }
4581            | ItemKind::Impl(_) => None,
4582        }
4583    }
4584
4585    pub fn generics(&self) -> Option<&Generics<'_>> {
4586        Some(match self {
4587            ItemKind::Fn { generics, .. }
4588            | ItemKind::TyAlias(_, generics, _)
4589            | ItemKind::Const(_, generics, _, _)
4590            | ItemKind::Enum(_, generics, _)
4591            | ItemKind::Struct(_, generics, _)
4592            | ItemKind::Union(_, generics, _)
4593            | ItemKind::Trait(_, _, _, _, generics, _, _)
4594            | ItemKind::TraitAlias(_, _, generics, _)
4595            | ItemKind::Impl(Impl { generics, .. }) => generics,
4596            _ => return None,
4597        })
4598    }
4599
4600    pub fn recovered(&self) -> bool {
4601        match self {
4602            ItemKind::Struct(
4603                _,
4604                _,
4605                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4606            ) => true,
4607            ItemKind::Union(
4608                _,
4609                _,
4610                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4611            ) => true,
4612            ItemKind::Enum(_, _, def) => def.variants.iter().any(|v| match v.data {
4613                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. } => true,
4614                _ => false,
4615            }),
4616            _ => false,
4617        }
4618    }
4619}
4620
4621// The bodies for items are stored "out of line", in a separate
4622// hashmap in the `Crate`. Here we just record the hir-id of the item
4623// so it can fetched later.
4624#[derive(#[automatically_derived]
impl ::core::marker::Copy for ForeignItemId { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ForeignItemId {
    #[inline]
    fn clone(&self) -> ForeignItemId {
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for ForeignItemId {
    #[inline]
    fn eq(&self, other: &ForeignItemId) -> bool {
        self.owner_id == other.owner_id
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ForeignItemId {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<OwnerId>;
    }
}Eq, const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for ForeignItemId {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    ForeignItemId { owner_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable, const _: () =
    {
        impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
            for ForeignItemId {
            fn decode(__decoder: &mut __D) -> Self {
                ForeignItemId {
                    owner_id: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, #[automatically_derived]
impl ::core::fmt::Debug for ForeignItemId {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "ForeignItemId",
            "owner_id", &&self.owner_id)
    }
}Debug, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for ForeignItemId where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ForeignItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4625pub struct ForeignItemId {
4626    pub owner_id: OwnerId,
4627}
4628
4629impl ForeignItemId {
4630    #[inline]
4631    pub fn hir_id(&self) -> HirId {
4632        // Items are always HIR owners.
4633        HirId::make_owner(self.owner_id.def_id)
4634    }
4635}
4636
4637#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ForeignItem<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ident", "kind", "owner_id", "span", "vis_span",
                        "has_delayed_lints"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ident, &self.kind, &self.owner_id, &self.span,
                        &self.vis_span, &&self.has_delayed_lints];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "ForeignItem",
            names, values)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ForeignItem<'hir> {
    #[inline]
    fn clone(&self) -> ForeignItem<'hir> {
        let _: ::core::clone::AssertParamIsClone<Ident>;
        let _: ::core::clone::AssertParamIsClone<ForeignItemKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<OwnerId>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ForeignItem<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ForeignItem<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ForeignItem {
                        ident: ref __binding_0,
                        kind: ref __binding_1,
                        owner_id: ref __binding_2,
                        span: ref __binding_3,
                        vis_span: ref __binding_4,
                        has_delayed_lints: ref __binding_5 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                        { __binding_5.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4638pub struct ForeignItem<'hir> {
4639    pub ident: Ident,
4640    pub kind: ForeignItemKind<'hir>,
4641    pub owner_id: OwnerId,
4642    pub span: Span,
4643    pub vis_span: Span,
4644    pub has_delayed_lints: bool,
4645}
4646
4647impl ForeignItem<'_> {
4648    #[inline]
4649    pub fn hir_id(&self) -> HirId {
4650        // Items are always HIR owners.
4651        HirId::make_owner(self.owner_id.def_id)
4652    }
4653
4654    pub fn foreign_item_id(&self) -> ForeignItemId {
4655        ForeignItemId { owner_id: self.owner_id }
4656    }
4657}
4658
4659/// An item within an `extern` block.
4660#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ForeignItemKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ForeignItemKind::Fn(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Fn",
                    __self_0, __self_1, &__self_2),
            ForeignItemKind::Static(__self_0, __self_1, __self_2) =>
                ::core::fmt::Formatter::debug_tuple_field3_finish(f, "Static",
                    __self_0, __self_1, &__self_2),
            ForeignItemKind::Type =>
                ::core::fmt::Formatter::write_str(f, "Type"),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ForeignItemKind<'hir> {
    #[inline]
    fn clone(&self) -> ForeignItemKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<FnSig<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir [Option<Ident>]>;
        let _: ::core::clone::AssertParamIsClone<&'hir Generics<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Mutability>;
        let _: ::core::clone::AssertParamIsClone<Safety>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ForeignItemKind<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            ForeignItemKind<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ForeignItemKind::Fn(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ForeignItemKind::Static(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ForeignItemKind::Type => {}
                }
            }
        }
    };HashStable_Generic)]
4661pub enum ForeignItemKind<'hir> {
4662    /// A foreign function.
4663    ///
4664    /// All argument idents are actually always present (i.e. `Some`), but
4665    /// `&[Option<Ident>]` is used because of code paths shared with `TraitFn`
4666    /// and `FnPtrTy`. The sharing is due to all of these cases not allowing
4667    /// arbitrary patterns for parameters.
4668    Fn(FnSig<'hir>, &'hir [Option<Ident>], &'hir Generics<'hir>),
4669    /// A foreign static item (`static ext: u8`).
4670    Static(&'hir Ty<'hir>, Mutability, Safety),
4671    /// A foreign type.
4672    Type,
4673}
4674
4675/// A variable captured by a closure.
4676#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Upvar {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "Upvar", "span",
            &&self.span)
    }
}Debug, #[automatically_derived]
impl ::core::marker::Copy for Upvar { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Upvar {
    #[inline]
    fn clone(&self) -> Upvar {
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, const _: () =
    {
        impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
            for Upvar where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    Upvar { span: ref __binding_0 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4677pub struct Upvar {
4678    /// First span where it is accessed (there can be multiple).
4679    pub span: Span,
4680}
4681
4682// The TraitCandidate's import_ids is empty if the trait is defined in the same module, and
4683// has length > 0 if the trait is found through an chain of imports, starting with the
4684// import/use statement in the scope where the trait is used.
4685#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for TraitCandidate<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "TraitCandidate", "def_id", &self.def_id, "import_ids",
            &self.import_ids, "lint_ambiguous", &&self.lint_ambiguous)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for TraitCandidate<'hir> {
    #[inline]
    fn clone(&self) -> TraitCandidate<'hir> {
        let _: ::core::clone::AssertParamIsClone<DefId>;
        let _: ::core::clone::AssertParamIsClone<&'hir [LocalDefId]>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for TraitCandidate<'hir> { }Copy, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            TraitCandidate<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    TraitCandidate {
                        def_id: ref __binding_0,
                        import_ids: ref __binding_1,
                        lint_ambiguous: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4686pub struct TraitCandidate<'hir> {
4687    pub def_id: DefId,
4688    pub import_ids: &'hir [LocalDefId],
4689    // Indicates whether this trait candidate is ambiguously glob imported
4690    // in it's scope. Related to the AMBIGUOUS_GLOB_IMPORTED_TRAITS lint.
4691    // If this is set to true and the trait is used as a result of method lookup, this
4692    // lint is thrown.
4693    pub lint_ambiguous: bool,
4694}
4695
4696#[derive(#[automatically_derived]
impl<'hir> ::core::marker::Copy for OwnerNode<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::clone::Clone for OwnerNode<'hir> {
    #[inline]
    fn clone(&self) -> OwnerNode<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Item<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ForeignItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir TraitItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ImplItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for OwnerNode<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            OwnerNode::Item(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
                    &__self_0),
            OwnerNode::ForeignItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ForeignItem", &__self_0),
            OwnerNode::TraitItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TraitItem", &__self_0),
            OwnerNode::ImplItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ImplItem", &__self_0),
            OwnerNode::Crate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Crate",
                    &__self_0),
            OwnerNode::Synthetic =>
                ::core::fmt::Formatter::write_str(f, "Synthetic"),
        }
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            OwnerNode<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    OwnerNode::Item(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    OwnerNode::ForeignItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    OwnerNode::TraitItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    OwnerNode::ImplItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    OwnerNode::Crate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    OwnerNode::Synthetic => {}
                }
            }
        }
    };HashStable_Generic)]
4697pub enum OwnerNode<'hir> {
4698    Item(&'hir Item<'hir>),
4699    ForeignItem(&'hir ForeignItem<'hir>),
4700    TraitItem(&'hir TraitItem<'hir>),
4701    ImplItem(&'hir ImplItem<'hir>),
4702    Crate(&'hir Mod<'hir>),
4703    Synthetic,
4704}
4705
4706impl<'hir> OwnerNode<'hir> {
4707    pub fn span(&self) -> Span {
4708        match self {
4709            OwnerNode::Item(Item { span, .. })
4710            | OwnerNode::ForeignItem(ForeignItem { span, .. })
4711            | OwnerNode::ImplItem(ImplItem { span, .. })
4712            | OwnerNode::TraitItem(TraitItem { span, .. }) => *span,
4713            OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => *inner_span,
4714            OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
4715        }
4716    }
4717
4718    pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
4719        match self {
4720            OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4721            | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4722            | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4723            | OwnerNode::ForeignItem(ForeignItem {
4724                kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4725            }) => Some(fn_sig),
4726            _ => None,
4727        }
4728    }
4729
4730    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
4731        match self {
4732            OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4733            | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4734            | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4735            | OwnerNode::ForeignItem(ForeignItem {
4736                kind: ForeignItemKind::Fn(fn_sig, _, _), ..
4737            }) => Some(fn_sig.decl),
4738            _ => None,
4739        }
4740    }
4741
4742    pub fn body_id(&self) -> Option<BodyId> {
4743        match self {
4744            OwnerNode::Item(Item {
4745                kind:
4746                    ItemKind::Static(_, _, _, body)
4747                    | ItemKind::Const(.., ConstItemRhs::Body(body))
4748                    | ItemKind::Fn { body, .. },
4749                ..
4750            })
4751            | OwnerNode::TraitItem(TraitItem {
4752                kind:
4753                    TraitItemKind::Fn(_, TraitFn::Provided(body))
4754                    | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _),
4755                ..
4756            })
4757            | OwnerNode::ImplItem(ImplItem {
4758                kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, ConstItemRhs::Body(body)),
4759                ..
4760            }) => Some(*body),
4761            _ => None,
4762        }
4763    }
4764
4765    pub fn generics(self) -> Option<&'hir Generics<'hir>> {
4766        Node::generics(self.into())
4767    }
4768
4769    pub fn def_id(self) -> OwnerId {
4770        match self {
4771            OwnerNode::Item(Item { owner_id, .. })
4772            | OwnerNode::TraitItem(TraitItem { owner_id, .. })
4773            | OwnerNode::ImplItem(ImplItem { owner_id, .. })
4774            | OwnerNode::ForeignItem(ForeignItem { owner_id, .. }) => *owner_id,
4775            OwnerNode::Crate(..) => crate::CRATE_HIR_ID.owner,
4776            OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
4777        }
4778    }
4779
4780    /// Check if node is an impl block.
4781    pub fn is_impl_block(&self) -> bool {
4782        #[allow(non_exhaustive_omitted_patterns)] match self {
    OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }) => true,
    _ => false,
}matches!(self, OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }))
4783    }
4784
4785    self
let OwnerNode::TraitItem(n) =
    self else { expect_failed("expect_trait_item", self) };
n;expect_methods_self! {
4786        expect_item,         &'hir Item<'hir>,        OwnerNode::Item(n),        n;
4787        expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;
4788        expect_impl_item,    &'hir ImplItem<'hir>,    OwnerNode::ImplItem(n),    n;
4789        expect_trait_item,   &'hir TraitItem<'hir>,   OwnerNode::TraitItem(n),   n;
4790    }
4791}
4792
4793impl<'hir> From<&'hir Item<'hir>> for OwnerNode<'hir> {
4794    fn from(val: &'hir Item<'hir>) -> Self {
4795        OwnerNode::Item(val)
4796    }
4797}
4798
4799impl<'hir> From<&'hir ForeignItem<'hir>> for OwnerNode<'hir> {
4800    fn from(val: &'hir ForeignItem<'hir>) -> Self {
4801        OwnerNode::ForeignItem(val)
4802    }
4803}
4804
4805impl<'hir> From<&'hir ImplItem<'hir>> for OwnerNode<'hir> {
4806    fn from(val: &'hir ImplItem<'hir>) -> Self {
4807        OwnerNode::ImplItem(val)
4808    }
4809}
4810
4811impl<'hir> From<&'hir TraitItem<'hir>> for OwnerNode<'hir> {
4812    fn from(val: &'hir TraitItem<'hir>) -> Self {
4813        OwnerNode::TraitItem(val)
4814    }
4815}
4816
4817impl<'hir> From<OwnerNode<'hir>> for Node<'hir> {
4818    fn from(val: OwnerNode<'hir>) -> Self {
4819        match val {
4820            OwnerNode::Item(n) => Node::Item(n),
4821            OwnerNode::ForeignItem(n) => Node::ForeignItem(n),
4822            OwnerNode::ImplItem(n) => Node::ImplItem(n),
4823            OwnerNode::TraitItem(n) => Node::TraitItem(n),
4824            OwnerNode::Crate(n) => Node::Crate(n),
4825            OwnerNode::Synthetic => Node::Synthetic,
4826        }
4827    }
4828}
4829
4830#[derive(#[automatically_derived]
impl<'hir> ::core::marker::Copy for Node<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::clone::Clone for Node<'hir> {
    #[inline]
    fn clone(&self) -> Node<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Param<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Item<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ForeignItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir TraitItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ImplItem<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Variant<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir FieldDef<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir AnonConst>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstBlock>;
        let _: ::core::clone::AssertParamIsClone<&'hir ConstArg<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Expr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir ExprField<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir ConstArgExprField<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Stmt<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir PathSegment<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Ty<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir AssocItemConstraint<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir TraitRef<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir OpaqueTy<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir TyPat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Pat<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir PatField<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir PatExpr<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Arm<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Block<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir LetStmt<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir VariantData<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Lifetime>;
        let _: ::core::clone::AssertParamIsClone<&'hir GenericParam<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir Mod<'hir>>;
        let _: ::core::clone::AssertParamIsClone<&'hir InferArg>;
        let _: ::core::clone::AssertParamIsClone<&'hir WherePredicate<'hir>>;
        let _:
                ::core::clone::AssertParamIsClone<&'hir PreciseCapturingNonLifetimeArg>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::fmt::Debug for Node<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Node::Param(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Param",
                    &__self_0),
            Node::Item(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Item",
                    &__self_0),
            Node::ForeignItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ForeignItem", &__self_0),
            Node::TraitItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TraitItem", &__self_0),
            Node::ImplItem(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ImplItem", &__self_0),
            Node::Variant(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Variant", &__self_0),
            Node::Field(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Field",
                    &__self_0),
            Node::AnonConst(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "AnonConst", &__self_0),
            Node::ConstBlock(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ConstBlock", &__self_0),
            Node::ConstArg(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ConstArg", &__self_0),
            Node::Expr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Expr",
                    &__self_0),
            Node::ExprField(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ExprField", &__self_0),
            Node::ConstArgExprField(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ConstArgExprField", &__self_0),
            Node::Stmt(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Stmt",
                    &__self_0),
            Node::PathSegment(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PathSegment", &__self_0),
            Node::Ty(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ty",
                    &__self_0),
            Node::AssocItemConstraint(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "AssocItemConstraint", &__self_0),
            Node::TraitRef(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TraitRef", &__self_0),
            Node::OpaqueTy(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "OpaqueTy", &__self_0),
            Node::TyPat(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "TyPat",
                    &__self_0),
            Node::Pat(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Pat",
                    &__self_0),
            Node::PatField(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PatField", &__self_0),
            Node::PatExpr(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PatExpr", &__self_0),
            Node::Arm(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Arm",
                    &__self_0),
            Node::Block(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Block",
                    &__self_0),
            Node::LetStmt(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "LetStmt", &__self_0),
            Node::Ctor(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Ctor",
                    &__self_0),
            Node::Lifetime(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Lifetime", &__self_0),
            Node::GenericParam(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "GenericParam", &__self_0),
            Node::Crate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Crate",
                    &__self_0),
            Node::Infer(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Infer",
                    &__self_0),
            Node::WherePredicate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "WherePredicate", &__self_0),
            Node::PreciseCapturingNonLifetimeArg(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "PreciseCapturingNonLifetimeArg", &__self_0),
            Node::Synthetic =>
                ::core::fmt::Formatter::write_str(f, "Synthetic"),
            Node::Err(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Err",
                    &__self_0),
        }
    }
}Debug, const _: () =
    {
        impl<'hir, __CTX>
            ::rustc_data_structures::stable_hasher::HashStable<__CTX> for
            Node<'hir> where __CTX: crate::HashStableContext {
            #[inline]
            fn hash_stable(&self, __hcx: &mut __CTX,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    Node::Param(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Item(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ForeignItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::TraitItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ImplItem(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Variant(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Field(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::AnonConst(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ConstBlock(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ConstArg(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Expr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ExprField(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::ConstArgExprField(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Stmt(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::PathSegment(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Ty(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::AssocItemConstraint(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::TraitRef(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::OpaqueTy(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::TyPat(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Pat(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::PatField(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::PatExpr(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Arm(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Block(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::LetStmt(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Ctor(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Lifetime(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::GenericParam(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Crate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Infer(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::WherePredicate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::PreciseCapturingNonLifetimeArg(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    Node::Synthetic => {}
                    Node::Err(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable_Generic)]
4831pub enum Node<'hir> {
4832    Param(&'hir Param<'hir>),
4833    Item(&'hir Item<'hir>),
4834    ForeignItem(&'hir ForeignItem<'hir>),
4835    TraitItem(&'hir TraitItem<'hir>),
4836    ImplItem(&'hir ImplItem<'hir>),
4837    Variant(&'hir Variant<'hir>),
4838    Field(&'hir FieldDef<'hir>),
4839    AnonConst(&'hir AnonConst),
4840    ConstBlock(&'hir ConstBlock),
4841    ConstArg(&'hir ConstArg<'hir>),
4842    Expr(&'hir Expr<'hir>),
4843    ExprField(&'hir ExprField<'hir>),
4844    ConstArgExprField(&'hir ConstArgExprField<'hir>),
4845    Stmt(&'hir Stmt<'hir>),
4846    PathSegment(&'hir PathSegment<'hir>),
4847    Ty(&'hir Ty<'hir>),
4848    AssocItemConstraint(&'hir AssocItemConstraint<'hir>),
4849    TraitRef(&'hir TraitRef<'hir>),
4850    OpaqueTy(&'hir OpaqueTy<'hir>),
4851    TyPat(&'hir TyPat<'hir>),
4852    Pat(&'hir Pat<'hir>),
4853    PatField(&'hir PatField<'hir>),
4854    /// Needed as its own node with its own HirId for tracking
4855    /// the unadjusted type of literals within patterns
4856    /// (e.g. byte str literals not being of slice type).
4857    PatExpr(&'hir PatExpr<'hir>),
4858    Arm(&'hir Arm<'hir>),
4859    Block(&'hir Block<'hir>),
4860    LetStmt(&'hir LetStmt<'hir>),
4861    /// `Ctor` refers to the constructor of an enum variant or struct. Only tuple or unit variants
4862    /// with synthesized constructors.
4863    Ctor(&'hir VariantData<'hir>),
4864    Lifetime(&'hir Lifetime),
4865    GenericParam(&'hir GenericParam<'hir>),
4866    Crate(&'hir Mod<'hir>),
4867    Infer(&'hir InferArg),
4868    WherePredicate(&'hir WherePredicate<'hir>),
4869    PreciseCapturingNonLifetimeArg(&'hir PreciseCapturingNonLifetimeArg),
4870    // Created by query feeding
4871    Synthetic,
4872    Err(Span),
4873}
4874
4875impl<'hir> Node<'hir> {
4876    /// Get the identifier of this `Node`, if applicable.
4877    ///
4878    /// # Edge cases
4879    ///
4880    /// Calling `.ident()` on a [`Node::Ctor`] will return `None`
4881    /// because `Ctor`s do not have identifiers themselves.
4882    /// Instead, call `.ident()` on the parent struct/variant, like so:
4883    ///
4884    /// ```ignore (illustrative)
4885    /// ctor
4886    ///     .ctor_hir_id()
4887    ///     .map(|ctor_id| tcx.parent_hir_node(ctor_id))
4888    ///     .and_then(|parent| parent.ident())
4889    /// ```
4890    pub fn ident(&self) -> Option<Ident> {
4891        match self {
4892            Node::Item(item) => item.kind.ident(),
4893            Node::TraitItem(TraitItem { ident, .. })
4894            | Node::ImplItem(ImplItem { ident, .. })
4895            | Node::ForeignItem(ForeignItem { ident, .. })
4896            | Node::Field(FieldDef { ident, .. })
4897            | Node::Variant(Variant { ident, .. })
4898            | Node::PathSegment(PathSegment { ident, .. }) => Some(*ident),
4899            Node::Lifetime(lt) => Some(lt.ident),
4900            Node::GenericParam(p) => Some(p.name.ident()),
4901            Node::AssocItemConstraint(c) => Some(c.ident),
4902            Node::PatField(f) => Some(f.ident),
4903            Node::ExprField(f) => Some(f.ident),
4904            Node::ConstArgExprField(f) => Some(f.field),
4905            Node::PreciseCapturingNonLifetimeArg(a) => Some(a.ident),
4906            Node::Param(..)
4907            | Node::AnonConst(..)
4908            | Node::ConstBlock(..)
4909            | Node::ConstArg(..)
4910            | Node::Expr(..)
4911            | Node::Stmt(..)
4912            | Node::Block(..)
4913            | Node::Ctor(..)
4914            | Node::Pat(..)
4915            | Node::TyPat(..)
4916            | Node::PatExpr(..)
4917            | Node::Arm(..)
4918            | Node::LetStmt(..)
4919            | Node::Crate(..)
4920            | Node::Ty(..)
4921            | Node::TraitRef(..)
4922            | Node::OpaqueTy(..)
4923            | Node::Infer(..)
4924            | Node::WherePredicate(..)
4925            | Node::Synthetic
4926            | Node::Err(..) => None,
4927        }
4928    }
4929
4930    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
4931        match self {
4932            Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4933            | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4934            | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4935            | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
4936                Some(fn_sig.decl)
4937            }
4938            Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. }) => {
4939                Some(fn_decl)
4940            }
4941            _ => None,
4942        }
4943    }
4944
4945    /// Get a `hir::Impl` if the node is an impl block for the given `trait_def_id`.
4946    pub fn impl_block_of_trait(self, trait_def_id: DefId) -> Option<&'hir Impl<'hir>> {
4947        if let Node::Item(Item { kind: ItemKind::Impl(impl_block), .. }) = self
4948            && let Some(of_trait) = impl_block.of_trait
4949            && let Some(trait_id) = of_trait.trait_ref.trait_def_id()
4950            && trait_id == trait_def_id
4951        {
4952            Some(impl_block)
4953        } else {
4954            None
4955        }
4956    }
4957
4958    pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
4959        match self {
4960            Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
4961            | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
4962            | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
4963            | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
4964                Some(fn_sig)
4965            }
4966            _ => None,
4967        }
4968    }
4969
4970    /// Get the type for constants, assoc types, type aliases and statics.
4971    pub fn ty(self) -> Option<&'hir Ty<'hir>> {
4972        match self {
4973            Node::Item(it) => match it.kind {
4974                ItemKind::TyAlias(_, _, ty)
4975                | ItemKind::Static(_, _, ty, _)
4976                | ItemKind::Const(_, _, ty, _) => Some(ty),
4977                ItemKind::Impl(impl_item) => Some(&impl_item.self_ty),
4978                _ => None,
4979            },
4980            Node::TraitItem(it) => match it.kind {
4981                TraitItemKind::Const(ty, _, _) => Some(ty),
4982                TraitItemKind::Type(_, ty) => ty,
4983                _ => None,
4984            },
4985            Node::ImplItem(it) => match it.kind {
4986                ImplItemKind::Const(ty, _) => Some(ty),
4987                ImplItemKind::Type(ty) => Some(ty),
4988                _ => None,
4989            },
4990            Node::ForeignItem(it) => match it.kind {
4991                ForeignItemKind::Static(ty, ..) => Some(ty),
4992                _ => None,
4993            },
4994            Node::GenericParam(param) => match param.kind {
4995                GenericParamKind::Lifetime { .. } => None,
4996                GenericParamKind::Type { default, .. } => default,
4997                GenericParamKind::Const { ty, .. } => Some(ty),
4998            },
4999            _ => None,
5000        }
5001    }
5002
5003    pub fn alias_ty(self) -> Option<&'hir Ty<'hir>> {
5004        match self {
5005            Node::Item(Item { kind: ItemKind::TyAlias(_, _, ty), .. }) => Some(ty),
5006            _ => None,
5007        }
5008    }
5009
5010    #[inline]
5011    pub fn associated_body(&self) -> Option<(LocalDefId, BodyId)> {
5012        match self {
5013            Node::Item(Item {
5014                owner_id,
5015                kind:
5016                    ItemKind::Const(.., ConstItemRhs::Body(body))
5017                    | ItemKind::Static(.., body)
5018                    | ItemKind::Fn { body, .. },
5019                ..
5020            })
5021            | Node::TraitItem(TraitItem {
5022                owner_id,
5023                kind:
5024                    TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)), _)
5025                    | TraitItemKind::Fn(_, TraitFn::Provided(body)),
5026                ..
5027            })
5028            | Node::ImplItem(ImplItem {
5029                owner_id,
5030                kind: ImplItemKind::Const(.., ConstItemRhs::Body(body)) | ImplItemKind::Fn(_, body),
5031                ..
5032            }) => Some((owner_id.def_id, *body)),
5033
5034            Node::Item(Item {
5035                owner_id, kind: ItemKind::GlobalAsm { asm: _, fake_body }, ..
5036            }) => Some((owner_id.def_id, *fake_body)),
5037
5038            Node::Expr(Expr { kind: ExprKind::Closure(Closure { def_id, body, .. }), .. }) => {
5039                Some((*def_id, *body))
5040            }
5041
5042            Node::AnonConst(constant) => Some((constant.def_id, constant.body)),
5043            Node::ConstBlock(constant) => Some((constant.def_id, constant.body)),
5044
5045            _ => None,
5046        }
5047    }
5048
5049    pub fn body_id(&self) -> Option<BodyId> {
5050        Some(self.associated_body()?.1)
5051    }
5052
5053    pub fn generics(self) -> Option<&'hir Generics<'hir>> {
5054        match self {
5055            Node::ForeignItem(ForeignItem {
5056                kind: ForeignItemKind::Fn(_, _, generics), ..
5057            })
5058            | Node::TraitItem(TraitItem { generics, .. })
5059            | Node::ImplItem(ImplItem { generics, .. }) => Some(generics),
5060            Node::Item(item) => item.kind.generics(),
5061            _ => None,
5062        }
5063    }
5064
5065    pub fn as_owner(self) -> Option<OwnerNode<'hir>> {
5066        match self {
5067            Node::Item(i) => Some(OwnerNode::Item(i)),
5068            Node::ForeignItem(i) => Some(OwnerNode::ForeignItem(i)),
5069            Node::TraitItem(i) => Some(OwnerNode::TraitItem(i)),
5070            Node::ImplItem(i) => Some(OwnerNode::ImplItem(i)),
5071            Node::Crate(i) => Some(OwnerNode::Crate(i)),
5072            Node::Synthetic => Some(OwnerNode::Synthetic),
5073            _ => None,
5074        }
5075    }
5076
5077    pub fn fn_kind(self) -> Option<FnKind<'hir>> {
5078        match self {
5079            Node::Item(i) => match i.kind {
5080                ItemKind::Fn { ident, sig, generics, .. } => {
5081                    Some(FnKind::ItemFn(ident, generics, sig.header))
5082                }
5083                _ => None,
5084            },
5085            Node::TraitItem(ti) => match ti.kind {
5086                TraitItemKind::Fn(ref sig, _) => Some(FnKind::Method(ti.ident, sig)),
5087                _ => None,
5088            },
5089            Node::ImplItem(ii) => match ii.kind {
5090                ImplItemKind::Fn(ref sig, _) => Some(FnKind::Method(ii.ident, sig)),
5091                _ => None,
5092            },
5093            Node::Expr(e) => match e.kind {
5094                ExprKind::Closure { .. } => Some(FnKind::Closure),
5095                _ => None,
5096            },
5097            _ => None,
5098        }
5099    }
5100
5101    self
let Node::Expr(Expr { kind: ExprKind::Closure(n), .. }) =
    self else { expect_failed("expect_closure", self) };
n;expect_methods_self! {
5102        expect_param,         &'hir Param<'hir>,        Node::Param(n),        n;
5103        expect_item,          &'hir Item<'hir>,         Node::Item(n),         n;
5104        expect_foreign_item,  &'hir ForeignItem<'hir>,  Node::ForeignItem(n),  n;
5105        expect_trait_item,    &'hir TraitItem<'hir>,    Node::TraitItem(n),    n;
5106        expect_impl_item,     &'hir ImplItem<'hir>,     Node::ImplItem(n),     n;
5107        expect_variant,       &'hir Variant<'hir>,      Node::Variant(n),      n;
5108        expect_field,         &'hir FieldDef<'hir>,     Node::Field(n),        n;
5109        expect_anon_const,    &'hir AnonConst,          Node::AnonConst(n),    n;
5110        expect_inline_const,  &'hir ConstBlock,         Node::ConstBlock(n),   n;
5111        expect_expr,          &'hir Expr<'hir>,         Node::Expr(n),         n;
5112        expect_expr_field,    &'hir ExprField<'hir>,    Node::ExprField(n),    n;
5113        expect_stmt,          &'hir Stmt<'hir>,         Node::Stmt(n),         n;
5114        expect_path_segment,  &'hir PathSegment<'hir>,  Node::PathSegment(n),  n;
5115        expect_ty,            &'hir Ty<'hir>,           Node::Ty(n),           n;
5116        expect_assoc_item_constraint,  &'hir AssocItemConstraint<'hir>,  Node::AssocItemConstraint(n),  n;
5117        expect_trait_ref,     &'hir TraitRef<'hir>,     Node::TraitRef(n),     n;
5118        expect_opaque_ty,     &'hir OpaqueTy<'hir>,     Node::OpaqueTy(n),     n;
5119        expect_pat,           &'hir Pat<'hir>,          Node::Pat(n),          n;
5120        expect_pat_field,     &'hir PatField<'hir>,     Node::PatField(n),     n;
5121        expect_arm,           &'hir Arm<'hir>,          Node::Arm(n),          n;
5122        expect_block,         &'hir Block<'hir>,        Node::Block(n),        n;
5123        expect_let_stmt,      &'hir LetStmt<'hir>,      Node::LetStmt(n),      n;
5124        expect_ctor,          &'hir VariantData<'hir>,  Node::Ctor(n),         n;
5125        expect_lifetime,      &'hir Lifetime,           Node::Lifetime(n),     n;
5126        expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
5127        expect_crate,         &'hir Mod<'hir>,          Node::Crate(n),        n;
5128        expect_infer,         &'hir InferArg,           Node::Infer(n),        n;
5129        expect_closure,       &'hir Closure<'hir>, Node::Expr(Expr { kind: ExprKind::Closure(n), .. }), n;
5130    }
5131}
5132
5133// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
5134#[cfg(target_pointer_width = "64")]
5135mod size_asserts {
5136    use rustc_data_structures::static_assert_size;
5137
5138    use super::*;
5139    // tidy-alphabetical-start
5140    const _: [(); 48] = [(); ::std::mem::size_of::<Block<'_>>()];static_assert_size!(Block<'_>, 48);
5141    const _: [(); 24] = [(); ::std::mem::size_of::<Body<'_>>()];static_assert_size!(Body<'_>, 24);
5142    const _: [(); 64] = [(); ::std::mem::size_of::<Expr<'_>>()];static_assert_size!(Expr<'_>, 64);
5143    const _: [(); 48] = [(); ::std::mem::size_of::<ExprKind<'_>>()];static_assert_size!(ExprKind<'_>, 48);
5144    const _: [(); 40] = [(); ::std::mem::size_of::<FnDecl<'_>>()];static_assert_size!(FnDecl<'_>, 40);
5145    const _: [(); 96] = [(); ::std::mem::size_of::<ForeignItem<'_>>()];static_assert_size!(ForeignItem<'_>, 96);
5146    const _: [(); 56] = [(); ::std::mem::size_of::<ForeignItemKind<'_>>()];static_assert_size!(ForeignItemKind<'_>, 56);
5147    const _: [(); 16] = [(); ::std::mem::size_of::<GenericArg<'_>>()];static_assert_size!(GenericArg<'_>, 16);
5148    const _: [(); 64] = [(); ::std::mem::size_of::<GenericBound<'_>>()];static_assert_size!(GenericBound<'_>, 64);
5149    const _: [(); 56] = [(); ::std::mem::size_of::<Generics<'_>>()];static_assert_size!(Generics<'_>, 56);
5150    const _: [(); 48] = [(); ::std::mem::size_of::<Impl<'_>>()];static_assert_size!(Impl<'_>, 48);
5151    const _: [(); 88] = [(); ::std::mem::size_of::<ImplItem<'_>>()];static_assert_size!(ImplItem<'_>, 88);
5152    const _: [(); 40] = [(); ::std::mem::size_of::<ImplItemKind<'_>>()];static_assert_size!(ImplItemKind<'_>, 40);
5153    const _: [(); 88] = [(); ::std::mem::size_of::<Item<'_>>()];static_assert_size!(Item<'_>, 88);
5154    const _: [(); 64] = [(); ::std::mem::size_of::<ItemKind<'_>>()];static_assert_size!(ItemKind<'_>, 64);
5155    const _: [(); 64] = [(); ::std::mem::size_of::<LetStmt<'_>>()];static_assert_size!(LetStmt<'_>, 64);
5156    const _: [(); 32] = [(); ::std::mem::size_of::<Param<'_>>()];static_assert_size!(Param<'_>, 32);
5157    const _: [(); 80] = [(); ::std::mem::size_of::<Pat<'_>>()];static_assert_size!(Pat<'_>, 80);
5158    const _: [(); 56] = [(); ::std::mem::size_of::<PatKind<'_>>()];static_assert_size!(PatKind<'_>, 56);
5159    const _: [(); 40] = [(); ::std::mem::size_of::<Path<'_>>()];static_assert_size!(Path<'_>, 40);
5160    const _: [(); 48] = [(); ::std::mem::size_of::<PathSegment<'_>>()];static_assert_size!(PathSegment<'_>, 48);
5161    const _: [(); 24] = [(); ::std::mem::size_of::<QPath<'_>>()];static_assert_size!(QPath<'_>, 24);
5162    const _: [(); 12] = [(); ::std::mem::size_of::<Res>()];static_assert_size!(Res, 12);
5163    const _: [(); 32] = [(); ::std::mem::size_of::<Stmt<'_>>()];static_assert_size!(Stmt<'_>, 32);
5164    const _: [(); 16] = [(); ::std::mem::size_of::<StmtKind<'_>>()];static_assert_size!(StmtKind<'_>, 16);
5165    const _: [(); 48] = [(); ::std::mem::size_of::<TraitImplHeader<'_>>()];static_assert_size!(TraitImplHeader<'_>, 48);
5166    const _: [(); 88] = [(); ::std::mem::size_of::<TraitItem<'_>>()];static_assert_size!(TraitItem<'_>, 88);
5167    const _: [(); 48] = [(); ::std::mem::size_of::<TraitItemKind<'_>>()];static_assert_size!(TraitItemKind<'_>, 48);
5168    const _: [(); 48] = [(); ::std::mem::size_of::<Ty<'_>>()];static_assert_size!(Ty<'_>, 48);
5169    const _: [(); 32] = [(); ::std::mem::size_of::<TyKind<'_>>()];static_assert_size!(TyKind<'_>, 32);
5170    // tidy-alphabetical-end
5171}
5172
5173#[cfg(test)]
5174mod tests;