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::steal::Steal;
22use rustc_data_structures::tagged_ptr::TaggedRef;
23use rustc_error_messages::{DiagArgValue, IntoDiagArg};
24use rustc_index::IndexVec;
25use rustc_macros::{Decodable, Encodable, StableHash};
26use rustc_span::def_id::LocalDefId;
27use rustc_span::{
28    BytePos, DUMMY_SP, DesugaringKind, ErrorGuaranteed, Ident, LocalExpnId, Span, Spanned, Symbol,
29    kw, sym,
30};
31use rustc_target::asm::InlineAsmRegOrRegClass;
32use smallvec::SmallVec;
33use thin_vec::ThinVec;
34use tracing::debug;
35
36use crate::attrs::AttributeKind;
37use crate::def::{CtorKind, DefKind, MacroKinds, PerNS, Res};
38use crate::def_id::{DefId, LocalDefIdMap};
39pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
40use crate::intravisit::{FnKind, VisitorExt};
41use crate::lints::DelayedLints;
42
43#[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 ::rustc_data_structures::stable_hash::StableHash for
            AngleBrackets {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    AngleBrackets::Missing => {}
                    AngleBrackets::Empty => {}
                    AngleBrackets::Full => {}
                }
            }
        }
    };StableHash)]
44pub enum AngleBrackets {
45    /// E.g. `Path`.
46    Missing,
47    /// E.g. `Path<>`.
48    Empty,
49    /// E.g. `Path<T>`.
50    Full,
51}
52
53#[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 ::rustc_data_structures::stable_hash::StableHash for
            LifetimeSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LifetimeSource::Reference => {}
                    LifetimeSource::Path { angle_brackets: ref __binding_0 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LifetimeSource::OutlivesBound => {}
                    LifetimeSource::PreciseCapturing => {}
                    LifetimeSource::Other => {}
                }
            }
        }
    };StableHash)]
54pub enum LifetimeSource {
55    /// E.g. `&Type`, `&'_ Type`, `&'a Type`, `&mut Type`, `&'_ mut Type`, `&'a mut Type`
56    Reference,
57
58    /// E.g. `ContainsLifetime`, `ContainsLifetime<>`, `ContainsLifetime<'_>`,
59    /// `ContainsLifetime<'a>`
60    Path { angle_brackets: AngleBrackets },
61
62    /// E.g. `impl Trait + '_`, `impl Trait + 'a`
63    OutlivesBound,
64
65    /// E.g. `impl Trait + use<'_>`, `impl Trait + use<'a>`
66    PreciseCapturing,
67
68    /// Other usages which have not yet been categorized. Feel free to
69    /// add new sources that you find useful.
70    ///
71    /// Some non-exhaustive examples:
72    /// - `where T: 'a`
73    /// - `fn(_: dyn Trait + 'a)`
74    Other,
75}
76
77#[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 ::rustc_data_structures::stable_hash::StableHash for
            LifetimeSyntax {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LifetimeSyntax::Implicit => {}
                    LifetimeSyntax::ExplicitAnonymous => {}
                    LifetimeSyntax::ExplicitBound => {}
                }
            }
        }
    };StableHash)]
78pub enum LifetimeSyntax {
79    /// E.g. `&Type`, `ContainsLifetime`
80    Implicit,
81
82    /// E.g. `&'_ Type`, `ContainsLifetime<'_>`, `impl Trait + '_`, `impl Trait + use<'_>`
83    ExplicitAnonymous,
84
85    /// E.g. `&'a Type`, `ContainsLifetime<'a>`, `impl Trait + 'a`, `impl Trait + use<'a>`
86    ExplicitBound,
87}
88
89impl From<Ident> for LifetimeSyntax {
90    fn from(ident: Ident) -> Self {
91        let name = ident.name;
92
93        if name == sym::empty {
94            {
    ::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");
95        } else if name == kw::UnderscoreLifetime {
96            LifetimeSyntax::ExplicitAnonymous
97        } else {
98            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('\''));
99            LifetimeSyntax::ExplicitBound
100        }
101    }
102}
103
104/// A lifetime. The valid field combinations are non-obvious and not all
105/// combinations are possible. The following example shows some of
106/// them. See also the comments on `LifetimeKind` and `LifetimeSource`.
107///
108/// ```
109/// #[repr(C)]
110/// struct S<'a>(&'a u32);       // res=Param, name='a, source=Reference, syntax=ExplicitBound
111/// unsafe extern "C" {
112///     fn f1(s: S);             // res=Param, name='_, source=Path, syntax=Implicit
113///     fn f2(s: S<'_>);         // res=Param, name='_, source=Path, syntax=ExplicitAnonymous
114///     fn f3<'a>(s: S<'a>);     // res=Param, name='a, source=Path, syntax=ExplicitBound
115/// }
116///
117/// struct St<'a> { x: &'a u32 } // res=Param, name='a, source=Reference, syntax=ExplicitBound
118/// fn f() {
119///     _ = St { x: &0 };        // res=Infer, name='_, source=Path, syntax=Implicit
120///     _ = St::<'_> { x: &0 };  // res=Infer, name='_, source=Path, syntax=ExplicitAnonymous
121/// }
122///
123/// struct Name<'a>(&'a str);    // res=Param,  name='a, source=Reference, syntax=ExplicitBound
124/// const A: Name = Name("a");   // res=Static, name='_, source=Path, syntax=Implicit
125/// const B: &str = "";          // res=Static, name='_, source=Reference, syntax=Implicit
126/// static C: &'_ str = "";      // res=Static, name='_, source=Reference, syntax=ExplicitAnonymous
127/// static D: &'static str = ""; // res=Static, name='static, source=Reference, syntax=ExplicitBound
128///
129/// trait Tr {}
130/// fn tr(_: Box<dyn Tr>) {}     // res=ImplicitObjectLifetimeDefault, name='_, source=Other, syntax=Implicit
131///
132/// fn capture_outlives<'a>() ->
133///     impl FnOnce() + 'a       // res=Param, ident='a, source=OutlivesBound, syntax=ExplicitBound
134/// {
135///     || {}
136/// }
137///
138/// fn capture_precise<'a>() ->
139///     impl FnOnce() + use<'a>  // res=Param, ident='a, source=PreciseCapturing, syntax=ExplicitBound
140/// {
141///     || {}
142/// }
143///
144/// // (commented out because these cases trigger errors)
145/// // struct S1<'a>(&'a str);   // res=Param, name='a, source=Reference, syntax=ExplicitBound
146/// // struct S2(S1);            // res=Error, name='_, source=Path, syntax=Implicit
147/// // struct S3(S1<'_>);        // res=Error, name='_, source=Path, syntax=ExplicitAnonymous
148/// // struct S4(S1<'a>);        // res=Error, name='a, source=Path, syntax=ExplicitBound
149/// ```
150///
151/// Some combinations that cannot occur are `LifetimeSyntax::Implicit` with
152/// `LifetimeSource::OutlivesBound` or `LifetimeSource::PreciseCapturing`
153/// — there's no way to "elide" these lifetimes.
154#[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 ::rustc_data_structures::stable_hash::StableHash for Lifetime {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
155// Raise the alignment to at least 4 bytes.
156// This is relied on in other parts of the compiler (for pointer tagging):
157// <https://github.com/rust-lang/rust/blob/ce5fdd7d42aba9a2925692e11af2bd39cf37798a/compiler/rustc_data_structures/src/tagged_ptr.rs#L163>
158// Removing this `repr(4)` will cause the compiler to not build on platforms
159// like `m68k` Linux, where the alignment of u32 and usize is only 2.
160// Since `repr(align)` may only raise alignment, this has no effect on
161// platforms where the alignment is already sufficient.
162#[repr(align(4))]
163pub struct Lifetime {
164    #[stable_hash(ignore)]
165    pub hir_id: HirId,
166
167    /// Either a named lifetime definition (e.g. `'a`, `'static`) or an
168    /// anonymous lifetime (`'_`, either explicitly written, or inserted for
169    /// things like `&type`).
170    pub ident: Ident,
171
172    /// Semantics of this lifetime.
173    pub kind: LifetimeKind,
174
175    /// The context in which the lifetime occurred. See `Lifetime::suggestion`
176    /// for example use.
177    pub source: LifetimeSource,
178
179    /// The syntax that the user used to declare this lifetime. See
180    /// `Lifetime::suggestion` for example use.
181    pub syntax: LifetimeSyntax,
182}
183
184#[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 ::rustc_data_structures::stable_hash::StableHash for ParamName {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ParamName::Plain(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ParamName::Error(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ParamName::Fresh => {}
                }
            }
        }
    };StableHash)]
185pub enum ParamName {
186    /// Some user-given name like `T` or `'x`.
187    Plain(Ident),
188
189    /// Indicates an illegal name was given and an error has been
190    /// reported (so we should squelch other derived errors).
191    ///
192    /// Occurs when, e.g., `'_` is used in the wrong place, or a
193    /// lifetime name is duplicated.
194    Error(Ident),
195
196    /// Synthetic name generated when user elided a lifetime in an impl header.
197    ///
198    /// E.g., the lifetimes in cases like these:
199    /// ```ignore (fragment)
200    /// impl Foo for &u32
201    /// impl Foo<'_> for u32
202    /// ```
203    /// in that case, we rewrite to
204    /// ```ignore (fragment)
205    /// impl<'f> Foo for &'f u32
206    /// impl<'f> Foo<'f> for u32
207    /// ```
208    /// where `'f` is something like `Fresh(0)`. The indices are
209    /// unique per impl, but not necessarily continuous.
210    Fresh,
211}
212
213impl ParamName {
214    pub fn ident(&self) -> Ident {
215        match *self {
216            ParamName::Plain(ident) | ParamName::Error(ident) => ident,
217            ParamName::Fresh => Ident::with_dummy_span(kw::UnderscoreLifetime),
218        }
219    }
220}
221
222#[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 ::rustc_data_structures::stable_hash::StableHash for LifetimeKind
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LifetimeKind::Param(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LifetimeKind::ImplicitObjectLifetimeDefault => {}
                    LifetimeKind::Error(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LifetimeKind::Infer => {}
                    LifetimeKind::Static => {}
                }
            }
        }
    };StableHash)]
223pub enum LifetimeKind {
224    /// User-given names or fresh (synthetic) names.
225    Param(LocalDefId),
226
227    /// Implicit lifetime in a context like `dyn Foo`. This is
228    /// distinguished from implicit lifetimes elsewhere because the
229    /// lifetime that they default to must appear elsewhere within the
230    /// enclosing type. This means that, in an `impl Trait` context, we
231    /// don't have to create a parameter for them. That is, `impl
232    /// Trait<Item = &u32>` expands to an opaque type like `type
233    /// Foo<'a> = impl Trait<Item = &'a u32>`, but `impl Trait<item =
234    /// dyn Bar>` expands to `type Foo = impl Trait<Item = dyn Bar +
235    /// 'static>`. The latter uses `ImplicitObjectLifetimeDefault` so
236    /// that surrounding code knows not to create a lifetime
237    /// parameter.
238    ImplicitObjectLifetimeDefault,
239
240    /// Indicates an error during lowering (usually `'_` in wrong place)
241    /// that was already reported.
242    Error(ErrorGuaranteed),
243
244    /// User wrote an anonymous lifetime, either `'_` or nothing (which gets
245    /// converted to `'_`). The semantics of this lifetime should be inferred
246    /// by typechecking code.
247    Infer,
248
249    /// User wrote `'static` or nothing (which gets converted to `'_`).
250    Static,
251}
252
253impl LifetimeKind {
254    fn is_elided(&self) -> bool {
255        match self {
256            LifetimeKind::ImplicitObjectLifetimeDefault | LifetimeKind::Infer => true,
257
258            // It might seem surprising that `Fresh` counts as not *elided*
259            // -- but this is because, as far as the code in the compiler is
260            // concerned -- `Fresh` variants act equivalently to "some fresh name".
261            // They correspond to early-bound regions on an impl, in other words.
262            LifetimeKind::Error(..) | LifetimeKind::Param(..) | LifetimeKind::Static => false,
263        }
264    }
265}
266
267impl fmt::Display for Lifetime {
268    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
269        self.ident.name.fmt(f)
270    }
271}
272
273impl Lifetime {
274    pub fn new(
275        hir_id: HirId,
276        ident: Ident,
277        kind: LifetimeKind,
278        source: LifetimeSource,
279        syntax: LifetimeSyntax,
280    ) -> Lifetime {
281        let lifetime = Lifetime { hir_id, ident, kind, source, syntax };
282
283        // Sanity check: elided lifetimes form a strict subset of anonymous lifetimes.
284        #[cfg(debug_assertions)]
285        match (lifetime.is_elided(), lifetime.is_anonymous()) {
286            (false, false) => {} // e.g. `'a`
287            (false, true) => {}  // e.g. explicit `'_`
288            (true, true) => {}   // e.g. `&x`
289            (true, false) => { ::core::panicking::panic_fmt(format_args!("bad Lifetime")); }panic!("bad Lifetime"),
290        }
291
292        lifetime
293    }
294
295    pub fn is_elided(&self) -> bool {
296        self.kind.is_elided()
297    }
298
299    pub fn is_anonymous(&self) -> bool {
300        self.ident.name == kw::UnderscoreLifetime
301    }
302
303    pub fn is_implicit(&self) -> bool {
304        #[allow(non_exhaustive_omitted_patterns)] match self.syntax {
    LifetimeSyntax::Implicit => true,
    _ => false,
}matches!(self.syntax, LifetimeSyntax::Implicit)
305    }
306
307    pub fn is_static(&self) -> bool {
308        self.kind == LifetimeKind::Static
309    }
310
311    pub fn suggestion(&self, new_lifetime: &str) -> (Span, String) {
312        use LifetimeSource::*;
313        use LifetimeSyntax::*;
314
315        if true {
    if !new_lifetime.starts_with('\'') {
        ::core::panicking::panic("assertion failed: new_lifetime.starts_with(\'\\\'\')")
    };
};debug_assert!(new_lifetime.starts_with('\''));
316
317        match (self.syntax, self.source) {
318            // The user wrote `'a` or `'_`.
319            (ExplicitBound | ExplicitAnonymous, _) => (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", new_lifetime))
    })format!("{new_lifetime}")),
320
321            // The user wrote `Path<T>`, and omitted the `'_,`.
322            (Implicit, Path { angle_brackets: AngleBrackets::Full }) => {
323                (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}, ", new_lifetime))
    })format!("{new_lifetime}, "))
324            }
325
326            // The user wrote `Path<>`, and omitted the `'_`..
327            (Implicit, Path { angle_brackets: AngleBrackets::Empty }) => {
328                (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0}", new_lifetime))
    })format!("{new_lifetime}"))
329            }
330
331            // The user wrote `Path` and omitted the `<'_>`.
332            (Implicit, Path { angle_brackets: AngleBrackets::Missing }) => {
333                (self.ident.span.shrink_to_hi(), ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("<{0}>", new_lifetime))
    })format!("<{new_lifetime}>"))
334            }
335
336            // The user wrote `&type` or `&mut type`.
337            (Implicit, Reference) => (self.ident.span, ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0} ", new_lifetime))
    })format!("{new_lifetime} ")),
338
339            (Implicit, source) => {
340                {
    ::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:?}")
341            }
342        }
343    }
344}
345
346/// A `Path` is essentially Rust's notion of a name; for instance,
347/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
348/// along with a bunch of supporting information.
349#[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> ::rustc_data_structures::stable_hash::StableHash for
            Path<'hir, R> where
            R: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Path {
                        span: ref __binding_0,
                        res: ref __binding_1,
                        segments: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
350pub struct Path<'hir, R = Res> {
351    pub span: Span,
352    /// The resolution for the path.
353    pub res: R,
354    /// The segments in the path: the things separated by `::`.
355    pub segments: &'hir [PathSegment<'hir>],
356}
357
358/// Up to three resolutions for type, value and macro namespaces.
359pub type UsePath<'hir> = Path<'hir, PerNS<Option<Res>>>;
360
361impl Path<'_> {
362    pub fn is_global(&self) -> bool {
363        self.segments.first().is_some_and(|segment| segment.ident.name == kw::PathRoot)
364    }
365}
366
367/// A segment of a path: an identifier, an optional lifetime, and a set of
368/// types.
369#[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> ::rustc_data_structures::stable_hash::StableHash for
            PathSegment<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
370pub struct PathSegment<'hir> {
371    /// The identifier portion of this path segment.
372    pub ident: Ident,
373    #[stable_hash(ignore)]
374    pub hir_id: HirId,
375    pub res: Res,
376
377    /// Type/lifetime parameters attached to this path. They come in
378    /// two flavors: `Path<A,B,C>` and `Path(A,B) -> C`. Note that
379    /// this is more than just simple syntactic sugar; the use of
380    /// parens affects the region binding rules, so we preserve the
381    /// distinction.
382    pub args: Option<&'hir GenericArgs<'hir>>,
383
384    /// Whether to infer remaining type parameters, if any.
385    /// This only applies to expression and pattern paths, and
386    /// out of those only the segments with no type parameters
387    /// to begin with, e.g., `Vec::new` is `<Vec<..>>::new::<..>`.
388    pub infer_args: bool,
389}
390
391impl<'hir> PathSegment<'hir> {
392    /// Converts an identifier to the corresponding segment.
393    pub fn new(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> {
394        PathSegment { ident, hir_id, res, infer_args: true, args: None }
395    }
396
397    pub fn invalid() -> Self {
398        Self::new(Ident::dummy(), HirId::INVALID, Res::Err)
399    }
400
401    pub fn args(&self) -> &GenericArgs<'hir> {
402        if let Some(ref args) = self.args { args } else { GenericArgs::NONE }
403    }
404}
405
406#[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> ::rustc_data_structures::stable_hash::StableHash for
            ConstItemRhs<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ConstItemRhs::Body(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstItemRhs::TypeConst(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
407pub enum ConstItemRhs<'hir> {
408    Body(BodyId),
409    TypeConst(&'hir ConstArg<'hir>),
410}
411
412impl<'hir> ConstItemRhs<'hir> {
413    pub fn hir_id(&self) -> HirId {
414        match self {
415            ConstItemRhs::Body(body_id) => body_id.hir_id,
416            ConstItemRhs::TypeConst(ct_arg) => ct_arg.hir_id,
417        }
418    }
419
420    pub fn span<'tcx>(&self, tcx: impl crate::intravisit::HirTyCtxt<'tcx>) -> Span {
421        match self {
422            ConstItemRhs::Body(body_id) => tcx.hir_body(*body_id).value.span,
423            ConstItemRhs::TypeConst(ct_arg) => ct_arg.span,
424        }
425    }
426}
427
428/// A constant that enters the type system, used for arguments to const generics (e.g. array lengths).
429///
430/// These are distinct from [`AnonConst`] as anon consts in the type system are not allowed
431/// to use any generic parameters, therefore we must represent `N` differently. Additionally
432/// future designs for supporting generic parameters in const arguments will likely not use
433/// an anon const based design.
434///
435/// So, `ConstArg` (specifically, [`ConstArgKind`]) distinguishes between const args
436/// that are [just paths](ConstArgKind::Path) (currently just bare const params)
437/// versus const args that are literals or have arbitrary computations (e.g., `{ 1 + 3 }`).
438///
439/// For an explanation of the `Unambig` generic parameter see the dev-guide:
440/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
441#[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> ::rustc_data_structures::stable_hash::StableHash
            for ConstArg<'hir, Unambig> where
            Unambig: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ConstArg {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
442#[repr(C)]
443pub struct ConstArg<'hir, Unambig = ()> {
444    #[stable_hash(ignore)]
445    pub hir_id: HirId,
446    pub kind: ConstArgKind<'hir, Unambig>,
447    pub span: Span,
448}
449
450impl<'hir> ConstArg<'hir, AmbigArg> {
451    /// Converts a `ConstArg` in an ambiguous position to one in an unambiguous position.
452    ///
453    /// Functions accepting unambiguous consts may expect the [`ConstArgKind::Infer`] variant
454    /// to be used. Care should be taken to separately handle infer consts when calling this
455    /// function as it cannot be handled by downstream code making use of the returned const.
456    ///
457    /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or
458    /// specifically matching on [`GenericArg::Infer`] when handling generic arguments.
459    ///
460    /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer]
461    pub fn as_unambig_ct(&self) -> &ConstArg<'hir> {
462        // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the
463        // layout is the same across different ZST type arguments.
464        let ptr = self as *const ConstArg<'hir, AmbigArg> as *const ConstArg<'hir, ()>;
465        unsafe { &*ptr }
466    }
467}
468
469impl<'hir> ConstArg<'hir> {
470    /// Converts a `ConstArg` in an unambiguous position to one in an ambiguous position. This is
471    /// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions.
472    ///
473    /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if
474    /// infer consts are relevant to you then care should be taken to handle them separately.
475    pub fn try_as_ambig_ct(&self) -> Option<&ConstArg<'hir, AmbigArg>> {
476        if let ConstArgKind::Infer(()) = self.kind {
477            return None;
478        }
479
480        // SAFETY: `ConstArg` is `repr(C)` and `ConstArgKind` is marked `repr(u8)` so that the layout is
481        // the same across different ZST type arguments. We also asserted that the `self` is
482        // not a `ConstArgKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`.
483        let ptr = self as *const ConstArg<'hir> as *const ConstArg<'hir, AmbigArg>;
484        Some(unsafe { &*ptr })
485    }
486}
487
488impl<'hir, Unambig> ConstArg<'hir, Unambig> {
489    pub fn anon_const_hir_id(&self) -> Option<HirId> {
490        match self.kind {
491            ConstArgKind::Anon(ac) => Some(ac.hir_id),
492            _ => None,
493        }
494    }
495}
496
497/// See [`ConstArg`].
498#[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> ::rustc_data_structures::stable_hash::StableHash
            for ConstArgKind<'hir, Unambig> where
            Unambig: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ConstArgKind::Tup(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Path(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Anon(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Struct(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::TupleCall(ref __binding_0, ref __binding_1) =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Array(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Error(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Infer(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ConstArgKind::Literal {
                        lit: ref __binding_0, negated: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
499#[repr(u8, C)]
500pub enum ConstArgKind<'hir, Unambig = ()> {
501    Tup(&'hir [&'hir ConstArg<'hir, Unambig>]),
502    /// **Note:** Currently this is only used for bare const params
503    /// (`N` where `fn foo<const N: usize>(...)`),
504    /// not paths to any const (`N` where `const N: usize = ...`).
505    ///
506    /// However, in the future, we'll be using it for all of those.
507    Path(QPath<'hir>),
508    Anon(&'hir AnonConst),
509    /// Represents construction of struct/struct variants
510    Struct(QPath<'hir>, &'hir [&'hir ConstArgExprField<'hir>]),
511    /// Tuple constructor variant
512    TupleCall(QPath<'hir>, &'hir [&'hir ConstArg<'hir>]),
513    /// Array literal argument
514    Array(&'hir ConstArgArrayExpr<'hir>),
515    /// Error const
516    Error(ErrorGuaranteed),
517    /// This variant is not always used to represent inference consts, sometimes
518    /// [`GenericArg::Infer`] is used instead.
519    Infer(Unambig),
520    Literal {
521        lit: LitKind,
522        negated: bool,
523    },
524}
525
526#[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> ::rustc_data_structures::stable_hash::StableHash for
            ConstArgExprField<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ConstArgExprField {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        field: ref __binding_2,
                        expr: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
527pub struct ConstArgExprField<'hir> {
528    pub hir_id: HirId,
529    pub span: Span,
530    pub field: Ident,
531    pub expr: &'hir ConstArg<'hir>,
532}
533
534#[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> ::rustc_data_structures::stable_hash::StableHash for
            ConstArgArrayExpr<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ConstArgArrayExpr {
                        span: ref __binding_0, elems: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
535pub struct ConstArgArrayExpr<'hir> {
536    pub span: Span,
537    pub elems: &'hir [&'hir ConstArg<'hir>],
538}
539
540#[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 ::rustc_data_structures::stable_hash::StableHash for InferArg {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    InferArg { hir_id: ref __binding_0, span: ref __binding_1 }
                        => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
541pub struct InferArg {
542    #[stable_hash(ignore)]
543    pub hir_id: HirId,
544    pub span: Span,
545}
546
547impl InferArg {
548    pub fn to_ty(&self) -> Ty<'static> {
549        Ty { kind: TyKind::Infer(()), span: self.span, hir_id: self.hir_id }
550    }
551}
552
553#[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> ::rustc_data_structures::stable_hash::StableHash for
            GenericArg<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GenericArg::Lifetime(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericArg::Type(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericArg::Const(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericArg::Infer(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
554pub enum GenericArg<'hir> {
555    Lifetime(&'hir Lifetime),
556    Type(&'hir Ty<'hir, AmbigArg>),
557    Const(&'hir ConstArg<'hir, AmbigArg>),
558    /// Inference variables in [`GenericArg`] are always represented by
559    /// `GenericArg::Infer` instead of the `Infer` variants on [`TyKind`] and
560    /// [`ConstArgKind`] as it is not clear until hir ty lowering whether a
561    /// `_` argument is a type or const argument.
562    ///
563    /// However, some builtin types' generic arguments are represented by [`TyKind`]
564    /// without a [`GenericArg`], instead directly storing a [`Ty`] or [`ConstArg`]. In
565    /// such cases they *are* represented by the `Infer` variants on [`TyKind`] and
566    /// [`ConstArgKind`] as it is not ambiguous whether the argument is a type or const.
567    Infer(InferArg),
568}
569
570impl GenericArg<'_> {
571    pub fn span(&self) -> Span {
572        match self {
573            GenericArg::Lifetime(l) => l.ident.span,
574            GenericArg::Type(t) => t.span,
575            GenericArg::Const(c) => c.span,
576            GenericArg::Infer(i) => i.span,
577        }
578    }
579
580    pub fn hir_id(&self) -> HirId {
581        match self {
582            GenericArg::Lifetime(l) => l.hir_id,
583            GenericArg::Type(t) => t.hir_id,
584            GenericArg::Const(c) => c.hir_id,
585            GenericArg::Infer(i) => i.hir_id,
586        }
587    }
588
589    pub fn descr(&self) -> &'static str {
590        match self {
591            GenericArg::Lifetime(_) => "lifetime",
592            GenericArg::Type(_) => "type",
593            GenericArg::Const(_) => "constant",
594            GenericArg::Infer(_) => "placeholder",
595        }
596    }
597
598    pub fn to_ord(&self) -> ast::ParamKindOrd {
599        match self {
600            GenericArg::Lifetime(_) => ast::ParamKindOrd::Lifetime,
601            GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => {
602                ast::ParamKindOrd::TypeOrConst
603            }
604        }
605    }
606
607    pub fn is_ty_or_const(&self) -> bool {
608        match self {
609            GenericArg::Lifetime(_) => false,
610            GenericArg::Type(_) | GenericArg::Const(_) | GenericArg::Infer(_) => true,
611        }
612    }
613}
614
615/// The generic arguments and associated item constraints of a path segment.
616#[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> ::rustc_data_structures::stable_hash::StableHash for
            GenericArgs<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    GenericArgs {
                        args: ref __binding_0,
                        constraints: ref __binding_1,
                        parenthesized: ref __binding_2,
                        span_ext: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
617pub struct GenericArgs<'hir> {
618    /// The generic arguments for this path segment.
619    pub args: &'hir [GenericArg<'hir>],
620    /// The associated item constraints for this path segment.
621    pub constraints: &'hir [AssocItemConstraint<'hir>],
622    /// Whether the arguments were written in parenthesized form (e.g., `Fn(T) -> U`).
623    ///
624    /// This is required mostly for pretty-printing and diagnostics,
625    /// but also for changing lifetime elision rules to be "function-like".
626    pub parenthesized: GenericArgsParentheses,
627    /// The span encompassing the arguments, constraints and the surrounding brackets (`<>` or `()`).
628    ///
629    /// For example:
630    ///
631    /// ```ignore (illustrative)
632    ///       Foo<A, B, AssocTy = D>           Fn(T, U, V) -> W
633    ///          ^^^^^^^^^^^^^^^^^^^             ^^^^^^^^^
634    /// ```
635    ///
636    /// Note that this may be:
637    /// - empty, if there are no generic brackets (but there may be hidden lifetimes)
638    /// - dummy, if this was generated during desugaring
639    pub span_ext: Span,
640}
641
642impl<'hir> GenericArgs<'hir> {
643    pub const NONE: &'hir GenericArgs<'hir> = &GenericArgs {
644        args: &[],
645        constraints: &[],
646        parenthesized: GenericArgsParentheses::No,
647        span_ext: DUMMY_SP,
648    };
649
650    /// Obtain the list of input types and the output type if the generic arguments are parenthesized.
651    ///
652    /// Returns the `Ty0, Ty1, ...` and the `RetTy` in `Trait(Ty0, Ty1, ...) -> RetTy`.
653    /// Panics if the parenthesized arguments have an incorrect form (this shouldn't happen).
654    pub fn paren_sugar_inputs_output(&self) -> Option<(&[Ty<'hir>], &Ty<'hir>)> {
655        if self.parenthesized != GenericArgsParentheses::ParenSugar {
656            return None;
657        }
658
659        let inputs = self
660            .args
661            .iter()
662            .find_map(|arg| {
663                let GenericArg::Type(ty) = arg else { return None };
664                let TyKind::Tup(tys) = &ty.kind else { return None };
665                Some(tys)
666            })
667            .unwrap();
668
669        Some((inputs, self.paren_sugar_output_inner()))
670    }
671
672    /// Obtain the output type if the generic arguments are parenthesized.
673    ///
674    /// Returns the `RetTy` in `Trait(Ty0, Ty1, ...) -> RetTy`.
675    /// Panics if the parenthesized arguments have an incorrect form (this shouldn't happen).
676    pub fn paren_sugar_output(&self) -> Option<&Ty<'hir>> {
677        (self.parenthesized == GenericArgsParentheses::ParenSugar)
678            .then(|| self.paren_sugar_output_inner())
679    }
680
681    fn paren_sugar_output_inner(&self) -> &Ty<'hir> {
682        let [constraint] = self.constraints.try_into().unwrap();
683        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);
684        constraint.ty().unwrap()
685    }
686
687    pub fn has_err(&self) -> Option<ErrorGuaranteed> {
688        self.args
689            .iter()
690            .find_map(|arg| {
691                let GenericArg::Type(ty) = arg else { return None };
692                let TyKind::Err(guar) = ty.kind else { return None };
693                Some(guar)
694            })
695            .or_else(|| {
696                self.constraints.iter().find_map(|constraint| {
697                    let TyKind::Err(guar) = constraint.ty()?.kind else { return None };
698                    Some(guar)
699                })
700            })
701    }
702
703    #[inline]
704    pub fn num_lifetime_args(&self) -> usize {
705        self.args.iter().filter(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
706    }
707
708    #[inline]
709    pub fn has_lifetime_args(&self) -> bool {
710        self.args.iter().any(|arg| #[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_)))
711    }
712
713    #[inline]
714    /// This function returns the number of type and const generic params.
715    /// It should only be used for diagnostics.
716    pub fn num_generic_params(&self) -> usize {
717        self.args.iter().filter(|arg| !#[allow(non_exhaustive_omitted_patterns)] match arg {
    GenericArg::Lifetime(_) => true,
    _ => false,
}matches!(arg, GenericArg::Lifetime(_))).count()
718    }
719
720    /// The span encompassing the arguments and constraints[^1] inside the surrounding brackets.
721    ///
722    /// Returns `None` if the span is empty (i.e., no brackets) or dummy.
723    ///
724    /// [^1]: Unless of the form `-> Ty` (see [`GenericArgsParentheses`]).
725    pub fn span(&self) -> Option<Span> {
726        let span_ext = self.span_ext()?;
727        Some(span_ext.with_lo(span_ext.lo() + BytePos(1)).with_hi(span_ext.hi() - BytePos(1)))
728    }
729
730    /// Returns span encompassing arguments and their surrounding `<>` or `()`
731    pub fn span_ext(&self) -> Option<Span> {
732        Some(self.span_ext).filter(|span| !span.is_empty())
733    }
734
735    pub fn is_empty(&self) -> bool {
736        self.args.is_empty()
737    }
738}
739
740#[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 ::rustc_data_structures::stable_hash::StableHash for
            GenericArgsParentheses {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GenericArgsParentheses::No => {}
                    GenericArgsParentheses::ReturnTypeNotation => {}
                    GenericArgsParentheses::ParenSugar => {}
                }
            }
        }
    };StableHash)]
741pub enum GenericArgsParentheses {
742    No,
743    /// Bounds for `feature(return_type_notation)`, like `T: Trait<method(..): Send>`,
744    /// where the args are explicitly elided with `..`
745    ReturnTypeNotation,
746    /// parenthesized function-family traits, like `T: Fn(u32) -> i32`
747    ParenSugar,
748}
749
750/// The modifiers on a trait bound.
751#[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 ::rustc_data_structures::stable_hash::StableHash for
            TraitBoundModifiers {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TraitBoundModifiers {
                        constness: ref __binding_0, polarity: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
752pub struct TraitBoundModifiers {
753    pub constness: BoundConstness,
754    pub polarity: BoundPolarity,
755}
756
757impl TraitBoundModifiers {
758    pub const NONE: Self =
759        TraitBoundModifiers { constness: BoundConstness::Never, polarity: BoundPolarity::Positive };
760}
761
762#[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> ::rustc_data_structures::stable_hash::StableHash for
            GenericBound<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GenericBound::Trait(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericBound::Outlives(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericBound::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
763pub enum GenericBound<'hir> {
764    Trait(PolyTraitRef<'hir>),
765    Outlives(&'hir Lifetime),
766    Use(&'hir [PreciseCapturingArg<'hir>], Span),
767}
768
769impl GenericBound<'_> {
770    pub fn trait_ref(&self) -> Option<&TraitRef<'_>> {
771        match self {
772            GenericBound::Trait(data) => Some(&data.trait_ref),
773            _ => None,
774        }
775    }
776
777    pub fn span(&self) -> Span {
778        match self {
779            GenericBound::Trait(t, ..) => t.span,
780            GenericBound::Outlives(l) => l.ident.span,
781            GenericBound::Use(_, span) => *span,
782        }
783    }
784}
785
786pub type GenericBounds<'hir> = &'hir [GenericBound<'hir>];
787
788#[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> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}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 ::rustc_data_structures::stable_hash::StableHash for
            MissingLifetimeKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MissingLifetimeKind::Underscore => {}
                    MissingLifetimeKind::Ampersand => {}
                    MissingLifetimeKind::Comma => {}
                    MissingLifetimeKind::Brackets => {}
                }
            }
        }
    };StableHash, #[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)]
789pub enum MissingLifetimeKind {
790    /// An explicit `'_`.
791    Underscore,
792    /// An elided lifetime `&' ty`.
793    Ampersand,
794    /// An elided lifetime in brackets with written brackets.
795    Comma,
796    /// An elided lifetime with elided brackets.
797    Brackets,
798}
799
800#[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 ::rustc_data_structures::stable_hash::StableHash for
            LifetimeParamKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LifetimeParamKind::Explicit => {}
                    LifetimeParamKind::Elided(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    LifetimeParamKind::Error => {}
                }
            }
        }
    };StableHash)]
