Skip to main content

rustc_hir/
hir.rs

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