801pub enum LifetimeParamKind {
802    // Indicates that the lifetime definition was explicitly declared (e.g., in
803    // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`).
804    Explicit,
805
806    // Indication that the lifetime was elided (e.g., in both cases in
807    // `fn foo(x: &u8) -> &'_ u8 { x }`).
808    Elided(MissingLifetimeKind),
809
810    // Indication that the lifetime name was somehow in error.
811    Error,
812}
813
814#[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> ::rustc_data_structures::stable_hash::StableHash for
            GenericParamKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GenericParamKind::Lifetime { kind: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    GenericParamKind::Type {
                        default: ref __binding_0, synthetic: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    GenericParamKind::Const {
                        ty: ref __binding_0, default: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
815pub enum GenericParamKind<'hir> {
816    /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
817    Lifetime {
818        kind: LifetimeParamKind,
819    },
820    Type {
821        default: Option<&'hir Ty<'hir>>,
822        synthetic: bool,
823    },
824    Const {
825        ty: &'hir Ty<'hir>,
826        /// Optional default value for the const generic param
827        default: Option<&'hir ConstArg<'hir>>,
828    },
829}
830
831#[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> ::rustc_data_structures::stable_hash::StableHash for
            GenericParam<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
832pub struct GenericParam<'hir> {
833    #[stable_hash(ignore)]
834    pub hir_id: HirId,
835    pub def_id: LocalDefId,
836    pub name: ParamName,
837    pub span: Span,
838    pub pure_wrt_drop: bool,
839    pub kind: GenericParamKind<'hir>,
840    pub colon_span: Option<Span>,
841    pub source: GenericParamSource,
842}
843
844impl<'hir> GenericParam<'hir> {
845    /// Synthetic type-parameters are inserted after normal ones.
846    /// In order for normal parameters to be able to refer to synthetic ones,
847    /// scans them first.
848    pub fn is_impl_trait(&self) -> bool {
849        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Type { synthetic: true, .. } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Type { synthetic: true, .. })
850    }
851
852    /// This can happen for `async fn`, e.g. `async fn f<'_>(&'_ self)`.
853    ///
854    /// See `lifetime_to_generic_param` in `rustc_ast_lowering` for more information.
855    pub fn is_elided_lifetime(&self) -> bool {
856        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Lifetime { kind: LifetimeParamKind::Elided(_) })
857    }
858
859    pub fn is_lifetime(&self) -> bool {
860        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    GenericParamKind::Lifetime { .. } => true,
    _ => false,
}matches!(self.kind, GenericParamKind::Lifetime { .. })
861    }
862}
863
864/// Records where the generic parameter originated from.
865///
866/// This can either be from an item's generics, in which case it's typically
867/// early-bound (but can be a late-bound lifetime in functions, for example),
868/// or from a `for<...>` binder, in which case it's late-bound (and notably,
869/// does not show up in the parent item's generics).
870#[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 ::rustc_data_structures::stable_hash::StableHash for
            GenericParamSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GenericParamSource::Generics => {}
                    GenericParamSource::Binder => {}
                }
            }
        }
    };StableHash)]
871pub enum GenericParamSource {
872    // Early or late-bound parameters defined on an item
873    Generics,
874    // Late-bound parameters defined via a `for<...>`
875    Binder,
876}
877
878#[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)]
879pub struct GenericParamCount {
880    pub lifetimes: usize,
881    pub types: usize,
882    pub consts: usize,
883    pub infer: usize,
884}
885
886/// Represents lifetimes and type parameters attached to a declaration
887/// of a function, enum, trait, etc.
888#[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> ::rustc_data_structures::stable_hash::StableHash for
            Generics<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
889pub struct Generics<'hir> {
890    pub params: &'hir [GenericParam<'hir>],
891    pub predicates: &'hir [WherePredicate<'hir>],
892    pub has_where_clause_predicates: bool,
893    pub where_clause_span: Span,
894    pub span: Span,
895}
896
897impl<'hir> Generics<'hir> {
898    pub const fn empty() -> &'hir Generics<'hir> {
899        const NOPE: Generics<'_> = Generics {
900            params: &[],
901            predicates: &[],
902            has_where_clause_predicates: false,
903            where_clause_span: DUMMY_SP,
904            span: DUMMY_SP,
905        };
906        &NOPE
907    }
908
909    pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'hir>> {
910        self.params.iter().find(|&param| name == param.name.ident().name)
911    }
912
913    /// If there are generic parameters, return where to introduce a new one.
914    pub fn span_for_lifetime_suggestion(&self) -> Option<Span> {
915        if let Some(first) = self.params.first()
916            && self.span.contains(first.span)
917        {
918            // `fn foo<A>(t: impl Trait)`
919            //         ^ suggest `'a, ` here
920            Some(first.span.shrink_to_lo())
921        } else {
922            None
923        }
924    }
925
926    /// If there are generic parameters, return where to introduce a new one.
927    pub fn span_for_param_suggestion(&self) -> Option<Span> {
928        self.params.iter().any(|p| self.span.contains(p.span)).then(|| {
929            // `fn foo<A>(t: impl Trait)`
930            //          ^ suggest `, T: Trait` here
931            self.span.with_lo(self.span.hi() - BytePos(1)).shrink_to_lo()
932        })
933    }
934
935    /// `Span` where further predicates would be suggested, accounting for trailing commas, like
936    ///  in `fn foo<T>(t: T) where T: Foo,` so we don't suggest two trailing commas.
937    pub fn tail_span_for_predicate_suggestion(&self) -> Span {
938        let end = self.where_clause_span.shrink_to_hi();
939        if self.has_where_clause_predicates {
940            self.predicates
941                .iter()
942                .rfind(|&p| p.kind.in_where_clause())
943                .map_or(end, |p| p.span)
944                .shrink_to_hi()
945                .to(end)
946        } else {
947            end
948        }
949    }
950
951    pub fn add_where_or_trailing_comma(&self) -> &'static str {
952        if self.has_where_clause_predicates {
953            ","
954        } else if self.where_clause_span.is_empty() {
955            " where"
956        } else {
957            // No where clause predicates, but we have `where` token
958            ""
959        }
960    }
961
962    pub fn bounds_for_param(
963        &self,
964        param_def_id: LocalDefId,
965    ) -> impl Iterator<Item = &WhereBoundPredicate<'hir>> {
966        self.predicates.iter().filter_map(move |pred| match pred.kind {
967            WherePredicateKind::BoundPredicate(bp)
968                if bp.is_param_bound(param_def_id.to_def_id()) =>
969            {
970                Some(bp)
971            }
972            _ => None,
973        })
974    }
975
976    pub fn outlives_for_param(
977        &self,
978        param_def_id: LocalDefId,
979    ) -> impl Iterator<Item = &WhereRegionPredicate<'_>> {
980        self.predicates.iter().filter_map(move |pred| match pred.kind {
981            WherePredicateKind::RegionPredicate(rp) if rp.is_param_bound(param_def_id) => Some(rp),
982            _ => None,
983        })
984    }
985
986    /// Returns a suggestable empty span right after the "final" bound of the generic parameter.
987    ///
988    /// If that bound needs to be wrapped in parentheses to avoid ambiguity with
989    /// subsequent bounds, it also returns an empty span for an open parenthesis
990    /// as the second component.
991    ///
992    /// E.g., adding `+ 'static` after `Fn() -> dyn Future<Output = ()>` or
993    /// `Fn() -> &'static dyn Debug` requires parentheses:
994    /// `Fn() -> (dyn Future<Output = ()>) + 'static` and
995    /// `Fn() -> &'static (dyn Debug) + 'static`, respectively.
996    pub fn bounds_span_for_suggestions(
997        &self,
998        param_def_id: LocalDefId,
999    ) -> Option<(Span, Option<Span>)> {
1000        self.bounds_for_param(param_def_id).flat_map(|bp| bp.bounds.iter().rev()).find_map(
1001            |bound| {
1002                let span_for_parentheses = if let Some(trait_ref) = bound.trait_ref()
1003                    && let [.., segment] = trait_ref.path.segments
1004                    && let Some(ret_ty) = segment.args().paren_sugar_output()
1005                    && let ret_ty = ret_ty.peel_refs()
1006                    && let TyKind::TraitObject(_, tagged_ptr) = ret_ty.kind
1007                    && let TraitObjectSyntax::Dyn = tagged_ptr.tag()
1008                    && ret_ty.span.can_be_used_for_suggestions()
1009                {
1010                    Some(ret_ty.span)
1011                } else {
1012                    None
1013                };
1014
1015                span_for_parentheses.map_or_else(
1016                    || {
1017                        // We include bounds that come from a `#[derive(_)]` but point at the user's
1018                        // code, as we use this method to get a span appropriate for suggestions.
1019                        let bs = bound.span();
1020                        // We use `from_expansion` instead of `can_be_used_for_suggestions` because
1021                        // the trait bound from imperfect derives do point at the type parameter,
1022                        // but expanded to a where clause, so we want to ignore those. This is only
1023                        // true for derive intrinsics.
1024                        bs.from_expansion().not().then(|| (bs.shrink_to_hi(), None))
1025                    },
1026                    |span| Some((span.shrink_to_hi(), Some(span.shrink_to_lo()))),
1027                )
1028            },
1029        )
1030    }
1031
1032    pub fn span_for_predicate_removal(&self, pos: usize) -> Span {
1033        let predicate = &self.predicates[pos];
1034        let span = predicate.span;
1035
1036        if !predicate.kind.in_where_clause() {
1037            // <T: ?Sized, U>
1038            //   ^^^^^^^^
1039            return span;
1040        }
1041
1042        // We need to find out which comma to remove.
1043        if pos < self.predicates.len() - 1 {
1044            let next_pred = &self.predicates[pos + 1];
1045            if next_pred.kind.in_where_clause() {
1046                // where T: ?Sized, Foo: Bar,
1047                //       ^^^^^^^^^^^
1048                return span.until(next_pred.span);
1049            }
1050        }
1051
1052        if pos > 0 {
1053            let prev_pred = &self.predicates[pos - 1];
1054            if prev_pred.kind.in_where_clause() {
1055                // where Foo: Bar, T: ?Sized,
1056                //               ^^^^^^^^^^^
1057                return prev_pred.span.shrink_to_hi().to(span);
1058            }
1059        }
1060
1061        // This is the only predicate in the where clause.
1062        // where T: ?Sized
1063        // ^^^^^^^^^^^^^^^
1064        self.where_clause_span
1065    }
1066
1067    pub fn span_for_bound_removal(&self, predicate_pos: usize, bound_pos: usize) -> Span {
1068        let predicate = &self.predicates[predicate_pos];
1069        let bounds = predicate.kind.bounds();
1070
1071        if bounds.len() == 1 {
1072            return self.span_for_predicate_removal(predicate_pos);
1073        }
1074
1075        let bound_span = bounds[bound_pos].span();
1076        if bound_pos < bounds.len() - 1 {
1077            // If there's another bound after the current bound
1078            // include the following '+' e.g.:
1079            //
1080            //  `T: Foo + CurrentBound + Bar`
1081            //            ^^^^^^^^^^^^^^^
1082            bound_span.to(bounds[bound_pos + 1].span().shrink_to_lo())
1083        } else {
1084            // If the current bound is the last bound
1085            // include the preceding '+' E.g.:
1086            //
1087            //  `T: Foo + Bar + CurrentBound`
1088            //               ^^^^^^^^^^^^^^^
1089            bound_span.with_lo(bounds[bound_pos - 1].span().hi())
1090        }
1091    }
1092
1093    /// Computes the span representing the removal of a generic parameter at `param_index`.
1094    ///
1095    /// This function identifies the correct slice of source code to delete so that the
1096    /// remaining generic list remains syntactically valid (handling commas and brackets).
1097    ///
1098    /// ### Examples
1099    ///
1100    /// 1. **With a following parameter:** (Includes the trailing comma)
1101    ///    - Input: `<T, U>` (index 0)
1102    ///    - Produces span for: `T, `
1103    ///
1104    /// 2. **With a previous parameter:** (Includes the leading comma and bounds)
1105    ///    - Input: `<T: Clone, U>` (index 1)
1106    ///    - Produces span for: `, U`
1107    ///
1108    /// 3. **The only parameter:** (Includes the angle brackets)
1109    ///    - Input: `<T>` (index 0)
1110    ///    - Produces span for: `<T>`
1111    ///
1112    /// 4. **Parameter with where-clause bounds:**
1113    ///    - Input: `fn foo<T, U>() where T: Copy` (index 0)
1114    ///    - Produces span for: `T, ` (The where-clause remains for other logic to handle).
1115    pub fn span_for_param_removal(&self, param_index: usize) -> Span {
1116        if param_index >= self.params.len() {
1117            return self.span.shrink_to_hi();
1118        }
1119
1120        let is_param_explicit = |par: &&GenericParam<'_>| match par.kind {
1121            GenericParamKind::Type { .. }
1122            | GenericParamKind::Const { .. }
1123            | GenericParamKind::Lifetime { kind: LifetimeParamKind::Explicit } => true,
1124            _ => false,
1125        };
1126
1127        // Find the span of the type parameter.
1128        if let Some(next) = self.params[param_index + 1..].iter().find(is_param_explicit) {
1129            self.params[param_index].span.until(next.span)
1130        } else if let Some(prev) = self.params[..param_index].iter().rfind(is_param_explicit) {
1131            let mut prev_span = prev.span;
1132            // Consider the span of the bounds with the previous generic parameter when there is.
1133            if let Some(prev_bounds_span) = self.span_for_param_bounds(prev) {
1134                prev_span = prev_span.to(prev_bounds_span);
1135            }
1136
1137            // Consider the span of the bounds with the current generic parameter when there is.
1138            prev_span.shrink_to_hi().to(
1139                if let Some(cur_bounds_span) = self.span_for_param_bounds(&self.params[param_index])
1140                {
1141                    cur_bounds_span
1142                } else {
1143                    self.params[param_index].span
1144                },
1145            )
1146        } else {
1147            // Remove also angle brackets <> when there is just ONE generic parameter.
1148            self.span
1149        }
1150    }
1151
1152    /// Returns the span of the `WherePredicate` associated with the given `GenericParam`, if any.
1153    ///
1154    /// This looks specifically for predicates in the `where` clause that were generated
1155    /// from the parameter definition (e.g., `T` in `where T: Bound`).
1156    ///
1157    /// ### Example
1158    ///
1159    /// - Input: `param` representing `T`
1160    /// - Context: `where T: Clone + Default, U: Copy`
1161    /// - Returns: Span of `T: Clone + Default`
1162    fn span_for_param_bounds(&self, param: &GenericParam<'hir>) -> Option<Span> {
1163        self.predicates
1164            .iter()
1165            .find(|pred| {
1166                if let WherePredicateKind::BoundPredicate(WhereBoundPredicate {
1167                    origin: PredicateOrigin::GenericParam,
1168                    bounded_ty,
1169                    ..
1170                }) = pred.kind
1171                {
1172                    bounded_ty.span == param.span
1173                } else {
1174                    false
1175                }
1176            })
1177            .map(|pred| pred.span)
1178    }
1179}
1180
1181/// A single predicate in a where-clause.
1182#[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> ::rustc_data_structures::stable_hash::StableHash for
            WherePredicate<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    WherePredicate {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1183pub struct WherePredicate<'hir> {
1184    #[stable_hash(ignore)]
1185    pub hir_id: HirId,
1186    pub span: Span,
1187    pub kind: &'hir WherePredicateKind<'hir>,
1188}
1189
1190/// The kind of a single predicate in a where-clause.
1191#[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),
        }
    }
}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>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for WherePredicateKind<'hir> { }Copy, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            WherePredicateKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    WherePredicateKind::BoundPredicate(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    WherePredicateKind::RegionPredicate(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1192pub enum WherePredicateKind<'hir> {
1193    /// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
1194    BoundPredicate(WhereBoundPredicate<'hir>),
1195    /// A lifetime predicate (e.g., `'a: 'b + 'c`).
1196    RegionPredicate(WhereRegionPredicate<'hir>),
1197}
1198
1199impl<'hir> WherePredicateKind<'hir> {
1200    pub fn in_where_clause(&self) -> bool {
1201        match self {
1202            WherePredicateKind::BoundPredicate(p) => p.origin == PredicateOrigin::WhereClause,
1203            WherePredicateKind::RegionPredicate(p) => p.in_where_clause,
1204        }
1205    }
1206
1207    pub fn bounds(&self) -> GenericBounds<'hir> {
1208        match self {
1209            WherePredicateKind::BoundPredicate(p) => p.bounds,
1210            WherePredicateKind::RegionPredicate(p) => p.bounds,
1211        }
1212    }
1213}
1214
1215#[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 ::rustc_data_structures::stable_hash::StableHash for
            PredicateOrigin {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PredicateOrigin::WhereClause => {}
                    PredicateOrigin::GenericParam => {}
                    PredicateOrigin::ImplTrait => {}
                }
            }
        }
    };StableHash, #[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)]
1216pub enum PredicateOrigin {
1217    WhereClause,
1218    GenericParam,
1219    ImplTrait,
1220}
1221
1222/// A type bound (e.g., `for<'c> Foo: Send + Clone + 'c`).
1223#[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> ::rustc_data_structures::stable_hash::StableHash for
            WhereBoundPredicate<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1224pub struct WhereBoundPredicate<'hir> {
1225    /// Origin of the predicate.
1226    pub origin: PredicateOrigin,
1227    /// Any generics from a `for` binding.
1228    pub bound_generic_params: &'hir [GenericParam<'hir>],
1229    /// The type being bounded.
1230    pub bounded_ty: &'hir Ty<'hir>,
1231    /// Trait and lifetime bounds (e.g., `Clone + Send + 'static`).
1232    pub bounds: GenericBounds<'hir>,
1233}
1234
1235impl<'hir> WhereBoundPredicate<'hir> {
1236    /// Returns `true` if `param_def_id` matches the `bounded_ty` of this predicate.
1237    pub fn is_param_bound(&self, param_def_id: DefId) -> bool {
1238        self.bounded_ty.as_generic_param().is_some_and(|(def_id, _)| def_id == param_def_id)
1239    }
1240}
1241
1242/// A lifetime predicate (e.g., `'a: 'b + 'c`).
1243#[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> ::rustc_data_structures::stable_hash::StableHash for
            WhereRegionPredicate<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    WhereRegionPredicate {
                        in_where_clause: ref __binding_0,
                        lifetime: ref __binding_1,
                        bounds: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1244pub struct WhereRegionPredicate<'hir> {
1245    pub in_where_clause: bool,
1246    pub lifetime: &'hir Lifetime,
1247    pub bounds: GenericBounds<'hir>,
1248}
1249
1250impl<'hir> WhereRegionPredicate<'hir> {
1251    /// Returns `true` if `param_def_id` matches the `lifetime` of this predicate.
1252    fn is_param_bound(&self, param_def_id: LocalDefId) -> bool {
1253        self.lifetime.kind == LifetimeKind::Param(param_def_id)
1254    }
1255}
1256
1257/// An equality predicate (e.g., `T = int`); currently unsupported.
1258#[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> ::rustc_data_structures::stable_hash::StableHash for
            WhereEqPredicate<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    WhereEqPredicate {
                        lhs_ty: ref __binding_0, rhs_ty: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1259pub struct WhereEqPredicate<'hir> {
1260    pub lhs_ty: &'hir Ty<'hir>,
1261    pub rhs_ty: &'hir Ty<'hir>,
1262}
1263
1264/// HIR node coupled with its parent's id in the same HIR owner.
1265///
1266/// The parent is trash when the node is a HIR owner.
1267#[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)]
1268pub struct ParentedNode<'tcx> {
1269    pub parent: ItemLocalId,
1270    pub node: Node<'tcx>,
1271}
1272
1273/// Arguments passed to an attribute macro.
1274#[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 ::rustc_data_structures::stable_hash::StableHash for AttrArgs {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    AttrArgs::Empty => {}
                    AttrArgs::Delimited(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    AttrArgs::Eq {
                        eq_span: ref __binding_0, expr: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
1275pub enum AttrArgs {
1276    /// No arguments: `#[attr]`.
1277    Empty,
1278    /// Delimited arguments: `#[attr()/[]/{}]`.
1279    Delimited(DelimArgs),
1280    /// Arguments of a key-value attribute: `#[attr = "value"]`.
1281    Eq {
1282        /// Span of the `=` token.
1283        eq_span: Span,
1284        /// The "value".
1285        expr: MetaItemLit,
1286    },
1287}
1288
1289#[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 ::rustc_data_structures::stable_hash::StableHash for AttrPath {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    AttrPath { segments: ref __binding_0, span: ref __binding_1
                        } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
1290pub struct AttrPath {
1291    pub segments: Box<[Symbol]>,
1292    pub span: Span,
1293}
1294
1295impl IntoDiagArg for AttrPath {
1296    fn into_diag_arg(self, path: &mut Option<std::path::PathBuf>) -> DiagArgValue {
1297        self.to_string().into_diag_arg(path)
1298    }
1299}
1300
1301impl AttrPath {
1302    pub fn from_ast(path: &ast::Path, lower_span: impl Copy + Fn(Span) -> Span) -> Self {
1303        AttrPath {
1304            segments: path
1305                .segments
1306                .iter()
1307                .map(|i| i.ident.name)
1308                .collect::<Vec<_>>()
1309                .into_boxed_slice(),
1310            span: lower_span(path.span),
1311        }
1312    }
1313}
1314
1315impl fmt::Display for AttrPath {
1316    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
1317        f.write_fmt(format_args!("{0}",
        join_path_idents(self.segments.iter().map(|i|
                    Ident { name: *i, span: DUMMY_SP }))))write!(
1318            f,
1319            "{}",
1320            join_path_idents(self.segments.iter().map(|i| Ident { name: *i, span: DUMMY_SP }))
1321        )
1322    }
1323}
1324
1325#[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 ::rustc_data_structures::stable_hash::StableHash for AttrItem {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
1326pub struct AttrItem {
1327    // Not lowered to hir::Path because we have no NodeId to resolve to.
1328    pub path: AttrPath,
1329    pub args: AttrArgs,
1330    pub id: HashIgnoredAttrId,
1331    /// Denotes if the attribute decorates the following construct (outer)
1332    /// or the construct this attribute is contained within (inner).
1333    pub style: AttrStyle,
1334    /// Span of the entire attribute
1335    pub span: Span,
1336}
1337
1338/// The derived implementation of [`StableHash`] on [`Attribute`]s shouldn't hash
1339/// [`AttrId`]s. By wrapping them in this, we make sure we never do.
1340#[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)]
1341pub struct HashIgnoredAttrId {
1342    pub attr_id: AttrId,
1343}
1344
1345/// Many functions on this type have their documentation in the [`AttributeExt`] trait,
1346/// since they defer their implementation directly to that trait.
1347#[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 ::rustc_data_structures::stable_hash::StableHash for Attribute {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Attribute::Parsed(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Attribute::Unparsed(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1348pub enum Attribute {
1349    /// A parsed built-in attribute.
1350    ///
1351    /// Each attribute has a span connected to it. However, you must be somewhat careful using it.
1352    /// That's because sometimes we merge multiple attributes together, like when an item has
1353    /// multiple `repr` attributes. In this case the span might not be very useful.
1354    Parsed(AttributeKind),
1355
1356    /// An attribute that could not be parsed, out of a token-like representation.
1357    /// This is the case for custom tool attributes.
1358    Unparsed(Box<AttrItem>),
1359}
1360
1361impl Attribute {
1362    pub fn get_normal_item(&self) -> &AttrItem {
1363        match &self {
1364            Attribute::Unparsed(normal) => &normal,
1365            _ => { ::core::panicking::panic_fmt(format_args!("unexpected parsed attribute")); }panic!("unexpected parsed attribute"),
1366        }
1367    }
1368
1369    pub fn unwrap_normal_item(self) -> AttrItem {
1370        match self {
1371            Attribute::Unparsed(normal) => *normal,
1372            _ => { ::core::panicking::panic_fmt(format_args!("unexpected parsed attribute")); }panic!("unexpected parsed attribute"),
1373        }
1374    }
1375
1376    pub fn value_lit(&self) -> Option<&MetaItemLit> {
1377        match &self {
1378            Attribute::Unparsed(n) => match n.as_ref() {
1379                AttrItem { args: AttrArgs::Eq { eq_span: _, expr }, .. } => Some(expr),
1380                _ => None,
1381            },
1382            _ => None,
1383        }
1384    }
1385
1386    pub fn is_parsed_attr(&self) -> bool {
1387        match self {
1388            Attribute::Parsed(_) => true,
1389            Attribute::Unparsed(_) => false,
1390        }
1391    }
1392
1393    pub fn is_prefix_attr_for_suggestions(&self) -> bool {
1394        match self {
1395            Attribute::Unparsed(attr) => attr.span.desugaring_kind().is_none(),
1396            // Other parsed attributes that can appear on expressions originate from source and
1397            // should make suggestions treat the expression like a prefixed form.
1398            Attribute::Parsed(_) => true,
1399        }
1400    }
1401}
1402
1403impl AttributeExt for Attribute {
1404    #[inline]
1405    fn id(&self) -> AttrId {
1406        match &self {
1407            Attribute::Unparsed(u) => u.id.attr_id,
1408            _ => ::core::panicking::panic("explicit panic")panic!(),
1409        }
1410    }
1411
1412    #[inline]
1413    fn meta_item_list(&self) -> Option<ThinVec<ast::MetaItemInner>> {
1414        match &self {
1415            Attribute::Unparsed(n) => match n.as_ref() {
1416                AttrItem { args: AttrArgs::Delimited(d), .. } => {
1417                    ast::MetaItemKind::list_from_tokens(d.tokens.clone())
1418                }
1419                _ => None,
1420            },
1421            _ => None,
1422        }
1423    }
1424
1425    #[inline]
1426    fn value_str(&self) -> Option<Symbol> {
1427        self.value_lit().and_then(|x| x.value_as_str())
1428    }
1429
1430    #[inline]
1431    fn value_span(&self) -> Option<Span> {
1432        self.value_lit().map(|i| i.span)
1433    }
1434
1435    /// For a single-segment attribute, returns its name; otherwise, returns `None`.
1436    #[inline]
1437    fn name(&self) -> Option<Symbol> {
1438        match &self {
1439            Attribute::Unparsed(n) => {
1440                if let [ident] = n.path.segments.as_ref() {
1441                    Some(*ident)
1442                } else {
1443                    None
1444                }
1445            }
1446            _ => None,
1447        }
1448    }
1449
1450    #[inline]
1451    fn path_matches(&self, name: &[Symbol]) -> bool {
1452        match &self {
1453            Attribute::Unparsed(n) => n.path.segments.iter().eq(name),
1454            _ => false,
1455        }
1456    }
1457
1458    #[inline]
1459    fn is_doc_comment(&self) -> Option<Span> {
1460        if let Attribute::Parsed(AttributeKind::DocComment { span, .. }) = self {
1461            Some(*span)
1462        } else {
1463            None
1464        }
1465    }
1466
1467    #[inline]
1468    fn span(&self) -> Span {
1469        match &self {
1470            Attribute::Unparsed(u) => u.span,
1471            // FIXME: should not be needed anymore when all attrs are parsed
1472            Attribute::Parsed(AttributeKind::DocComment { span, .. }) => *span,
1473            Attribute::Parsed(AttributeKind::Deprecated { span, .. }) => *span,
1474            Attribute::Parsed(AttributeKind::CfgTrace(cfgs)) => cfgs[0].1,
1475            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:?}"),
1476        }
1477    }
1478
1479    #[inline]
1480    fn is_word(&self) -> bool {
1481        match &self {
1482            Attribute::Unparsed(n) => {
1483                #[allow(non_exhaustive_omitted_patterns)] match n.args {
    AttrArgs::Empty => true,
    _ => false,
}matches!(n.args, AttrArgs::Empty)
1484            }
1485            _ => false,
1486        }
1487    }
1488
1489    #[inline]
1490    fn symbol_path(&self) -> Option<SmallVec<[Symbol; 1]>> {
1491        match &self {
1492            Attribute::Unparsed(n) => Some(n.path.segments.iter().copied().collect()),
1493            _ => None,
1494        }
1495    }
1496
1497    fn path_span(&self) -> Option<Span> {
1498        match &self {
1499            Attribute::Unparsed(attr) => Some(attr.path.span),
1500            Attribute::Parsed(_) => None,
1501        }
1502    }
1503
1504    #[inline]
1505    fn doc_str(&self) -> Option<Symbol> {
1506        match &self {
1507            Attribute::Parsed(AttributeKind::DocComment { comment, .. }) => Some(*comment),
1508            _ => None,
1509        }
1510    }
1511
1512    fn is_automatically_derived_attr(&self) -> bool {
1513        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::AutomaticallyDerived) => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::AutomaticallyDerived))
1514    }
1515
1516    #[inline]
1517    fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind)> {
1518        match &self {
1519            Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => {
1520                Some((*comment, *kind))
1521            }
1522            _ => None,
1523        }
1524    }
1525
1526    fn doc_resolution_scope(&self) -> Option<AttrStyle> {
1527        match self {
1528            Attribute::Parsed(AttributeKind::DocComment { style, .. }) => Some(*style),
1529            Attribute::Unparsed(attr) if self.has_name(sym::doc) && self.value_str().is_some() => {
1530                Some(attr.style)
1531            }
1532            _ => None,
1533        }
1534    }
1535
1536    fn is_proc_macro_attr(&self) -> bool {
1537        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::ProcMacro |
        AttributeKind::ProcMacroAttribute | AttributeKind::ProcMacroDerive {
        .. }) => true,
    _ => false,
}matches!(
1538            self,
1539            Attribute::Parsed(
1540                AttributeKind::ProcMacro
1541                    | AttributeKind::ProcMacroAttribute
1542                    | AttributeKind::ProcMacroDerive { .. }
1543            )
1544        )
1545    }
1546
1547    fn is_doc_hidden(&self) -> bool {
1548        #[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())
1549    }
1550
1551    fn is_doc_keyword_or_attribute(&self) -> bool {
1552        #[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())
1553    }
1554
1555    fn is_rustc_doc_primitive(&self) -> bool {
1556        #[allow(non_exhaustive_omitted_patterns)] match self {
    Attribute::Parsed(AttributeKind::RustcDocPrimitive(..)) => true,
    _ => false,
}matches!(self, Attribute::Parsed(AttributeKind::RustcDocPrimitive(..)))
1557    }
1558}
1559
1560// FIXME(fn_delegation): use function delegation instead of manually forwarding
1561impl Attribute {
1562    #[inline]
1563    pub fn id(&self) -> AttrId {
1564        AttributeExt::id(self)
1565    }
1566
1567    #[inline]
1568    pub fn name(&self) -> Option<Symbol> {
1569        AttributeExt::name(self)
1570    }
1571
1572    #[inline]
1573    pub fn meta_item_list(&self) -> Option<ThinVec<MetaItemInner>> {
1574        AttributeExt::meta_item_list(self)
1575    }
1576
1577    #[inline]
1578    pub fn value_str(&self) -> Option<Symbol> {
1579        AttributeExt::value_str(self)
1580    }
1581
1582    #[inline]
1583    pub fn value_span(&self) -> Option<Span> {
1584        AttributeExt::value_span(self)
1585    }
1586
1587    #[inline]
1588    pub fn path_matches(&self, name: &[Symbol]) -> bool {
1589        AttributeExt::path_matches(self, name)
1590    }
1591
1592    #[inline]
1593    pub fn is_doc_comment(&self) -> Option<Span> {
1594        AttributeExt::is_doc_comment(self)
1595    }
1596
1597    #[inline]
1598    pub fn has_name(&self, name: Symbol) -> bool {
1599        AttributeExt::has_name(self, name)
1600    }
1601
1602    #[inline]
1603    pub fn has_any_name(&self, names: &[Symbol]) -> bool {
1604        AttributeExt::has_any_name(self, names)
1605    }
1606
1607    #[inline]
1608    pub fn span(&self) -> Span {
1609        AttributeExt::span(self)
1610    }
1611
1612    #[inline]
1613    pub fn is_word(&self) -> bool {
1614        AttributeExt::is_word(self)
1615    }
1616
1617    #[inline]
1618    pub fn path(&self) -> SmallVec<[Symbol; 1]> {
1619        AttributeExt::path(self)
1620    }
1621
1622    #[inline]
1623    pub fn doc_str(&self) -> Option<Symbol> {
1624        AttributeExt::doc_str(self)
1625    }
1626
1627    #[inline]
1628    pub fn is_proc_macro_attr(&self) -> bool {
1629        AttributeExt::is_proc_macro_attr(self)
1630    }
1631
1632    #[inline]
1633    pub fn doc_str_and_fragment_kind(&self) -> Option<(Symbol, DocFragmentKind)> {
1634        AttributeExt::doc_str_and_fragment_kind(self)
1635    }
1636}
1637
1638/// Attributes owned by a HIR owner.
1639#[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)]
1640pub struct AttributeMap<'tcx> {
1641    pub map: SortedMap<ItemLocalId, &'tcx [Attribute]>,
1642    /// Preprocessed `#[define_opaque]` attribute.
1643    pub define_opaque: Option<&'tcx [(Span, LocalDefId)]>,
1644    // Only present when the crate hash is needed.
1645    pub opt_hash: Option<Fingerprint>,
1646}
1647
1648impl<'tcx> AttributeMap<'tcx> {
1649    pub const EMPTY: &'static AttributeMap<'static> = &AttributeMap {
1650        map: SortedMap::new(),
1651        opt_hash: Some(Fingerprint::ZERO),
1652        define_opaque: None,
1653    };
1654
1655    #[inline]
1656    pub fn get(&self, id: ItemLocalId) -> &'tcx [Attribute] {
1657        self.map.get(&id).copied().unwrap_or(&[])
1658    }
1659}
1660
1661/// Map of all HIR nodes inside the current owner.
1662/// These nodes are mapped by `ItemLocalId` alongside the index of their parent node.
1663/// The HIR tree, including bodies, is pre-hashed.
1664pub struct OwnerNodes<'tcx> {
1665    /// Pre-computed hash of the full HIR. Used in the crate hash. Only present
1666    /// when incr. comp. is enabled.
1667    pub opt_hash_including_bodies: Option<Fingerprint>,
1668    /// Full HIR for the current owner.
1669    // The zeroth node's parent should never be accessed: the owner's parent is computed by the
1670    // hir_owner_parent query. It is set to `ItemLocalId::INVALID` to force an ICE if accidentally
1671    // used.
1672    pub nodes: IndexVec<ItemLocalId, ParentedNode<'tcx>>,
1673    /// Content of local bodies.
1674    pub bodies: SortedMap<ItemLocalId, &'tcx Body<'tcx>>,
1675}
1676
1677impl<'tcx> OwnerNodes<'tcx> {
1678    pub fn node(&self) -> OwnerNode<'tcx> {
1679        // Indexing must ensure it is an OwnerNode.
1680        self.nodes[ItemLocalId::ZERO].node.as_owner().unwrap()
1681    }
1682
1683    /// Return an instance of `OwnerNodes` suitable for definitions that have no corresponding AST.
1684    pub fn synthetic() -> OwnerNodes<'tcx> {
1685        OwnerNodes {
1686            // There is no reason to bother computing a hash for a synthetic body.
1687            // Just use a constant value.
1688            opt_hash_including_bodies: Some(Fingerprint::ZERO),
1689            nodes: IndexVec::from_elem_n(
1690                ParentedNode { parent: ItemLocalId::INVALID, node: OwnerNode::Synthetic.into() },
1691                1,
1692            ),
1693            bodies: SortedMap::new(),
1694        }
1695    }
1696}
1697
1698impl fmt::Debug for OwnerNodes<'_> {
1699    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1700        f.debug_struct("OwnerNodes")
1701            // Do not print all the pointers to all the nodes, as it would be unreadable.
1702            .field("node", &self.nodes[ItemLocalId::ZERO])
1703            .field(
1704                "parents",
1705                &fmt::from_fn(|f| {
1706                    f.debug_list()
1707                        .entries(self.nodes.iter_enumerated().map(|(id, parented_node)| {
1708                            fmt::from_fn(move |f| f.write_fmt(format_args!("({1:?}, {0:?})", parented_node.parent, id))write!(f, "({id:?}, {:?})", parented_node.parent))
1709                        }))
1710                        .finish()
1711                }),
1712            )
1713            .field("bodies", &self.bodies)
1714            .field("opt_hash_including_bodies", &self.opt_hash_including_bodies)
1715            .finish()
1716    }
1717}
1718
1719/// Full information resulting from lowering an AST node.
1720#[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> ::rustc_data_structures::stable_hash::StableHash for
            OwnerInfo<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        {}
                    }
                }
            }
        }
    };StableHash)]
1721pub struct OwnerInfo<'hir> {
1722    /// Contents of the HIR.
1723    pub nodes: OwnerNodes<'hir>,
1724    /// Map from each nested owner to its parent's local id.
1725    pub parenting: LocalDefIdMap<ItemLocalId>,
1726    /// Collected attributes of the HIR nodes.
1727    pub attrs: AttributeMap<'hir>,
1728    /// Map indicating what traits are in scope for places where this
1729    /// is relevant; generated by resolve.
1730    pub trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>,
1731
1732    /// Lints delayed during ast lowering to be emitted
1733    /// after hir has completely built
1734    ///
1735    /// WARNING: The delayed lints are not hashed as a part of the `OwnerInfo`, and therefore
1736    ///          should only be accessed in `eval_always` queries.
1737    #[stable_hash(ignore)]
1738    pub delayed_lints: Steal<DelayedLints>,
1739}
1740
1741impl<'tcx> OwnerInfo<'tcx> {
1742    #[inline]
1743    pub fn node(&self) -> OwnerNode<'tcx> {
1744        self.nodes.node()
1745    }
1746}
1747
1748#[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> ::rustc_data_structures::stable_hash::StableHash for
            MaybeOwner<'tcx> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MaybeOwner::Owner(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MaybeOwner::NonOwner(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MaybeOwner::Phantom => {}
                }
            }
        }
    };StableHash)]
1749pub enum MaybeOwner<'tcx> {
1750    Owner(&'tcx OwnerInfo<'tcx>),
1751    NonOwner(HirId),
1752    /// Used as a placeholder for unused LocalDefId.
1753    Phantom,
1754}
1755
1756impl<'tcx> MaybeOwner<'tcx> {
1757    pub fn as_owner(self) -> Option<&'tcx OwnerInfo<'tcx>> {
1758        match self {
1759            MaybeOwner::Owner(i) => Some(i),
1760            MaybeOwner::NonOwner(_) | MaybeOwner::Phantom => None,
1761        }
1762    }
1763
1764    pub fn unwrap(self) -> &'tcx OwnerInfo<'tcx> {
1765        self.as_owner().unwrap_or_else(|| { ::core::panicking::panic_fmt(format_args!("Not a HIR owner")); }panic!("Not a HIR owner"))
1766    }
1767}
1768
1769#[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", "explicit_captures"];
        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, &&self.explicit_captures];
        ::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>;
        let _: ::core::clone::AssertParamIsClone<&'hir [ExplicitCapture]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for Closure<'hir> { }Copy, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            Closure<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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,
                        explicit_captures: ref __binding_10 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                        { __binding_8.stable_hash(__hcx, __hasher); }
                        { __binding_9.stable_hash(__hcx, __hasher); }
                        { __binding_10.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1770pub struct Closure<'hir> {
1771    pub def_id: LocalDefId,
1772    pub binder: ClosureBinder,
1773    pub constness: Constness,
1774    pub capture_clause: CaptureBy,
1775    pub bound_generic_params: &'hir [GenericParam<'hir>],
1776    pub fn_decl: &'hir FnDecl<'hir>,
1777    pub body: BodyId,
1778    /// The span of the declaration block: 'move |...| -> ...'
1779    pub fn_decl_span: Span,
1780    /// The span of the argument block `|...|`
1781    pub fn_arg_span: Option<Span>,
1782    pub kind: ClosureKind,
1783    pub explicit_captures: &'hir [ExplicitCapture],
1784}
1785
1786/// A HIR local that must be captured by value even if ordinary closure capture
1787/// analysis would infer a weaker capture kind from its uses in the body.
1788#[derive(#[automatically_derived]
impl ::core::fmt::Debug for ExplicitCapture {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f,
            "ExplicitCapture", "var_hir_id", &&self.var_hir_id)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for ExplicitCapture {
    #[inline]
    fn clone(&self) -> ExplicitCapture {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ExplicitCapture { }Copy, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            ExplicitCapture {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ExplicitCapture { var_hir_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1789pub struct ExplicitCapture {
1790    pub var_hir_id: HirId,
1791}
1792
1793#[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 ::rustc_data_structures::stable_hash::StableHash for ClosureKind
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ClosureKind::Closure => {}
                    ClosureKind::Coroutine(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ClosureKind::CoroutineClosure(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
1794pub enum ClosureKind {
1795    /// This is a plain closure expression.
1796    Closure,
1797    /// This is a coroutine expression -- i.e. a closure expression in which
1798    /// we've found a `yield`. These can arise either from "plain" coroutine
1799    ///  usage (e.g. `let x = || { yield (); }`) or from a desugared expression
1800    /// (e.g. `async` and `gen` blocks).
1801    Coroutine(CoroutineKind),
1802    /// This is a coroutine-closure, which is a special sugared closure that
1803    /// returns one of the sugared coroutine (`async`/`gen`/`async gen`). It
1804    /// additionally allows capturing the coroutine's upvars by ref, and therefore
1805    /// needs to be specially treated during analysis and borrowck.
1806    CoroutineClosure(CoroutineDesugaring),
1807}
1808
1809/// A block of statements `{ .. }`, which may have a label (in this case the
1810/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
1811/// the `rules` being anything but `DefaultBlock`.
1812#[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> ::rustc_data_structures::stable_hash::StableHash for
            Block<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1813pub struct Block<'hir> {
1814    /// Statements in a block.
1815    pub stmts: &'hir [Stmt<'hir>],
1816    /// An expression at the end of the block
1817    /// without a semicolon, if any.
1818    pub expr: Option<&'hir Expr<'hir>>,
1819    #[stable_hash(ignore)]
1820    pub hir_id: HirId,
1821    /// Distinguishes between `unsafe { ... }` and `{ ... }`.
1822    pub rules: BlockCheckMode,
1823    /// The span includes the curly braces `{` and `}` around the block.
1824    pub span: Span,
1825    /// If true, then there may exist `break 'a` values that aim to
1826    /// break out of this block early.
1827    /// Used by `'label: {}` blocks and by `try {}` blocks.
1828    pub targeted_by_break: bool,
1829}
1830
1831impl<'hir> Block<'hir> {
1832    pub fn innermost_block(&self) -> &Block<'hir> {
1833        let mut block = self;
1834        while let Some(Expr { kind: ExprKind::Block(inner_block, _), .. }) = block.expr {
1835            block = inner_block;
1836        }
1837        block
1838    }
1839}
1840
1841#[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 ::rustc_data_structures::stable_hash::StableHash for TyFieldPath
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TyFieldPath {
                        variant: ref __binding_0, field: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1842pub struct TyFieldPath {
1843    pub variant: Option<Ident>,
1844    pub field: Ident,
1845}
1846
1847#[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> ::rustc_data_structures::stable_hash::StableHash for
            TyPat<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TyPat {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1848pub struct TyPat<'hir> {
1849    #[stable_hash(ignore)]
1850    pub hir_id: HirId,
1851    pub kind: TyPatKind<'hir>,
1852    pub span: Span,
1853}
1854
1855#[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> ::rustc_data_structures::stable_hash::StableHash for
            Pat<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
1856pub struct Pat<'hir> {
1857    #[stable_hash(ignore)]
1858    pub hir_id: HirId,
1859    pub kind: PatKind<'hir>,
1860    pub span: Span,
1861    /// Whether to use default binding modes.
1862    /// At present, this is false only for destructuring assignment.
1863    pub default_binding_modes: bool,
1864}
1865
1866impl<'hir> Pat<'hir> {
1867    fn walk_short_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) -> bool {
1868        if !it(self) {
1869            return false;
1870        }
1871
1872        use PatKind::*;
1873        match self.kind {
1874            Missing => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
1875            Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => true,
1876            Box(s) | Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => {
1877                s.walk_short_(it)
1878            }
1879            Struct(_, fields, _) => fields.iter().all(|field| field.pat.walk_short_(it)),
1880            TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().all(|p| p.walk_short_(it)),
1881            Slice(before, slice, after) => {
1882                before.iter().chain(slice).chain(after.iter()).all(|p| p.walk_short_(it))
1883            }
1884        }
1885    }
1886
1887    /// Walk the pattern in left-to-right order,
1888    /// short circuiting (with `.all(..)`) if `false` is returned.
1889    ///
1890    /// Note that when visiting e.g. `Tuple(ps)`,
1891    /// if visiting `ps[0]` returns `false`,
1892    /// then `ps[1]` will not be visited.
1893    pub fn walk_short(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) -> bool {
1894        self.walk_short_(&mut it)
1895    }
1896
1897    fn walk_(&self, it: &mut impl FnMut(&Pat<'hir>) -> bool) {
1898        if !it(self) {
1899            return;
1900        }
1901
1902        use PatKind::*;
1903        match self.kind {
1904            Missing | Wild | Never | Expr(_) | Range(..) | Binding(.., None) | Err(_) => {}
1905            Box(s) | Deref(s) | Ref(s, _, _) | Binding(.., Some(s)) | Guard(s, _) => s.walk_(it),
1906            Struct(_, fields, _) => fields.iter().for_each(|field| field.pat.walk_(it)),
1907            TupleStruct(_, s, _) | Tuple(s, _) | Or(s) => s.iter().for_each(|p| p.walk_(it)),
1908            Slice(before, slice, after) => {
1909                before.iter().chain(slice).chain(after.iter()).for_each(|p| p.walk_(it))
1910            }
1911        }
1912    }
1913
1914    /// Walk the pattern in left-to-right order.
1915    ///
1916    /// If `it(pat)` returns `false`, the children are not visited.
1917    pub fn walk(&self, mut it: impl FnMut(&Pat<'hir>) -> bool) {
1918        self.walk_(&mut it)
1919    }
1920
1921    /// Walk the pattern in left-to-right order.
1922    ///
1923    /// If you always want to recurse, prefer this method over `walk`.
1924    pub fn walk_always(&self, mut it: impl FnMut(&Pat<'_>)) {
1925        self.walk(|p| {
1926            it(p);
1927            true
1928        })
1929    }
1930
1931    /// Whether this a never pattern.
1932    pub fn is_never_pattern(&self) -> bool {
1933        let mut is_never_pattern = false;
1934        self.walk(|pat| match &pat.kind {
1935            PatKind::Never => {
1936                is_never_pattern = true;
1937                false
1938            }
1939            PatKind::Or(s) => {
1940                is_never_pattern = s.iter().all(|p| p.is_never_pattern());
1941                false
1942            }
1943            _ => true,
1944        });
1945        is_never_pattern
1946    }
1947
1948    /// Whether this pattern constitutes a read of value of the scrutinee that
1949    /// it is matching against. This is used to determine whether we should
1950    /// perform `NeverToAny` coercions.
1951    ///
1952    /// See [`expr_guaranteed_to_constitute_read_for_never`][m] for the nuances of
1953    /// what happens when this returns true.
1954    ///
1955    /// [m]: ../../rustc_middle/ty/struct.TyCtxt.html#method.expr_guaranteed_to_constitute_read_for_never
1956    pub fn is_guaranteed_to_constitute_read_for_never(&self) -> bool {
1957        match self.kind {
1958            // Does not constitute a read.
1959            PatKind::Wild => false,
1960
1961            // The guard cannot affect if we make a read or not (it runs after the inner pattern
1962            // has matched), therefore it's irrelevant.
1963            PatKind::Guard(pat, _) => pat.is_guaranteed_to_constitute_read_for_never(),
1964
1965            // This is unnecessarily restrictive when the pattern that doesn't
1966            // constitute a read is unreachable.
1967            //
1968            // For example `match *never_ptr { value => {}, _ => {} }` or
1969            // `match *never_ptr { _ if false => {}, value => {} }`.
1970            //
1971            // It is however fine to be restrictive here; only returning `true`
1972            // can lead to unsoundness.
1973            PatKind::Or(subpats) => {
1974                subpats.iter().all(|pat| pat.is_guaranteed_to_constitute_read_for_never())
1975            }
1976
1977            // Does constitute a read, since it is equivalent to a discriminant read.
1978            PatKind::Never => true,
1979
1980            // All of these constitute a read, or match on something that isn't `!`,
1981            // which would require a `NeverToAny` coercion.
1982            PatKind::Missing
1983            | PatKind::Binding(_, _, _, _)
1984            | PatKind::Struct(_, _, _)
1985            | PatKind::TupleStruct(_, _, _)
1986            | PatKind::Tuple(_, _)
1987            | PatKind::Box(_)
1988            | PatKind::Ref(_, _, _)
1989            | PatKind::Deref(_)
1990            | PatKind::Expr(_)
1991            | PatKind::Range(_, _, _)
1992            | PatKind::Slice(_, _, _)
1993            | PatKind::Err(_) => true,
1994        }
1995    }
1996}
1997
1998/// A single field in a struct pattern.
1999///
2000/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
2001/// are treated the same as` x: x, y: ref y, z: ref mut z`,
2002/// except `is_shorthand` is true.
2003#[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> ::rustc_data_structures::stable_hash::StableHash for
            PatField<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2004pub struct PatField<'hir> {
2005    #[stable_hash(ignore)]
2006    pub hir_id: HirId,
2007    /// The identifier for the field.
2008    pub ident: Ident,
2009    /// The pattern the field is destructured to.
2010    pub pat: &'hir Pat<'hir>,
2011    pub is_shorthand: bool,
2012    pub span: Span,
2013}
2014
2015#[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 ::rustc_data_structures::stable_hash::StableHash for RangeEnd {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    RangeEnd::Included => {}
                    RangeEnd::Excluded => {}
                }
            }
        }
    };StableHash, #[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)]
2016pub enum RangeEnd {
2017    Included,
2018    Excluded,
2019}
2020
2021impl fmt::Display for RangeEnd {
2022    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2023        f.write_str(match self {
2024            RangeEnd::Included => "..=",
2025            RangeEnd::Excluded => "..",
2026        })
2027    }
2028}
2029
2030// Equivalent to `Option<usize>`. That type takes up 16 bytes on 64-bit, but
2031// this type only takes up 4 bytes, at the cost of being restricted to a
2032// maximum value of `u32::MAX - 1`. In practice, this is more than enough.
2033#[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 ::rustc_data_structures::stable_hash::StableHash for DotDotPos {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    DotDotPos(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2034pub struct DotDotPos(u32);
2035
2036impl DotDotPos {
2037    /// Panics if n >= u32::MAX.
2038    pub fn new(n: Option<usize>) -> Self {
2039        match n {
2040            Some(n) => {
2041                if !(n < u32::MAX as usize) {
    ::core::panicking::panic("assertion failed: n < u32::MAX as usize")
};assert!(n < u32::MAX as usize);
2042                Self(n as u32)
2043            }
2044            None => Self(u32::MAX),
2045        }
2046    }
2047
2048    pub fn as_opt_usize(&self) -> Option<usize> {
2049        if self.0 == u32::MAX { None } else { Some(self.0 as usize) }
2050    }
2051}
2052
2053impl fmt::Debug for DotDotPos {
2054    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2055        self.as_opt_usize().fmt(f)
2056    }
2057}
2058
2059#[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> ::rustc_data_structures::stable_hash::StableHash for
            PatExpr<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    PatExpr {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2060pub struct PatExpr<'hir> {
2061    #[stable_hash(ignore)]
2062    pub hir_id: HirId,
2063    pub span: Span,
2064    pub kind: PatExprKind<'hir>,
2065}
2066
2067#[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> ::rustc_data_structures::stable_hash::StableHash for
            PatExprKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PatExprKind::Lit {
                        lit: ref __binding_0, negated: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    PatExprKind::Path(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2068pub enum PatExprKind<'hir> {
2069    Lit {
2070        lit: Lit,
2071        negated: bool,
2072    },
2073    /// A path pattern for a unit struct/variant or a (maybe-associated) constant.
2074    Path(QPath<'hir>),
2075}
2076
2077#[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> ::rustc_data_structures::stable_hash::StableHash for
            TyPatKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    TyPatKind::Range(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyPatKind::NotNull => {}
                    TyPatKind::Or(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyPatKind::Err(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2078pub enum TyPatKind<'hir> {
2079    /// A range pattern (e.g., `1..=2` or `1..2`).
2080    Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>),
2081
2082    /// A pattern that excludes null pointers
2083    NotNull,
2084
2085    /// A list of patterns where only one needs to be satisfied
2086    Or(&'hir [TyPat<'hir>]),
2087
2088    /// A placeholder for a pattern that wasn't well formed in some way.
2089    Err(ErrorGuaranteed),
2090}
2091
2092#[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> ::rustc_data_structures::stable_hash::StableHash for
            PatKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PatKind::Missing => {}
                    PatKind::Wild => {}
                    PatKind::Binding(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::TupleStruct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Or(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Never => {}
                    PatKind::Tuple(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Box(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Deref(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Ref(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Expr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Guard(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Range(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Slice(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    PatKind::Err(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2093pub enum PatKind<'hir> {
2094    /// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`.
2095    Missing,
2096
2097    /// Represents a wildcard pattern (i.e., `_`).
2098    Wild,
2099
2100    /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`.
2101    /// The `HirId` is the canonical ID for the variable being bound,
2102    /// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID),
2103    /// which is the pattern ID of the first `x`.
2104    ///
2105    /// The `BindingMode` is what's provided by the user, before match
2106    /// ergonomics are applied. For the binding mode actually in use,
2107    /// see [`TypeckResults::extract_binding_mode`].
2108    ///
2109    /// [`TypeckResults::extract_binding_mode`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.extract_binding_mode
2110    Binding(BindingMode, HirId, Ident, Option<&'hir Pat<'hir>>),
2111
2112    /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`).
2113    /// The `Option` contains the span of a possible `..`.
2114    Struct(QPath<'hir>, &'hir [PatField<'hir>], Option<Span>),
2115
2116    /// A tuple struct/variant pattern `Variant(x, y, .., z)`.
2117    /// If the `..` pattern fragment is present, then `DotDotPos` denotes its position.
2118    /// `0 <= position <= subpats.len()`
2119    TupleStruct(QPath<'hir>, &'hir [Pat<'hir>], DotDotPos),
2120
2121    /// An or-pattern `A | B | C`.
2122    /// Invariant: `pats.len() >= 2`.
2123    Or(&'hir [Pat<'hir>]),
2124
2125    /// A never pattern `!`.
2126    Never,
2127
2128    /// A tuple pattern (e.g., `(a, b)`).
2129    /// If the `..` pattern fragment is present, then `DotDotPos` denotes its position.
2130    /// `0 <= position <= subpats.len()`
2131    Tuple(&'hir [Pat<'hir>], DotDotPos),
2132
2133    /// A `box` pattern.
2134    Box(&'hir Pat<'hir>),
2135
2136    /// A `deref` pattern (currently `deref!()` macro-based syntax).
2137    Deref(&'hir Pat<'hir>),
2138
2139    /// A reference pattern (e.g., `&mut (a, b)`).
2140    Ref(&'hir Pat<'hir>, Pinnedness, Mutability),
2141
2142    /// A literal, const block or path.
2143    Expr(&'hir PatExpr<'hir>),
2144
2145    /// A guard pattern (e.g., `x if guard(x)`).
2146    Guard(&'hir Pat<'hir>, &'hir Expr<'hir>),
2147
2148    /// A range pattern (e.g., `1..=2` or `1..2`).
2149    Range(Option<&'hir PatExpr<'hir>>, Option<&'hir PatExpr<'hir>>, RangeEnd),
2150
2151    /// A slice pattern, `[before_0, ..., before_n, (slice, after_0, ..., after_n)?]`.
2152    ///
2153    /// Here, `slice` is lowered from the syntax `($binding_mode $ident @)? ..`.
2154    /// If `slice` exists, then `after` can be non-empty.
2155    ///
2156    /// The representation for e.g., `[a, b, .., c, d]` is:
2157    /// ```ignore (illustrative)
2158    /// PatKind::Slice([Binding(a), Binding(b)], Some(Wild), [Binding(c), Binding(d)])
2159    /// ```
2160    Slice(&'hir [Pat<'hir>], Option<&'hir Pat<'hir>>, &'hir [Pat<'hir>]),
2161
2162    /// A placeholder for a pattern that wasn't well formed in some way.
2163    Err(ErrorGuaranteed),
2164}
2165
2166/// A statement.
2167#[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> ::rustc_data_structures::stable_hash::StableHash for
            Stmt<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Stmt {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2168pub struct Stmt<'hir> {
2169    #[stable_hash(ignore)]
2170    pub hir_id: HirId,
2171    pub kind: StmtKind<'hir>,
2172    pub span: Span,
2173}
2174
2175/// The contents of a statement.
2176#[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> ::rustc_data_structures::stable_hash::StableHash for
            StmtKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    StmtKind::Let(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    StmtKind::Item(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    StmtKind::Expr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    StmtKind::Semi(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2177pub enum StmtKind<'hir> {
2178    /// A local (`let`) binding.
2179    Let(&'hir LetStmt<'hir>),
2180
2181    /// An item binding.
2182    Item(ItemId),
2183
2184    /// An expression without a trailing semi-colon (must have unit type).
2185    Expr(&'hir Expr<'hir>),
2186
2187    /// An expression with a trailing semi-colon (may have any type).
2188    Semi(&'hir Expr<'hir>),
2189}
2190
2191/// Represents a `let` statement (i.e., `let <pat>:<ty> = <init>;`).
2192#[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> ::rustc_data_structures::stable_hash::StableHash for
            LetStmt<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2193pub struct LetStmt<'hir> {
2194    /// Span of `super` in `super let`.
2195    pub super_: Option<Span>,
2196    pub pat: &'hir Pat<'hir>,
2197    /// Type annotation, if any (otherwise the type will be inferred).
2198    pub ty: Option<&'hir Ty<'hir>>,
2199    /// Initializer expression to set the value, if any.
2200    pub init: Option<&'hir Expr<'hir>>,
2201    /// Else block for a `let...else` binding.
2202    pub els: Option<&'hir Block<'hir>>,
2203    #[stable_hash(ignore)]
2204    pub hir_id: HirId,
2205    pub span: Span,
2206    /// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
2207    /// desugaring, or `AssignDesugar` if it is the result of a complex
2208    /// assignment desugaring. Otherwise will be `Normal`.
2209    pub source: LocalSource,
2210}
2211
2212/// Represents a single arm of a `match` expression, e.g.
2213/// `<pat> (if <guard>) => <body>`.
2214#[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> ::rustc_data_structures::stable_hash::StableHash for
            Arm<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2215pub struct Arm<'hir> {
2216    #[stable_hash(ignore)]
2217    pub hir_id: HirId,
2218    pub span: Span,
2219    /// If this pattern and the optional guard matches, then `body` is evaluated.
2220    pub pat: &'hir Pat<'hir>,
2221    /// Optional guard clause.
2222    pub guard: Option<&'hir Expr<'hir>>,
2223    /// The expression the arm evaluates to if this arm matches.
2224    pub body: &'hir Expr<'hir>,
2225}
2226
2227/// Represents a `let <pat>[: <ty>] = <expr>` expression (not a [`LetStmt`]), occurring in an `if-let`
2228/// or `let-else`, evaluating to a boolean. Typically the pattern is refutable.
2229///
2230/// In an `if let`, imagine it as `if (let <pat> = <expr>) { ... }`; in a let-else, it is part of
2231/// the desugaring to if-let. Only let-else supports the type annotation at present.
2232#[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> ::rustc_data_structures::stable_hash::StableHash for
            LetExpr<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2233pub struct LetExpr<'hir> {
2234    pub span: Span,
2235    pub pat: &'hir Pat<'hir>,
2236    pub ty: Option<&'hir Ty<'hir>>,
2237    pub init: &'hir Expr<'hir>,
2238    /// `Recovered::Yes` when this let expressions is not in a syntactically valid location.
2239    /// Used to prevent building MIR in such situations.
2240    pub recovered: ast::Recovered,
2241}
2242
2243#[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> ::rustc_data_structures::stable_hash::StableHash for
            ExprField<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2244pub struct ExprField<'hir> {
2245    #[stable_hash(ignore)]
2246    pub hir_id: HirId,
2247    pub ident: Ident,
2248    pub expr: &'hir Expr<'hir>,
2249    pub span: Span,
2250    pub is_shorthand: bool,
2251}
2252
2253#[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 ::rustc_data_structures::stable_hash::StableHash for
            BlockCheckMode {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    BlockCheckMode::DefaultBlock => {}
                    BlockCheckMode::UnsafeBlock(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2254pub enum BlockCheckMode {
2255    DefaultBlock,
2256    UnsafeBlock(UnsafeSource),
2257}
2258
2259#[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 ::rustc_data_structures::stable_hash::StableHash for UnsafeSource
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    UnsafeSource::CompilerGenerated => {}
                    UnsafeSource::UserProvided => {}
                }
            }
        }
    };StableHash)]
2260pub enum UnsafeSource {
2261    CompilerGenerated,
2262    UserProvided,
2263}
2264
2265#[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 ::rustc_data_structures::stable_hash::StableHash for BodyId {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    BodyId { hir_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2266pub struct BodyId {
2267    pub hir_id: HirId,
2268}
2269
2270/// The body of a function, closure, or constant value. In the case of
2271/// a function, the body contains not only the function body itself
2272/// (which is an expression), but also the argument patterns, since
2273/// those are something that the caller doesn't really care about.
2274///
2275/// # Examples
2276///
2277/// ```
2278/// fn foo((x, y): (u32, u32)) -> u32 {
2279///     x + y
2280/// }
2281/// ```
2282///
2283/// Here, the `Body` associated with `foo()` would contain:
2284///
2285/// - an `params` array containing the `(x, y)` pattern
2286/// - a `value` containing the `x + y` expression (maybe wrapped in a block)
2287/// - `coroutine_kind` would be `None`
2288///
2289/// All bodies have an **owner**, which can be accessed via the HIR
2290/// map using `body_owner_def_id()`.
2291#[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> ::rustc_data_structures::stable_hash::StableHash for
            Body<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Body { params: ref __binding_0, value: ref __binding_1 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2292pub struct Body<'hir> {
2293    pub params: &'hir [Param<'hir>],
2294    pub value: &'hir Expr<'hir>,
2295}
2296
2297impl<'hir> Body<'hir> {
2298    pub fn id(&self) -> BodyId {
2299        BodyId { hir_id: self.value.hir_id }
2300    }
2301}
2302
2303/// The type of source expression that caused this coroutine to be created.
2304#[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 ::rustc_data_structures::stable_hash::StableHash for
            CoroutineKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    CoroutineKind::Desugared(ref __binding_0, ref __binding_1)
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    CoroutineKind::Coroutine(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
2305pub enum CoroutineKind {
2306    /// A coroutine that comes from a desugaring.
2307    Desugared(CoroutineDesugaring, CoroutineSource),
2308
2309    /// A coroutine literal created via a `yield` inside a closure.
2310    Coroutine(Movability),
2311}
2312
2313impl CoroutineKind {
2314    pub fn movability(self) -> Movability {
2315        match self {
2316            CoroutineKind::Desugared(CoroutineDesugaring::Async, _)
2317            | CoroutineKind::Desugared(CoroutineDesugaring::AsyncGen, _) => Movability::Static,
2318            CoroutineKind::Desugared(CoroutineDesugaring::Gen, _) => Movability::Movable,
2319            CoroutineKind::Coroutine(mov) => mov,
2320        }
2321    }
2322
2323    pub fn is_fn_like(self) -> bool {
2324        #[allow(non_exhaustive_omitted_patterns)] match self {
    CoroutineKind::Desugared(_, CoroutineSource::Fn) => true,
    _ => false,
}matches!(self, CoroutineKind::Desugared(_, CoroutineSource::Fn))
2325    }
2326
2327    pub fn is_async_desugaring(self) -> bool {
2328        #[allow(non_exhaustive_omitted_patterns)] match self {
    CoroutineKind::Desugared(CoroutineDesugaring::Async |
        CoroutineDesugaring::AsyncGen, _) => true,
    _ => false,
}matches!(
2329            self,
2330            CoroutineKind::Desugared(CoroutineDesugaring::Async | CoroutineDesugaring::AsyncGen, _)
2331        )
2332    }
2333
2334    pub fn to_plural_string(&self) -> String {
2335        match self {
2336            CoroutineKind::Desugared(d, CoroutineSource::Fn) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}fn bodies", d))
    })format!("{d:#}fn bodies"),
2337            CoroutineKind::Desugared(d, CoroutineSource::Block) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}blocks", d))
    })format!("{d:#}blocks"),
2338            CoroutineKind::Desugared(d, CoroutineSource::Closure) => ::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("{0:#}closure bodies", d))
    })format!("{d:#}closure bodies"),
2339            CoroutineKind::Coroutine(_) => "coroutines".to_string(),
2340        }
2341    }
2342}
2343
2344impl fmt::Display for CoroutineKind {
2345    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2346        match self {
2347            CoroutineKind::Desugared(d, k) => {
2348                d.fmt(f)?;
2349                k.fmt(f)
2350            }
2351            CoroutineKind::Coroutine(_) => f.write_str("coroutine"),
2352        }
2353    }
2354}
2355
2356/// In the case of a coroutine created as part of an async/gen construct,
2357/// which kind of async/gen construct caused it to be created?
2358///
2359/// This helps error messages but is also used to drive coercions in
2360/// type-checking (see #60424).
2361#[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 ::rustc_data_structures::stable_hash::StableHash for
            CoroutineSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    CoroutineSource::Block => {}
                    CoroutineSource::Closure => {}
                    CoroutineSource::Fn => {}
                }
            }
        }
    };StableHash, 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)]
2362pub enum CoroutineSource {
2363    /// An explicit `async`/`gen` block written by the user.
2364    Block,
2365
2366    /// An explicit `async`/`gen` closure written by the user.
2367    Closure,
2368
2369    /// The `async`/`gen` block generated as the body of an async/gen function.
2370    Fn,
2371}
2372
2373impl fmt::Display for CoroutineSource {
2374    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2375        match self {
2376            CoroutineSource::Block => "block",
2377            CoroutineSource::Closure => "closure body",
2378            CoroutineSource::Fn => "fn body",
2379        }
2380        .fmt(f)
2381    }
2382}
2383
2384#[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 ::rustc_data_structures::stable_hash::StableHash for
            CoroutineDesugaring {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    CoroutineDesugaring::Async => {}
                    CoroutineDesugaring::Gen => {}
                    CoroutineDesugaring::AsyncGen => {}
                }
            }
        }
    };StableHash, 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)]
2385pub enum CoroutineDesugaring {
2386    /// An explicit `async` block or the body of an `async` function.
2387    Async,
2388
2389    /// An explicit `gen` block or the body of a `gen` function.
2390    Gen,
2391
2392    /// An explicit `async gen` block or the body of an `async gen` function,
2393    /// which is able to both `yield` and `.await`.
2394    AsyncGen,
2395}
2396
2397impl fmt::Display for CoroutineDesugaring {
2398    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2399        match self {
2400            CoroutineDesugaring::Async => {
2401                if f.alternate() {
2402                    f.write_str("`async` ")?;
2403                } else {
2404                    f.write_str("async ")?
2405                }
2406            }
2407            CoroutineDesugaring::Gen => {
2408                if f.alternate() {
2409                    f.write_str("`gen` ")?;
2410                } else {
2411                    f.write_str("gen ")?
2412                }
2413            }
2414            CoroutineDesugaring::AsyncGen => {
2415                if f.alternate() {
2416                    f.write_str("`async gen` ")?;
2417                } else {
2418                    f.write_str("async gen ")?
2419                }
2420            }
2421        }
2422
2423        Ok(())
2424    }
2425}
2426
2427#[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)]
2428pub enum BodyOwnerKind {
2429    /// Functions and methods.
2430    Fn,
2431
2432    /// Closures
2433    Closure,
2434
2435    /// Constants and associated constants, also including inline constants.
2436    Const { inline: bool },
2437
2438    /// Initializer of a `static` item.
2439    Static(Mutability),
2440
2441    /// Fake body for a global asm to store its const-like value types.
2442    GlobalAsm,
2443}
2444
2445impl BodyOwnerKind {
2446    pub fn is_fn_or_closure(self) -> bool {
2447        match self {
2448            BodyOwnerKind::Fn | BodyOwnerKind::Closure => true,
2449            BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(_) | BodyOwnerKind::GlobalAsm => {
2450                false
2451            }
2452        }
2453    }
2454}
2455
2456/// The kind of an item that requires const-checking.
2457#[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 { allow_const_fn_promotion: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "allow_const_fn_promotion", &__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 { allow_const_fn_promotion: __self_0 },
                    ConstContext::Const { allow_const_fn_promotion: __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)]
2458pub enum ConstContext {
2459    /// A `const fn`.
2460    ConstFn,
2461
2462    /// A `static` or `static mut`.
2463    Static(Mutability),
2464
2465    /// A `const`, associated `const`, or other const context.
2466    ///
2467    /// Other contexts include:
2468    /// - Array length expressions
2469    /// - Enum discriminants
2470    /// - Const generics
2471    Const {
2472        /// For backwards compatibility `const` items allow
2473        /// calls to `const fn` to get promoted.
2474        /// We forbid that in comptime fns and inline consts.
2475        allow_const_fn_promotion: bool,
2476    },
2477}
2478
2479impl ConstContext {
2480    /// A description of this const context that can appear between backticks in an error message.
2481    ///
2482    /// E.g. `const` or `static mut`.
2483    pub fn keyword_name(self) -> &'static str {
2484        match self {
2485            Self::Const { .. } => "const",
2486            Self::Static(Mutability::Not) => "static",
2487            Self::Static(Mutability::Mut) => "static mut",
2488            Self::ConstFn => "const fn",
2489        }
2490    }
2491}
2492
2493/// A colloquial, trivially pluralizable description of this const context for use in error
2494/// messages.
2495impl fmt::Display for ConstContext {
2496    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2497        match *self {
2498            Self::Const { .. } => f.write_fmt(format_args!("constant"))write!(f, "constant"),
2499            Self::Static(_) => f.write_fmt(format_args!("static"))write!(f, "static"),
2500            Self::ConstFn => f.write_fmt(format_args!("constant function"))write!(f, "constant function"),
2501        }
2502    }
2503}
2504
2505impl IntoDiagArg for ConstContext {
2506    fn into_diag_arg(self, _: &mut Option<std::path::PathBuf>) -> DiagArgValue {
2507        DiagArgValue::Str(Cow::Borrowed(match self {
2508            ConstContext::ConstFn => "constant function",
2509            ConstContext::Static(_) => "static",
2510            ConstContext::Const { .. } => "constant",
2511        }))
2512    }
2513}
2514
2515/// A literal.
2516pub type Lit = Spanned<LitKind>;
2517
2518/// A constant (expression) that's not an item or associated item,
2519/// but needs its own `DefId` for type-checking, const-eval, etc.
2520/// These are usually found nested inside types (e.g., array lengths)
2521/// or expressions (e.g., repeat counts), and also used to define
2522/// explicit discriminant values for enum variants.
2523///
2524/// You can check if this anon const is a default in a const param
2525/// `const N: usize = { ... }` with `tcx.hir_opt_const_param_default_param_def_id(..)`
2526#[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 ::rustc_data_structures::stable_hash::StableHash for AnonConst {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    AnonConst {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        body: ref __binding_2,
                        span: ref __binding_3 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2527pub struct AnonConst {
2528    #[stable_hash(ignore)]
2529    pub hir_id: HirId,
2530    pub def_id: LocalDefId,
2531    pub body: BodyId,
2532    pub span: Span,
2533}
2534
2535/// An inline constant expression `const { something }`.
2536#[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 ::rustc_data_structures::stable_hash::StableHash for ConstBlock {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ConstBlock {
                        hir_id: ref __binding_0,
                        def_id: ref __binding_1,
                        body: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2537pub struct ConstBlock {
2538    #[stable_hash(ignore)]
2539    pub hir_id: HirId,
2540    pub def_id: LocalDefId,
2541    pub body: BodyId,
2542}
2543
2544/// An expression.
2545///
2546/// For more details, see the [rust lang reference].
2547/// Note that the reference does not document nightly-only features.
2548/// There may be also slight differences in the names and representation of AST nodes between
2549/// the compiler and the reference.
2550///
2551/// [rust lang reference]: https://doc.rust-lang.org/reference/expressions.html
2552#[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> ::rustc_data_structures::stable_hash::StableHash for
            Expr<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Expr {
                        hir_id: ref __binding_0,
                        kind: ref __binding_1,
                        span: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2553pub struct Expr<'hir> {
2554    #[stable_hash(ignore)]
2555    pub hir_id: HirId,
2556    pub kind: ExprKind<'hir>,
2557    pub span: Span,
2558}
2559
2560impl Expr<'_> {
2561    pub fn precedence(&self, has_attr: &dyn Fn(HirId) -> bool) -> ExprPrecedence {
2562        let prefix_attrs_precedence = || -> ExprPrecedence {
2563            if has_attr(self.hir_id) { ExprPrecedence::Prefix } else { ExprPrecedence::Unambiguous }
2564        };
2565
2566        match &self.kind {
2567            ExprKind::Closure(closure) => match closure.fn_decl.output {
2568                FnRetTy::DefaultReturn(_) => ExprPrecedence::Jump,
2569                FnRetTy::Return(_) => prefix_attrs_precedence(),
2570            },
2571
2572            ExprKind::Break(..)
2573            | ExprKind::Ret(..)
2574            | ExprKind::Yield(..)
2575            | ExprKind::Become(..) => ExprPrecedence::Jump,
2576
2577            // Binop-like expr kinds, handled by `AssocOp`.
2578            ExprKind::Binary(op, ..) => op.node.precedence(),
2579            ExprKind::Cast(..) => ExprPrecedence::Cast,
2580
2581            ExprKind::Assign(..) | ExprKind::AssignOp(..) => ExprPrecedence::Assign,
2582
2583            // Unary, prefix
2584            ExprKind::AddrOf(..) => ExprPrecedence::Prefix,
2585
2586            // Here `let pats = expr` has `let pats =` as a "unary" prefix of `expr`.
2587            // However, this is not exactly right. When `let _ = a` is the LHS of a binop we
2588            // need parens sometimes. E.g. we can print `(let _ = a) && b` as `let _ = a && b`
2589            // but we need to print `(let _ = a) < b` as-is with parens.
2590            ExprKind::Let(..) | ExprKind::Unary(..) => ExprPrecedence::Prefix,
2591
2592            // Need parens if and only if there are prefix attributes.
2593            ExprKind::Array(_)
2594            | ExprKind::Block(..)
2595            | ExprKind::Call(..)
2596            | ExprKind::ConstBlock(_)
2597            | ExprKind::Continue(..)
2598            | ExprKind::Field(..)
2599            | ExprKind::If(..)
2600            | ExprKind::Index(..)
2601            | ExprKind::InlineAsm(..)
2602            | ExprKind::Lit(_)
2603            | ExprKind::Loop(..)
2604            | ExprKind::Match(..)
2605            | ExprKind::MethodCall(..)
2606            | ExprKind::OffsetOf(..)
2607            | ExprKind::Path(..)
2608            | ExprKind::Repeat(..)
2609            | ExprKind::Struct(..)
2610            | ExprKind::Tup(_)
2611            | ExprKind::Type(..)
2612            | ExprKind::UnsafeBinderCast(..)
2613            | ExprKind::Use(..)
2614            | ExprKind::Err(_) => prefix_attrs_precedence(),
2615
2616            ExprKind::DropTemps(expr, ..) => expr.precedence(has_attr),
2617        }
2618    }
2619
2620    /// Whether this looks like a place expr, without checking for deref
2621    /// adjustments.
2622    /// This will return `true` in some potentially surprising cases such as
2623    /// `CONSTANT.field`.
2624    pub fn is_syntactic_place_expr(&self) -> bool {
2625        self.is_place_expr(|_| true)
2626    }
2627
2628    /// Whether this is a place expression.
2629    ///
2630    /// `allow_projections_from` should return `true` if indexing a field or index expression based
2631    /// on the given expression should be considered a place expression.
2632    pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
2633        match self.kind {
2634            ExprKind::Path(QPath::Resolved(_, ref path)) => {
2635                #[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)
2636            }
2637
2638            // Type ascription inherits its place expression kind from its
2639            // operand. See:
2640            // https://github.com/rust-lang/rfcs/blob/master/text/0803-type-ascription.md#type-ascription-and-temporaries
2641            ExprKind::Type(ref e, _) => e.is_place_expr(allow_projections_from),
2642
2643            // Unsafe binder cast preserves place-ness of the sub-expression.
2644            ExprKind::UnsafeBinderCast(_, e, _) => e.is_place_expr(allow_projections_from),
2645
2646            ExprKind::Unary(UnOp::Deref, _) => true,
2647
2648            ExprKind::Field(ref base, _) | ExprKind::Index(ref base, _, _) => {
2649                allow_projections_from(base) || base.is_place_expr(allow_projections_from)
2650            }
2651
2652            // Suppress errors for bad expressions.
2653            ExprKind::Err(_guar)
2654            | ExprKind::Let(&LetExpr { recovered: ast::Recovered::Yes(_guar), .. }) => true,
2655
2656            // Partially qualified paths in expressions can only legally
2657            // refer to associated items which are always rvalues.
2658            ExprKind::Path(QPath::TypeRelative(..))
2659            | ExprKind::Call(..)
2660            | ExprKind::MethodCall(..)
2661            | ExprKind::Use(..)
2662            | ExprKind::Struct(..)
2663            | ExprKind::Tup(..)
2664            | ExprKind::If(..)
2665            | ExprKind::Match(..)
2666            | ExprKind::Closure { .. }
2667            | ExprKind::Block(..)
2668            | ExprKind::Repeat(..)
2669            | ExprKind::Array(..)
2670            | ExprKind::Break(..)
2671            | ExprKind::Continue(..)
2672            | ExprKind::Ret(..)
2673            | ExprKind::Become(..)
2674            | ExprKind::Let(..)
2675            | ExprKind::Loop(..)
2676            | ExprKind::Assign(..)
2677            | ExprKind::InlineAsm(..)
2678            | ExprKind::OffsetOf(..)
2679            | ExprKind::AssignOp(..)
2680            | ExprKind::Lit(_)
2681            | ExprKind::ConstBlock(..)
2682            | ExprKind::Unary(..)
2683            | ExprKind::AddrOf(..)
2684            | ExprKind::Binary(..)
2685            | ExprKind::Yield(..)
2686            | ExprKind::Cast(..)
2687            | ExprKind::DropTemps(..) => false,
2688        }
2689    }
2690
2691    /// If this is a desugared range expression,
2692    /// returns the span of the range without desugaring context.
2693    pub fn range_span(&self) -> Option<Span> {
2694        is_range_literal(self).then(|| self.span.parent_callsite().unwrap())
2695    }
2696
2697    /// Check if expression is an integer literal that can be used
2698    /// where `usize` is expected.
2699    pub fn is_size_lit(&self) -> bool {
2700        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    ExprKind::Lit(Lit {
        node: LitKind::Int(_,
            LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)), ..
        }) => true,
    _ => false,
}matches!(
2701            self.kind,
2702            ExprKind::Lit(Lit {
2703                node: LitKind::Int(_, LitIntType::Unsuffixed | LitIntType::Unsigned(UintTy::Usize)),
2704                ..
2705            })
2706        )
2707    }
2708
2709    /// If `Self.kind` is `ExprKind::DropTemps(expr)`, drill down until we get a non-`DropTemps`
2710    /// `Expr`. This is used in suggestions to ignore this `ExprKind` as it is semantically
2711    /// silent, only signaling the ownership system. By doing this, suggestions that check the
2712    /// `ExprKind` of any given `Expr` for presentation don't have to care about `DropTemps`
2713    /// beyond remembering to call this function before doing analysis on it.
2714    pub fn peel_drop_temps(&self) -> &Self {
2715        let mut expr = self;
2716        while let ExprKind::DropTemps(inner) = &expr.kind {
2717            expr = inner;
2718        }
2719        expr
2720    }
2721
2722    pub fn peel_blocks(&self) -> &Self {
2723        let mut expr = self;
2724        while let ExprKind::Block(Block { expr: Some(inner), .. }, _) = &expr.kind {
2725            expr = inner;
2726        }
2727        expr
2728    }
2729
2730    pub fn peel_borrows(&self) -> &Self {
2731        let mut expr = self;
2732        while let ExprKind::AddrOf(.., inner) = &expr.kind {
2733            expr = inner;
2734        }
2735        expr
2736    }
2737
2738    pub fn can_have_side_effects(&self) -> bool {
2739        match self.peel_drop_temps().kind {
2740            ExprKind::Path(_) | ExprKind::Lit(_) | ExprKind::OffsetOf(..) | ExprKind::Use(..) => {
2741                false
2742            }
2743            ExprKind::Type(base, _)
2744            | ExprKind::Unary(_, base)
2745            | ExprKind::Field(base, _)
2746            | ExprKind::Index(base, _, _)
2747            | ExprKind::AddrOf(.., base)
2748            | ExprKind::Cast(base, _)
2749            | ExprKind::UnsafeBinderCast(_, base, _) => {
2750                // This isn't exactly true for `Index` and all `Unary`, but we are using this
2751                // method exclusively for diagnostics and there's a *cultural* pressure against
2752                // them being used only for its side-effects.
2753                base.can_have_side_effects()
2754            }
2755            ExprKind::Binary(_, lhs, rhs) => {
2756                // This isn't exactly true for all `Binary`, but we are using this
2757                // method exclusively for diagnostics and there's a *cultural* pressure against
2758                // them being used only for its side-effects.
2759                lhs.can_have_side_effects() || rhs.can_have_side_effects()
2760            }
2761            ExprKind::Struct(_, fields, init) => {
2762                let init_side_effects = match init {
2763                    StructTailExpr::Base(init) => init.can_have_side_effects(),
2764                    StructTailExpr::DefaultFields(_)
2765                    | StructTailExpr::None
2766                    | StructTailExpr::NoneWithError(_) => false,
2767                };
2768                fields.iter().map(|field| field.expr).any(|e| e.can_have_side_effects())
2769                    || init_side_effects
2770            }
2771
2772            ExprKind::Array(args)
2773            | ExprKind::Tup(args)
2774            | ExprKind::Call(
2775                Expr {
2776                    kind:
2777                        ExprKind::Path(QPath::Resolved(
2778                            None,
2779                            Path { res: Res::Def(DefKind::Ctor(_, CtorKind::Fn), _), .. },
2780                        )),
2781                    ..
2782                },
2783                args,
2784            ) => args.iter().any(|arg| arg.can_have_side_effects()),
2785            ExprKind::Repeat(arg, _) => arg.can_have_side_effects(),
2786            ExprKind::If(..)
2787            | ExprKind::Match(..)
2788            | ExprKind::MethodCall(..)
2789            | ExprKind::Call(..)
2790            | ExprKind::Closure { .. }
2791            | ExprKind::Block(..)
2792            | ExprKind::Break(..)
2793            | ExprKind::Continue(..)
2794            | ExprKind::Ret(..)
2795            | ExprKind::Become(..)
2796            | ExprKind::Let(..)
2797            | ExprKind::Loop(..)
2798            | ExprKind::Assign(..)
2799            | ExprKind::InlineAsm(..)
2800            | ExprKind::AssignOp(..)
2801            | ExprKind::ConstBlock(..)
2802            | ExprKind::Yield(..)
2803            | ExprKind::DropTemps(..)
2804            | ExprKind::Err(_) => true,
2805        }
2806    }
2807
2808    /// To a first-order approximation, is this a pattern?
2809    pub fn is_approximately_pattern(&self) -> bool {
2810        match &self.kind {
2811            ExprKind::Array(_)
2812            | ExprKind::Call(..)
2813            | ExprKind::Tup(_)
2814            | ExprKind::Lit(_)
2815            | ExprKind::Path(_)
2816            | ExprKind::Struct(..) => true,
2817            _ => false,
2818        }
2819    }
2820
2821    /// Whether this and the `other` expression are the same for purposes of an indexing operation.
2822    ///
2823    /// This is only used for diagnostics to see if we have things like `foo[i]` where `foo` is
2824    /// borrowed multiple times with `i`.
2825    pub fn equivalent_for_indexing(&self, other: &Expr<'_>) -> bool {
2826        match (self.kind, other.kind) {
2827            (ExprKind::Lit(lit1), ExprKind::Lit(lit2)) => lit1.node == lit2.node,
2828            (
2829                ExprKind::Path(QPath::Resolved(None, path1)),
2830                ExprKind::Path(QPath::Resolved(None, path2)),
2831            ) => path1.res == path2.res,
2832            (
2833                ExprKind::Struct(
2834                    &QPath::Resolved(None, &Path { res: Res::Def(_, path1_def_id), .. }),
2835                    args1,
2836                    StructTailExpr::None,
2837                ),
2838                ExprKind::Struct(
2839                    &QPath::Resolved(None, &Path { res: Res::Def(_, path2_def_id), .. }),
2840                    args2,
2841                    StructTailExpr::None,
2842                ),
2843            ) => {
2844                path2_def_id == path1_def_id
2845                    && is_range_literal(self)
2846                    && is_range_literal(other)
2847                    && std::iter::zip(args1, args2)
2848                        .all(|(a, b)| a.expr.equivalent_for_indexing(b.expr))
2849            }
2850            _ => false,
2851        }
2852    }
2853
2854    pub fn method_ident(&self) -> Option<Ident> {
2855        match self.kind {
2856            ExprKind::MethodCall(receiver_method, ..) => Some(receiver_method.ident),
2857            ExprKind::Unary(_, expr) | ExprKind::AddrOf(.., expr) => expr.method_ident(),
2858            _ => None,
2859        }
2860    }
2861}
2862
2863/// Checks if the specified expression is a built-in range literal.
2864/// (See: `LoweringContext::lower_expr()`).
2865pub fn is_range_literal(expr: &Expr<'_>) -> bool {
2866    if let ExprKind::Struct(QPath::Resolved(None, path), _, StructTailExpr::None) = expr.kind
2867        && let [.., segment] = path.segments
2868        && let sym::RangeFrom
2869        | sym::RangeFull
2870        | sym::Range
2871        | sym::RangeToInclusive
2872        | sym::RangeTo
2873        | sym::RangeFromCopy
2874        | sym::RangeCopy
2875        | sym::RangeInclusiveCopy
2876        | sym::RangeToInclusiveCopy = segment.ident.name
2877        && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2878    {
2879        true
2880    } else if let ExprKind::Call(func, _) = &expr.kind
2881        && let ExprKind::Path(QPath::Resolved(None, path)) = func.kind
2882        && let [.., segment] = path.segments
2883        && let sym::range_inclusive_new = segment.ident.name
2884        && expr.span.is_desugaring(DesugaringKind::RangeExpr)
2885    {
2886        true
2887    } else {
2888        false
2889    }
2890}
2891
2892/// Checks if the specified expression needs parentheses for prefix
2893/// or postfix suggestions to be valid.
2894/// For example, `a + b` requires parentheses to suggest `&(a + b)`,
2895/// but just `a` does not.
2896/// Similarly, `(a + b).c()` also requires parentheses.
2897/// This should not be used for other types of suggestions.
2898pub fn expr_needs_parens(expr: &Expr<'_>) -> bool {
2899    match expr.kind {
2900        // parenthesize if needed (Issue #46756)
2901        ExprKind::Cast(_, _) | ExprKind::Binary(_, _, _) => true,
2902        // parenthesize borrows of range literals (Issue #54505)
2903        _ if is_range_literal(expr) => true,
2904        _ => false,
2905    }
2906}
2907
2908#[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> ::rustc_data_structures::stable_hash::StableHash for
            ExprKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ExprKind::ConstBlock(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Array(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Call(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::MethodCall(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Tup(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Binary(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Unary(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Lit(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Cast(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Type(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::DropTemps(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Let(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::If(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Loop(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Match(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Closure(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Block(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Assign(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::AssignOp(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Field(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Index(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Path(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::AddrOf(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Break(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Continue(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Ret(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Become(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::InlineAsm(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::OffsetOf(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Repeat(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Yield(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::UnsafeBinderCast(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ExprKind::Err(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
2909pub enum ExprKind<'hir> {
2910    /// Allow anonymous constants from an inline `const` block
2911    ConstBlock(ConstBlock),
2912    /// An array (e.g., `[a, b, c, d]`).
2913    Array(&'hir [Expr<'hir>]),
2914    /// A function call.
2915    ///
2916    /// The first field resolves to the function itself (usually an `ExprKind::Path`),
2917    /// and the second field is the list of arguments.
2918    /// This also represents calling the constructor of
2919    /// tuple-like ADTs such as tuple structs and enum variants.
2920    Call(&'hir Expr<'hir>, &'hir [Expr<'hir>]),
2921    /// A method call (e.g., `x.foo::<'static, Bar, Baz>(a, b, c, d)`).
2922    ///
2923    /// The `PathSegment` represents the method name and its generic arguments
2924    /// (within the angle brackets).
2925    /// The `&Expr` is the expression that evaluates
2926    /// to the object on which the method is being called on (the receiver),
2927    /// and the `&[Expr]` is the rest of the arguments.
2928    /// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
2929    /// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, x, [a, b, c, d], span)`.
2930    /// The final `Span` represents the span of the function and arguments
2931    /// (e.g. `foo::<Bar, Baz>(a, b, c, d)` in `x.foo::<Bar, Baz>(a, b, c, d)`
2932    ///
2933    /// To resolve the called method to a `DefId`, call [`type_dependent_def_id`] with
2934    /// the `hir_id` of the `MethodCall` node itself.
2935    ///
2936    /// [`type_dependent_def_id`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.type_dependent_def_id
2937    MethodCall(&'hir PathSegment<'hir>, &'hir Expr<'hir>, &'hir [Expr<'hir>], Span),
2938    /// An use expression (e.g., `var.use`).
2939    Use(&'hir Expr<'hir>, Span),
2940    /// A tuple (e.g., `(a, b, c, d)`).
2941    Tup(&'hir [Expr<'hir>]),
2942    /// A binary operation (e.g., `a + b`, `a * b`).
2943    Binary(BinOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2944    /// A unary operation (e.g., `!x`, `*x`).
2945    Unary(UnOp, &'hir Expr<'hir>),
2946    /// A literal (e.g., `1`, `"foo"`).
2947    Lit(Lit),
2948    /// A cast (e.g., `foo as f64`).
2949    Cast(&'hir Expr<'hir>, &'hir Ty<'hir>),
2950    /// A type ascription (e.g., `x: Foo`). See RFC 3307.
2951    Type(&'hir Expr<'hir>, &'hir Ty<'hir>),
2952    /// Wraps the expression in a terminating scope.
2953    /// This makes it semantically equivalent to `{ let _t = expr; _t }`.
2954    ///
2955    /// This construct only exists to tweak the drop order in AST lowering.
2956    /// An example of that is the desugaring of `for` loops.
2957    DropTemps(&'hir Expr<'hir>),
2958    /// A `let $pat = $expr` expression.
2959    ///
2960    /// These are not [`LetStmt`] and only occur as expressions.
2961    /// The `let Some(x) = foo()` in `if let Some(x) = foo()` is an example of `Let(..)`.
2962    Let(&'hir LetExpr<'hir>),
2963    /// An `if` block, with an optional else block.
2964    ///
2965    /// I.e., `if <expr> { <expr> } else { <expr> }`.
2966    ///
2967    /// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
2968    /// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
2969    /// Note that using an `Expr` instead of a `Block` for the "then" part is intentional,
2970    /// as it simplifies the type coercion machinery.
2971    If(&'hir Expr<'hir>, &'hir Expr<'hir>, Option<&'hir Expr<'hir>>),
2972    /// A conditionless loop (can be exited with `break`, `continue`, or `return`).
2973    ///
2974    /// I.e., `'label: loop { <block> }`.
2975    ///
2976    /// The `Span` is the loop header (`for x in y`/`while let pat = expr`).
2977    Loop(&'hir Block<'hir>, Option<Label>, LoopSource, Span),
2978    /// A `match` block, with a source that indicates whether or not it is
2979    /// the result of a desugaring, and if so, which kind.
2980    Match(&'hir Expr<'hir>, &'hir [Arm<'hir>], MatchSource),
2981    /// A closure (e.g., `move |a, b, c| {a + b + c}`).
2982    ///
2983    /// The `Span` is the argument block `|...|`.
2984    ///
2985    /// This may also be a coroutine literal or an `async block` as indicated by the
2986    /// `Option<Movability>`.
2987    Closure(&'hir Closure<'hir>),
2988    /// A block (e.g., `'label: { ... }`).
2989    Block(&'hir Block<'hir>, Option<Label>),
2990
2991    /// An assignment (e.g., `a = foo()`).
2992    Assign(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
2993    /// An assignment with an operator.
2994    ///
2995    /// E.g., `a += 1`.
2996    AssignOp(AssignOp, &'hir Expr<'hir>, &'hir Expr<'hir>),
2997    /// Access of a named (e.g., `obj.foo`) or unnamed (e.g., `obj.0`) struct or tuple field.
2998    Field(&'hir Expr<'hir>, Ident),
2999    /// An indexing operation (`foo[2]`).
3000    /// Similar to [`ExprKind::MethodCall`], the final `Span` represents the span of the brackets
3001    /// and index.
3002    Index(&'hir Expr<'hir>, &'hir Expr<'hir>, Span),
3003
3004    /// Path to a definition, possibly containing lifetime or type parameters.
3005    Path(QPath<'hir>),
3006
3007    /// A referencing operation (i.e., `&a` or `&mut a`).
3008    AddrOf(BorrowKind, Mutability, &'hir Expr<'hir>),
3009    /// A `break`, with an optional label to break.
3010    Break(Destination, Option<&'hir Expr<'hir>>),
3011    /// A `continue`, with an optional label.
3012    Continue(Destination),
3013    /// A `return`, with an optional value to be returned.
3014    Ret(Option<&'hir Expr<'hir>>),
3015    /// A `become`, with the value to be returned.
3016    Become(&'hir Expr<'hir>),
3017
3018    /// Inline assembly (from `asm!`), with its outputs and inputs.
3019    InlineAsm(&'hir InlineAsm<'hir>),
3020
3021    /// Field offset (`offset_of!`)
3022    OffsetOf(&'hir Ty<'hir>, &'hir [Ident]),
3023
3024    /// A struct or struct-like variant literal expression.
3025    ///
3026    /// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`,
3027    /// where `base` is the `Option<Expr>`.
3028    Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], StructTailExpr<'hir>),
3029
3030    /// An array literal constructed from one repeated element.
3031    ///
3032    /// E.g., `[1; 5]`. The first expression is the element
3033    /// to be repeated; the second is the number of times to repeat it.
3034    Repeat(&'hir Expr<'hir>, &'hir ConstArg<'hir>),
3035
3036    /// A suspension point for coroutines (i.e., `yield <expr>`).
3037    Yield(&'hir Expr<'hir>, YieldSource),
3038
3039    /// Operators which can be used to interconvert `unsafe` binder types.
3040    /// e.g. `unsafe<'a> &'a i32` <=> `&i32`.
3041    UnsafeBinderCast(UnsafeBinderCastKind, &'hir Expr<'hir>, Option<&'hir Ty<'hir>>),
3042
3043    /// A placeholder for an expression that wasn't syntactically well formed in some way.
3044    Err(rustc_span::ErrorGuaranteed),
3045}
3046
3047#[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> ::rustc_data_structures::stable_hash::StableHash for
            StructTailExpr<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    StructTailExpr::None => {}
                    StructTailExpr::Base(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    StructTailExpr::DefaultFields(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    StructTailExpr::NoneWithError(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3048pub enum StructTailExpr<'hir> {
3049    /// A struct expression where all the fields are explicitly enumerated: `Foo { a, b }`.
3050    None,
3051    /// A struct expression with a "base", an expression of the same type as the outer struct that
3052    /// will be used to populate any fields not explicitly mentioned: `Foo { ..base }`
3053    Base(&'hir Expr<'hir>),
3054    /// A struct expression with a `..` tail but no "base" expression. The values from the struct
3055    /// fields' default values will be used to populate any fields not explicitly mentioned:
3056    /// `Foo { .. }`.
3057    DefaultFields(Span),
3058    /// No trailing `..` was written, and also, a parse error occurred inside the struct braces.
3059    ///
3060    /// This struct should be treated similarly to as if it had an `..` in it,
3061    /// in particular rather than reporting missing fields, because the parse error
3062    /// makes which fields the struct was intended to have not fully known.
3063    NoneWithError(ErrorGuaranteed),
3064}
3065
3066/// Represents an optionally `Self`-qualified value/type path or associated extension.
3067///
3068/// To resolve the path to a `DefId`, call [`qpath_res`].
3069///
3070/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res
3071#[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> ::rustc_data_structures::stable_hash::StableHash for
            QPath<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    QPath::Resolved(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    QPath::TypeRelative(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3072pub enum QPath<'hir> {
3073    /// Path to a definition, optionally "fully-qualified" with a `Self`
3074    /// type, if the path points to an associated item in a trait.
3075    ///
3076    /// E.g., an unqualified path like `Clone::clone` has `None` for `Self`,
3077    /// while `<Vec<T> as Clone>::clone` has `Some(Vec<T>)` for `Self`,
3078    /// even though they both have the same two-segment `Clone::clone` `Path`.
3079    Resolved(Option<&'hir Ty<'hir>>, &'hir Path<'hir>),
3080
3081    /// Type-related paths (e.g., `<T>::default` or `<T>::Output`).
3082    /// Will be resolved by type-checking to an associated item.
3083    ///
3084    /// UFCS source paths can desugar into this, with `Vec::new` turning into
3085    /// `<Vec>::new`, and `T::X::Y::method` into `<<<T>::X>::Y>::method`,
3086    /// the `X` and `Y` nodes each being a `TyKind::Path(QPath::TypeRelative(..))`.
3087    TypeRelative(&'hir Ty<'hir>, &'hir PathSegment<'hir>),
3088}
3089
3090impl<'hir> QPath<'hir> {
3091    /// Returns the span of this `QPath`.
3092    pub fn span(&self) -> Span {
3093        match *self {
3094            QPath::Resolved(_, path) => path.span,
3095            QPath::TypeRelative(qself, ps) => qself.span.to(ps.ident.span),
3096        }
3097    }
3098
3099    /// Returns the span of the qself of this `QPath`. For example, `()` in
3100    /// `<() as Trait>::method`.
3101    pub fn qself_span(&self) -> Span {
3102        match *self {
3103            QPath::Resolved(_, path) => path.span,
3104            QPath::TypeRelative(qself, _) => qself.span,
3105        }
3106    }
3107}
3108
3109/// Hints at the original code for a let statement.
3110#[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 ::rustc_data_structures::stable_hash::StableHash for LocalSource
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LocalSource::Normal => {}
                    LocalSource::AsyncFn => {}
                    LocalSource::AwaitDesugar => {}
                    LocalSource::AssignDesugar => {}
                    LocalSource::Contract => {}
                }
            }
        }
    };StableHash)]
3111pub enum LocalSource {
3112    /// A `match _ { .. }`.
3113    Normal,
3114    /// When lowering async functions, we create locals within the `async move` so that
3115    /// all parameters are dropped after the future is polled.
3116    ///
3117    /// ```ignore (pseudo-Rust)
3118    /// async fn foo(<pattern> @ x: Type) {
3119    ///     async move {
3120    ///         let <pattern> = x;
3121    ///     }
3122    /// }
3123    /// ```
3124    AsyncFn,
3125    /// A desugared `<expr>.await`.
3126    AwaitDesugar,
3127    /// A desugared `expr = expr`, where the LHS is a tuple, struct, array or underscore expression.
3128    AssignDesugar,
3129    /// A contract `#[ensures(..)]` attribute injects a let binding for the check that runs at point of return.
3130    Contract,
3131}
3132
3133/// Hints at the original code for a `match _ { .. }`.
3134#[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 ::rustc_data_structures::stable_hash::StableHash for MatchSource
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MatchSource::Normal => {}
                    MatchSource::Postfix => {}
                    MatchSource::ForLoopDesugar => {}
                    MatchSource::TryDesugar(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    MatchSource::AwaitDesugar => {}
                    MatchSource::FormatArgs => {}
                }
            }
        }
    };StableHash, 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)]
3135pub enum MatchSource {
3136    /// A `match _ { .. }`.
3137    Normal,
3138    /// A `expr.match { .. }`.
3139    Postfix,
3140    /// A desugared `for _ in _ { .. }` loop.
3141    ForLoopDesugar,
3142    /// A desugared `?` operator.
3143    TryDesugar(HirId),
3144    /// A desugared `<expr>.await`.
3145    AwaitDesugar,
3146    /// A desugared `format_args!()`.
3147    FormatArgs,
3148}
3149
3150impl MatchSource {
3151    #[inline]
3152    pub const fn name(self) -> &'static str {
3153        use MatchSource::*;
3154        match self {
3155            Normal => "match",
3156            Postfix => ".match",
3157            ForLoopDesugar => "for",
3158            TryDesugar(_) => "?",
3159            AwaitDesugar => ".await",
3160            FormatArgs => "format_args!()",
3161        }
3162    }
3163}
3164
3165/// The loop type that yielded an `ExprKind::Loop`.
3166#[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 ::rustc_data_structures::stable_hash::StableHash for LoopSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LoopSource::Loop => {}
                    LoopSource::While => {}
                    LoopSource::ForLoop => {}
                }
            }
        }
    };StableHash)]
3167pub enum LoopSource {
3168    /// A `loop { .. }` loop.
3169    Loop,
3170    /// A `while _ { .. }` loop.
3171    While,
3172    /// A `for _ in _ { .. }` loop.
3173    ForLoop,
3174}
3175
3176impl LoopSource {
3177    pub fn name(self) -> &'static str {
3178        match self {
3179            LoopSource::Loop => "loop",
3180            LoopSource::While => "while",
3181            LoopSource::ForLoop => "for",
3182        }
3183    }
3184}
3185
3186#[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 ::rustc_data_structures::stable_hash::StableHash for LoopIdError
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    LoopIdError::OutsideLoopScope => {}
                    LoopIdError::UnlabeledCfInWhileCondition => {}
                    LoopIdError::UnresolvedLabel => {}
                }
            }
        }
    };StableHash)]
3187pub enum LoopIdError {
3188    OutsideLoopScope,
3189    UnlabeledCfInWhileCondition,
3190    UnresolvedLabel,
3191}
3192
3193impl fmt::Display for LoopIdError {
3194    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3195        f.write_str(match self {
3196            LoopIdError::OutsideLoopScope => "not inside loop scope",
3197            LoopIdError::UnlabeledCfInWhileCondition => {
3198                "unlabeled control flow (break or continue) in while condition"
3199            }
3200            LoopIdError::UnresolvedLabel => "label not found",
3201        })
3202    }
3203}
3204
3205#[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 ::rustc_data_structures::stable_hash::StableHash for Destination
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Destination {
                        label: ref __binding_0, target_id: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3206pub struct Destination {
3207    /// This is `Some(_)` iff there is an explicit user-specified 'label
3208    pub label: Option<Label>,
3209
3210    /// These errors are caught and then reported during the diagnostics pass in
3211    /// `librustc_passes/loops.rs`
3212    pub target_id: Result<HirId, LoopIdError>,
3213}
3214
3215/// The yield kind that caused an `ExprKind::Yield`.
3216#[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 ::rustc_data_structures::stable_hash::StableHash for YieldSource
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    YieldSource::Await { expr: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    YieldSource::Yield => {}
                }
            }
        }
    };StableHash)]
3217pub enum YieldSource {
3218    /// An `<expr>.await`.
3219    Await { expr: Option<HirId> },
3220    /// A plain `yield`.
3221    Yield,
3222}
3223
3224impl fmt::Display for YieldSource {
3225    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3226        f.write_str(match self {
3227            YieldSource::Await { .. } => "`await`",
3228            YieldSource::Yield => "`yield`",
3229        })
3230    }
3231}
3232
3233// N.B., if you change this, you'll probably want to change the corresponding
3234// type structure in middle/ty.rs as well.
3235#[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> ::rustc_data_structures::stable_hash::StableHash for
            MutTy<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    MutTy { ty: ref __binding_0, mutbl: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3236pub struct MutTy<'hir> {
3237    pub ty: &'hir Ty<'hir>,
3238    pub mutbl: Mutability,
3239}
3240
3241/// Represents a function's signature in a trait declaration,
3242/// trait implementation, or a free function.
3243#[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> ::rustc_data_structures::stable_hash::StableHash for
            FnSig<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    FnSig {
                        header: ref __binding_0,
                        decl: ref __binding_1,
                        span: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3244pub struct FnSig<'hir> {
3245    pub header: FnHeader,
3246    pub decl: &'hir FnDecl<'hir>,
3247    pub span: Span,
3248}
3249
3250// The bodies for items are stored "out of line", in a separate
3251// hashmap in the `Crate`. Here we just record the hir-id of the item
3252// so it can fetched later.
3253#[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 ::rustc_data_structures::stable_hash::StableHash for TraitItemId
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TraitItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3254pub struct TraitItemId {
3255    pub owner_id: OwnerId,
3256}
3257
3258impl TraitItemId {
3259    #[inline]
3260    pub fn hir_id(&self) -> HirId {
3261        // Items are always HIR owners.
3262        HirId::make_owner(self.owner_id.def_id)
3263    }
3264}
3265
3266/// Represents an item declaration within a trait declaration,
3267/// possibly including a default implementation. A trait item is
3268/// either required (meaning it doesn't have an implementation, just a
3269/// signature) or provided (meaning it has a default implementation).
3270#[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> ::rustc_data_structures::stable_hash::StableHash for
            TraitItem<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3271pub struct TraitItem<'hir> {
3272    pub ident: Ident,
3273    pub owner_id: OwnerId,
3274    pub generics: &'hir Generics<'hir>,
3275    pub kind: TraitItemKind<'hir>,
3276    pub span: Span,
3277    pub defaultness: Defaultness,
3278    pub has_delayed_lints: bool,
3279}
3280
3281macro_rules! expect_methods_self_kind {
3282    ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3283        $(
3284            #[track_caller]
3285            pub fn $name(&self) -> $ret_ty {
3286                let $pat = &self.kind else { expect_failed(stringify!($name), self) };
3287                $ret_val
3288            }
3289        )*
3290    }
3291}
3292
3293macro_rules! expect_methods_self {
3294    ( $( $name:ident, $ret_ty:ty, $pat:pat, $ret_val:expr; )* ) => {
3295        $(
3296            #[track_caller]
3297            pub fn $name(&self) -> $ret_ty {
3298                let $pat = self else { expect_failed(stringify!($name), self) };
3299                $ret_val
3300            }
3301        )*
3302    }
3303}
3304
3305#[track_caller]
3306fn expect_failed<T: fmt::Debug>(ident: &'static str, found: T) -> ! {
3307    {
    ::core::panicking::panic_fmt(format_args!("{0}: found {1:?}", ident,
            found));
}panic!("{ident}: found {found:?}")
3308}
3309
3310impl<'hir> TraitItem<'hir> {
3311    #[inline]
3312    pub fn hir_id(&self) -> HirId {
3313        // Items are always HIR owners.
3314        HirId::make_owner(self.owner_id.def_id)
3315    }
3316
3317    pub fn trait_item_id(&self) -> TraitItemId {
3318        TraitItemId { owner_id: self.owner_id }
3319    }
3320
3321    #[track_caller]
pub fn expect_type(&self) -> (GenericBounds<'hir>, Option<&'hir Ty<'hir>>) {
    let TraitItemKind::Type(bounds, ty) =
        &self.kind else { expect_failed("expect_type", self) };
    (bounds, *ty)
}expect_methods_self_kind! {
3322        expect_const, (&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3323            TraitItemKind::Const(ty, rhs), (ty, *rhs);
3324
3325        expect_fn, (&FnSig<'hir>, &TraitFn<'hir>),
3326            TraitItemKind::Fn(ty, trfn), (ty, trfn);
3327
3328        expect_type, (GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3329            TraitItemKind::Type(bounds, ty), (bounds, *ty);
3330    }
3331}
3332
3333/// Represents a trait method's body (or just argument names).
3334#[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> ::rustc_data_structures::stable_hash::StableHash for
            TraitFn<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    TraitFn::Required(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TraitFn::Provided(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3335pub enum TraitFn<'hir> {
3336    /// No default body in the trait, just a signature.
3337    Required(&'hir [Option<Ident>]),
3338
3339    /// Both signature and body are provided in the trait.
3340    Provided(BodyId),
3341}
3342
3343/// Represents a trait method or associated constant or type
3344#[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) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Const",
                    __self_0, &__self_1),
            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<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> ::rustc_data_structures::stable_hash::StableHash for
            TraitItemKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    TraitItemKind::Const(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TraitItemKind::Fn(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TraitItemKind::Type(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3345pub enum TraitItemKind<'hir> {
3346    /// An associated constant with an optional value (otherwise `impl`s must contain a value).
3347    Const(&'hir Ty<'hir>, Option<ConstItemRhs<'hir>>),
3348    /// An associated function with an optional body.
3349    Fn(FnSig<'hir>, TraitFn<'hir>),
3350    /// An associated type with (possibly empty) bounds and optional concrete
3351    /// type.
3352    Type(GenericBounds<'hir>, Option<&'hir Ty<'hir>>),
3353}
3354
3355// The bodies for items are stored "out of line", in a separate
3356// hashmap in the `Crate`. Here we just record the hir-id of the item
3357// so it can fetched later.
3358#[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 ::rustc_data_structures::stable_hash::StableHash for ImplItemId {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ImplItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3359pub struct ImplItemId {
3360    pub owner_id: OwnerId,
3361}
3362
3363impl ImplItemId {
3364    #[inline]
3365    pub fn hir_id(&self) -> HirId {
3366        // Items are always HIR owners.
3367        HirId::make_owner(self.owner_id.def_id)
3368    }
3369}
3370
3371/// Represents an associated item within an impl block.
3372///
3373/// Refer to [`Impl`] for an impl block declaration.
3374#[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> ::rustc_data_structures::stable_hash::StableHash for
            ImplItem<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3375pub struct ImplItem<'hir> {
3376    pub ident: Ident,
3377    pub owner_id: OwnerId,
3378    pub generics: &'hir Generics<'hir>,
3379    pub kind: ImplItemKind<'hir>,
3380    pub impl_kind: ImplItemImplKind,
3381    pub span: Span,
3382    pub has_delayed_lints: bool,
3383}
3384
3385#[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 ::rustc_data_structures::stable_hash::StableHash for
            ImplItemImplKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ImplItemImplKind::Inherent { vis_span: ref __binding_0 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ImplItemImplKind::Trait {
                        defaultness: ref __binding_0,
                        trait_item_def_id: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3386pub enum ImplItemImplKind {
3387    Inherent {
3388        vis_span: Span,
3389    },
3390    Trait {
3391        defaultness: Defaultness,
3392        /// Item in the trait that this item implements
3393        trait_item_def_id: Result<DefId, ErrorGuaranteed>,
3394    },
3395}
3396
3397impl<'hir> ImplItem<'hir> {
3398    #[inline]
3399    pub fn hir_id(&self) -> HirId {
3400        // Items are always HIR owners.
3401        HirId::make_owner(self.owner_id.def_id)
3402    }
3403
3404    pub fn impl_item_id(&self) -> ImplItemId {
3405        ImplItemId { owner_id: self.owner_id }
3406    }
3407
3408    pub fn vis_span(&self) -> Option<Span> {
3409        match self.impl_kind {
3410            ImplItemImplKind::Trait { .. } => None,
3411            ImplItemImplKind::Inherent { vis_span, .. } => Some(vis_span),
3412        }
3413    }
3414
3415    #[track_caller]
pub fn expect_type(&self) -> &'hir Ty<'hir> {
    let ImplItemKind::Type(ty) =
        &self.kind else { expect_failed("expect_type", self) };
    ty
}expect_methods_self_kind! {
3416        expect_const, (&'hir Ty<'hir>, ConstItemRhs<'hir>), ImplItemKind::Const(ty, rhs), (ty, *rhs);
3417        expect_fn,    (&FnSig<'hir>, BodyId),               ImplItemKind::Fn(ty, body),   (ty, *body);
3418        expect_type,  &'hir Ty<'hir>,                       ImplItemKind::Type(ty),       ty;
3419    }
3420}
3421
3422/// Represents various kinds of content within an `impl`.
3423#[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> ::rustc_data_structures::stable_hash::StableHash for
            ImplItemKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ImplItemKind::Const(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ImplItemKind::Fn(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ImplItemKind::Type(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3424pub enum ImplItemKind<'hir> {
3425    /// An associated constant of the given type, set to the constant result
3426    /// of the expression.
3427    Const(&'hir Ty<'hir>, ConstItemRhs<'hir>),
3428    /// An associated function implementation with the given signature and body.
3429    Fn(FnSig<'hir>, BodyId),
3430    /// An associated type.
3431    Type(&'hir Ty<'hir>),
3432}
3433
3434/// A constraint on an associated item.
3435///
3436/// ### Examples
3437///
3438/// * the `A = Ty` and `B = Ty` in `Trait<A = Ty, B = Ty>`
3439/// * the `G<Ty> = Ty` in `Trait<G<Ty> = Ty>`
3440/// * the `A: Bound` in `Trait<A: Bound>`
3441/// * the `RetTy` in `Trait(ArgTy, ArgTy) -> RetTy`
3442/// * the `C = { Ct }` in `Trait<C = { Ct }>` (feature `min_generic_const_args`)
3443/// * the `f(..): Bound` in `Trait<f(..): Bound>` (feature `return_type_notation`)
3444#[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> ::rustc_data_structures::stable_hash::StableHash for
            AssocItemConstraint<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3445pub struct AssocItemConstraint<'hir> {
3446    #[stable_hash(ignore)]
3447    pub hir_id: HirId,
3448    pub ident: Ident,
3449    pub gen_args: &'hir GenericArgs<'hir>,
3450    pub kind: AssocItemConstraintKind<'hir>,
3451    pub span: Span,
3452}
3453
3454impl<'hir> AssocItemConstraint<'hir> {
3455    /// Obtain the type on the RHS of an assoc ty equality constraint if applicable.
3456    pub fn ty(self) -> Option<&'hir Ty<'hir>> {
3457        match self.kind {
3458            AssocItemConstraintKind::Equality { term: Term::Ty(ty) } => Some(ty),
3459            _ => None,
3460        }
3461    }
3462
3463    /// Obtain the const on the RHS of an assoc const equality constraint if applicable.
3464    pub fn ct(self) -> Option<&'hir ConstArg<'hir>> {
3465        match self.kind {
3466            AssocItemConstraintKind::Equality { term: Term::Const(ct) } => Some(ct),
3467            _ => None,
3468        }
3469    }
3470}
3471
3472#[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> ::rustc_data_structures::stable_hash::StableHash for
            Term<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Term::Ty(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Term::Const(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3473pub enum Term<'hir> {
3474    Ty(&'hir Ty<'hir>),
3475    Const(&'hir ConstArg<'hir>),
3476}
3477
3478impl<'hir> From<&'hir Ty<'hir>> for Term<'hir> {
3479    fn from(ty: &'hir Ty<'hir>) -> Self {
3480        Term::Ty(ty)
3481    }
3482}
3483
3484impl<'hir> From<&'hir ConstArg<'hir>> for Term<'hir> {
3485    fn from(c: &'hir ConstArg<'hir>) -> Self {
3486        Term::Const(c)
3487    }
3488}
3489
3490/// The kind of [associated item constraint][AssocItemConstraint].
3491#[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> ::rustc_data_structures::stable_hash::StableHash for
            AssocItemConstraintKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    AssocItemConstraintKind::Equality { term: ref __binding_0 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    AssocItemConstraintKind::Bound { bounds: ref __binding_0 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3492pub enum AssocItemConstraintKind<'hir> {
3493    /// An equality constraint for an associated item (e.g., `AssocTy = Ty` in `Trait<AssocTy = Ty>`).
3494    ///
3495    /// Also known as an *associated item binding* (we *bind* an associated item to a term).
3496    ///
3497    /// Furthermore, associated type equality constraints can also be referred to as *associated type
3498    /// bindings*. Similarly with associated const equality constraints and *associated const bindings*.
3499    Equality { term: Term<'hir> },
3500    /// A bound on an associated type (e.g., `AssocTy: Bound` in `Trait<AssocTy: Bound>`).
3501    Bound { bounds: &'hir [GenericBound<'hir>] },
3502}
3503
3504impl<'hir> AssocItemConstraintKind<'hir> {
3505    pub fn descr(&self) -> &'static str {
3506        match self {
3507            AssocItemConstraintKind::Equality { .. } => "binding",
3508            AssocItemConstraintKind::Bound { .. } => "constraint",
3509        }
3510    }
3511}
3512
3513/// An uninhabited enum used to make `Infer` variants on [`Ty`] and [`ConstArg`] be
3514/// unreachable. Zero-Variant enums are guaranteed to have the same layout as the never
3515/// type.
3516#[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 ::rustc_data_structures::stable_hash::StableHash for AmbigArg {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {}
            }
        }
    };StableHash)]
3517pub enum AmbigArg {}
3518
3519/// Represents a type in the `HIR`.
3520///
3521/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3522/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
3523#[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> ::rustc_data_structures::stable_hash::StableHash
            for Ty<'hir, Unambig> where
            Unambig: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Ty {
                        hir_id: ref __binding_0,
                        span: ref __binding_1,
                        kind: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3524#[repr(C)]
3525pub struct Ty<'hir, Unambig = ()> {
3526    #[stable_hash(ignore)]
3527    pub hir_id: HirId,
3528    pub span: Span,
3529    pub kind: TyKind<'hir, Unambig>,
3530}
3531
3532impl<'hir> Ty<'hir, AmbigArg> {
3533    /// Converts a `Ty` in an ambiguous position to one in an unambiguous position.
3534    ///
3535    /// Functions accepting an unambiguous types may expect the [`TyKind::Infer`] variant
3536    /// to be used. Care should be taken to separately handle infer types when calling this
3537    /// function as it cannot be handled by downstream code making use of the returned ty.
3538    ///
3539    /// In practice this may mean overriding the [`Visitor::visit_infer`][visit_infer] method on hir visitors, or
3540    /// specifically matching on [`GenericArg::Infer`] when handling generic arguments.
3541    ///
3542    /// [visit_infer]: [rustc_hir::intravisit::Visitor::visit_infer]
3543    pub fn as_unambig_ty(&self) -> &Ty<'hir> {
3544        // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is
3545        // the same across different ZST type arguments.
3546        let ptr = self as *const Ty<'hir, AmbigArg> as *const Ty<'hir, ()>;
3547        unsafe { &*ptr }
3548    }
3549}
3550
3551impl<'hir> Ty<'hir> {
3552    /// Converts a `Ty` in an unambiguous position to one in an ambiguous position. This is
3553    /// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions.
3554    ///
3555    /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if
3556    /// infer types are relevant to you then care should be taken to handle them separately.
3557    pub fn try_as_ambig_ty(&self) -> Option<&Ty<'hir, AmbigArg>> {
3558        if let TyKind::Infer(()) = self.kind {
3559            return None;
3560        }
3561
3562        // SAFETY: `Ty` is `repr(C)` and `TyKind` is marked `repr(u8)` so that the layout is
3563        // the same across different ZST type arguments. We also asserted that the `self` is
3564        // not a `TyKind::Infer` so there is no risk of transmuting a `()` to `AmbigArg`.
3565        let ptr = self as *const Ty<'hir> as *const Ty<'hir, AmbigArg>;
3566        Some(unsafe { &*ptr })
3567    }
3568}
3569
3570impl<'hir> Ty<'hir, AmbigArg> {
3571    pub fn peel_refs(&self) -> &Ty<'hir> {
3572        let mut final_ty = self.as_unambig_ty();
3573        while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3574            final_ty = ty;
3575        }
3576        final_ty
3577    }
3578}
3579
3580impl<'hir> Ty<'hir> {
3581    pub fn peel_refs(&self) -> &Self {
3582        let mut final_ty = self;
3583        while let TyKind::Ref(_, MutTy { ty, .. }) = &final_ty.kind {
3584            final_ty = ty;
3585        }
3586        final_ty
3587    }
3588
3589    /// Returns `true` if `param_def_id` matches the `bounded_ty` of this predicate.
3590    pub fn as_generic_param(&self) -> Option<(DefId, Ident)> {
3591        let TyKind::Path(QPath::Resolved(None, path)) = self.kind else {
3592            return None;
3593        };
3594        let [segment] = &path.segments else {
3595            return None;
3596        };
3597        match path.res {
3598            Res::Def(DefKind::TyParam, def_id) | Res::SelfTyParam { trait_: def_id } => {
3599                Some((def_id, segment.ident))
3600            }
3601            _ => None,
3602        }
3603    }
3604
3605    pub fn find_self_aliases(&self) -> Vec<Span> {
3606        use crate::intravisit::Visitor;
3607        struct MyVisitor(Vec<Span>);
3608        impl<'v> Visitor<'v> for MyVisitor {
3609            fn visit_ty(&mut self, t: &'v Ty<'v, AmbigArg>) {
3610                if #[allow(non_exhaustive_omitted_patterns)] match &t.kind {
    TyKind::Path(QPath::Resolved(_, Path {
        res: crate::def::Res::SelfTyAlias { .. }, .. })) => true,
    _ => false,
}matches!(
3611                    &t.kind,
3612                    TyKind::Path(QPath::Resolved(
3613                        _,
3614                        Path { res: crate::def::Res::SelfTyAlias { .. }, .. },
3615                    ))
3616                ) {
3617                    self.0.push(t.span);
3618                    return;
3619                }
3620                crate::intravisit::walk_ty(self, t);
3621            }
3622        }
3623
3624        let mut my_visitor = MyVisitor(::alloc::vec::Vec::new()vec![]);
3625        my_visitor.visit_ty_unambig(self);
3626        my_visitor.0
3627    }
3628
3629    /// Whether `ty` is a type with `_` placeholders that can be inferred. Used in diagnostics only to
3630    /// use inference to provide suggestions for the appropriate type if possible.
3631    pub fn is_suggestable_infer_ty(&self) -> bool {
3632        fn are_suggestable_generic_args(generic_args: &[GenericArg<'_>]) -> bool {
3633            generic_args.iter().any(|arg| match arg {
3634                GenericArg::Type(ty) => ty.as_unambig_ty().is_suggestable_infer_ty(),
3635                GenericArg::Infer(_) => true,
3636                _ => false,
3637            })
3638        }
3639        {
    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:3639",
                        "rustc_hir::hir", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_hir/src/hir.rs"),
                        ::tracing_core::__macro_support::Option::Some(3639u32),
                        ::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);
3640        match &self.kind {
3641            TyKind::Infer(()) => true,
3642            TyKind::Slice(ty) => ty.is_suggestable_infer_ty(),
3643            TyKind::Array(ty, length) => {
3644                ty.is_suggestable_infer_ty() || #[allow(non_exhaustive_omitted_patterns)] match length.kind {
    ConstArgKind::Infer(..) => true,
    _ => false,
}matches!(length.kind, ConstArgKind::Infer(..))
3645            }
3646            TyKind::Tup(tys) => tys.iter().any(Self::is_suggestable_infer_ty),
3647            TyKind::Ptr(mut_ty) | TyKind::Ref(_, mut_ty) => mut_ty.ty.is_suggestable_infer_ty(),
3648            TyKind::Path(QPath::TypeRelative(ty, segment)) => {
3649                ty.is_suggestable_infer_ty() || are_suggestable_generic_args(segment.args().args)
3650            }
3651            TyKind::Path(QPath::Resolved(ty_opt, Path { segments, .. })) => {
3652                ty_opt.is_some_and(Self::is_suggestable_infer_ty)
3653                    || segments
3654                        .iter()
3655                        .any(|segment| are_suggestable_generic_args(segment.args().args))
3656            }
3657            _ => false,
3658        }
3659    }
3660}
3661
3662/// Not represented directly in the AST; referred to by name through a `ty_path`.
3663#[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 ::rustc_data_structures::stable_hash::StableHash for PrimTy {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PrimTy::Int(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PrimTy::Uint(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PrimTy::Float(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PrimTy::Str => {}
                    PrimTy::Bool => {}
                    PrimTy::Char => {}
                }
            }
        }
    };StableHash)]
3664pub enum PrimTy {
3665    Int(IntTy),
3666    Uint(UintTy),
3667    Float(FloatTy),
3668    Str,
3669    Bool,
3670    Char,
3671}
3672
3673impl PrimTy {
3674    /// All of the primitive types
3675    pub const ALL: [Self; 19] = [
3676        // any changes here should also be reflected in `PrimTy::from_name`
3677        Self::Int(IntTy::I8),
3678        Self::Int(IntTy::I16),
3679        Self::Int(IntTy::I32),
3680        Self::Int(IntTy::I64),
3681        Self::Int(IntTy::I128),
3682        Self::Int(IntTy::Isize),
3683        Self::Uint(UintTy::U8),
3684        Self::Uint(UintTy::U16),
3685        Self::Uint(UintTy::U32),
3686        Self::Uint(UintTy::U64),
3687        Self::Uint(UintTy::U128),
3688        Self::Uint(UintTy::Usize),
3689        Self::Float(FloatTy::F16),
3690        Self::Float(FloatTy::F32),
3691        Self::Float(FloatTy::F64),
3692        Self::Float(FloatTy::F128),
3693        Self::Bool,
3694        Self::Char,
3695        Self::Str,
3696    ];
3697
3698    /// Like [`PrimTy::name`], but returns a &str instead of a symbol.
3699    ///
3700    /// Used by clippy.
3701    pub fn name_str(self) -> &'static str {
3702        match self {
3703            PrimTy::Int(i) => i.name_str(),
3704            PrimTy::Uint(u) => u.name_str(),
3705            PrimTy::Float(f) => f.name_str(),
3706            PrimTy::Str => "str",
3707            PrimTy::Bool => "bool",
3708            PrimTy::Char => "char",
3709        }
3710    }
3711
3712    pub fn name(self) -> Symbol {
3713        match self {
3714            PrimTy::Int(i) => i.name(),
3715            PrimTy::Uint(u) => u.name(),
3716            PrimTy::Float(f) => f.name(),
3717            PrimTy::Str => sym::str,
3718            PrimTy::Bool => sym::bool,
3719            PrimTy::Char => sym::char,
3720        }
3721    }
3722
3723    /// Returns the matching `PrimTy` for a `Symbol` such as "str" or "i32".
3724    /// Returns `None` if no matching type is found.
3725    pub fn from_name(name: Symbol) -> Option<Self> {
3726        let ty = match name {
3727            // any changes here should also be reflected in `PrimTy::ALL`
3728            sym::i8 => Self::Int(IntTy::I8),
3729            sym::i16 => Self::Int(IntTy::I16),
3730            sym::i32 => Self::Int(IntTy::I32),
3731            sym::i64 => Self::Int(IntTy::I64),
3732            sym::i128 => Self::Int(IntTy::I128),
3733            sym::isize => Self::Int(IntTy::Isize),
3734            sym::u8 => Self::Uint(UintTy::U8),
3735            sym::u16 => Self::Uint(UintTy::U16),
3736            sym::u32 => Self::Uint(UintTy::U32),
3737            sym::u64 => Self::Uint(UintTy::U64),
3738            sym::u128 => Self::Uint(UintTy::U128),
3739            sym::usize => Self::Uint(UintTy::Usize),
3740            sym::f16 => Self::Float(FloatTy::F16),
3741            sym::f32 => Self::Float(FloatTy::F32),
3742            sym::f64 => Self::Float(FloatTy::F64),
3743            sym::f128 => Self::Float(FloatTy::F128),
3744            sym::bool => Self::Bool,
3745            sym::char => Self::Char,
3746            sym::str => Self::Str,
3747            _ => return None,
3748        };
3749        Some(ty)
3750    }
3751}
3752
3753#[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> ::rustc_data_structures::stable_hash::StableHash for
            FnPtrTy<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3754pub struct FnPtrTy<'hir> {
3755    pub safety: Safety,
3756    pub abi: ExternAbi,
3757    pub generic_params: &'hir [GenericParam<'hir>],
3758    pub decl: &'hir FnDecl<'hir>,
3759    // `Option` because bare fn parameter identifiers are optional. We also end up
3760    // with `None` in some error cases, e.g. invalid parameter patterns.
3761    pub param_idents: &'hir [Option<Ident>],
3762}
3763
3764#[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> ::rustc_data_structures::stable_hash::StableHash for
            UnsafeBinderTy<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    UnsafeBinderTy {
                        generic_params: ref __binding_0, inner_ty: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3765pub struct UnsafeBinderTy<'hir> {
3766    pub generic_params: &'hir [GenericParam<'hir>],
3767    pub inner_ty: &'hir Ty<'hir>,
3768}
3769
3770#[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> ::rustc_data_structures::stable_hash::StableHash for
            OpaqueTy<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3771pub struct OpaqueTy<'hir> {
3772    #[stable_hash(ignore)]
3773    pub hir_id: HirId,
3774    pub def_id: LocalDefId,
3775    pub bounds: GenericBounds<'hir>,
3776    pub origin: OpaqueTyOrigin<LocalDefId>,
3777    pub span: Span,
3778}
3779
3780#[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> ::rustc_data_structures::stable_hash::StableHash for
            PreciseCapturingArgKind<T, U> where
            T: ::rustc_data_structures::stable_hash::StableHash,
            U: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    PreciseCapturingArgKind::Lifetime(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    PreciseCapturingArgKind::Param(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
3781pub enum PreciseCapturingArgKind<T, U> {
3782    Lifetime(T),
3783    /// Non-lifetime argument (type or const)
3784    Param(U),
3785}
3786
3787pub type PreciseCapturingArg<'hir> =
3788    PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
3789
3790impl PreciseCapturingArg<'_> {
3791    pub fn hir_id(self) -> HirId {
3792        match self {
3793            PreciseCapturingArg::Lifetime(lt) => lt.hir_id,
3794            PreciseCapturingArg::Param(param) => param.hir_id,
3795        }
3796    }
3797
3798    pub fn name(self) -> Symbol {
3799        match self {
3800            PreciseCapturingArg::Lifetime(lt) => lt.ident.name,
3801            PreciseCapturingArg::Param(param) => param.ident.name,
3802        }
3803    }
3804}
3805
3806/// We need to have a [`Node`] for the [`HirId`] that we attach the type/const param
3807/// resolution to. Lifetimes don't have this problem, and for them, it's actually
3808/// kind of detrimental to use a custom node type versus just using [`Lifetime`],
3809/// since resolve_bound_vars operates on `Lifetime`s.
3810#[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 ::rustc_data_structures::stable_hash::StableHash for
            PreciseCapturingNonLifetimeArg {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    PreciseCapturingNonLifetimeArg {
                        hir_id: ref __binding_0,
                        ident: ref __binding_1,
                        res: ref __binding_2 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3811pub struct PreciseCapturingNonLifetimeArg {
3812    #[stable_hash(ignore)]
3813    pub hir_id: HirId,
3814    pub ident: Ident,
3815    pub res: Res,
3816}
3817
3818#[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)]
3819#[derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for RpitContext
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    RpitContext::Trait => {}
                    RpitContext::TraitImpl => {}
                }
            }
        }
    };StableHash, 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)]
3820pub enum RpitContext {
3821    Trait,
3822    TraitImpl,
3823}
3824
3825/// From whence the opaque type came.
3826#[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)]
3827#[derive(const _: () =
    {
        impl<D> ::rustc_data_structures::stable_hash::StableHash for
            OpaqueTyOrigin<D> where
            D: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    OpaqueTyOrigin::FnReturn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    OpaqueTyOrigin::AsyncFn {
                        parent: ref __binding_0, in_trait_or_impl: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    OpaqueTyOrigin::TyAlias {
                        parent: ref __binding_0, in_assoc_ty: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, 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)]
3828pub enum OpaqueTyOrigin<D> {
3829    /// `-> impl Trait`
3830    FnReturn {
3831        /// The defining function.
3832        parent: D,
3833        // Whether this is an RPITIT (return position impl trait in trait)
3834        in_trait_or_impl: Option<RpitContext>,
3835    },
3836    /// `async fn`
3837    AsyncFn {
3838        /// The defining function.
3839        parent: D,
3840        // Whether this is an AFIT (async fn in trait)
3841        in_trait_or_impl: Option<RpitContext>,
3842    },
3843    /// type aliases: `type Foo = impl Trait;`
3844    TyAlias {
3845        /// The type alias or associated type parent of the TAIT/ATPIT
3846        parent: D,
3847        /// associated types in impl blocks for traits.
3848        in_assoc_ty: bool,
3849    },
3850}
3851
3852#[derive(#[automatically_derived]
impl ::core::fmt::Debug for DelegationInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["call_expr_id", "call_path_res", "parent_args_segment_id",
                        "child_args_segment_id", "self_ty_id", "propagate_self_ty",
                        "group_id"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.call_expr_id, &self.call_path_res,
                        &self.parent_args_segment_id, &self.child_args_segment_id,
                        &self.self_ty_id, &self.propagate_self_ty, &&self.group_id];
        ::core::fmt::Formatter::debug_struct_fields_finish(f,
            "DelegationInfo", names, values)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for DelegationInfo {
    #[inline]
    fn clone(&self) -> DelegationInfo {
        let _: ::core::clone::AssertParamIsClone<HirId>;
        let _: ::core::clone::AssertParamIsClone<Option<DefId>>;
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        let _: ::core::clone::AssertParamIsClone<Option<HirId>>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Option<(LocalExpnId, bool)>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for DelegationInfo { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for DelegationInfo {
    #[inline]
    fn eq(&self, other: &DelegationInfo) -> bool {
        self.propagate_self_ty == other.propagate_self_ty &&
                                self.call_expr_id == other.call_expr_id &&
                            self.call_path_res == other.call_path_res &&
                        self.parent_args_segment_id == other.parent_args_segment_id
                    && self.child_args_segment_id == other.child_args_segment_id
                && self.self_ty_id == other.self_ty_id &&
            self.group_id == other.group_id
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for DelegationInfo {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<HirId>;
        let _: ::core::cmp::AssertParamIsEq<Option<DefId>>;
        let _: ::core::cmp::AssertParamIsEq<Option<HirId>>;
        let _: ::core::cmp::AssertParamIsEq<Option<HirId>>;
        let _: ::core::cmp::AssertParamIsEq<Option<HirId>>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Option<(LocalExpnId, bool)>>;
    }
}Eq, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            DelegationInfo {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    DelegationInfo {
                        call_expr_id: ref __binding_0,
                        call_path_res: ref __binding_1,
                        parent_args_segment_id: ref __binding_2,
                        child_args_segment_id: ref __binding_3,
                        self_ty_id: ref __binding_4,
                        propagate_self_ty: ref __binding_5,
                        group_id: ref __binding_6 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3853pub struct DelegationInfo {
3854    pub call_expr_id: HirId,
3855    pub call_path_res: Option<DefId>,
3856    pub parent_args_segment_id: Option<HirId>,
3857    pub child_args_segment_id: Option<HirId>,
3858    pub self_ty_id: Option<HirId>,
3859    pub propagate_self_ty: bool,
3860    pub group_id: Option<(LocalExpnId, bool /* unused_target_expr */)>,
3861}
3862
3863#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InferDelegationSig<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            InferDelegationSig::Input(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Input",
                    &__self_0),
            InferDelegationSig::Output(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Output",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for InferDelegationSig<'hir> {
    #[inline]
    fn clone(&self) -> InferDelegationSig<'hir> {
        let _: ::core::clone::AssertParamIsClone<usize>;
        let _: ::core::clone::AssertParamIsClone<&'hir DelegationInfo>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for InferDelegationSig<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::cmp::PartialEq for InferDelegationSig<'hir> {
    #[inline]
    fn eq(&self, other: &InferDelegationSig<'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) {
                (InferDelegationSig::Input(__self_0),
                    InferDelegationSig::Input(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (InferDelegationSig::Output(__self_0),
                    InferDelegationSig::Output(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl<'hir> ::core::cmp::Eq for InferDelegationSig<'hir> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<usize>;
        let _: ::core::cmp::AssertParamIsEq<&'hir DelegationInfo>;
    }
}Eq, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            InferDelegationSig<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    InferDelegationSig::Input(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    InferDelegationSig::Output(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3864pub enum InferDelegationSig<'hir> {
3865    Input(usize),
3866    // Place delegation info here, as we always specify output type for delegations.
3867    Output(&'hir DelegationInfo),
3868}
3869
3870#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for InferDelegation<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            InferDelegation::DefId(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "DefId",
                    &__self_0),
            InferDelegation::Sig(__self_0, __self_1) =>
                ::core::fmt::Formatter::debug_tuple_field2_finish(f, "Sig",
                    __self_0, &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for InferDelegation<'hir> {
    #[inline]
    fn clone(&self) -> InferDelegation<'hir> {
        let _: ::core::clone::AssertParamIsClone<DefId>;
        let _: ::core::clone::AssertParamIsClone<InferDelegationSig<'hir>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for InferDelegation<'hir> { }Copy, #[automatically_derived]
impl<'hir> ::core::cmp::PartialEq for InferDelegation<'hir> {
    #[inline]
    fn eq(&self, other: &InferDelegation<'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) {
                (InferDelegation::DefId(__self_0),
                    InferDelegation::DefId(__arg1_0)) => __self_0 == __arg1_0,
                (InferDelegation::Sig(__self_0, __self_1),
                    InferDelegation::Sig(__arg1_0, __arg1_1)) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl<'hir> ::core::cmp::Eq for InferDelegation<'hir> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<DefId>;
        let _: ::core::cmp::AssertParamIsEq<InferDelegationSig<'hir>>;
    }
}Eq, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            InferDelegation<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    InferDelegation::DefId(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    InferDelegation::Sig(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3871pub enum InferDelegation<'hir> {
3872    /// Infer the type of this `DefId` through `tcx.type_of(def_id).instantiate_identity()`,
3873    /// used for const types propagation.
3874    DefId(DefId),
3875    /// Used during signature inheritance, `DefId` corresponds to the signature function.
3876    Sig(DefId, InferDelegationSig<'hir>),
3877}
3878
3879/// The various kinds of types recognized by the compiler.
3880///
3881/// For an explanation of the `Unambig` generic parameter see the dev-guide:
3882/// <https://rustc-dev-guide.rust-lang.org/ambig-unambig-ty-and-consts.html>
3883// SAFETY: `repr(u8)` is required so that `TyKind<()>` and `TyKind<!>` are layout compatible
3884#[repr(u8, C)]
3885#[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) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "InferDelegation", &__self_0),
            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) =>
                TyKind::InferDelegation(::core::clone::Clone::clone(__self_0)),
            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> ::rustc_data_structures::stable_hash::StableHash
            for TyKind<'hir, Unambig> where
            Unambig: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    TyKind::InferDelegation(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Slice(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Array(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Ptr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Ref(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::FnPtr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::UnsafeBinder(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Never => {}
                    TyKind::Tup(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Path(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::OpaqueDef(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::TraitAscription(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::TraitObject(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Err(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Pat(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::FieldOf(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Infer(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3886pub enum TyKind<'hir, Unambig = ()> {
3887    /// Actual type should be inherited from `DefId` signature
3888    InferDelegation(InferDelegation<'hir>),
3889    /// A variable length slice (i.e., `[T]`).
3890    Slice(&'hir Ty<'hir>),
3891    /// A fixed length array (i.e., `[T; n]`).
3892    Array(&'hir Ty<'hir>, &'hir ConstArg<'hir>),
3893    /// A raw pointer (i.e., `*const T` or `*mut T`).
3894    Ptr(MutTy<'hir>),
3895    /// A reference (i.e., `&'a T` or `&'a mut T`).
3896    Ref(&'hir Lifetime, MutTy<'hir>),
3897    /// A function pointer (e.g., `fn(usize) -> bool`).
3898    FnPtr(&'hir FnPtrTy<'hir>),
3899    /// An unsafe binder type (e.g. `unsafe<'a> Foo<'a>`).
3900    UnsafeBinder(&'hir UnsafeBinderTy<'hir>),
3901    /// The never type (`!`).
3902    Never,
3903    /// A tuple (`(A, B, C, D, ...)`).
3904    Tup(&'hir [Ty<'hir>]),
3905    /// A path to a type definition (`module::module::...::Type`), or an
3906    /// associated type (e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`).
3907    ///
3908    /// Type parameters may be stored in each `PathSegment`.
3909    Path(QPath<'hir>),
3910    /// An opaque type definition itself. This is only used for `impl Trait`.
3911    OpaqueDef(&'hir OpaqueTy<'hir>),
3912    /// A trait ascription type, which is `impl Trait` within a local binding.
3913    TraitAscription(GenericBounds<'hir>),
3914    /// A trait object type `Bound1 + Bound2 + Bound3`
3915    /// where `Bound` is a trait or a lifetime.
3916    ///
3917    /// We use pointer tagging to represent a `&'hir Lifetime` and `TraitObjectSyntax` pair
3918    /// as otherwise this type being `repr(C)` would result in `TyKind` increasing in size.
3919    TraitObject(&'hir [PolyTraitRef<'hir>], TaggedRef<'hir, Lifetime, TraitObjectSyntax>),
3920    /// Placeholder for a type that has failed to be defined.
3921    Err(rustc_span::ErrorGuaranteed),
3922    /// Pattern types (`pattern_type!(u32 is 1..)`)
3923    Pat(&'hir Ty<'hir>, &'hir TyPat<'hir>),
3924    /// Field representing type (`field_of!(Struct, field)`).
3925    ///
3926    /// The optional ident is the variant when an enum is passed `field_of!(Enum, Variant.field)`.
3927    FieldOf(&'hir Ty<'hir>, &'hir TyFieldPath),
3928    /// `TyKind::Infer` means the type should be inferred instead of it having been
3929    /// specified. This can appear anywhere in a type.
3930    ///
3931    /// This variant is not always used to represent inference types, sometimes
3932    /// [`GenericArg::Infer`] is used instead.
3933    Infer(Unambig),
3934}
3935
3936#[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> ::rustc_data_structures::stable_hash::StableHash for
            InlineAsmOperand<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    InlineAsmOperand::In {
                        reg: ref __binding_0, expr: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Out {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        expr: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::InOut {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        expr: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SplitInOut {
                        reg: ref __binding_0,
                        late: ref __binding_1,
                        in_expr: ref __binding_2,
                        out_expr: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Const { anon_const: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SymFn { expr: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::SymStatic {
                        path: ref __binding_0, def_id: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    InlineAsmOperand::Label { block: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3937pub enum InlineAsmOperand<'hir> {
3938    In {
3939        reg: InlineAsmRegOrRegClass,
3940        expr: &'hir Expr<'hir>,
3941    },
3942    Out {
3943        reg: InlineAsmRegOrRegClass,
3944        late: bool,
3945        expr: Option<&'hir Expr<'hir>>,
3946    },
3947    InOut {
3948        reg: InlineAsmRegOrRegClass,
3949        late: bool,
3950        expr: &'hir Expr<'hir>,
3951    },
3952    SplitInOut {
3953        reg: InlineAsmRegOrRegClass,
3954        late: bool,
3955        in_expr: &'hir Expr<'hir>,
3956        out_expr: Option<&'hir Expr<'hir>>,
3957    },
3958    Const {
3959        anon_const: ConstBlock,
3960    },
3961    SymFn {
3962        expr: &'hir Expr<'hir>,
3963    },
3964    SymStatic {
3965        path: QPath<'hir>,
3966        def_id: DefId,
3967    },
3968    Label {
3969        block: &'hir Block<'hir>,
3970    },
3971}
3972
3973impl<'hir> InlineAsmOperand<'hir> {
3974    pub fn reg(&self) -> Option<InlineAsmRegOrRegClass> {
3975        match *self {
3976            Self::In { reg, .. }
3977            | Self::Out { reg, .. }
3978            | Self::InOut { reg, .. }
3979            | Self::SplitInOut { reg, .. } => Some(reg),
3980            Self::Const { .. }
3981            | Self::SymFn { .. }
3982            | Self::SymStatic { .. }
3983            | Self::Label { .. } => None,
3984        }
3985    }
3986
3987    pub fn is_clobber(&self) -> bool {
3988        #[allow(non_exhaustive_omitted_patterns)] match self {
    InlineAsmOperand::Out {
        reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None } => true,
    _ => false,
}matches!(
3989            self,
3990            InlineAsmOperand::Out { reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None }
3991        )
3992    }
3993}
3994
3995#[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> ::rustc_data_structures::stable_hash::StableHash for
            InlineAsm<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
3996pub struct InlineAsm<'hir> {
3997    pub asm_macro: ast::AsmMacro,
3998    pub template: &'hir [InlineAsmTemplatePiece],
3999    pub template_strs: &'hir [(Symbol, Option<Symbol>, Span)],
4000    pub operands: &'hir [(InlineAsmOperand<'hir>, Span)],
4001    pub options: InlineAsmOptions,
4002    pub line_spans: &'hir [Span],
4003}
4004
4005impl InlineAsm<'_> {
4006    pub fn contains_label(&self) -> bool {
4007        self.operands.iter().any(|x| #[allow(non_exhaustive_omitted_patterns)] match x.0 {
    InlineAsmOperand::Label { .. } => true,
    _ => false,
}matches!(x.0, InlineAsmOperand::Label { .. }))
4008    }
4009}
4010
4011/// Represents a parameter in a function header.
4012#[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> ::rustc_data_structures::stable_hash::StableHash for
            Param<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Param {
                        hir_id: ref __binding_0,
                        pat: ref __binding_1,
                        ty_span: ref __binding_2,
                        span: ref __binding_3 } => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4013pub struct Param<'hir> {
4014    #[stable_hash(ignore)]
4015    pub hir_id: HirId,
4016    pub pat: &'hir Pat<'hir>,
4017    pub ty_span: Span,
4018    pub span: Span,
4019}
4020
4021/// Error type for splatted argument index errors.
4022#[derive(#[automatically_derived]
impl ::core::fmt::Debug for SplattedArgIndexError {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            SplattedArgIndexError::InvalidIndex { splatted_arg_index: __self_0
                } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "InvalidIndex", "splatted_arg_index", &__self_0),
            SplattedArgIndexError::OutOfBounds {
                splatted_arg_index: __self_0, args_len: __self_1 } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "OutOfBounds", "splatted_arg_index", __self_0, "args_len",
                    &__self_1),
        }
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for SplattedArgIndexError {
    #[inline]
    fn clone(&self) -> SplattedArgIndexError {
        let _: ::core::clone::AssertParamIsClone<u16>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for SplattedArgIndexError { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for SplattedArgIndexError {
    #[inline]
    fn eq(&self, other: &SplattedArgIndexError) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (SplattedArgIndexError::InvalidIndex {
                    splatted_arg_index: __self_0 },
                    SplattedArgIndexError::InvalidIndex {
                    splatted_arg_index: __arg1_0 }) => __self_0 == __arg1_0,
                (SplattedArgIndexError::OutOfBounds {
                    splatted_arg_index: __self_0, args_len: __self_1 },
                    SplattedArgIndexError::OutOfBounds {
                    splatted_arg_index: __arg1_0, args_len: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for SplattedArgIndexError {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u16>;
    }
}Eq)]
4023pub enum SplattedArgIndexError {
4024    /// The splatted argument index is invalid.
4025    /// Currently the only unsupported index is `u16::MAX`, which is used to indicate that no argument
4026    /// is splatted.
4027    InvalidIndex { splatted_arg_index: u16 },
4028
4029    /// The splatted argument index is outside the bounds of the function arguments.
4030    OutOfBounds { splatted_arg_index: u16, args_len: u16 },
4031}
4032
4033/// Contains the packed non-type fields of a function declaration.
4034#[derive(#[automatically_derived]
impl ::core::marker::Copy for FnDeclFlags { }Copy, #[automatically_derived]
impl ::core::clone::Clone for FnDeclFlags {
    #[inline]
    fn clone(&self) -> FnDeclFlags {
        let _: ::core::clone::AssertParamIsClone<u8>;
        let _: ::core::clone::AssertParamIsClone<u16>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for FnDeclFlags {
    #[inline]
    fn eq(&self, other: &FnDeclFlags) -> bool {
        self.flags == other.flags && self.splatted == other.splatted
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for FnDeclFlags {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<u8>;
        let _: ::core::cmp::AssertParamIsEq<u16>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for FnDeclFlags {
    #[inline]
    fn partial_cmp(&self, other: &FnDeclFlags)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for FnDeclFlags {
    #[inline]
    fn cmp(&self, other: &FnDeclFlags) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.flags, &other.flags) {
            ::core::cmp::Ordering::Equal =>
                ::core::cmp::Ord::cmp(&self.splatted, &other.splatted),
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for FnDeclFlags {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.flags, state);
        ::core::hash::Hash::hash(&self.splatted, state)
    }
}Hash)]
4035#[derive(const _: () =
    {
        impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
            for FnDeclFlags {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    FnDeclFlags {
                        flags: ref __binding_0, splatted: 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 FnDeclFlags {
            fn decode(__decoder: &mut __D) -> Self {
                FnDeclFlags {
                    flags: ::rustc_serialize::Decodable::decode(__decoder),
                    splatted: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for FnDeclFlags
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    FnDeclFlags {
                        flags: ref __binding_0, splatted: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4036pub struct FnDeclFlags {
4037    /// Holds the c_variadic and lifetime_elision_allowed bitflags, and 3 bits for the `ImplicitSelfKind`.
4038    flags: u8,
4039
4040    /// Which function argument is splatted into multiple arguments in callers, if any?
4041    /// Splatting functions with `u16::MAX` arguments is not supported, see `FnSigKind` for
4042    /// details.
4043    splatted: u16,
4044}
4045
4046impl fmt::Debug for FnDeclFlags {
4047    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4048        let mut f = f.debug_tuple("FnDeclFlags");
4049        f.field(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("ImplicitSelfKind({0:?})",
                self.implicit_self()))
    })format!("ImplicitSelfKind({:?})", self.implicit_self()));
4050
4051        if self.lifetime_elision_allowed() {
4052            f.field(&"LifetimeElisionAllowed");
4053        } else {
4054            f.field(&"NoLifetimeElision");
4055        }
4056
4057        if self.c_variadic() {
4058            f.field(&"CVariadic");
4059        }
4060
4061        if let Some(index) = self.splatted() {
4062            f.field(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("Splatted({0})", index))
    })format!("Splatted({})", index));
4063        }
4064
4065        f.finish()
4066    }
4067}
4068
4069impl FnDeclFlags {
4070    /// Mask for the implicit self kind.
4071    const IMPLICIT_SELF_MASK: u8 = 0b111;
4072
4073    /// Bitflag for a trailing C-style variadic argument.
4074    const C_VARIADIC_FLAG: u8 = 1 << 3;
4075
4076    /// Bitflag for lifetime elision.
4077    const LIFETIME_ELISION_ALLOWED_FLAG: u8 = 1 << 4;
4078
4079    /// Marker index for "no splatted argument".
4080    /// Must have the same value as `FnSigKind::NO_SPLATTED_ARG_INDEX` and `rustc_ast::FnDecl::NO_SPLATTED_ARG_INDEX`.
4081    const NO_SPLATTED_ARG_INDEX: u16 = u16::MAX;
4082
4083    /// Create a new FnDeclKind with no implicit self, no lifetime elision, no C-style variadic
4084    /// argument, and no splatting.
4085    /// To modify these flags, use the `set_*` methods, for readability.
4086    // FIXME: use Default instead when that trait is const stable.
4087    pub const fn default() -> Self {
4088        Self { flags: 0, splatted: 0 }
4089            .set_implicit_self(ImplicitSelfKind::None)
4090            .set_lifetime_elision_allowed(false)
4091            .set_c_variadic(false)
4092            .set_no_splatted_args()
4093    }
4094
4095    /// Set the implicit self kind.
4096    #[must_use = "this method does not modify the receiver"]
4097    pub const fn set_implicit_self(mut self, implicit_self: ImplicitSelfKind) -> Self {
4098        self.flags &= !Self::IMPLICIT_SELF_MASK;
4099
4100        match implicit_self {
4101            ImplicitSelfKind::None => self.flags |= 0,
4102            ImplicitSelfKind::Imm => self.flags |= 1,
4103            ImplicitSelfKind::Mut => self.flags |= 2,
4104            ImplicitSelfKind::RefImm => self.flags |= 3,
4105            ImplicitSelfKind::RefMut => self.flags |= 4,
4106        }
4107
4108        self
4109    }
4110
4111    /// Set the C-style variadic argument flag.
4112    #[must_use = "this method does not modify the receiver"]
4113    pub const fn set_c_variadic(mut self, c_variadic: bool) -> Self {
4114        if c_variadic {
4115            self.flags |= Self::C_VARIADIC_FLAG;
4116        } else {
4117            self.flags &= !Self::C_VARIADIC_FLAG;
4118        }
4119
4120        self
4121    }
4122
4123    /// Set the lifetime elision allowed flag.
4124    #[must_use = "this method does not modify the receiver"]
4125    pub const fn set_lifetime_elision_allowed(mut self, allowed: bool) -> Self {
4126        if allowed {
4127            self.flags |= Self::LIFETIME_ELISION_ALLOWED_FLAG;
4128        } else {
4129            self.flags &= !Self::LIFETIME_ELISION_ALLOWED_FLAG;
4130        }
4131
4132        self
4133    }
4134
4135    /// Set the splatted argument index.
4136    /// The number of function arguments is used for error checking.
4137    #[must_use = "this method does not modify the receiver"]
4138    pub const fn set_splatted(
4139        mut self,
4140        splatted: Option<u16>,
4141        args_len: usize,
4142    ) -> Result<Self, SplattedArgIndexError> {
4143        if let Some(splatted_arg_index) = splatted {
4144            if splatted_arg_index == Self::NO_SPLATTED_ARG_INDEX {
4145                // This index value is used as a marker for "no splatting", so it is unsupported.
4146                return Err(SplattedArgIndexError::InvalidIndex { splatted_arg_index });
4147            } else if splatted_arg_index as usize >= args_len {
4148                return Err(SplattedArgIndexError::OutOfBounds {
4149                    splatted_arg_index,
4150                    args_len: args_len as u16,
4151                });
4152            }
4153
4154            self.splatted = splatted_arg_index;
4155        } else {
4156            self.splatted = Self::NO_SPLATTED_ARG_INDEX;
4157        }
4158
4159        Ok(self)
4160    }
4161
4162    /// Set "no splatted arguments" for the function declaration.
4163    #[must_use = "this method does not modify the receiver"]
4164    pub const fn set_no_splatted_args(mut self) -> Self {
4165        self.splatted = Self::NO_SPLATTED_ARG_INDEX;
4166
4167        self
4168    }
4169
4170    /// Get the implicit self kind.
4171    pub const fn implicit_self(self) -> ImplicitSelfKind {
4172        match self.flags & Self::IMPLICIT_SELF_MASK {
4173            0 => ImplicitSelfKind::None,
4174            1 => ImplicitSelfKind::Imm,
4175            2 => ImplicitSelfKind::Mut,
4176            3 => ImplicitSelfKind::RefImm,
4177            4 => ImplicitSelfKind::RefMut,
4178            _ => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
4179        }
4180    }
4181
4182    /// Do the function arguments end with a C-style variadic argument?
4183    pub const fn c_variadic(self) -> bool {
4184        self.flags & Self::C_VARIADIC_FLAG != 0
4185    }
4186
4187    /// Is lifetime elision allowed?
4188    pub const fn lifetime_elision_allowed(self) -> bool {
4189        self.flags & Self::LIFETIME_ELISION_ALLOWED_FLAG != 0
4190    }
4191
4192    /// Get the splatted argument index, if any.
4193    pub const fn splatted(self) -> Option<u16> {
4194        if self.splatted == Self::NO_SPLATTED_ARG_INDEX { None } else { Some(self.splatted) }
4195    }
4196}
4197
4198/// Represents the header (not the body) of a function declaration.
4199#[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_field3_finish(f, "FnDecl",
            "inputs", &self.inputs, "output", &self.output, "fn_decl_kind",
            &&self.fn_decl_kind)
    }
}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<FnDeclFlags>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for FnDecl<'hir> { }Copy, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            FnDecl<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    FnDecl {
                        inputs: ref __binding_0,
                        output: ref __binding_1,
                        fn_decl_kind: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4200pub struct FnDecl<'hir> {
4201    /// The types of the function's parameters.
4202    ///
4203    /// Additional argument data is stored in the function's [body](Body::params).
4204    pub inputs: &'hir [Ty<'hir>],
4205    pub output: FnRetTy<'hir>,
4206    /// The packed function declaration attributes.
4207    pub fn_decl_kind: FnDeclFlags,
4208}
4209
4210impl<'hir> FnDecl<'hir> {
4211    pub fn opt_delegation_sig_id(&self) -> Option<DefId> {
4212        if let FnRetTy::Return(ty) = self.output
4213            && let TyKind::InferDelegation(InferDelegation::Sig(sig_id, _)) = ty.kind
4214        {
4215            return Some(sig_id);
4216        }
4217        None
4218    }
4219
4220    pub fn opt_delegation_info(&self) -> Option<&'hir DelegationInfo> {
4221        if let FnRetTy::Return(ty) = self.output
4222            && let TyKind::InferDelegation(InferDelegation::Sig(_, kind)) = ty.kind
4223            && let InferDelegationSig::Output(generics) = kind
4224        {
4225            return Some(generics);
4226        }
4227
4228        None
4229    }
4230
4231    pub fn implicit_self(&self) -> ImplicitSelfKind {
4232        self.fn_decl_kind.implicit_self()
4233    }
4234
4235    pub fn c_variadic(&self) -> bool {
4236        self.fn_decl_kind.c_variadic()
4237    }
4238
4239    pub fn lifetime_elision_allowed(&self) -> bool {
4240        self.fn_decl_kind.lifetime_elision_allowed()
4241    }
4242
4243    pub fn splatted(&self) -> Option<u16> {
4244        self.fn_decl_kind.splatted()
4245    }
4246
4247    pub fn dummy(span: Span) -> Self {
4248        Self {
4249            inputs: &[],
4250            output: FnRetTy::DefaultReturn(span),
4251            fn_decl_kind: FnDeclFlags::default().set_lifetime_elision_allowed(true),
4252        }
4253    }
4254}
4255
4256/// Represents what type of implicit self a function has, if any.
4257#[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 ::rustc_data_structures::stable_hash::StableHash for
            ImplicitSelfKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ImplicitSelfKind::Imm => {}
                    ImplicitSelfKind::Mut => {}
                    ImplicitSelfKind::RefImm => {}
                    ImplicitSelfKind::RefMut => {}
                    ImplicitSelfKind::None => {}
                }
            }
        }
    };StableHash)]
4258pub enum ImplicitSelfKind {
4259    /// Represents a `fn x(self);`.
4260    Imm,
4261    /// Represents a `fn x(mut self);`.
4262    Mut,
4263    /// Represents a `fn x(&self);`.
4264    RefImm,
4265    /// Represents a `fn x(&mut self);`.
4266    RefMut,
4267    /// Represents when a function does not have a self argument or
4268    /// when a function has a `self: X` argument.
4269    None,
4270}
4271
4272impl ImplicitSelfKind {
4273    /// Does this represent an implicit self?
4274    pub fn has_implicit_self(&self) -> bool {
4275        !#[allow(non_exhaustive_omitted_patterns)] match *self {
    ImplicitSelfKind::None => true,
    _ => false,
}matches!(*self, ImplicitSelfKind::None)
4276    }
4277}
4278
4279#[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 ::rustc_data_structures::stable_hash::StableHash for IsAsync {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    IsAsync::Async(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    IsAsync::NotAsync => {}
                }
            }
        }
    };StableHash)]
4280pub enum IsAsync {
4281    Async(Span),
4282    NotAsync,
4283}
4284
4285impl IsAsync {
4286    pub fn is_async(self) -> bool {
4287        #[allow(non_exhaustive_omitted_patterns)] match self {
    IsAsync::Async(_) => true,
    _ => false,
}matches!(self, IsAsync::Async(_))
4288    }
4289}
4290
4291#[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 ::rustc_data_structures::stable_hash::StableHash for Defaultness
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Defaultness::Default { has_value: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Defaultness::Final => {}
                }
            }
        }
    };StableHash)]
4292#[derive(#[automatically_derived]
impl ::core::default::Default for Defaultness {
    #[inline]
    fn default() -> Defaultness { Self::Final }
}Default)]
4293pub enum Defaultness {
4294    Default {
4295        has_value: bool,
4296    },
4297    #[default]
4298    Final,
4299}
4300
4301impl Defaultness {
4302    pub fn has_value(&self) -> bool {
4303        match *self {
4304            Defaultness::Default { has_value } => has_value,
4305            Defaultness::Final => true,
4306        }
4307    }
4308
4309    pub fn is_final(&self) -> bool {
4310        *self == Defaultness::Final
4311    }
4312
4313    pub fn is_default(&self) -> bool {
4314        #[allow(non_exhaustive_omitted_patterns)] match *self {
    Defaultness::Default { .. } => true,
    _ => false,
}matches!(*self, Defaultness::Default { .. })
4315    }
4316}
4317
4318#[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> ::rustc_data_structures::stable_hash::StableHash for
            FnRetTy<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    FnRetTy::DefaultReturn(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    FnRetTy::Return(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4319pub enum FnRetTy<'hir> {
4320    /// Return type is not specified.
4321    ///
4322    /// Functions default to `()` and
4323    /// closures default to inference. Span points to where return
4324    /// type would be inserted.
4325    DefaultReturn(Span),
4326    /// Everything else.
4327    Return(&'hir Ty<'hir>),
4328}
4329
4330impl<'hir> FnRetTy<'hir> {
4331    #[inline]
4332    pub fn span(&self) -> Span {
4333        match *self {
4334            Self::DefaultReturn(span) => span,
4335            Self::Return(ref ty) => ty.span,
4336        }
4337    }
4338
4339    pub fn is_suggestable_infer_ty(&self) -> Option<&'hir Ty<'hir>> {
4340        if let Self::Return(ty) = self
4341            && ty.is_suggestable_infer_ty()
4342        {
4343            return Some(*ty);
4344        }
4345        None
4346    }
4347}
4348
4349/// Represents `for<...>` binder before a closure
4350#[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 ::rustc_data_structures::stable_hash::StableHash for
            ClosureBinder {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ClosureBinder::Default => {}
                    ClosureBinder::For { span: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4351pub enum ClosureBinder {
4352    /// Binder is not specified.
4353    Default,
4354    /// Binder is specified.
4355    ///
4356    /// Span points to the whole `for<...>`.
4357    For { span: Span },
4358}
4359
4360#[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> ::rustc_data_structures::stable_hash::StableHash for
            Mod<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Mod { spans: ref __binding_0, item_ids: ref __binding_1 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4361pub struct Mod<'hir> {
4362    pub spans: ModSpans,
4363    pub item_ids: &'hir [ItemId],
4364}
4365
4366#[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 ::rustc_data_structures::stable_hash::StableHash for ModSpans {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ModSpans {
                        inner_span: ref __binding_0,
                        inject_use_span: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4367pub struct ModSpans {
4368    /// A span from the first token past `{` to the last token until `}`.
4369    /// For `mod foo;`, the inner span ranges from the first token
4370    /// to the last token in the external file.
4371    pub inner_span: Span,
4372    pub inject_use_span: Span,
4373}
4374
4375#[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> ::rustc_data_structures::stable_hash::StableHash for
            EnumDef<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    EnumDef { variants: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4376pub struct EnumDef<'hir> {
4377    pub variants: &'hir [Variant<'hir>],
4378}
4379
4380#[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> ::rustc_data_structures::stable_hash::StableHash for
            Variant<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4381pub struct Variant<'hir> {
4382    /// Name of the variant.
4383    pub ident: Ident,
4384    /// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
4385    #[stable_hash(ignore)]
4386    pub hir_id: HirId,
4387    pub def_id: LocalDefId,
4388    /// Fields and constructor id of the variant.
4389    pub data: VariantData<'hir>,
4390    /// Explicit discriminant (e.g., `Foo = 1`).
4391    pub disr_expr: Option<&'hir AnonConst>,
4392    /// Span
4393    pub span: Span,
4394}
4395
4396#[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 ::rustc_data_structures::stable_hash::StableHash for UseKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    UseKind::Single(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    UseKind::Glob => {}
                    UseKind::ListStem => {}
                }
            }
        }
    };StableHash)]
4397pub enum UseKind {
4398    /// One import, e.g., `use foo::bar` or `use foo::bar as baz`.
4399    /// Also produced for each element of a list `use`, e.g.
4400    /// `use foo::{a, b}` lowers to `use foo::a; use foo::b;`.
4401    ///
4402    /// The identifier is the name defined by the import. E.g. for `use
4403    /// foo::bar` it is `bar`, for `use foo::bar as baz` it is `baz`.
4404    Single(Ident),
4405
4406    /// Glob import, e.g., `use foo::*`.
4407    Glob,
4408
4409    /// Degenerate list import, e.g., `use foo::{a, b}` produces
4410    /// an additional `use foo::{}` for performing checks such as
4411    /// unstable feature gating. May be removed in the future.
4412    ListStem,
4413}
4414
4415/// References to traits in impls.
4416///
4417/// `resolve` maps each `TraitRef`'s `ref_id` to its defining trait; that's all
4418/// that the `ref_id` is for. Note that `ref_id`'s value is not the `HirId` of the
4419/// trait being referred to but just a unique `HirId` that serves as a key
4420/// within the resolution map.
4421#[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> ::rustc_data_structures::stable_hash::StableHash for
            TraitRef<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TraitRef {
                        path: ref __binding_0, hir_ref_id: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        {}
                    }
                }
            }
        }
    };StableHash)]
4422pub struct TraitRef<'hir> {
4423    pub path: &'hir Path<'hir>,
4424    // Don't hash the `ref_id`. It is tracked via the thing it is used to access.
4425    #[stable_hash(ignore)]
4426    pub hir_ref_id: HirId,
4427}
4428
4429impl TraitRef<'_> {
4430    /// Gets the `DefId` of the referenced trait. It _must_ actually be a trait or trait alias.
4431    pub fn trait_def_id(&self) -> Option<DefId> {
4432        match self.path.res {
4433            Res::Def(DefKind::Trait | DefKind::TraitAlias, did) => Some(did),
4434            Res::Err => None,
4435            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"),
4436        }
4437    }
4438}
4439
4440#[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> ::rustc_data_structures::stable_hash::StableHash for
            PolyTraitRef<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4441pub struct PolyTraitRef<'hir> {
4442    /// The `'a` in `for<'a> Foo<&'a T>`.
4443    pub bound_generic_params: &'hir [GenericParam<'hir>],
4444
4445    /// The constness and polarity of the trait ref.
4446    ///
4447    /// The `async` modifier is lowered directly into a different trait for now.
4448    pub modifiers: TraitBoundModifiers,
4449
4450    /// The `Foo<&'a T>` in `for<'a> Foo<&'a T>`.
4451    pub trait_ref: TraitRef<'hir>,
4452
4453    pub span: Span,
4454}
4455
4456#[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> ::rustc_data_structures::stable_hash::StableHash for
            FieldDef<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4457pub struct FieldDef<'hir> {
4458    pub span: Span,
4459    pub vis_span: Span,
4460    pub ident: Ident,
4461    #[stable_hash(ignore)]
4462    pub hir_id: HirId,
4463    pub def_id: LocalDefId,
4464    pub ty: &'hir Ty<'hir>,
4465    pub safety: Safety,
4466    pub default: Option<&'hir AnonConst>,
4467}
4468
4469impl FieldDef<'_> {
4470    // Still necessary in couple of places
4471    pub fn is_positional(&self) -> bool {
4472        self.ident.as_str().as_bytes()[0].is_ascii_digit()
4473    }
4474}
4475
4476/// Fields and constructor IDs of enum variants and structs.
4477#[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> ::rustc_data_structures::stable_hash::StableHash for
            VariantData<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    VariantData::Struct {
                        fields: ref __binding_0, recovered: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    VariantData::Tuple(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        {}
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    VariantData::Unit(ref __binding_0, ref __binding_1) => {
                        {}
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4478pub enum VariantData<'hir> {
4479    /// A struct variant.
4480    ///
4481    /// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
4482    Struct { fields: &'hir [FieldDef<'hir>], recovered: ast::Recovered },
4483    /// A tuple variant.
4484    ///
4485    /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
4486    Tuple(&'hir [FieldDef<'hir>], #[stable_hash(ignore)] HirId, LocalDefId),
4487    /// A unit variant.
4488    ///
4489    /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`.
4490    Unit(#[stable_hash(ignore)] HirId, LocalDefId),
4491}
4492
4493impl<'hir> VariantData<'hir> {
4494    /// Return the fields of this variant.
4495    pub fn fields(&self) -> &'hir [FieldDef<'hir>] {
4496        match *self {
4497            VariantData::Struct { fields, .. } | VariantData::Tuple(fields, ..) => fields,
4498            _ => &[],
4499        }
4500    }
4501
4502    pub fn ctor(&self) -> Option<(CtorKind, HirId, LocalDefId)> {
4503        match *self {
4504            VariantData::Tuple(_, hir_id, def_id) => Some((CtorKind::Fn, hir_id, def_id)),
4505            VariantData::Unit(hir_id, def_id) => Some((CtorKind::Const, hir_id, def_id)),
4506            VariantData::Struct { .. } => None,
4507        }
4508    }
4509
4510    #[inline]
4511    pub fn ctor_kind(&self) -> Option<CtorKind> {
4512        self.ctor().map(|(kind, ..)| kind)
4513    }
4514
4515    /// Return the `HirId` of this variant's constructor, if it has one.
4516    #[inline]
4517    pub fn ctor_hir_id(&self) -> Option<HirId> {
4518        self.ctor().map(|(_, hir_id, _)| hir_id)
4519    }
4520
4521    /// Return the `LocalDefId` of this variant's constructor, if it has one.
4522    #[inline]
4523    pub fn ctor_def_id(&self) -> Option<LocalDefId> {
4524        self.ctor().map(|(.., def_id)| def_id)
4525    }
4526}
4527
4528// The bodies for items are stored "out of line", in a separate
4529// hashmap in the `Crate`. Here we just record the hir-id of the item
4530// so it can fetched later.
4531#[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 ::rustc_data_structures::stable_hash::StableHash for ItemId {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4532pub struct ItemId {
4533    pub owner_id: OwnerId,
4534}
4535
4536impl ItemId {
4537    #[inline]
4538    pub fn hir_id(&self) -> HirId {
4539        // Items are always HIR owners.
4540        HirId::make_owner(self.owner_id.def_id)
4541    }
4542}
4543
4544/// An item
4545///
4546/// For more details, see the [rust lang reference].
4547/// Note that the reference does not document nightly-only features.
4548/// There may be also slight differences in the names and representation of AST nodes between
4549/// the compiler and the reference.
4550///
4551/// [rust lang reference]: https://doc.rust-lang.org/reference/items.html
4552#[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> ::rustc_data_structures::stable_hash::StableHash for
            Item<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4553pub struct Item<'hir> {
4554    pub owner_id: OwnerId,
4555    pub kind: ItemKind<'hir>,
4556    pub span: Span,
4557    pub vis_span: Span,
4558    pub has_delayed_lints: bool,
4559    /// hint to speed up collection: true if the item is a static or function and has
4560    /// either an `EiiImpls` or `EiiExternTarget` attribute
4561    pub eii: bool,
4562}
4563
4564impl<'hir> Item<'hir> {
4565    #[inline]
4566    pub fn hir_id(&self) -> HirId {
4567        // Items are always HIR owners.
4568        HirId::make_owner(self.owner_id.def_id)
4569    }
4570
4571    pub fn item_id(&self) -> ItemId {
4572        ItemId { owner_id: self.owner_id }
4573    }
4574
4575    /// Check if this is an [`ItemKind::Enum`], [`ItemKind::Struct`] or
4576    /// [`ItemKind::Union`].
4577    pub fn is_adt(&self) -> bool {
4578        #[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(..))
4579    }
4580
4581    /// Check if this is an [`ItemKind::Struct`] or [`ItemKind::Union`].
4582    pub fn is_struct_or_union(&self) -> bool {
4583        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    ItemKind::Struct(..) | ItemKind::Union(..) => true,
    _ => false,
}matches!(self.kind, ItemKind::Struct(..) | ItemKind::Union(..))
4584    }
4585
4586    #[track_caller]
pub fn expect_impl(&self) -> &Impl<'hir> {
    let ItemKind::Impl(imp) =
        &self.kind else { expect_failed("expect_impl", self) };
    imp
}expect_methods_self_kind! {
4587        expect_extern_crate, (Option<Symbol>, Ident),
4588            ItemKind::ExternCrate(s, ident), (*s, *ident);
4589
4590        expect_use, (&'hir UsePath<'hir>, UseKind), ItemKind::Use(p, uk), (p, *uk);
4591
4592        expect_static, (Mutability, Ident, &'hir Ty<'hir>, BodyId),
4593            ItemKind::Static(mutbl, ident, ty, body), (*mutbl, *ident, ty, *body);
4594
4595        expect_const, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4596            ItemKind::Const(ident, generics, ty, rhs), (*ident, generics, ty, *rhs);
4597
4598        expect_fn, (Ident, &FnSig<'hir>, &'hir Generics<'hir>, BodyId),
4599            ItemKind::Fn { ident, sig, generics, body, .. }, (*ident, sig, generics, *body);
4600
4601        expect_macro, (Ident, &ast::MacroDef, MacroKinds),
4602            ItemKind::Macro(ident, def, mk), (*ident, def, *mk);
4603
4604        expect_mod, (Ident, &'hir Mod<'hir>), ItemKind::Mod(ident, m), (*ident, m);
4605
4606        expect_foreign_mod, (ExternAbi, &'hir [ForeignItemId]),
4607            ItemKind::ForeignMod { abi, items }, (*abi, items);
4608
4609        expect_global_asm, &'hir InlineAsm<'hir>, ItemKind::GlobalAsm { asm, .. }, asm;
4610
4611        expect_ty_alias, (Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4612            ItemKind::TyAlias(ident, generics, ty), (*ident, generics, ty);
4613
4614        expect_enum, (Ident, &'hir Generics<'hir>, &EnumDef<'hir>),
4615            ItemKind::Enum(ident, generics, def), (*ident, generics, def);
4616
4617        expect_struct, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4618            ItemKind::Struct(ident, generics, data), (*ident, generics, data);
4619
4620        expect_union, (Ident, &'hir Generics<'hir>, &VariantData<'hir>),
4621            ItemKind::Union(ident, generics, data), (*ident, generics, data);
4622
4623        expect_trait,
4624            (
4625                &'hir ImplRestriction<'hir>,
4626                Constness,
4627                IsAuto,
4628                Safety,
4629                Ident,
4630                &'hir Generics<'hir>,
4631                GenericBounds<'hir>,
4632                &'hir [TraitItemId]
4633            ),
4634            ItemKind::Trait { impl_restriction, constness, is_auto, safety, ident, generics, bounds, items },
4635            (impl_restriction, *constness, *is_auto, *safety, *ident, generics, bounds, items);
4636
4637        expect_trait_alias, (Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4638            ItemKind::TraitAlias(constness, ident, generics, bounds), (*constness, *ident, generics, bounds);
4639
4640        expect_impl, &Impl<'hir>, ItemKind::Impl(imp), imp;
4641    }
4642}
4643
4644#[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> {
        ::core::option::Option::Some(::core::cmp::Ord::cmp(self, other))
    }
}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)]
4645#[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 ::rustc_data_structures::stable_hash::StableHash for Safety {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self { Safety::Unsafe => {} Safety::Safe => {} }
            }
        }
    };StableHash, #[automatically_derived]
impl ::core::default::Default for Safety {
    #[inline]
    fn default() -> Safety { Self::Unsafe }
}Default)]
4646pub enum Safety {
4647    /// This is the default variant, because the compiler messing up
4648    /// metadata encoding and failing to encode a `Safe` flag, means
4649    /// downstream crates think a thing is `Unsafe` instead of silently
4650    /// treating an unsafe thing as safe.
4651    #[default]
4652    Unsafe,
4653    Safe,
4654}
4655
4656impl Safety {
4657    pub fn prefix_str(self) -> &'static str {
4658        match self {
4659            Self::Unsafe => "unsafe ",
4660            Self::Safe => "",
4661        }
4662    }
4663
4664    #[inline]
4665    pub fn is_unsafe(self) -> bool {
4666        !self.is_safe()
4667    }
4668
4669    #[inline]
4670    pub fn is_safe(self) -> bool {
4671        match self {
4672            Self::Unsafe => false,
4673            Self::Safe => true,
4674        }
4675    }
4676}
4677
4678impl fmt::Display for Safety {
4679    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4680        f.write_str(match *self {
4681            Self::Unsafe => "unsafe",
4682            Self::Safe => "safe",
4683        })
4684    }
4685}
4686
4687#[derive(#[automatically_derived]
impl ::core::marker::Copy for Constness { }Copy, #[automatically_derived]
impl ::core::clone::Clone for Constness {
    #[inline]
    fn clone(&self) -> Constness {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *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 &&
            match (self, other) {
                (Constness::Const { always: __self_0 }, Constness::Const {
                    always: __arg1_0 }) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Constness {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for Constness {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Constness::Const { always: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Const",
                    "always", &__self_0),
            Constness::NotConst =>
                ::core::fmt::Formatter::write_str(f, "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 { always: ref __binding_0 } => { 0usize }
                        Constness::NotConst => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    Constness::Const { always: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    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 {
                            always: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    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 ::rustc_data_structures::stable_hash::StableHash for Constness {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Constness::Const { always: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Constness::NotConst => {}
                }
            }
        }
    };StableHash)]
4688pub enum Constness {
4689    Const { always: bool },
4690    NotConst,
4691}
4692
4693/// This impl exists as an optimization so that metadata deserialization can
4694/// store the value directly and not have to encode it wrapped in another `Option`.
4695impl Default for Constness {
4696    fn default() -> Self {
4697        Self::Const { always: false }
4698    }
4699}
4700
4701impl fmt::Display for Constness {
4702    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4703        f.write_str(match *self {
4704            Self::Const { always: true } => "comptime",
4705            Self::Const { always: false } => "const",
4706            Self::NotConst => "non-const",
4707        })
4708    }
4709}
4710
4711#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for ImplRestriction<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "ImplRestriction", "kind", &self.kind, "span", &&self.span)
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for ImplRestriction<'hir> {
    #[inline]
    fn clone(&self) -> ImplRestriction<'hir> {
        let _: ::core::clone::AssertParamIsClone<RestrictionKind<'hir>>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for ImplRestriction<'hir> { }Copy, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            ImplRestriction<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ImplRestriction {
                        kind: ref __binding_0, span: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4712pub struct ImplRestriction<'hir> {
4713    pub kind: RestrictionKind<'hir>,
4714    pub span: Span,
4715}
4716
4717#[derive(#[automatically_derived]
impl<'hir> ::core::fmt::Debug for RestrictionKind<'hir> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            RestrictionKind::Unrestricted =>
                ::core::fmt::Formatter::write_str(f, "Unrestricted"),
            RestrictionKind::Restricted(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Restricted", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'hir> ::core::clone::Clone for RestrictionKind<'hir> {
    #[inline]
    fn clone(&self) -> RestrictionKind<'hir> {
        let _: ::core::clone::AssertParamIsClone<&'hir Path<'hir, DefId>>;
        *self
    }
}Clone, #[automatically_derived]
impl<'hir> ::core::marker::Copy for RestrictionKind<'hir> { }Copy, const _: () =
    {
        impl<'hir> ::rustc_data_structures::stable_hash::StableHash for
            RestrictionKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    RestrictionKind::Unrestricted => {}
                    RestrictionKind::Restricted(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4718pub enum RestrictionKind<'hir> {
4719    /// The restriction does not affect the item.
4720    Unrestricted,
4721    /// The restriction only applies outside of this path.
4722    Restricted(&'hir Path<'hir, DefId>),
4723}
4724
4725/// The actual safety specified in syntax. We may treat
4726/// its safety different within the type system to create a
4727/// "sound by default" system that needs checking this enum
4728/// explicitly to allow unsafe operations.
4729#[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 ::rustc_data_structures::stable_hash::StableHash for HeaderSafety
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    HeaderSafety::SafeTargetFeatures => {}
                    HeaderSafety::Normal(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, #[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)]
4730pub enum HeaderSafety {
4731    /// A safe function annotated with `#[target_features]`.
4732    /// The type system treats this function as an unsafe function,
4733    /// but safety checking will check this enum to treat it as safe
4734    /// and allowing calling other safe target feature functions with
4735    /// the same features without requiring an additional unsafe block.
4736    SafeTargetFeatures,
4737    Normal(Safety),
4738}
4739
4740impl From<Safety> for HeaderSafety {
4741    fn from(v: Safety) -> Self {
4742        Self::Normal(v)
4743    }
4744}
4745
4746#[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 ::rustc_data_structures::stable_hash::StableHash for FnHeader {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    FnHeader {
                        safety: ref __binding_0,
                        constness: ref __binding_1,
                        asyncness: ref __binding_2,
                        abi: ref __binding_3 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4747pub struct FnHeader {
4748    pub safety: HeaderSafety,
4749    pub constness: Constness,
4750    pub asyncness: IsAsync,
4751    pub abi: ExternAbi,
4752}
4753
4754impl FnHeader {
4755    pub fn is_async(&self) -> bool {
4756        #[allow(non_exhaustive_omitted_patterns)] match self.asyncness {
    IsAsync::Async(_) => true,
    _ => false,
}matches!(self.asyncness, IsAsync::Async(_))
4757    }
4758
4759    pub fn is_unsafe(&self) -> bool {
4760        self.safety().is_unsafe()
4761    }
4762
4763    pub fn is_safe(&self) -> bool {
4764        self.safety().is_safe()
4765    }
4766
4767    pub fn safety(&self) -> Safety {
4768        match self.safety {
4769            HeaderSafety::SafeTargetFeatures => Safety::Unsafe,
4770            HeaderSafety::Normal(safety) => safety,
4771        }
4772    }
4773}
4774
4775#[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 {
                impl_restriction: __self_0,
                constness: __self_1,
                is_auto: __self_2,
                safety: __self_3,
                ident: __self_4,
                generics: __self_5,
                bounds: __self_6,
                items: __self_7 } => {
                let names: &'static _ =
                    &["impl_restriction", "constness", "is_auto", "safety",
                                "ident", "generics", "bounds", "items"];
                let values: &[&dyn ::core::fmt::Debug] =
                    &[__self_0, __self_1, __self_2, __self_3, __self_4,
                                __self_5, __self_6, &__self_7];
                ::core::fmt::Formatter::debug_struct_fields_finish(f, "Trait",
                    names, 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<&'hir ImplRestriction<'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> ::rustc_data_structures::stable_hash::StableHash for
            ItemKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ItemKind::ExternCrate(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Use(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Static(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Const(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Macro(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Mod(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::ForeignMod {
                        abi: ref __binding_0, items: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::GlobalAsm {
                        asm: ref __binding_0, fake_body: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::TyAlias(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Enum(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Struct(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Union(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Trait {
                        impl_restriction: ref __binding_0,
                        constness: ref __binding_1,
                        is_auto: ref __binding_2,
                        safety: ref __binding_3,
                        ident: ref __binding_4,
                        generics: ref __binding_5,
                        bounds: ref __binding_6,
                        items: ref __binding_7 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                        { __binding_6.stable_hash(__hcx, __hasher); }
                        { __binding_7.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::TraitAlias(ref __binding_0, ref __binding_1,
                        ref __binding_2, ref __binding_3) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                    }
                    ItemKind::Impl(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4776pub enum ItemKind<'hir> {
4777    /// An `extern crate` item, with optional *original* crate name if the crate was renamed.
4778    ///
4779    /// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
4780    ExternCrate(Option<Symbol>, Ident),
4781
4782    /// `use foo::bar::*;` or `use foo::bar::baz as quux;`
4783    ///
4784    /// or just
4785    ///
4786    /// `use foo::bar::baz;` (with `as baz` implicitly on the right).
4787    Use(&'hir UsePath<'hir>, UseKind),
4788
4789    /// A `static` item.
4790    Static(Mutability, Ident, &'hir Ty<'hir>, BodyId),
4791    /// A `const` item.
4792    Const(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>, ConstItemRhs<'hir>),
4793    /// A function declaration.
4794    Fn {
4795        sig: FnSig<'hir>,
4796        ident: Ident,
4797        generics: &'hir Generics<'hir>,
4798        body: BodyId,
4799        /// Whether this function actually has a body.
4800        /// For functions without a body, `body` is synthesized (to avoid ICEs all over the
4801        /// compiler), but that code should never be translated.
4802        has_body: bool,
4803    },
4804    /// A MBE macro definition (`macro_rules!` or `macro`).
4805    Macro(Ident, &'hir ast::MacroDef, MacroKinds),
4806    /// A module.
4807    Mod(Ident, &'hir Mod<'hir>),
4808    /// An external module, e.g. `extern { .. }`.
4809    ForeignMod { abi: ExternAbi, items: &'hir [ForeignItemId] },
4810    /// Module-level inline assembly (from `global_asm!`).
4811    GlobalAsm {
4812        asm: &'hir InlineAsm<'hir>,
4813        /// A fake body which stores typeck results for the global asm's sym_fn
4814        /// operands, which are represented as path expressions. This body contains
4815        /// a single [`ExprKind::InlineAsm`] which points to the asm in the field
4816        /// above, and which is typechecked like a inline asm expr just for the
4817        /// typeck results.
4818        fake_body: BodyId,
4819    },
4820    /// A type alias, e.g., `type Foo = Bar<u8>`.
4821    TyAlias(Ident, &'hir Generics<'hir>, &'hir Ty<'hir>),
4822    /// An enum definition, e.g., `enum Foo<A, B> { C<A>, D<B> }`.
4823    Enum(Ident, &'hir Generics<'hir>, EnumDef<'hir>),
4824    /// A struct definition, e.g., `struct Foo<A> {x: A}`.
4825    Struct(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4826    /// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`.
4827    Union(Ident, &'hir Generics<'hir>, VariantData<'hir>),
4828    /// A trait definition.
4829    Trait {
4830        impl_restriction: &'hir ImplRestriction<'hir>,
4831        constness: Constness,
4832        is_auto: IsAuto,
4833        safety: Safety,
4834        ident: Ident,
4835        generics: &'hir Generics<'hir>,
4836        bounds: GenericBounds<'hir>,
4837        items: &'hir [TraitItemId],
4838    },
4839    /// A trait alias.
4840    TraitAlias(Constness, Ident, &'hir Generics<'hir>, GenericBounds<'hir>),
4841
4842    /// An implementation, e.g., `impl<A> Trait for Foo { .. }`.
4843    Impl(Impl<'hir>),
4844}
4845
4846/// Represents an impl block declaration.
4847///
4848/// E.g., `impl $Type { .. }` or `impl $Trait for $Type { .. }`
4849/// Refer to [`ImplItem`] for an associated item within an impl block.
4850#[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> ::rustc_data_structures::stable_hash::StableHash for
            Impl<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4851pub struct Impl<'hir> {
4852    pub generics: &'hir Generics<'hir>,
4853    pub of_trait: Option<&'hir TraitImplHeader<'hir>>,
4854    pub self_ty: &'hir Ty<'hir>,
4855    pub items: &'hir [ImplItemId],
4856    pub constness: Constness,
4857}
4858
4859#[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> ::rustc_data_structures::stable_hash::StableHash for
            TraitImplHeader<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4860pub struct TraitImplHeader<'hir> {
4861    pub safety: Safety,
4862    pub polarity: ImplPolarity,
4863    pub defaultness: Defaultness,
4864    // We do not put a `Span` in `Defaultness` because it breaks foreign crate metadata
4865    // decoding as `Span`s cannot be decoded when a `Session` is not available.
4866    pub defaultness_span: Option<Span>,
4867    pub trait_ref: TraitRef<'hir>,
4868}
4869
4870impl ItemKind<'_> {
4871    pub fn ident(&self) -> Option<Ident> {
4872        match *self {
4873            ItemKind::ExternCrate(_, ident)
4874            | ItemKind::Use(_, UseKind::Single(ident))
4875            | ItemKind::Static(_, ident, ..)
4876            | ItemKind::Const(ident, ..)
4877            | ItemKind::Fn { ident, .. }
4878            | ItemKind::Macro(ident, ..)
4879            | ItemKind::Mod(ident, ..)
4880            | ItemKind::TyAlias(ident, ..)
4881            | ItemKind::Enum(ident, ..)
4882            | ItemKind::Struct(ident, ..)
4883            | ItemKind::Union(ident, ..)
4884            | ItemKind::Trait { ident, .. }
4885            | ItemKind::TraitAlias(_, ident, ..) => Some(ident),
4886
4887            ItemKind::Use(_, UseKind::Glob | UseKind::ListStem)
4888            | ItemKind::ForeignMod { .. }
4889            | ItemKind::GlobalAsm { .. }
4890            | ItemKind::Impl(_) => None,
4891        }
4892    }
4893
4894    pub fn generics(&self) -> Option<&Generics<'_>> {
4895        Some(match self {
4896            ItemKind::Fn { generics, .. }
4897            | ItemKind::TyAlias(_, generics, _)
4898            | ItemKind::Const(_, generics, _, _)
4899            | ItemKind::Enum(_, generics, _)
4900            | ItemKind::Struct(_, generics, _)
4901            | ItemKind::Union(_, generics, _)
4902            | ItemKind::Trait { generics, .. }
4903            | ItemKind::TraitAlias(_, _, generics, _)
4904            | ItemKind::Impl(Impl { generics, .. }) => generics,
4905            _ => return None,
4906        })
4907    }
4908
4909    pub fn recovered(&self) -> bool {
4910        match self {
4911            ItemKind::Struct(
4912                _,
4913                _,
4914                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4915            ) => true,
4916            ItemKind::Union(
4917                _,
4918                _,
4919                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. },
4920            ) => true,
4921            ItemKind::Enum(_, _, def) => def.variants.iter().any(|v| match v.data {
4922                VariantData::Struct { recovered: ast::Recovered::Yes(_), .. } => true,
4923                _ => false,
4924            }),
4925            _ => false,
4926        }
4927    }
4928}
4929
4930// The bodies for items are stored "out of line", in a separate
4931// hashmap in the `Crate`. Here we just record the hir-id of the item
4932// so it can fetched later.
4933#[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 ::rustc_data_structures::stable_hash::StableHash for
            ForeignItemId {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    ForeignItemId { owner_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4934pub struct ForeignItemId {
4935    pub owner_id: OwnerId,
4936}
4937
4938impl ForeignItemId {
4939    #[inline]
4940    pub fn hir_id(&self) -> HirId {
4941        // Items are always HIR owners.
4942        HirId::make_owner(self.owner_id.def_id)
4943    }
4944}
4945
4946#[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> ::rustc_data_structures::stable_hash::StableHash for
            ForeignItem<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::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.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                        { __binding_3.stable_hash(__hcx, __hasher); }
                        { __binding_4.stable_hash(__hcx, __hasher); }
                        { __binding_5.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4947pub struct ForeignItem<'hir> {
4948    pub ident: Ident,
4949    pub kind: ForeignItemKind<'hir>,
4950    pub owner_id: OwnerId,
4951    pub span: Span,
4952    pub vis_span: Span,
4953    pub has_delayed_lints: bool,
4954}
4955
4956impl ForeignItem<'_> {
4957    #[inline]
4958    pub fn hir_id(&self) -> HirId {
4959        // Items are always HIR owners.
4960        HirId::make_owner(self.owner_id.def_id)
4961    }
4962
4963    pub fn foreign_item_id(&self) -> ForeignItemId {
4964        ForeignItemId { owner_id: self.owner_id }
4965    }
4966}
4967
4968/// An item within an `extern` block.
4969#[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> ::rustc_data_structures::stable_hash::StableHash for
            ForeignItemKind<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ForeignItemKind::Fn(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ForeignItemKind::Static(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                    ForeignItemKind::Type => {}
                }
            }
        }
    };StableHash)]
4970pub enum ForeignItemKind<'hir> {
4971    /// A foreign function.
4972    ///
4973    /// All argument idents are actually always present (i.e. `Some`), but
4974    /// `&[Option<Ident>]` is used because of code paths shared with `TraitFn`
4975    /// and `FnPtrTy`. The sharing is due to all of these cases not allowing
4976    /// arbitrary patterns for parameters.
4977    Fn(FnSig<'hir>, &'hir [Option<Ident>], &'hir Generics<'hir>),
4978    /// A foreign static item (`static ext: u8`).
4979    Static(&'hir Ty<'hir>, Mutability, Safety),
4980    /// A foreign type.
4981    Type,
4982}
4983
4984/// A variable captured by a closure.
4985#[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 ::rustc_data_structures::stable_hash::StableHash for Upvar {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    Upvar { span: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4986pub struct Upvar {
4987    /// First span where it is accessed (there can be multiple).
4988    pub span: Span,
4989}
4990
4991// The TraitCandidate's import_ids is empty if the trait is defined in the same module, and
4992// has length > 0 if the trait is found through an chain of imports, starting with the
4993// import/use statement in the scope where the trait is used.
4994#[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> ::rustc_data_structures::stable_hash::StableHash for
            TraitCandidate<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                match *self {
                    TraitCandidate {
                        def_id: ref __binding_0,
                        import_ids: ref __binding_1,
                        lint_ambiguous: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
4995pub struct TraitCandidate<'hir> {
4996    pub def_id: DefId,
4997    pub import_ids: &'hir [LocalDefId],
4998    // Indicates whether this trait candidate is ambiguously glob imported
4999    // in it's scope. Related to the AMBIGUOUS_GLOB_IMPORTED_TRAITS lint.
5000    // If this is set to true and the trait is used as a result of method lookup, this
5001    // lint is thrown.
5002    pub lint_ambiguous: bool,
5003}
5004
5005#[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> ::rustc_data_structures::stable_hash::StableHash for
            OwnerNode<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    OwnerNode::Item(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    OwnerNode::ForeignItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    OwnerNode::TraitItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    OwnerNode::ImplItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    OwnerNode::Crate(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    OwnerNode::Synthetic => {}
                }
            }
        }
    };StableHash)]
5006pub enum OwnerNode<'hir> {
5007    Item(&'hir Item<'hir>),
5008    ForeignItem(&'hir ForeignItem<'hir>),
5009    TraitItem(&'hir TraitItem<'hir>),
5010    ImplItem(&'hir ImplItem<'hir>),
5011    Crate(&'hir Mod<'hir>),
5012    Synthetic,
5013}
5014
5015impl<'hir> OwnerNode<'hir> {
5016    pub fn span(&self) -> Span {
5017        match self {
5018            OwnerNode::Item(Item { span, .. })
5019            | OwnerNode::ForeignItem(ForeignItem { span, .. })
5020            | OwnerNode::ImplItem(ImplItem { span, .. })
5021            | OwnerNode::TraitItem(TraitItem { span, .. }) => *span,
5022            OwnerNode::Crate(Mod { spans: ModSpans { inner_span, .. }, .. }) => *inner_span,
5023            OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
5024        }
5025    }
5026
5027    pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
5028        match self {
5029            OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5030            | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5031            | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5032            | OwnerNode::ForeignItem(ForeignItem {
5033                kind: ForeignItemKind::Fn(fn_sig, _, _), ..
5034            }) => Some(fn_sig),
5035            _ => None,
5036        }
5037    }
5038
5039    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
5040        match self {
5041            OwnerNode::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5042            | OwnerNode::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5043            | OwnerNode::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5044            | OwnerNode::ForeignItem(ForeignItem {
5045                kind: ForeignItemKind::Fn(fn_sig, _, _), ..
5046            }) => Some(fn_sig.decl),
5047            _ => None,
5048        }
5049    }
5050
5051    pub fn body_id(&self) -> Option<BodyId> {
5052        match self {
5053            OwnerNode::Item(Item {
5054                kind:
5055                    ItemKind::Static(_, _, _, body)
5056                    | ItemKind::Const(.., ConstItemRhs::Body(body))
5057                    | ItemKind::Fn { body, .. },
5058                ..
5059            })
5060            | OwnerNode::TraitItem(TraitItem {
5061                kind:
5062                    TraitItemKind::Fn(_, TraitFn::Provided(body))
5063                    | TraitItemKind::Const(_, Some(ConstItemRhs::Body(body))),
5064                ..
5065            })
5066            | OwnerNode::ImplItem(ImplItem {
5067                kind: ImplItemKind::Fn(_, body) | ImplItemKind::Const(_, ConstItemRhs::Body(body)),
5068                ..
5069            }) => Some(*body),
5070            _ => None,
5071        }
5072    }
5073
5074    pub fn generics(self) -> Option<&'hir Generics<'hir>> {
5075        Node::generics(self.into())
5076    }
5077
5078    pub fn def_id(self) -> OwnerId {
5079        match self {
5080            OwnerNode::Item(Item { owner_id, .. })
5081            | OwnerNode::TraitItem(TraitItem { owner_id, .. })
5082            | OwnerNode::ImplItem(ImplItem { owner_id, .. })
5083            | OwnerNode::ForeignItem(ForeignItem { owner_id, .. }) => *owner_id,
5084            OwnerNode::Crate(..) => crate::CRATE_HIR_ID.owner,
5085            OwnerNode::Synthetic => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
5086        }
5087    }
5088
5089    /// Check if node is an impl block.
5090    pub fn is_impl_block(&self) -> bool {
5091        #[allow(non_exhaustive_omitted_patterns)] match self {
    OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }) => true,
    _ => false,
}matches!(self, OwnerNode::Item(Item { kind: ItemKind::Impl(_), .. }))
5092    }
5093
5094    #[track_caller]
pub fn expect_trait_item(&self) -> &'hir TraitItem<'hir> {
    let OwnerNode::TraitItem(n) =
        self else { expect_failed("expect_trait_item", self) };
    n
}expect_methods_self! {
5095        expect_item,         &'hir Item<'hir>,        OwnerNode::Item(n),        n;
5096        expect_foreign_item, &'hir ForeignItem<'hir>, OwnerNode::ForeignItem(n), n;
5097        expect_impl_item,    &'hir ImplItem<'hir>,    OwnerNode::ImplItem(n),    n;
5098        expect_trait_item,   &'hir TraitItem<'hir>,   OwnerNode::TraitItem(n),   n;
5099    }
5100}
5101
5102impl<'hir> From<&'hir Item<'hir>> for OwnerNode<'hir> {
5103    fn from(val: &'hir Item<'hir>) -> Self {
5104        OwnerNode::Item(val)
5105    }
5106}
5107
5108impl<'hir> From<&'hir ForeignItem<'hir>> for OwnerNode<'hir> {
5109    fn from(val: &'hir ForeignItem<'hir>) -> Self {
5110        OwnerNode::ForeignItem(val)
5111    }
5112}
5113
5114impl<'hir> From<&'hir ImplItem<'hir>> for OwnerNode<'hir> {
5115    fn from(val: &'hir ImplItem<'hir>) -> Self {
5116        OwnerNode::ImplItem(val)
5117    }
5118}
5119
5120impl<'hir> From<&'hir TraitItem<'hir>> for OwnerNode<'hir> {
5121    fn from(val: &'hir TraitItem<'hir>) -> Self {
5122        OwnerNode::TraitItem(val)
5123    }
5124}
5125
5126impl<'hir> From<OwnerNode<'hir>> for Node<'hir> {
5127    fn from(val: OwnerNode<'hir>) -> Self {
5128        match val {
5129            OwnerNode::Item(n) => Node::Item(n),
5130            OwnerNode::ForeignItem(n) => Node::ForeignItem(n),
5131            OwnerNode::ImplItem(n) => Node::ImplItem(n),
5132            OwnerNode::TraitItem(n) => Node::TraitItem(n),
5133            OwnerNode::Crate(n) => Node::Crate(n),
5134            OwnerNode::Synthetic => Node::Synthetic,
5135        }
5136    }
5137}
5138
5139#[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> ::rustc_data_structures::stable_hash::StableHash for
            Node<'hir> {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Node::Param(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Item(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ForeignItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::TraitItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ImplItem(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Variant(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Field(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::AnonConst(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ConstBlock(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ConstArg(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Expr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ExprField(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::ConstArgExprField(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Stmt(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::PathSegment(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Ty(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::AssocItemConstraint(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::TraitRef(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::OpaqueTy(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::TyPat(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Pat(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::PatField(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::PatExpr(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Arm(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Block(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::LetStmt(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Ctor(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Lifetime(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::GenericParam(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Crate(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Infer(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::WherePredicate(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::PreciseCapturingNonLifetimeArg(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    Node::Synthetic => {}
                    Node::Err(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash)]
5140pub enum Node<'hir> {
5141    Param(&'hir Param<'hir>),
5142    Item(&'hir Item<'hir>),
5143    ForeignItem(&'hir ForeignItem<'hir>),
5144    TraitItem(&'hir TraitItem<'hir>),
5145    ImplItem(&'hir ImplItem<'hir>),
5146    Variant(&'hir Variant<'hir>),
5147    Field(&'hir FieldDef<'hir>),
5148    AnonConst(&'hir AnonConst),
5149    ConstBlock(&'hir ConstBlock),
5150    ConstArg(&'hir ConstArg<'hir>),
5151    Expr(&'hir Expr<'hir>),
5152    ExprField(&'hir ExprField<'hir>),
5153    ConstArgExprField(&'hir ConstArgExprField<'hir>),
5154    Stmt(&'hir Stmt<'hir>),
5155    PathSegment(&'hir PathSegment<'hir>),
5156    Ty(&'hir Ty<'hir>),
5157    AssocItemConstraint(&'hir AssocItemConstraint<'hir>),
5158    TraitRef(&'hir TraitRef<'hir>),
5159    OpaqueTy(&'hir OpaqueTy<'hir>),
5160    TyPat(&'hir TyPat<'hir>),
5161    Pat(&'hir Pat<'hir>),
5162    PatField(&'hir PatField<'hir>),
5163    /// Needed as its own node with its own HirId for tracking
5164    /// the unadjusted type of literals within patterns
5165    /// (e.g. byte str literals not being of slice type).
5166    PatExpr(&'hir PatExpr<'hir>),
5167    Arm(&'hir Arm<'hir>),
5168    Block(&'hir Block<'hir>),
5169    LetStmt(&'hir LetStmt<'hir>),
5170    /// `Ctor` refers to the constructor of an enum variant or struct. Only tuple or unit variants
5171    /// with synthesized constructors.
5172    Ctor(&'hir VariantData<'hir>),
5173    Lifetime(&'hir Lifetime),
5174    GenericParam(&'hir GenericParam<'hir>),
5175    Crate(&'hir Mod<'hir>),
5176    Infer(&'hir InferArg),
5177    WherePredicate(&'hir WherePredicate<'hir>),
5178    PreciseCapturingNonLifetimeArg(&'hir PreciseCapturingNonLifetimeArg),
5179    // Created by query feeding
5180    Synthetic,
5181    Err(Span),
5182}
5183
5184impl<'hir> Node<'hir> {
5185    /// Get the identifier of this `Node`, if applicable.
5186    ///
5187    /// # Edge cases
5188    ///
5189    /// Calling `.ident()` on a [`Node::Ctor`] will return `None`
5190    /// because `Ctor`s do not have identifiers themselves.
5191    /// Instead, call `.ident()` on the parent struct/variant, like so:
5192    ///
5193    /// ```ignore (illustrative)
5194    /// ctor
5195    ///     .ctor_hir_id()
5196    ///     .map(|ctor_id| tcx.parent_hir_node(ctor_id))
5197    ///     .and_then(|parent| parent.ident())
5198    /// ```
5199    pub fn ident(&self) -> Option<Ident> {
5200        match self {
5201            Node::Item(item) => item.kind.ident(),
5202            Node::TraitItem(TraitItem { ident, .. })
5203            | Node::ImplItem(ImplItem { ident, .. })
5204            | Node::ForeignItem(ForeignItem { ident, .. })
5205            | Node::Field(FieldDef { ident, .. })
5206            | Node::Variant(Variant { ident, .. })
5207            | Node::PathSegment(PathSegment { ident, .. }) => Some(*ident),
5208            Node::Lifetime(lt) => Some(lt.ident),
5209            Node::GenericParam(p) => Some(p.name.ident()),
5210            Node::AssocItemConstraint(c) => Some(c.ident),
5211            Node::PatField(f) => Some(f.ident),
5212            Node::ExprField(f) => Some(f.ident),
5213            Node::ConstArgExprField(f) => Some(f.field),
5214            Node::PreciseCapturingNonLifetimeArg(a) => Some(a.ident),
5215            Node::Param(..)
5216            | Node::AnonConst(..)
5217            | Node::ConstBlock(..)
5218            | Node::ConstArg(..)
5219            | Node::Expr(..)
5220            | Node::Stmt(..)
5221            | Node::Block(..)
5222            | Node::Ctor(..)
5223            | Node::Pat(..)
5224            | Node::TyPat(..)
5225            | Node::PatExpr(..)
5226            | Node::Arm(..)
5227            | Node::LetStmt(..)
5228            | Node::Crate(..)
5229            | Node::Ty(..)
5230            | Node::TraitRef(..)
5231            | Node::OpaqueTy(..)
5232            | Node::Infer(..)
5233            | Node::WherePredicate(..)
5234            | Node::Synthetic
5235            | Node::Err(..) => None,
5236        }
5237    }
5238
5239    pub fn fn_decl(self) -> Option<&'hir FnDecl<'hir>> {
5240        match self {
5241            Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5242            | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5243            | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5244            | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
5245                Some(fn_sig.decl)
5246            }
5247            Node::Expr(Expr { kind: ExprKind::Closure(Closure { fn_decl, .. }), .. }) => {
5248                Some(fn_decl)
5249            }
5250            _ => None,
5251        }
5252    }
5253
5254    /// Get a `hir::Impl` if the node is an impl block for the given `trait_def_id`.
5255    pub fn impl_block_of_trait(self, trait_def_id: DefId) -> Option<&'hir Impl<'hir>> {
5256        if let Node::Item(Item { kind: ItemKind::Impl(impl_block), .. }) = self
5257            && let Some(of_trait) = impl_block.of_trait
5258            && let Some(trait_id) = of_trait.trait_ref.trait_def_id()
5259            && trait_id == trait_def_id
5260        {
5261            Some(impl_block)
5262        } else {
5263            None
5264        }
5265    }
5266
5267    pub fn fn_sig(self) -> Option<&'hir FnSig<'hir>> {
5268        match self {
5269            Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
5270            | Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
5271            | Node::Item(Item { kind: ItemKind::Fn { sig: fn_sig, .. }, .. })
5272            | Node::ForeignItem(ForeignItem { kind: ForeignItemKind::Fn(fn_sig, _, _), .. }) => {
5273                Some(fn_sig)
5274            }
5275            _ => None,
5276        }
5277    }
5278
5279    /// Get the type for constants, assoc types, type aliases and statics.
5280    pub fn ty(self) -> Option<&'hir Ty<'hir>> {
5281        match self {
5282            Node::Item(it) => match it.kind {
5283                ItemKind::TyAlias(_, _, ty)
5284                | ItemKind::Static(_, _, ty, _)
5285                | ItemKind::Const(_, _, ty, _) => Some(ty),
5286                ItemKind::Impl(impl_item) => Some(&impl_item.self_ty),
5287                _ => None,
5288            },
5289            Node::TraitItem(it) => match it.kind {
5290                TraitItemKind::Const(ty, _) => Some(ty),
5291                TraitItemKind::Type(_, ty) => ty,
5292                _ => None,
5293            },
5294            Node::ImplItem(it) => match it.kind {
5295                ImplItemKind::Const(ty, _) => Some(ty),
5296                ImplItemKind::Type(ty) => Some(ty),
5297                _ => None,
5298            },
5299            Node::ForeignItem(it) => match it.kind {
5300                ForeignItemKind::Static(ty, ..) => Some(ty),
5301                _ => None,
5302            },
5303            Node::GenericParam(param) => match param.kind {
5304                GenericParamKind::Lifetime { .. } => None,
5305                GenericParamKind::Type { default, .. } => default,
5306                GenericParamKind::Const { ty, .. } => Some(ty),
5307            },
5308            Node::Field(f) => Some(f.ty),
5309            _ => None,
5310        }
5311    }
5312
5313    pub fn alias_ty(self) -> Option<&'hir Ty<'hir>> {
5314        match self {
5315            Node::Item(Item { kind: ItemKind::TyAlias(_, _, ty), .. }) => Some(ty),
5316            _ => None,
5317        }
5318    }
5319
5320    #[inline]
5321    pub fn associated_body(&self) -> Option<(LocalDefId, BodyId)> {
5322        match self {
5323            Node::Item(Item {
5324                owner_id,
5325                kind:
5326                    ItemKind::Const(.., ConstItemRhs::Body(body))
5327                    | ItemKind::Static(.., body)
5328                    | ItemKind::Fn { body, .. },
5329                ..
5330            })
5331            | Node::TraitItem(TraitItem {
5332                owner_id,
5333                kind:
5334                    TraitItemKind::Const(_, Some(ConstItemRhs::Body(body)))
5335                    | TraitItemKind::Fn(_, TraitFn::Provided(body)),
5336                ..
5337            })
5338            | Node::ImplItem(ImplItem {
5339                owner_id,
5340                kind: ImplItemKind::Const(.., ConstItemRhs::Body(body)) | ImplItemKind::Fn(_, body),
5341                ..
5342            }) => Some((owner_id.def_id, *body)),
5343
5344            Node::Item(Item {
5345                owner_id, kind: ItemKind::GlobalAsm { asm: _, fake_body }, ..
5346            }) => Some((owner_id.def_id, *fake_body)),
5347
5348            Node::Expr(Expr { kind: ExprKind::Closure(Closure { def_id, body, .. }), .. }) => {
5349                Some((*def_id, *body))
5350            }
5351
5352            Node::AnonConst(constant) => Some((constant.def_id, constant.body)),
5353            Node::ConstBlock(constant) => Some((constant.def_id, constant.body)),
5354
5355            _ => None,
5356        }
5357    }
5358
5359    pub fn body_id(&self) -> Option<BodyId> {
5360        Some(self.associated_body()?.1)
5361    }
5362
5363    pub fn generics(self) -> Option<&'hir Generics<'hir>> {
5364        match self {
5365            Node::ForeignItem(ForeignItem {
5366                kind: ForeignItemKind::Fn(_, _, generics), ..
5367            })
5368            | Node::TraitItem(TraitItem { generics, .. })
5369            | Node::ImplItem(ImplItem { generics, .. }) => Some(generics),
5370            Node::Item(item) => item.kind.generics(),
5371            _ => None,
5372        }
5373    }
5374
5375    pub fn as_owner(self) -> Option<OwnerNode<'hir>> {
5376        match self {
5377            Node::Item(i) => Some(OwnerNode::Item(i)),
5378            Node::ForeignItem(i) => Some(OwnerNode::ForeignItem(i)),
5379            Node::TraitItem(i) => Some(OwnerNode::TraitItem(i)),
5380            Node::ImplItem(i) => Some(OwnerNode::ImplItem(i)),
5381            Node::Crate(i) => Some(OwnerNode::Crate(i)),
5382            Node::Synthetic => Some(OwnerNode::Synthetic),
5383            _ => None,
5384        }
5385    }
5386
5387    pub fn fn_kind(self) -> Option<FnKind<'hir>> {
5388        match self {
5389            Node::Item(i) => match i.kind {
5390                ItemKind::Fn { ident, sig, generics, .. } => {
5391                    Some(FnKind::ItemFn(ident, generics, sig.header))
5392                }
5393                _ => None,
5394            },
5395            Node::TraitItem(ti) => match ti.kind {
5396                TraitItemKind::Fn(ref sig, _) => Some(FnKind::Method(ti.ident, sig)),
5397                _ => None,
5398            },
5399            Node::ImplItem(ii) => match ii.kind {
5400                ImplItemKind::Fn(ref sig, _) => Some(FnKind::Method(ii.ident, sig)),
5401                _ => None,
5402            },
5403            Node::Expr(e) => match e.kind {
5404                ExprKind::Closure { .. } => Some(FnKind::Closure),
5405                _ => None,
5406            },
5407            _ => None,
5408        }
5409    }
5410
5411    #[track_caller]
pub fn expect_closure(&self) -> &'hir Closure<'hir> {
    let Node::Expr(Expr { kind: ExprKind::Closure(n), .. }) =
        self else { expect_failed("expect_closure", self) };
    n
}expect_methods_self! {
5412        expect_param,         &'hir Param<'hir>,        Node::Param(n),        n;
5413        expect_item,          &'hir Item<'hir>,         Node::Item(n),         n;
5414        expect_foreign_item,  &'hir ForeignItem<'hir>,  Node::ForeignItem(n),  n;
5415        expect_trait_item,    &'hir TraitItem<'hir>,    Node::TraitItem(n),    n;
5416        expect_impl_item,     &'hir ImplItem<'hir>,     Node::ImplItem(n),     n;
5417        expect_variant,       &'hir Variant<'hir>,      Node::Variant(n),      n;
5418        expect_field,         &'hir FieldDef<'hir>,     Node::Field(n),        n;
5419        expect_anon_const,    &'hir AnonConst,          Node::AnonConst(n),    n;
5420        expect_inline_const,  &'hir ConstBlock,         Node::ConstBlock(n),   n;
5421        expect_expr,          &'hir Expr<'hir>,         Node::Expr(n),         n;
5422        expect_expr_field,    &'hir ExprField<'hir>,    Node::ExprField(n),    n;
5423        expect_stmt,          &'hir Stmt<'hir>,         Node::Stmt(n),         n;
5424        expect_path_segment,  &'hir PathSegment<'hir>,  Node::PathSegment(n),  n;
5425        expect_ty,            &'hir Ty<'hir>,           Node::Ty(n),           n;
5426        expect_assoc_item_constraint,  &'hir AssocItemConstraint<'hir>,  Node::AssocItemConstraint(n),  n;
5427        expect_trait_ref,     &'hir TraitRef<'hir>,     Node::TraitRef(n),     n;
5428        expect_opaque_ty,     &'hir OpaqueTy<'hir>,     Node::OpaqueTy(n),     n;
5429        expect_pat,           &'hir Pat<'hir>,          Node::Pat(n),          n;
5430        expect_pat_field,     &'hir PatField<'hir>,     Node::PatField(n),     n;
5431        expect_arm,           &'hir Arm<'hir>,          Node::Arm(n),          n;
5432        expect_block,         &'hir Block<'hir>,        Node::Block(n),        n;
5433        expect_let_stmt,      &'hir LetStmt<'hir>,      Node::LetStmt(n),      n;
5434        expect_ctor,          &'hir VariantData<'hir>,  Node::Ctor(n),         n;
5435        expect_lifetime,      &'hir Lifetime,           Node::Lifetime(n),     n;
5436        expect_generic_param, &'hir GenericParam<'hir>, Node::GenericParam(n), n;
5437        expect_crate,         &'hir Mod<'hir>,          Node::Crate(n),        n;
5438        expect_infer,         &'hir InferArg,           Node::Infer(n),        n;
5439        expect_closure,       &'hir Closure<'hir>, Node::Expr(Expr { kind: ExprKind::Closure(n), .. }), n;
5440    }
5441}
5442
5443// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
5444#[cfg(target_pointer_width = "64")]
5445mod size_asserts {
5446    use rustc_data_structures::static_assert_size;
5447
5448    use super::*;
5449    // tidy-alphabetical-start
5450    const _: [(); 48] = [(); ::std::mem::size_of::<Block<'_>>()];static_assert_size!(Block<'_>, 48);
5451    const _: [(); 24] = [(); ::std::mem::size_of::<Body<'_>>()];static_assert_size!(Body<'_>, 24);
5452    const _: [(); 64] = [(); ::std::mem::size_of::<Expr<'_>>()];static_assert_size!(Expr<'_>, 64);
5453    const _: [(); 48] = [(); ::std::mem::size_of::<ExprKind<'_>>()];static_assert_size!(ExprKind<'_>, 48);
5454    const _: [(); 40] = [(); ::std::mem::size_of::<FnDecl<'_>>()];static_assert_size!(FnDecl<'_>, 40);
5455    const _: [(); 96] = [(); ::std::mem::size_of::<ForeignItem<'_>>()];static_assert_size!(ForeignItem<'_>, 96);
5456    const _: [(); 56] = [(); ::std::mem::size_of::<ForeignItemKind<'_>>()];static_assert_size!(ForeignItemKind<'_>, 56);
5457    const _: [(); 16] = [(); ::std::mem::size_of::<GenericArg<'_>>()];static_assert_size!(GenericArg<'_>, 16);
5458    const _: [(); 64] = [(); ::std::mem::size_of::<GenericBound<'_>>()];static_assert_size!(GenericBound<'_>, 64);
5459    const _: [(); 56] = [(); ::std::mem::size_of::<Generics<'_>>()];static_assert_size!(Generics<'_>, 56);
5460    const _: [(); 48] = [(); ::std::mem::size_of::<Impl<'_>>()];static_assert_size!(Impl<'_>, 48);
5461    const _: [(); 88] = [(); ::std::mem::size_of::<ImplItem<'_>>()];static_assert_size!(ImplItem<'_>, 88);
5462    const _: [(); 40] = [(); ::std::mem::size_of::<ImplItemKind<'_>>()];static_assert_size!(ImplItemKind<'_>, 40);
5463    const _: [(); 88] = [(); ::std::mem::size_of::<Item<'_>>()];static_assert_size!(Item<'_>, 88);
5464    const _: [(); 64] = [(); ::std::mem::size_of::<ItemKind<'_>>()];static_assert_size!(ItemKind<'_>, 64);
5465    const _: [(); 64] = [(); ::std::mem::size_of::<LetStmt<'_>>()];static_assert_size!(LetStmt<'_>, 64);
5466    const _: [(); 32] = [(); ::std::mem::size_of::<Param<'_>>()];static_assert_size!(Param<'_>, 32);
5467    const _: [(); 80] = [(); ::std::mem::size_of::<Pat<'_>>()];static_assert_size!(Pat<'_>, 80);
5468    const _: [(); 56] = [(); ::std::mem::size_of::<PatKind<'_>>()];static_assert_size!(PatKind<'_>, 56);
5469    const _: [(); 40] = [(); ::std::mem::size_of::<Path<'_>>()];static_assert_size!(Path<'_>, 40);
5470    const _: [(); 48] = [(); ::std::mem::size_of::<PathSegment<'_>>()];static_assert_size!(PathSegment<'_>, 48);
5471    const _: [(); 24] = [(); ::std::mem::size_of::<QPath<'_>>()];static_assert_size!(QPath<'_>, 24);
5472    const _: [(); 12] = [(); ::std::mem::size_of::<Res>()];static_assert_size!(Res, 12);
5473    const _: [(); 32] = [(); ::std::mem::size_of::<Stmt<'_>>()];static_assert_size!(Stmt<'_>, 32);
5474    const _: [(); 16] = [(); ::std::mem::size_of::<StmtKind<'_>>()];static_assert_size!(StmtKind<'_>, 16);
5475    const _: [(); 48] = [(); ::std::mem::size_of::<TraitImplHeader<'_>>()];static_assert_size!(TraitImplHeader<'_>, 48);
5476    const _: [(); 88] = [(); ::std::mem::size_of::<TraitItem<'_>>()];static_assert_size!(TraitItem<'_>, 88);
5477    const _: [(); 48] = [(); ::std::mem::size_of::<TraitItemKind<'_>>()];static_assert_size!(TraitItemKind<'_>, 48);
5478    const _: [(); 48] = [(); ::std::mem::size_of::<Ty<'_>>()];static_assert_size!(Ty<'_>, 48);
5479    const _: [(); 32] = [(); ::std::mem::size_of::<TyKind<'_>>()];static_assert_size!(TyKind<'_>, 32);
5480    // tidy-alphabetical-end
5481}
5482
5483#[cfg(test)]
5484mod tests;