Skip to main content

rustc_type_ir/
ty_kind.rs

1use std::fmt;
2use std::marker::PhantomData;
3use std::ops::Deref;
4
5use derive_where::derive_where;
6use rustc_abi::ExternAbi;
7use rustc_ast_ir::Mutability;
8#[cfg(feature = "nightly")]
9use rustc_data_structures::stable_hash::{StableHash, StableHashCtxt, StableHasher};
10#[cfg(feature = "nightly")]
11use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash, StableHash_NoContext};
12use rustc_type_ir::data_structures::{NoError, UnifyKey, UnifyValue};
13use rustc_type_ir_macros::{
14    GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic,
15};
16
17use self::TyKind::*;
18pub use self::closure::*;
19use crate::inherent::*;
20use crate::ty::AliasTy;
21use crate::{
22    self as ty, BoundVarIndexKind, Const, FloatTy, FreeAliasTy, InherentAliasTy, IntTy, Interner,
23    OpaqueAliasTy, ProjectionAliasTy, Region, UintTy, Unnormalized,
24};
25
26mod closure;
27
28#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for AliasTyKind<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for AliasTyKind<I> where I: Interner {
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for AliasTyKind<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            AliasTyKind::Projection { def_id: ref __field_def_id } => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_def_id, __state);
            }
            AliasTyKind::Inherent { def_id: ref __field_def_id } => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_def_id, __state);
            }
            AliasTyKind::Opaque { def_id: ref __field_def_id } => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_def_id, __state);
            }
            AliasTyKind::Free { def_id: ref __field_def_id } => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_def_id, __state);
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for AliasTyKind<I> where I: Interner
    {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        if ::core::mem::discriminant(self) ==
                ::core::mem::discriminant(__other) {
            match (self, __other) {
                (AliasTyKind::Projection { def_id: ref __field_def_id },
                    AliasTyKind::Projection { def_id: ref __other_field_def_id
                    }) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_def_id,
                            __other_field_def_id),
                (AliasTyKind::Inherent { def_id: ref __field_def_id },
                    AliasTyKind::Inherent { def_id: ref __other_field_def_id })
                    =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_def_id,
                            __other_field_def_id),
                (AliasTyKind::Opaque { def_id: ref __field_def_id },
                    AliasTyKind::Opaque { def_id: ref __other_field_def_id }) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_def_id,
                            __other_field_def_id),
                (AliasTyKind::Free { def_id: ref __field_def_id },
                    AliasTyKind::Free { def_id: ref __other_field_def_id }) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_def_id,
                            __other_field_def_id),
                _ => unsafe { ::core::hint::unreachable_unchecked() },
            }
        } else { false }
    }
}
const _: () =
    {
        trait DeriveWhereAssertEq {
            fn assert(&self);
        }
        impl<I: Interner> DeriveWhereAssertEq for AliasTyKind<I> where
            I: Interner {
            fn assert(&self) {
                struct __AssertEq<__T: ::core::cmp::Eq +
                    ?::core::marker::Sized>(::core::marker::PhantomData<__T>);
                let _: __AssertEq<I::TraitAssocTyId>;
                let _: __AssertEq<I::InherentAssocTyId>;
                let _: __AssertEq<I::OpaqueTyId>;
                let _: __AssertEq<I::FreeTyAliasId>;
            }
        }
    };
#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for AliasTyKind<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for AliasTyKind<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            AliasTyKind::Projection { def_id: ref __field_def_id } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Projection");
                ::core::fmt::DebugStruct::field(&mut __builder, "def_id",
                    __field_def_id);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
            AliasTyKind::Inherent { def_id: ref __field_def_id } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Inherent");
                ::core::fmt::DebugStruct::field(&mut __builder, "def_id",
                    __field_def_id);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
            AliasTyKind::Opaque { def_id: ref __field_def_id } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Opaque");
                ::core::fmt::DebugStruct::field(&mut __builder, "def_id",
                    __field_def_id);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
            AliasTyKind::Free { def_id: ref __field_def_id } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Free");
                ::core::fmt::DebugStruct::field(&mut __builder, "def_id",
                    __field_def_id);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Copy, Hash, PartialEq, Eq, Debug; I: Interner)]
29#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for AliasTyKind<I>
            where I: Interner,
            I::TraitAssocTyId: ::rustc_type_ir::TypeVisitable<I>,
            I::InherentAssocTyId: ::rustc_type_ir::TypeVisitable<I>,
            I::OpaqueTyId: ::rustc_type_ir::TypeVisitable<I>,
            I::FreeTyAliasId: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    AliasTyKind::Projection { def_id: ref __binding_0 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    AliasTyKind::Inherent { def_id: ref __binding_0 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    AliasTyKind::Opaque { def_id: ref __binding_0 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    AliasTyKind::Free { def_id: ref __binding_0 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for AliasTyKind<I>
            where
            I::TraitAssocTyId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::InherentAssocTyId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::OpaqueTyId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::FreeTyAliasId: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    AliasTyKind::Projection { def_id: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    AliasTyKind::Inherent { def_id: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    AliasTyKind::Opaque { def_id: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    AliasTyKind::Free { def_id: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for AliasTyKind<I>
            where I: Interner,
            I::TraitAssocTyId: ::rustc_type_ir::TypeFoldable<I>,
            I::InherentAssocTyId: ::rustc_type_ir::TypeFoldable<I>,
            I::OpaqueTyId: ::rustc_type_ir::TypeFoldable<I>,
            I::FreeTyAliasId: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        AliasTyKind::Projection { def_id: __binding_0 } => {
                            AliasTyKind::Projection {
                                def_id: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                        AliasTyKind::Inherent { def_id: __binding_0 } => {
                            AliasTyKind::Inherent {
                                def_id: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                        AliasTyKind::Opaque { def_id: __binding_0 } => {
                            AliasTyKind::Opaque {
                                def_id: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                        AliasTyKind::Free { def_id: __binding_0 } => {
                            AliasTyKind::Free {
                                def_id: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    AliasTyKind::Projection { def_id: __binding_0 } => {
                        AliasTyKind::Projection {
                            def_id: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                    AliasTyKind::Inherent { def_id: __binding_0 } => {
                        AliasTyKind::Inherent {
                            def_id: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                    AliasTyKind::Opaque { def_id: __binding_0 } => {
                        AliasTyKind::Opaque {
                            def_id: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                    AliasTyKind::Free { def_id: __binding_0 } => {
                        AliasTyKind::Free {
                            def_id: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for AliasTyKind<I>
            where J: Interner, I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = AliasTyKind<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    AliasTyKind::Projection { def_id: __binding_0 } => {
                        AliasTyKind::Projection {
                            def_id: __binding_0.lift_to_interner(interner),
                        }
                    }
                    AliasTyKind::Inherent { def_id: __binding_0 } => {
                        AliasTyKind::Inherent {
                            def_id: __binding_0.lift_to_interner(interner),
                        }
                    }
                    AliasTyKind::Opaque { def_id: __binding_0 } => {
                        AliasTyKind::Opaque {
                            def_id: __binding_0.lift_to_interner(interner),
                        }
                    }
                    AliasTyKind::Free { def_id: __binding_0 } => {
                        AliasTyKind::Free {
                            def_id: __binding_0.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
30#[cfg_attr(
31    feature = "nightly",
32    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for AliasTyKind<I> where
            I::TraitAssocTyId: ::rustc_serialize::Encodable<__E>,
            I::InherentAssocTyId: ::rustc_serialize::Encodable<__E>,
            I::OpaqueTyId: ::rustc_serialize::Encodable<__E>,
            I::FreeTyAliasId: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        AliasTyKind::Projection { def_id: ref __binding_0 } => {
                            0usize
                        }
                        AliasTyKind::Inherent { def_id: ref __binding_0 } => {
                            1usize
                        }
                        AliasTyKind::Opaque { def_id: ref __binding_0 } => {
                            2usize
                        }
                        AliasTyKind::Free { def_id: ref __binding_0 } => { 3usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    AliasTyKind::Projection { def_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    AliasTyKind::Inherent { def_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    AliasTyKind::Opaque { def_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    AliasTyKind::Free { def_id: ref __binding_0 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for AliasTyKind<I> where
            I::TraitAssocTyId: ::rustc_serialize::Decodable<__D>,
            I::InherentAssocTyId: ::rustc_serialize::Decodable<__D>,
            I::OpaqueTyId: ::rustc_serialize::Decodable<__D>,
            I::FreeTyAliasId: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        AliasTyKind::Projection {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    1usize => {
                        AliasTyKind::Inherent {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    2usize => {
                        AliasTyKind::Opaque {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    3usize => {
                        AliasTyKind::Free {
                            def_id: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AliasTyKind`, expected 0..4, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            AliasTyKind<I> where
            I::TraitAssocTyId: ::rustc_data_structures::stable_hash::StableHash,
            I::InherentAssocTyId: ::rustc_data_structures::stable_hash::StableHash,
            I::OpaqueTyId: ::rustc_data_structures::stable_hash::StableHash,
            I::FreeTyAliasId: ::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 {
                    AliasTyKind::Projection { def_id: ref __binding_0 } =>
                        0u8.stable_hash(__hcx, __hasher),
                    AliasTyKind::Inherent { def_id: ref __binding_0 } =>
                        1u8.stable_hash(__hcx, __hasher),
                    AliasTyKind::Opaque { def_id: ref __binding_0 } =>
                        2u8.stable_hash(__hcx, __hasher),
                    AliasTyKind::Free { def_id: ref __binding_0 } =>
                        3u8.stable_hash(__hcx, __hasher),
                }
                match *self {
                    AliasTyKind::Projection { def_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    AliasTyKind::Inherent { def_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    AliasTyKind::Opaque { def_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    AliasTyKind::Free { def_id: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
33)]
34pub enum AliasTyKind<I: Interner> {
35    /// A projection `<Type as Trait>::AssocType`.
36    ///
37    /// Can get normalized away if monomorphic enough.
38    ///
39    /// The `def_id` is the `DefId` of the `TraitItem` for the associated type.
40    ///
41    /// Note that the `def_id` is not the `DefId` of the `TraitRef` containing this
42    /// associated type, which is in `interner.associated_item(def_id).container`,
43    /// aka. `interner.parent(def_id)`.
44    Projection { def_id: I::TraitAssocTyId },
45
46    /// An associated type in an inherent `impl`
47    ///
48    /// The `def_id` is the `DefId` of the `ImplItem` for the associated type.
49    Inherent { def_id: I::InherentAssocTyId },
50
51    /// An opaque type (usually from `impl Trait` in type aliases or function return types)
52    ///
53    /// `def_id` is the `DefId` of the `OpaqueType` item.
54    ///
55    ///
56    /// Can only be normalized away in `PostAnalysis` mode or its defining scope.
57    ///
58    /// During codegen, `interner.type_of(def_id)` can be used to get the type of the
59    /// underlying type if the type is an opaque.
60    Opaque { def_id: I::OpaqueTyId },
61
62    /// A type alias that actually checks its trait bounds.
63    ///
64    /// Currently only used if the type alias references opaque types.
65    /// Can always be normalized away.
66    Free { def_id: I::FreeTyAliasId },
67}
68
69impl<I: Interner> AliasTyKind<I> {
70    pub fn descr(self) -> &'static str {
71        match self {
72            AliasTyKind::Projection { .. } => "associated type",
73            AliasTyKind::Inherent { .. } => "inherent associated type",
74            AliasTyKind::Opaque { .. } => "opaque type",
75            AliasTyKind::Free { .. } => "type alias",
76        }
77    }
78
79    pub fn try_to_projection(self) -> Option<I::TraitAssocTyId> {
80        match self {
81            AliasTyKind::Projection { def_id } => Some(def_id),
82            _ => None,
83        }
84    }
85
86    pub fn try_to_inherent(self) -> Option<I::InherentAssocTyId> {
87        match self {
88            AliasTyKind::Inherent { def_id } => Some(def_id),
89            _ => None,
90        }
91    }
92
93    pub fn try_to_opaque(self) -> Option<I::OpaqueTyId> {
94        match self {
95            AliasTyKind::Opaque { def_id } => Some(def_id),
96            _ => None,
97        }
98    }
99
100    pub fn try_to_free(self) -> Option<I::FreeTyAliasId> {
101        match self {
102            AliasTyKind::Free { def_id } => Some(def_id),
103            _ => None,
104        }
105    }
106}
107
108/// Whether an alias type is rigid or potentially normalizeable.
109///
110/// This is not used by the old solver and is always `IsRigid::No` there. In the new solver,
111/// aliases which cannot be further normalized in their current scope normalize to themselves
112/// with `IsRigid::Yes`. At this point we no longer have to try and renormalize this alias
113/// later on.
114///
115/// Rigidness becomes outdated when the surrounding typing mode or param env changes,
116/// because further normalization might be possible.
117/// We should also note that rigidness can be shared within some typing mode groups
118/// if the param env is the same, e.g., `Typeck/PostTypeckThroughBorrowck` and
119/// `PostAnalysis/Codegen`.
120///
121/// We always reveal auto traits for rigid aliases and this can cause query cycle in
122/// `TypingMode::ErasedNotCoherence`. Thus we don't allow incorrectly marked rigid local
123/// opaques. We achieve this by immediately bailing out when normalizing local opaques.
124///
125/// FIXME(#155345): Alias handling is currently still in flux for the new trait
126/// solver and this is currently somewhat messy. Please reach out on
127/// #t-types/trait-system-refactor-initiative if you encounter this and it isn't
128/// immediately clear what to do.
129#[derive(#[automatically_derived]impl ::core::fmt::Debug for IsRigid {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self { IsRigid::Yes => "Yes", IsRigid::No => "No", })
    }
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for IsRigid {
}
#[automatically_derived]impl ::core::clone::Clone for IsRigid {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::Copy for IsRigid { }Copy, #[automatically_derived]impl ::core::hash::Hash for IsRigid {
    #[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::marker::StructuralPartialEq for IsRigid {
}
#[automatically_derived]impl ::core::cmp::PartialEq for IsRigid {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
            ::core::intrinsics::discriminant_value(other)
    }
}PartialEq)]
130#[derive(const _: () =
    {
        impl<I> ::rustc_type_ir::TypeVisitable<I> for IsRigid where
            I: Interner {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self { IsRigid::Yes => {} IsRigid::No => {} }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<__V> ::rustc_type_ir::GenericTypeVisitable<__V> for
            IsRigid {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self { IsRigid::Yes => {} IsRigid::No => {} }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I> ::rustc_type_ir::TypeFoldable<I> for IsRigid where I: Interner
            {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        IsRigid::Yes => { IsRigid::Yes }
                        IsRigid::No => { IsRigid::No }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    IsRigid::Yes => { IsRigid::Yes }
                    IsRigid::No => { IsRigid::No }
                }
            }
        }
    };TypeFoldable_Generic)]
131#[cfg_attr(
132    feature = "nightly",
133    derive(const _: () =
    {
        impl<__D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for IsRigid {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { IsRigid::Yes }
                    1usize => { IsRigid::No }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `IsRigid`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<__E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for IsRigid {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        IsRigid::Yes => { 0usize }
                        IsRigid::No => { 1usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for IsRigid {
            #[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 {
                    IsRigid::Yes => 0u8.stable_hash(__hcx, __hasher),
                    IsRigid::No => 1u8.stable_hash(__hcx, __hasher),
                }
                match *self { IsRigid::Yes => {} IsRigid::No => {} }
            }
        }
    };StableHash_NoContext)
134)]
135pub enum IsRigid {
136    Yes,
137    No,
138}
139
140impl IsRigid {
141    pub fn yes_if_next_solver<I: Interner>(interner: I) -> IsRigid {
142        if interner.next_trait_solver_globally() { IsRigid::Yes } else { IsRigid::No }
143    }
144}
145
146/// Defines the kinds of types used by the type system.
147///
148/// Types written by the user start out as `hir::TyKind` and get
149/// converted to this representation using `<dyn HirTyLowerer>::lower_ty`.
150#[cfg_attr(feature = "nightly", rustc_diagnostic_item = "IrTyKind")]
151#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for TyKind<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for TyKind<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for TyKind<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            TyKind::Bool => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
            }
            TyKind::Char => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
            }
            TyKind::Int(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Uint(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Float(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Adt(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Foreign(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Str => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
            }
            TyKind::Array(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Pat(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Slice(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::RawPtr(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Ref(ref __field_0, ref __field_1, ref __field_2) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
                ::core::hash::Hash::hash(__field_2, __state);
            }
            TyKind::FnDef(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::FnPtr(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::UnsafeBinder(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Dynamic(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Closure(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::CoroutineClosure(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Coroutine(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::CoroutineWitness(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Never => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
            }
            TyKind::Tuple(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::View(ref __field_0, ref __field_1, ref __field_2) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
                ::core::hash::Hash::hash(__field_2, __state);
            }
            TyKind::Alias(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Param(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Bound(ref __field_0, ref __field_1) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
                ::core::hash::Hash::hash(__field_1, __state);
            }
            TyKind::Placeholder(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Infer(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
            TyKind::Error(ref __field_0) => {
                ::core::hash::Hash::hash(&::core::mem::discriminant(self),
                    __state);
                ::core::hash::Hash::hash(__field_0, __state);
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for TyKind<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        if ::core::mem::discriminant(self) ==
                ::core::mem::discriminant(__other) {
            match (self, __other) {
                (TyKind::Int(ref __field_0), TyKind::Int(ref __other_field_0))
                    =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Uint(ref __field_0),
                    TyKind::Uint(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Float(ref __field_0),
                    TyKind::Float(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Adt(ref __field_0, ref __field_1),
                    TyKind::Adt(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Foreign(ref __field_0),
                    TyKind::Foreign(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Array(ref __field_0, ref __field_1),
                    TyKind::Array(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Pat(ref __field_0, ref __field_1),
                    TyKind::Pat(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Slice(ref __field_0),
                    TyKind::Slice(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::RawPtr(ref __field_0, ref __field_1),
                    TyKind::RawPtr(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Ref(ref __field_0, ref __field_1, ref __field_2),
                    TyKind::Ref(ref __other_field_0, ref __other_field_1,
                    ref __other_field_2)) =>
                    true &&
                                ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                            ::core::cmp::PartialEq::eq(__field_1, __other_field_1) &&
                        ::core::cmp::PartialEq::eq(__field_2, __other_field_2),
                (TyKind::FnDef(ref __field_0, ref __field_1),
                    TyKind::FnDef(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::FnPtr(ref __field_0, ref __field_1),
                    TyKind::FnPtr(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::UnsafeBinder(ref __field_0),
                    TyKind::UnsafeBinder(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Dynamic(ref __field_0, ref __field_1),
                    TyKind::Dynamic(ref __other_field_0, ref __other_field_1))
                    =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Closure(ref __field_0, ref __field_1),
                    TyKind::Closure(ref __other_field_0, ref __other_field_1))
                    =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::CoroutineClosure(ref __field_0, ref __field_1),
                    TyKind::CoroutineClosure(ref __other_field_0,
                    ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Coroutine(ref __field_0, ref __field_1),
                    TyKind::Coroutine(ref __other_field_0, ref __other_field_1))
                    =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::CoroutineWitness(ref __field_0, ref __field_1),
                    TyKind::CoroutineWitness(ref __other_field_0,
                    ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Tuple(ref __field_0),
                    TyKind::Tuple(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::View(ref __field_0, ref __field_1, ref __field_2),
                    TyKind::View(ref __other_field_0, ref __other_field_1,
                    ref __other_field_2)) =>
                    true &&
                                ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                            ::core::cmp::PartialEq::eq(__field_1, __other_field_1) &&
                        ::core::cmp::PartialEq::eq(__field_2, __other_field_2),
                (TyKind::Alias(ref __field_0, ref __field_1),
                    TyKind::Alias(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Param(ref __field_0),
                    TyKind::Param(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Bound(ref __field_0, ref __field_1),
                    TyKind::Bound(ref __other_field_0, ref __other_field_1)) =>
                    true &&
                            ::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
                        ::core::cmp::PartialEq::eq(__field_1, __other_field_1),
                (TyKind::Placeholder(ref __field_0),
                    TyKind::Placeholder(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Infer(ref __field_0),
                    TyKind::Infer(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                (TyKind::Error(ref __field_0),
                    TyKind::Error(ref __other_field_0)) =>
                    true &&
                        ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
                _ => true,
            }
        } else { false }
    }
}#[derive_where(Clone, Copy, Hash, PartialEq; I: Interner)]
152#[derive(const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for TyKind<I> where
            IntTy: ::rustc_type_ir::GenericTypeVisitable<__V>,
            UintTy: ::rustc_type_ir::GenericTypeVisitable<__V>,
            FloatTy: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::AdtDef: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::ForeignId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Const<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Pat: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Mutability: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Region<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Mutability: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::FunctionId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            ty::Binder<I,
            I::GenericArgs>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            ty::Binder<I,
            FnSigTys<I>>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            FnHeader<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            UnsafeBinderInner<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::BoundExistentialPredicates: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Region<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::ClosureId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::CoroutineClosureId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::CoroutineId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::CoroutineId: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Tys: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::AdtDef: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::GenericArgs: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            IsRigid: ::rustc_type_ir::GenericTypeVisitable<__V>,
            AliasTy<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::ParamTy: ::rustc_type_ir::GenericTypeVisitable<__V>,
            BoundVarIndexKind: ::rustc_type_ir::GenericTypeVisitable<__V>,
            ty::BoundTy<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            ty::PlaceholderType<I>: ::rustc_type_ir::GenericTypeVisitable<__V>,
            InferTy: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::ErrorGuaranteed: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    TyKind::Bool => {}
                    TyKind::Char => {}
                    TyKind::Int(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Uint(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Float(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Adt(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Foreign(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Str => {}
                    TyKind::Array(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Pat(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Slice(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::RawPtr(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Ref(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_2,
                                __visitor);
                        }
                    }
                    TyKind::FnDef(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::FnPtr(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::UnsafeBinder(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Dynamic(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Closure(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::CoroutineClosure(ref __binding_0, ref __binding_1)
                        => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Coroutine(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::CoroutineWitness(ref __binding_0, ref __binding_1)
                        => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Never => {}
                    TyKind::Tuple(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::View(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_2,
                                __visitor);
                        }
                    }
                    TyKind::Alias(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Param(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Bound(ref __binding_0, ref __binding_1) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                    TyKind::Placeholder(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Infer(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                    TyKind::Error(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable)]
153#[cfg_attr(
154    feature = "nightly",
155    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for TyKind<I> where
            I::AdtDef: ::rustc_serialize::Encodable<__E>,
            I::GenericArgs: ::rustc_serialize::Encodable<__E>,
            I::ForeignId: ::rustc_serialize::Encodable<__E>,
            I::Ty: ::rustc_serialize::Encodable<__E>,
            Const<I>: ::rustc_serialize::Encodable<__E>,
            I::Pat: ::rustc_serialize::Encodable<__E>,
            Region<I>: ::rustc_serialize::Encodable<__E>,
            I::FunctionId: ::rustc_serialize::Encodable<__E>,
            ty::Binder<I, I::GenericArgs>: ::rustc_serialize::Encodable<__E>,
            ty::Binder<I, FnSigTys<I>>: ::rustc_serialize::Encodable<__E>,
            FnHeader<I>: ::rustc_serialize::Encodable<__E>,
            UnsafeBinderInner<I>: ::rustc_serialize::Encodable<__E>,
            I::BoundExistentialPredicates: ::rustc_serialize::Encodable<__E>,
            I::ClosureId: ::rustc_serialize::Encodable<__E>,
            I::CoroutineClosureId: ::rustc_serialize::Encodable<__E>,
            I::CoroutineId: ::rustc_serialize::Encodable<__E>,
            I::Tys: ::rustc_serialize::Encodable<__E>,
            AliasTy<I>: ::rustc_serialize::Encodable<__E>,
            I::ParamTy: ::rustc_serialize::Encodable<__E>,
            ty::BoundTy<I>: ::rustc_serialize::Encodable<__E>,
            ty::PlaceholderType<I>: ::rustc_serialize::Encodable<__E>,
            I::ErrorGuaranteed: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        TyKind::Bool => { 0usize }
                        TyKind::Char => { 1usize }
                        TyKind::Int(ref __binding_0) => { 2usize }
                        TyKind::Uint(ref __binding_0) => { 3usize }
                        TyKind::Float(ref __binding_0) => { 4usize }
                        TyKind::Adt(ref __binding_0, ref __binding_1) => { 5usize }
                        TyKind::Foreign(ref __binding_0) => { 6usize }
                        TyKind::Str => { 7usize }
                        TyKind::Array(ref __binding_0, ref __binding_1) => {
                            8usize
                        }
                        TyKind::Pat(ref __binding_0, ref __binding_1) => { 9usize }
                        TyKind::Slice(ref __binding_0) => { 10usize }
                        TyKind::RawPtr(ref __binding_0, ref __binding_1) => {
                            11usize
                        }
                        TyKind::Ref(ref __binding_0, ref __binding_1,
                            ref __binding_2) => {
                            12usize
                        }
                        TyKind::FnDef(ref __binding_0, ref __binding_1) => {
                            13usize
                        }
                        TyKind::FnPtr(ref __binding_0, ref __binding_1) => {
                            14usize
                        }
                        TyKind::UnsafeBinder(ref __binding_0) => { 15usize }
                        TyKind::Dynamic(ref __binding_0, ref __binding_1) => {
                            16usize
                        }
                        TyKind::Closure(ref __binding_0, ref __binding_1) => {
                            17usize
                        }
                        TyKind::CoroutineClosure(ref __binding_0, ref __binding_1)
                            => {
                            18usize
                        }
                        TyKind::Coroutine(ref __binding_0, ref __binding_1) => {
                            19usize
                        }
                        TyKind::CoroutineWitness(ref __binding_0, ref __binding_1)
                            => {
                            20usize
                        }
                        TyKind::Never => { 21usize }
                        TyKind::Tuple(ref __binding_0) => { 22usize }
                        TyKind::View(ref __binding_0, ref __binding_1,
                            ref __binding_2) => {
                            23usize
                        }
                        TyKind::Alias(ref __binding_0, ref __binding_1) => {
                            24usize
                        }
                        TyKind::Param(ref __binding_0) => { 25usize }
                        TyKind::Bound(ref __binding_0, ref __binding_1) => {
                            26usize
                        }
                        TyKind::Placeholder(ref __binding_0) => { 27usize }
                        TyKind::Infer(ref __binding_0) => { 28usize }
                        TyKind::Error(ref __binding_0) => { 29usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    TyKind::Bool => {}
                    TyKind::Char => {}
                    TyKind::Int(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Uint(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Float(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Adt(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Foreign(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Str => {}
                    TyKind::Array(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Pat(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Slice(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::RawPtr(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Ref(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                            __encoder);
                    }
                    TyKind::FnDef(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::FnPtr(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::UnsafeBinder(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Dynamic(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Closure(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::CoroutineClosure(ref __binding_0, ref __binding_1)
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Coroutine(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::CoroutineWitness(ref __binding_0, ref __binding_1)
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Never => {}
                    TyKind::Tuple(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::View(ref __binding_0, ref __binding_1,
                        ref __binding_2) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                            __encoder);
                    }
                    TyKind::Alias(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Param(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Bound(ref __binding_0, ref __binding_1) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                    TyKind::Placeholder(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Infer(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    TyKind::Error(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for TyKind<I> where
            I::AdtDef: ::rustc_serialize::Decodable<__D>,
            I::GenericArgs: ::rustc_serialize::Decodable<__D>,
            I::ForeignId: ::rustc_serialize::Decodable<__D>,
            I::Ty: ::rustc_serialize::Decodable<__D>,
            Const<I>: ::rustc_serialize::Decodable<__D>,
            I::Pat: ::rustc_serialize::Decodable<__D>,
            Region<I>: ::rustc_serialize::Decodable<__D>,
            I::FunctionId: ::rustc_serialize::Decodable<__D>,
            ty::Binder<I, I::GenericArgs>: ::rustc_serialize::Decodable<__D>,
            ty::Binder<I, FnSigTys<I>>: ::rustc_serialize::Decodable<__D>,
            FnHeader<I>: ::rustc_serialize::Decodable<__D>,
            UnsafeBinderInner<I>: ::rustc_serialize::Decodable<__D>,
            I::BoundExistentialPredicates: ::rustc_serialize::Decodable<__D>,
            I::ClosureId: ::rustc_serialize::Decodable<__D>,
            I::CoroutineClosureId: ::rustc_serialize::Decodable<__D>,
            I::CoroutineId: ::rustc_serialize::Decodable<__D>,
            I::Tys: ::rustc_serialize::Decodable<__D>,
            AliasTy<I>: ::rustc_serialize::Decodable<__D>,
            I::ParamTy: ::rustc_serialize::Decodable<__D>,
            ty::BoundTy<I>: ::rustc_serialize::Decodable<__D>,
            ty::PlaceholderType<I>: ::rustc_serialize::Decodable<__D>,
            I::ErrorGuaranteed: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { TyKind::Bool }
                    1usize => { TyKind::Char }
                    2usize => {
                        TyKind::Int(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    3usize => {
                        TyKind::Uint(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    4usize => {
                        TyKind::Float(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    5usize => {
                        TyKind::Adt(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    6usize => {
                        TyKind::Foreign(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    7usize => { TyKind::Str }
                    8usize => {
                        TyKind::Array(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    9usize => {
                        TyKind::Pat(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    10usize => {
                        TyKind::Slice(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    11usize => {
                        TyKind::RawPtr(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    12usize => {
                        TyKind::Ref(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    13usize => {
                        TyKind::FnDef(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    14usize => {
                        TyKind::FnPtr(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    15usize => {
                        TyKind::UnsafeBinder(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    16usize => {
                        TyKind::Dynamic(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    17usize => {
                        TyKind::Closure(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    18usize => {
                        TyKind::CoroutineClosure(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    19usize => {
                        TyKind::Coroutine(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    20usize => {
                        TyKind::CoroutineWitness(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    21usize => { TyKind::Never }
                    22usize => {
                        TyKind::Tuple(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    23usize => {
                        TyKind::View(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    24usize => {
                        TyKind::Alias(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    25usize => {
                        TyKind::Param(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    26usize => {
                        TyKind::Bound(::rustc_serialize::Decodable::decode(__decoder),
                            ::rustc_serialize::Decodable::decode(__decoder))
                    }
                    27usize => {
                        TyKind::Placeholder(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    28usize => {
                        TyKind::Infer(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    29usize => {
                        TyKind::Error(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `TyKind`, expected 0..30, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            TyKind<I> where
            I::AdtDef: ::rustc_data_structures::stable_hash::StableHash,
            I::GenericArgs: ::rustc_data_structures::stable_hash::StableHash,
            I::ForeignId: ::rustc_data_structures::stable_hash::StableHash,
            I::Ty: ::rustc_data_structures::stable_hash::StableHash,
            Const<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::Pat: ::rustc_data_structures::stable_hash::StableHash,
            Region<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::FunctionId: ::rustc_data_structures::stable_hash::StableHash,
            ty::Binder<I,
            I::GenericArgs>: ::rustc_data_structures::stable_hash::StableHash,
            ty::Binder<I,
            FnSigTys<I>>: ::rustc_data_structures::stable_hash::StableHash,
            FnHeader<I>: ::rustc_data_structures::stable_hash::StableHash,
            UnsafeBinderInner<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::BoundExistentialPredicates: ::rustc_data_structures::stable_hash::StableHash,
            I::ClosureId: ::rustc_data_structures::stable_hash::StableHash,
            I::CoroutineClosureId: ::rustc_data_structures::stable_hash::StableHash,
            I::CoroutineId: ::rustc_data_structures::stable_hash::StableHash,
            I::Tys: ::rustc_data_structures::stable_hash::StableHash,
            AliasTy<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::ParamTy: ::rustc_data_structures::stable_hash::StableHash,
            ty::BoundTy<I>: ::rustc_data_structures::stable_hash::StableHash,
            ty::PlaceholderType<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::ErrorGuaranteed: ::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 {
                    TyKind::Bool => 0u8.stable_hash(__hcx, __hasher),
                    TyKind::Char => 1u8.stable_hash(__hcx, __hasher),
                    TyKind::Int(ref __binding_0) =>
                        2u8.stable_hash(__hcx, __hasher),
                    TyKind::Uint(ref __binding_0) =>
                        3u8.stable_hash(__hcx, __hasher),
                    TyKind::Float(ref __binding_0) =>
                        4u8.stable_hash(__hcx, __hasher),
                    TyKind::Adt(ref __binding_0, ref __binding_1) =>
                        5u8.stable_hash(__hcx, __hasher),
                    TyKind::Foreign(ref __binding_0) =>
                        6u8.stable_hash(__hcx, __hasher),
                    TyKind::Str => 7u8.stable_hash(__hcx, __hasher),
                    TyKind::Array(ref __binding_0, ref __binding_1) =>
                        8u8.stable_hash(__hcx, __hasher),
                    TyKind::Pat(ref __binding_0, ref __binding_1) =>
                        9u8.stable_hash(__hcx, __hasher),
                    TyKind::Slice(ref __binding_0) =>
                        10u8.stable_hash(__hcx, __hasher),
                    TyKind::RawPtr(ref __binding_0, ref __binding_1) =>
                        11u8.stable_hash(__hcx, __hasher),
                    TyKind::Ref(ref __binding_0, ref __binding_1,
                        ref __binding_2) => 12u8.stable_hash(__hcx, __hasher),
                    TyKind::FnDef(ref __binding_0, ref __binding_1) =>
                        13u8.stable_hash(__hcx, __hasher),
                    TyKind::FnPtr(ref __binding_0, ref __binding_1) =>
                        14u8.stable_hash(__hcx, __hasher),
                    TyKind::UnsafeBinder(ref __binding_0) =>
                        15u8.stable_hash(__hcx, __hasher),
                    TyKind::Dynamic(ref __binding_0, ref __binding_1) =>
                        16u8.stable_hash(__hcx, __hasher),
                    TyKind::Closure(ref __binding_0, ref __binding_1) =>
                        17u8.stable_hash(__hcx, __hasher),
                    TyKind::CoroutineClosure(ref __binding_0, ref __binding_1)
                        => 18u8.stable_hash(__hcx, __hasher),
                    TyKind::Coroutine(ref __binding_0, ref __binding_1) =>
                        19u8.stable_hash(__hcx, __hasher),
                    TyKind::CoroutineWitness(ref __binding_0, ref __binding_1)
                        => 20u8.stable_hash(__hcx, __hasher),
                    TyKind::Never => 21u8.stable_hash(__hcx, __hasher),
                    TyKind::Tuple(ref __binding_0) =>
                        22u8.stable_hash(__hcx, __hasher),
                    TyKind::View(ref __binding_0, ref __binding_1,
                        ref __binding_2) => 23u8.stable_hash(__hcx, __hasher),
                    TyKind::Alias(ref __binding_0, ref __binding_1) =>
                        24u8.stable_hash(__hcx, __hasher),
                    TyKind::Param(ref __binding_0) =>
                        25u8.stable_hash(__hcx, __hasher),
                    TyKind::Bound(ref __binding_0, ref __binding_1) =>
                        26u8.stable_hash(__hcx, __hasher),
                    TyKind::Placeholder(ref __binding_0) =>
                        27u8.stable_hash(__hcx, __hasher),
                    TyKind::Infer(ref __binding_0) =>
                        28u8.stable_hash(__hcx, __hasher),
                    TyKind::Error(ref __binding_0) =>
                        29u8.stable_hash(__hcx, __hasher),
                }
                match *self {
                    TyKind::Bool => {}
                    TyKind::Char => {}
                    TyKind::Int(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Uint(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Float(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Adt(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Foreign(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Str => {}
                    TyKind::Array(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.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::Slice(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::RawPtr(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::FnDef(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::FnPtr(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::UnsafeBinder(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Dynamic(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Closure(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::CoroutineClosure(ref __binding_0, ref __binding_1)
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Coroutine(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::CoroutineWitness(ref __binding_0, ref __binding_1)
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Never => {}
                    TyKind::Tuple(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::View(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::Alias(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Param(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Bound(ref __binding_0, ref __binding_1) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Placeholder(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Infer(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    TyKind::Error(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
156)]
157pub enum TyKind<I: Interner> {
158    /// The primitive boolean type. Written as `bool`.
159    Bool,
160
161    /// The primitive character type; holds a Unicode scalar value
162    /// (a non-surrogate code point). Written as `char`.
163    Char,
164
165    /// A primitive signed integer type. For example, `i32`.
166    Int(IntTy),
167
168    /// A primitive unsigned integer type. For example, `u32`.
169    Uint(UintTy),
170
171    /// A primitive floating-point type. For example, `f64`.
172    Float(FloatTy),
173
174    /// Algebraic data types (ADT). For example: structures, enumerations and unions.
175    ///
176    /// For example, the type `List<i32>` would be represented using the `AdtDef`
177    /// for `struct List<T>` and the args `[i32]`.
178    ///
179    /// Note that generic parameters in fields only get lazily instantiated
180    /// by using something like `adt_def.all_fields().map(|field| field.ty(interner, args))`.
181    Adt(I::AdtDef, I::GenericArgs),
182
183    /// An unsized FFI type that is opaque to Rust. Written as `extern type T`.
184    Foreign(I::ForeignId),
185
186    /// The pointee of a string slice. Written as `str`.
187    Str,
188
189    /// An array with the given length. Written as `[T; N]`.
190    Array(I::Ty, Const<I>),
191
192    /// A pattern newtype.
193    ///
194    /// Takes any type and restricts its valid values to its pattern.
195    /// This will also change the layout to take advantage of this restriction.
196    /// Only `Copy` and `Clone` will automatically get implemented for pattern types.
197    /// Auto-traits treat this as if it were an aggregate with a single nested type.
198    /// Only supports integer range patterns for now.
199    Pat(I::Ty, I::Pat),
200
201    /// The pointee of an array slice. Written as `[T]`.
202    Slice(I::Ty),
203
204    /// A raw pointer. Written as `*mut T` or `*const T`
205    RawPtr(I::Ty, Mutability),
206
207    /// A reference; a pointer with an associated lifetime. Written as
208    /// `&'a mut T` or `&'a T`.
209    Ref(Region<I>, I::Ty, Mutability),
210
211    /// The anonymous type of a function declaration/definition.
212    ///
213    /// Each function has a unique type.
214    ///
215    /// For the function `fn foo() -> i32 { 3 }` this type would be
216    /// shown to the user as `fn() -> i32 {foo}`.
217    ///
218    /// For example the type of `bar` here:
219    /// ```rust
220    /// fn foo() -> i32 { 1 }
221    /// let bar = foo; // bar: fn() -> i32 {foo}
222    /// ```
223    FnDef(I::FunctionId, ty::Binder<I, I::GenericArgs>),
224
225    /// A pointer to a function.
226    ///
227    /// Written as `fn() -> i32`.
228    ///
229    /// Note that both functions and closures start out as either
230    /// [FnDef] or [Closure] which can be then be coerced to this variant.
231    ///
232    /// For example the type of `bar` here:
233    ///
234    /// ```rust
235    /// fn foo() -> i32 { 1 }
236    /// let bar: fn() -> i32 = foo;
237    /// ```
238    ///
239    /// These two fields are equivalent to a `ty::Binder<I, FnSig<I>>`. But by
240    /// splitting that into two pieces, we get a more compact data layout that
241    /// reduces the size of `TyKind` by 8 bytes. It is a very hot type, so it's
242    /// worth the mild inconvenience.
243    FnPtr(ty::Binder<I, FnSigTys<I>>, FnHeader<I>),
244
245    /// An unsafe binder type.
246    ///
247    /// A higher-ranked type used to represent a type which has had some of its
248    /// lifetimes erased. This can be used to represent types in positions where
249    /// a lifetime is literally inexpressible, such as self-referential types.
250    UnsafeBinder(UnsafeBinderInner<I>),
251
252    /// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`.
253    Dynamic(I::BoundExistentialPredicates, Region<I>),
254
255    /// The anonymous type of a closure. Used to represent the type of `|a| a`.
256    ///
257    /// Closure args contain both the - potentially instantiated - generic parameters
258    /// of its parent and some synthetic parameters. See the documentation for
259    /// `ClosureArgs` for more details.
260    Closure(I::ClosureId, I::GenericArgs),
261
262    /// The anonymous type of an async closure. Used to represent the type of `async |a| a`.
263    ///
264    /// This type itself is not a coroutine, it just represents a closure that returns one.
265    ///
266    /// Coroutine-closure args contain both the - potentially instantiated - generic
267    /// parameters of its parent and some synthetic parameters. See the documentation
268    /// for `CoroutineClosureArgs` for more details.
269    CoroutineClosure(I::CoroutineClosureId, I::GenericArgs),
270
271    /// The anonymous type of a coroutine. Used to represent the type of
272    /// `|a| yield a`.
273    ///
274    /// For more info about coroutine args, visit the documentation for
275    /// `CoroutineArgs`.
276    Coroutine(I::CoroutineId, I::GenericArgs),
277
278    /// A type representing the types stored inside a coroutine.
279    ///
280    /// This should only appear as part of the `CoroutineArgs`.
281    ///
282    /// Unlike upvars, the witness can reference lifetimes from
283    /// inside of the coroutine itself. To deal with them in
284    /// the type of the coroutine, we convert them to higher ranked
285    /// lifetimes bound by the witness itself.
286    ///
287    /// This contains the `DefId` and the `GenericArg` of the coroutine.
288    /// The actual witness types are computed on MIR by the `mir_coroutine_witnesses` query.
289    ///
290    /// Looking at the following example, the witness for this coroutine
291    /// may end up as something like `for<'a> [Vec<i32>, &'a Vec<i32>]`:
292    ///
293    /// ```
294    /// #![feature(coroutines)]
295    /// #[coroutine] static |a| {
296    ///     let x = &vec![3];
297    ///     yield a;
298    ///     yield x[0];
299    /// }
300    /// # ;
301    /// ```
302    CoroutineWitness(I::CoroutineId, I::GenericArgs),
303
304    /// The never type `!`.
305    Never,
306
307    /// A tuple type. For example, `(i32, bool)`.
308    Tuple(I::Tys),
309
310    /// A view over an [`Adt`].
311    ///
312    /// Takes an ADT and restricts the fields that can be accessed. The layout
313    /// is the same as the initial ADT. View types are `!MetaSized`.
314    ///
315    /// The fields that can be accessed are encoded as a tuple of `FieldRepresentingType`.
316    /// For instance, `view_type!(MyStruct.{ field1, field2 })` is represented as
317    /// `View(MyStruct, [], (field_of!(MyStruct.field1), field_of!(FieldInfo.field2)))`.
318    ///
319    /// Refer to the [View types experiment][1] project goal for more infos.
320    ///
321    /// [1]: https://goals.rust-lang.org/2026/view-types-experiment.html
322    View(I::AdtDef, I::GenericArgs, I::Ty),
323
324    /// A projection, opaque type, free type alias, or inherent associated type.
325    ///
326    /// All of these types are represented as pairs of def-id and args, and can
327    /// be normalized, so they are grouped conceptually.
328    Alias(IsRigid, AliasTy<I>),
329
330    /// A type parameter; for example, `T` in `fn f<T>(x: T) {}`.
331    Param(I::ParamTy),
332
333    /// Bound type variable, used to represent the `'a` in `for<'a> fn(&'a ())`.
334    ///
335    /// For canonical queries, we replace inference variables with bound variables,
336    /// so e.g. when checking whether `&'_ (): Trait<_>` holds, we canonicalize that to
337    /// `for<'a, T> &'a (): Trait<T>` and then convert the introduced bound variables
338    /// back to inference variables in a new inference context when inside of the query.
339    ///
340    /// It is conventional to render anonymous bound types like `^N` or `^D_N`,
341    /// where `N` is the bound variable's anonymous index into the binder, and
342    /// `D` is the debruijn index, or totally omitted if the debruijn index is zero.
343    ///
344    /// See the `rustc-dev-guide` for more details about
345    /// [higher-ranked trait bounds][1] and [canonical queries][2].
346    ///
347    /// [1]: https://rustc-dev-guide.rust-lang.org/traits/hrtb.html
348    /// [2]: https://rustc-dev-guide.rust-lang.org/traits/canonical-queries.html
349    Bound(BoundVarIndexKind, ty::BoundTy<I>),
350
351    /// A placeholder type, used during higher ranked subtyping to instantiate
352    /// bound variables.
353    ///
354    /// It is conventional to render anonymous placeholder types like `!N` or `!U_N`,
355    /// where `N` is the placeholder variable's anonymous index (which corresponds
356    /// to the bound variable's index from the binder from which it was instantiated),
357    /// and `U` is the universe index in which it is instantiated, or totally omitted
358    /// if the universe index is zero.
359    Placeholder(ty::PlaceholderType<I>),
360
361    /// A type variable used during type checking.
362    ///
363    /// Similar to placeholders, inference variables also live in a universe to
364    /// correctly deal with higher ranked types. Though unlike placeholders,
365    /// that universe is stored in the `InferCtxt` instead of directly
366    /// inside of the type.
367    Infer(InferTy),
368
369    /// A placeholder for a type which could not be computed.
370    ///
371    /// This is propagated to avoid useless error messages.
372    Error(I::ErrorGuaranteed),
373}
374
375impl<I: Interner> Eq for TyKind<I> {}
376
377impl<I: Interner> TyKind<I> {
378    pub fn unnormalized_fn_sig(self, interner: I) -> Unnormalized<I, ty::Binder<I, ty::FnSig<I>>> {
379        match self {
380            ty::FnPtr(sig_tys, hdr) => Unnormalized::new_wip(sig_tys.with(hdr)),
381            ty::FnDef(def_id, args) => {
382                interner.fn_sig(def_id).instantiate(interner, args.no_bound_vars().unwrap())
383            }
384            // ignore errors (#54954)
385            ty::Error(_) => Unnormalized::dummy(ty::Binder::dummy(ty::FnSig::dummy())),
386            ty::Closure(..) => {
    ::core::panicking::panic_fmt(format_args!("to get the signature of a closure, use `args.as_closure().sig()` not `fn_sig()`"));
}panic!(
387                "to get the signature of a closure, use `args.as_closure().sig()` not `fn_sig()`",
388            ),
389            _ => {
    ::core::panicking::panic_fmt(format_args!("Ty::fn_sig() called on non-fn type: {0:?}",
            self));
}panic!("Ty::fn_sig() called on non-fn type: {:?}", self),
390        }
391    }
392
393    pub fn fn_sig(self, interner: I) -> ty::Binder<I, ty::FnSig<I>> {
394        self.unnormalized_fn_sig(interner).skip_normalization()
395    }
396
397    pub fn fn_sig_abi(self, interner: I) -> ExternAbi {
398        match self {
399            ty::FnPtr(_, hdr) => hdr.abi(),
400            ty::FnDef(def_id, _) => interner.fn_sig(def_id).skip_binder().abi(),
401            // ignore errors (#54954)
402            ty::Error(_) => FnSig::<I>::dummy().abi(),
403            ty::Closure(..) => {
    ::core::panicking::panic_fmt(format_args!("to get the ABI of a closure, use `args.as_closure().sig().abi()` not `fn_sig_abi()`"));
}panic!(
404                "to get the ABI of a closure, use `args.as_closure().sig().abi()` not `fn_sig_abi()`",
405            ),
406            _ => {
    ::core::panicking::panic_fmt(format_args!("`fn_sig_abi` called on non-fn type: {0:?}",
            self));
}panic!("`fn_sig_abi` called on non-fn type: {:?}", self),
407        }
408    }
409
410    pub fn fn_sig_safety(self, interner: I) -> I::Safety {
411        match self {
412            ty::FnPtr(_, hdr) => hdr.safety(),
413            ty::FnDef(def_id, _) => interner.fn_sig(def_id).skip_binder().safety(),
414            // ignore errors (#54954)
415            ty::Error(_) => FnSig::<I>::dummy().safety(),
416            ty::Closure(..) => {
    ::core::panicking::panic_fmt(format_args!("to get the safety of a closure, use `args.as_closure().sig().safety()` not `fn_sig_safety()`"));
}panic!(
417                "to get the safety of a closure, use `args.as_closure().sig().safety()` not `fn_sig_safety()`",
418            ),
419            _ => {
    ::core::panicking::panic_fmt(format_args!("`fn_sig_safety` called on non-fn type: {0:?}",
            self));
}panic!("`fn_sig_safety` called on non-fn type: {:?}", self),
420        }
421    }
422
423    /// Returns `true` when the outermost type cannot be further normalized,
424    /// resolved, or instantiated.
425    ///
426    /// This includes all primitive types, but also
427    /// things like ADTs and trait objects, since even if their arguments or
428    /// nested types may be further simplified, the outermost [`ty::TyKind`] or
429    /// type constructor remains the same.
430    pub fn is_known_rigid(self) -> bool {
431        match self {
432            ty::Bool
433            | ty::Char
434            | ty::Int(_)
435            | ty::Uint(_)
436            | ty::Float(_)
437            | ty::Adt(_, _)
438            | ty::Foreign(_)
439            | ty::Str
440            | ty::Array(_, _)
441            | ty::Pat(_, _)
442            | ty::Slice(_)
443            | ty::RawPtr(_, _)
444            | ty::Ref(_, _, _)
445            | ty::FnDef(_, _)
446            | ty::FnPtr(..)
447            | ty::UnsafeBinder(_)
448            | ty::Dynamic(_, _)
449            | ty::Closure(_, _)
450            | ty::CoroutineClosure(_, _)
451            | ty::Coroutine(_, _)
452            | ty::CoroutineWitness(..)
453            | ty::Never
454            | ty::Tuple(_) => true,
455
456            ty::Error(_)
457            | ty::Infer(_)
458            | ty::Alias(ty::IsRigid::No | ty::IsRigid::Yes, _)
459            | ty::Param(_)
460            | ty::Bound(_, _)
461            | ty::Placeholder(_) => false,
462
463            // FIXME(scrabsha)
464            ty::View(..) => ::core::panicking::unimplemented_default_msg()unimplemented!(),
465        }
466    }
467}
468
469// This is manually implemented because a derive would require `I: Debug`
470impl<I: Interner> fmt::Debug for TyKind<I> {
471    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
472        match self {
473            Bool => f.write_fmt(format_args!("bool"))write!(f, "bool"),
474            Char => f.write_fmt(format_args!("char"))write!(f, "char"),
475            Int(i) => f.write_fmt(format_args!("{0:?}", i))write!(f, "{i:?}"),
476            Uint(u) => f.write_fmt(format_args!("{0:?}", u))write!(f, "{u:?}"),
477            Float(float) => f.write_fmt(format_args!("{0:?}", float))write!(f, "{float:?}"),
478            Adt(d, s) => debug_adt::<I>(f, d, s),
479            Foreign(d) => f.debug_tuple("Foreign").field(d).finish(),
480            Str => f.write_fmt(format_args!("str"))write!(f, "str"),
481            Array(t, c) => f.write_fmt(format_args!("[{0:?}; {1:?}]", t, c))write!(f, "[{t:?}; {c:?}]"),
482            Pat(t, p) => f.write_fmt(format_args!("pattern_type!({0:?} is {1:?})", t, p))write!(f, "pattern_type!({t:?} is {p:?})"),
483            Slice(t) => f.write_fmt(format_args!("[{0:?}]", &t))write!(f, "[{:?}]", &t),
484            RawPtr(ty, mutbl) => f.write_fmt(format_args!("*{0} {1:?}", mutbl.ptr_str(), ty))write!(f, "*{} {:?}", mutbl.ptr_str(), ty),
485            Ref(r, t, m) => f.write_fmt(format_args!("&{0:?} {1}{2:?}", r, m.prefix_str(), t))write!(f, "&{:?} {}{:?}", r, m.prefix_str(), t),
486            FnDef(d, s) => f.debug_tuple("FnDef").field(d).field(&s).finish(),
487            FnPtr(sig_tys, hdr) => f.write_fmt(format_args!("{0:?}", sig_tys.with(*hdr)))write!(f, "{:?}", sig_tys.with(*hdr)),
488            // FIXME(unsafe_binder): print this like `unsafe<'a> T<'a>`.
489            UnsafeBinder(binder) => f.write_fmt(format_args!("{0:?}", binder))write!(f, "{:?}", binder),
490            Dynamic(p, r) => f.write_fmt(format_args!("dyn {0:?} + {1:?}", p, r))write!(f, "dyn {p:?} + {r:?}"),
491            Closure(d, s) => f.debug_tuple("Closure").field(d).field(&s).finish(),
492            CoroutineClosure(d, s) => f.debug_tuple("CoroutineClosure").field(d).field(&s).finish(),
493            Coroutine(d, s) => f.debug_tuple("Coroutine").field(d).field(&s).finish(),
494            CoroutineWitness(d, s) => f.debug_tuple("CoroutineWitness").field(d).field(&s).finish(),
495            Never => f.write_fmt(format_args!("!"))write!(f, "!"),
496            Tuple(t) => {
497                f.write_fmt(format_args!("("))write!(f, "(")?;
498                let mut count = 0;
499                for ty in t.iter() {
500                    if count > 0 {
501                        f.write_fmt(format_args!(", "))write!(f, ", ")?;
502                    }
503                    f.write_fmt(format_args!("{0:?}", ty))write!(f, "{ty:?}")?;
504                    count += 1;
505                }
506                // unary tuples need a trailing comma
507                if count == 1 {
508                    f.write_fmt(format_args!(","))write!(f, ",")?;
509                }
510                f.write_fmt(format_args!(")"))write!(f, ")")
511            }
512            ty::View(d, s, fields) => {
513                f.write_fmt(format_args!("view_type!({0}.{{ {1:?} }})",
        fmt::from_fn(|f| debug_adt::<I>(f, d, s)), fields))write!(
514                    f,
515                    "view_type!({}.{{ {fields:?} }})",
516                    fmt::from_fn(|f| debug_adt::<I>(f, d, s))
517                )
518            }
519            Alias(is_rigid, a) => f.debug_tuple("Alias").field(&is_rigid).field(&a).finish(),
520            Param(p) => f.write_fmt(format_args!("{0:?}", p))write!(f, "{p:?}"),
521            Bound(d, b) => crate::debug_bound_var(f, *d, b),
522            Placeholder(p) => f.write_fmt(format_args!("{0:?}", p))write!(f, "{p:?}"),
523            Infer(t) => f.write_fmt(format_args!("{0:?}", t))write!(f, "{:?}", t),
524            TyKind::Error(_) => f.write_fmt(format_args!("{{type error}}"))write!(f, "{{type error}}"),
525        }
526    }
527}
528
529fn debug_adt<I: Interner>(
530    f: &mut fmt::Formatter<'_>,
531    d: &<I as Interner>::AdtDef,
532    s: &<I as Interner>::GenericArgs,
533) -> Result<(), fmt::Error> {
534    f.write_fmt(format_args!("{0:?}", d))write!(f, "{d:?}")?;
535    let mut s = s.iter();
536    let first = s.next();
537    match first {
538        Some(first) => f.write_fmt(format_args!("<{0:?}", first))write!(f, "<{:?}", first)?,
539        None => return Ok(()),
540    };
541
542    for arg in s {
543        f.write_fmt(format_args!(", {0:?}", arg))write!(f, ", {:?}", arg)?;
544    }
545
546    f.write_fmt(format_args!(">"))write!(f, ">")
547}
548
549impl<I: Interner> AliasTy<I> {
550    pub fn new_from_args(interner: I, kind: AliasTyKind<I>, args: I::GenericArgs) -> AliasTy<I> {
551        if truecfg!(debug_assertions) {
552            interner.debug_assert_alias_term_args_compatible(kind.into(), args);
553        }
554        AliasTy { kind, args, _use_alias_new_instead: () }
555    }
556
557    pub fn new(
558        interner: I,
559        kind: AliasTyKind<I>,
560        args: impl IntoIterator<Item: Into<I::GenericArg>>,
561    ) -> AliasTy<I> {
562        let args = interner.mk_args_from_iter(args.into_iter().map(Into::into));
563        Self::new_from_args(interner, kind, args)
564    }
565
566    /// Whether this alias type is an opaque.
567    pub fn is_opaque(self) -> bool {
568        #[allow(non_exhaustive_omitted_patterns)] match self.kind {
    AliasTyKind::Opaque { .. } => true,
    _ => false,
}matches!(self.kind, AliasTyKind::Opaque { .. })
569    }
570
571    pub fn to_ty(self, interner: I, is_rigid: ty::IsRigid) -> I::Ty {
572        Ty::new_alias(interner, is_rigid, self)
573    }
574
575    pub fn try_to_projection(self) -> Option<ProjectionAliasTy<I>> {
576        self.kind.try_to_projection().map(|kind| ty::Alias {
577            kind,
578            args: self.args,
579            _use_alias_new_instead: (),
580        })
581    }
582
583    pub fn try_to_inherent(self) -> Option<InherentAliasTy<I>> {
584        self.kind.try_to_inherent().map(|kind| ty::Alias {
585            kind,
586            args: self.args,
587            _use_alias_new_instead: (),
588        })
589    }
590
591    pub fn try_to_opaque(self) -> Option<OpaqueAliasTy<I>> {
592        self.kind.try_to_opaque().map(|kind| ty::Alias {
593            kind,
594            args: self.args,
595            _use_alias_new_instead: (),
596        })
597    }
598
599    pub fn try_to_free(self) -> Option<FreeAliasTy<I>> {
600        self.kind.try_to_free().map(|kind| ty::Alias {
601            kind,
602            args: self.args,
603            _use_alias_new_instead: (),
604        })
605    }
606}
607
608impl<I: Interner> ProjectionAliasTy<I> {
609    pub fn new_projection_from_args(
610        interner: I,
611        kind: I::TraitAssocTyId,
612        args: I::GenericArgs,
613    ) -> Self {
614        interner.debug_assert_alias_term_args_compatible(
615            ty::AliasTermKind::ProjectionTy { def_id: kind },
616            args,
617        );
618        Self { kind, args, _use_alias_new_instead: () }
619    }
620
621    pub fn projection_to_alias_ty(self) -> AliasTy<I> {
622        AliasTy {
623            kind: AliasTyKind::Projection { def_id: self.kind },
624            args: self.args,
625            _use_alias_new_instead: (),
626        }
627    }
628
629    #[track_caller]
630    pub fn projection_self_ty(self) -> I::Ty {
631        self.args.type_at(0)
632    }
633}
634
635/// The following methods work only with (trait) associated type projections.
636// FIXME: Migrate these to the impl on ProjectionAliasTy (by making callers use `try_to_projection`
637// or similar when they guard for projections)
638impl<I: Interner> AliasTy<I> {
639    #[track_caller]
640    pub fn self_ty(self) -> I::Ty {
641        self.args.type_at(0)
642    }
643
644    pub fn with_replaced_self_ty(self, interner: I, self_ty: I::Ty) -> Self {
645        AliasTy::new(
646            interner,
647            self.kind,
648            [self_ty.into()].into_iter().chain(self.args.iter().skip(1)),
649        )
650    }
651
652    pub fn trait_def_id(self, interner: I) -> I::TraitId {
653        let AliasTyKind::Projection { def_id } = self.kind else { { ::core::panicking::panic_fmt(format_args!("expected a projection")); }panic!("expected a projection") };
654
655        interner.projection_parent(def_id.into())
656    }
657
658    /// Extracts the underlying trait reference and own args from this projection.
659    ///
660    /// For example, if this is a projection of `<T as StreamingIterator>::Item<'a>`,
661    /// then this function would return a `T: StreamingIterator` trait reference and
662    /// `['a]` as the own args.
663    pub fn trait_ref_and_own_args<'a>(
664        &'a self,
665        interner: I,
666    ) -> (ty::TraitRef<I>, I::GenericArgsSlice<'a>)
667    where
668        I: 'a,
669    {
670        let AliasTyKind::Projection { def_id } = self.kind else { { ::core::panicking::panic_fmt(format_args!("expected a projection")); }panic!("expected a projection") };
671
672        interner.trait_ref_and_own_args_for_alias(def_id.into(), &self.args)
673    }
674
675    /// Extracts the underlying trait reference from this projection.
676    ///
677    /// For example, if this is a projection of `<T as Iterator>::Item`,
678    /// then this function would return a `T: Iterator` trait reference.
679    ///
680    /// WARNING: This will drop the args for generic associated types
681    /// consider calling [Self::trait_ref_and_own_args] to get those
682    /// as well.
683    pub fn trait_ref(self, interner: I) -> ty::TraitRef<I> {
684        self.trait_ref_and_own_args(interner).0
685    }
686}
687
688impl<I: Interner> InherentAliasTy<I> {
689    pub fn new_inherent_from_args(
690        interner: I,
691        kind: I::InherentAssocTyId,
692        args: I::GenericArgs,
693    ) -> Self {
694        interner.debug_assert_alias_term_args_compatible(
695            ty::AliasTermKind::InherentTy { def_id: kind },
696            args,
697        );
698        Self { kind, args, _use_alias_new_instead: () }
699    }
700
701    pub fn inherent_to_alias_ty(self) -> AliasTy<I> {
702        AliasTy {
703            kind: AliasTyKind::Inherent { def_id: self.kind },
704            args: self.args,
705            _use_alias_new_instead: (),
706        }
707    }
708}
709
710impl<I: Interner> OpaqueAliasTy<I> {
711    pub fn new_opaque_from_args(interner: I, kind: I::OpaqueTyId, args: I::GenericArgs) -> Self {
712        interner.debug_assert_alias_term_args_compatible(
713            ty::AliasTermKind::OpaqueTy { def_id: kind },
714            args,
715        );
716        Self { kind, args, _use_alias_new_instead: () }
717    }
718
719    pub fn opaque_to_alias_ty(self) -> AliasTy<I> {
720        AliasTy {
721            kind: AliasTyKind::Opaque { def_id: self.kind },
722            args: self.args,
723            _use_alias_new_instead: (),
724        }
725    }
726}
727
728impl<I: Interner> FreeAliasTy<I> {
729    pub fn new_free_from_args(interner: I, kind: I::FreeTyAliasId, args: I::GenericArgs) -> Self {
730        interner.debug_assert_alias_term_args_compatible(
731            ty::AliasTermKind::FreeTy { def_id: kind },
732            args,
733        );
734        Self { kind, args, _use_alias_new_instead: () }
735    }
736
737    pub fn free_to_alias_ty(self) -> AliasTy<I> {
738        AliasTy {
739            kind: AliasTyKind::Free { def_id: self.kind },
740            args: self.args,
741            _use_alias_new_instead: (),
742        }
743    }
744}
745
746#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for IntVarValue {
}
#[automatically_derived]impl ::core::clone::Clone for IntVarValue {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<IntTy>;
        let _: ::core::clone::AssertParamIsClone<UintTy>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for IntVarValue { }Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    IntVarValue {
}
#[automatically_derived]impl ::core::cmp::PartialEq for IntVarValue {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::IntType(__self_0), Self::IntType(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::UintType(__self_0), Self::UintType(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for IntVarValue {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<IntTy>;
        let _: ::core::cmp::AssertParamIsEq<UintTy>;
    }
}Eq, #[automatically_derived]impl ::core::fmt::Debug for IntVarValue {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Unknown => ::core::fmt::Formatter::write_str(f, "Unknown"),
            Self::IntType(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "IntType", &__self_0),
            Self::UintType(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "UintType", &__self_0),
        }
    }
}Debug)]
747pub enum IntVarValue {
748    Unknown,
749    IntType(IntTy),
750    UintType(UintTy),
751}
752
753impl IntVarValue {
754    pub fn is_known(self) -> bool {
755        match self {
756            IntVarValue::IntType(_) | IntVarValue::UintType(_) => true,
757            IntVarValue::Unknown => false,
758        }
759    }
760
761    pub fn is_unknown(self) -> bool {
762        !self.is_known()
763    }
764}
765
766#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for FloatVarValue {
}
#[automatically_derived]impl ::core::clone::Clone for FloatVarValue {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<FloatTy>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for FloatVarValue { }Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
    FloatVarValue {
}
#[automatically_derived]impl ::core::cmp::PartialEq for FloatVarValue {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::Known(__self_0), Self::Known(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for FloatVarValue {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<FloatTy>;
    }
}Eq, #[automatically_derived]impl ::core::fmt::Debug for FloatVarValue {
    #[inline]
    #[rustc_trivial_field_reads]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Self::Unknown => ::core::fmt::Formatter::write_str(f, "Unknown"),
            Self::Known(__self_0) =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f, "Known",
                    &__self_0),
        }
    }
}Debug)]
767pub enum FloatVarValue {
768    Unknown,
769    Known(FloatTy),
770}
771
772impl FloatVarValue {
773    pub fn is_known(self) -> bool {
774        match self {
775            FloatVarValue::Known(_) => true,
776            FloatVarValue::Unknown => false,
777        }
778    }
779
780    pub fn is_unknown(self) -> bool {
781        !self.is_known()
782    }
783}
784
785#[automatically_derived]impl ::core::marker::Copy for TyVid { }
impl TyVid {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for TyVid {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for TyVid {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for TyVid {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for TyVid {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for TyVid {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for TyVid {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl From<TyVid> for u32 {
    #[inline]
    fn from(v: TyVid) -> u32 { v.as_u32() }
}
impl From<TyVid> for usize {
    #[inline]
    fn from(v: TyVid) -> usize { v.as_usize() }
}
impl From<usize> for TyVid {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for TyVid {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for TyVid {}
impl ::std::cmp::PartialEq for TyVid {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for TyVid { }
impl ::std::hash::Hash for TyVid {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for TyVid
    {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for TyVid
    {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for TyVid {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("?{0}t", self.as_u32()))
    }
}rustc_index::newtype_index! {
786    /// A **ty**pe **v**ariable **ID**.
787    #[encodable]
788    #[orderable]
789    #[debug_format = "?{}t"]
790    #[gate_rustc_only]
791    pub struct TyVid {}
792}
793
794#[automatically_derived]impl ::core::marker::Copy for IntVid { }
impl IntVid {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for IntVid {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for IntVid {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for IntVid {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for IntVid {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for IntVid {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for IntVid {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl From<IntVid> for u32 {
    #[inline]
    fn from(v: IntVid) -> u32 { v.as_u32() }
}
impl From<IntVid> for usize {
    #[inline]
    fn from(v: IntVid) -> usize { v.as_usize() }
}
impl From<usize> for IntVid {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for IntVid {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for IntVid {}
impl ::std::cmp::PartialEq for IntVid {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for IntVid { }
impl ::std::hash::Hash for IntVid {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for IntVid
    {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for IntVid
    {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for IntVid {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("?{0}i", self.as_u32()))
    }
}rustc_index::newtype_index! {
795    /// An **int**egral (`u32`, `i32`, `usize`, etc.) type **v**ariable **ID**.
796    #[encodable]
797    #[orderable]
798    #[debug_format = "?{}i"]
799    #[gate_rustc_only]
800    pub struct IntVid {}
801}
802
803#[automatically_derived]impl ::core::marker::Copy for FloatVid { }
impl FloatVid {
    #[doc = r" Maximum value the index can take, as a `u32`."]
    pub const MAX_AS_U32: u32 = 0xFFFF_FF00;
    #[doc = r" Maximum value the index can take."]
    pub const MAX: Self = Self::from_u32(0xFFFF_FF00);
    #[doc = r" Zero value of the index."]
    pub const ZERO: Self = Self::from_u32(0);
    #[doc = r" Creates a new index from a given `usize`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_usize(value: usize) -> Self {
        if !(value <= (0xFFFF_FF00 as usize)) {
            ::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
        };
        unsafe { Self::from_u32_unchecked(value as u32) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u32(value: u32) -> Self {
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u16`."]
    #[doc = r""]
    #[doc = r" # Panics"]
    #[doc = r""]
    #[doc = r" Will panic if `value` exceeds `MAX`."]
    #[inline]
    pub const fn from_u16(value: u16) -> Self {
        let value = value as u32;
        if !(value <= 0xFFFF_FF00) {
            ::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
        };
        unsafe { Self::from_u32_unchecked(value) }
    }
    #[doc = r" Creates a new index from a given `u32`."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc =
    r" The provided value must be less than or equal to the maximum value for the newtype."]
    #[doc =
    r" Providing a value outside this range is undefined due to layout restrictions."]
    #[doc = r""]
    #[doc = r" Prefer using `from_u32`."]
    #[inline]
    pub const unsafe fn from_u32_unchecked(value: u32) -> Self {
        Self {
            private_use_as_methods_instead: unsafe {
                std::mem::transmute(value)
            },
        }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn index(self) -> usize { self.as_usize() }
    #[doc = r" Extracts the value of this index as a `u32`."]
    #[inline]
    pub const fn as_u32(self) -> u32 {
        unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
    }
    #[doc = r" Extracts the value of this index as a `usize`."]
    #[inline]
    pub const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for FloatVid {
    type Output = Self;
    #[inline]
    fn add(self, other: usize) -> Self {
        Self::from_usize(self.index() + other)
    }
}
impl std::ops::AddAssign<usize> for FloatVid {
    #[inline]
    fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for FloatVid {
    #[inline]
    fn new(value: usize) -> Self { Self::from_usize(value) }
    #[inline]
    fn index(self) -> usize { self.as_usize() }
}
impl ::std::iter::Step for FloatVid {
    #[inline]
    fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>) {
        <usize as
                ::std::iter::Step>::steps_between(&Self::index(*start),
            &Self::index(*end))
    }
    #[inline]
    fn forward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_add(u).map(Self::from_usize)
    }
    #[inline]
    fn backward_checked(start: Self, u: usize) -> Option<Self> {
        Self::index(start).checked_sub(u).map(Self::from_usize)
    }
    #[inline]
    fn forward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_add(u);
        (Self::from_usize(s), o)
    }
    #[inline]
    fn backward_overflowing(start: Self, u: usize) -> (Self, bool) {
        let (s, o) = Self::index(start).overflowing_sub(u);
        (Self::from_usize(s), o)
    }
}
impl ::std::cmp::Ord for FloatVid {
    #[inline]
    fn cmp(&self, other: &Self) -> std::cmp::Ordering {
        self.as_u32().cmp(&other.as_u32())
    }
}
impl ::std::cmp::PartialOrd for FloatVid {
    #[inline]
    fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl From<FloatVid> for u32 {
    #[inline]
    fn from(v: FloatVid) -> u32 { v.as_u32() }
}
impl From<FloatVid> for usize {
    #[inline]
    fn from(v: FloatVid) -> usize { v.as_usize() }
}
impl From<usize> for FloatVid {
    #[inline]
    fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for FloatVid {
    #[inline]
    fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for FloatVid {}
impl ::std::cmp::PartialEq for FloatVid {
    fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for FloatVid { }
impl ::std::hash::Hash for FloatVid {
    fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
        self.as_u32().hash(state)
    }
}
impl<D: ::rustc_serialize::Decoder> ::rustc_serialize::Decodable<D> for
    FloatVid {
    fn decode(d: &mut D) -> Self { Self::from_u32(d.read_u32()) }
}
impl<E: ::rustc_serialize::Encoder> ::rustc_serialize::Encodable<E> for
    FloatVid {
    fn encode(&self, e: &mut E) { e.emit_u32(self.as_u32()); }
}
impl ::std::fmt::Debug for FloatVid {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("?{0}f", self.as_u32()))
    }
}rustc_index::newtype_index! {
804    /// A **float**ing-point (`f32` or `f64`) type **v**ariable **ID**.
805    #[encodable]
806    #[orderable]
807    #[debug_format = "?{}f"]
808    #[gate_rustc_only]
809    pub struct FloatVid {}
810}
811
812/// A placeholder for a type that hasn't been inferred yet.
813///
814/// E.g., if we have an empty array (`[]`), then we create a fresh
815/// type variable for the element type since we won't know until it's
816/// used what the element type is supposed to be.
817#[derive(#[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for InferTy {
}
#[automatically_derived]impl ::core::clone::Clone for InferTy {
    #[inline]
    #[rustc_trivial_field_reads]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<TyVid>;
        let _: ::core::clone::AssertParamIsClone<IntVid>;
        let _: ::core::clone::AssertParamIsClone<FloatVid>;
        let _: ::core::clone::AssertParamIsClone<u32>;
        *self
    }
}Clone, #[automatically_derived]impl ::core::marker::Copy for InferTy { }Copy, #[automatically_derived]impl ::core::marker::StructuralPartialEq for InferTy {
}
#[automatically_derived]impl ::core::cmp::PartialEq for InferTy {
    #[inline]
    fn eq(&self, other: &Self) -> bool {
        ::core::intrinsics::discriminant_value(self) ==
                ::core::intrinsics::discriminant_value(other) &&
            match (self, other) {
                (Self::TyVar(__self_0), Self::TyVar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::IntVar(__self_0), Self::IntVar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::FloatVar(__self_0), Self::FloatVar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::FreshTy(__self_0), Self::FreshTy(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::FreshIntTy(__self_0), Self::FreshIntTy(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (Self::FreshFloatTy(__self_0), Self::FreshFloatTy(__arg1_0))
                    => __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for InferTy {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<TyVid>;
        let _: ::core::cmp::AssertParamIsEq<IntVid>;
        let _: ::core::cmp::AssertParamIsEq<FloatVid>;
        let _: ::core::cmp::AssertParamIsEq<u32>;
    }
}Eq, #[automatically_derived]impl ::core::cmp::PartialOrd for InferTy {
    #[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 InferTy {
    #[inline]
    fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
        match (self, other) {
            (Self::TyVar(__self_0), Self::TyVar(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::IntVar(__self_0), Self::IntVar(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::FloatVar(__self_0), Self::FloatVar(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::FreshTy(__self_0), Self::FreshTy(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::FreshIntTy(__self_0), Self::FreshIntTy(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            (Self::FreshFloatTy(__self_0), Self::FreshFloatTy(__arg1_0)) =>
                ::core::cmp::Ord::cmp(__self_0, __arg1_0),
            _ =>
                ::core::cmp::Ord::cmp(&::core::intrinsics::discriminant_value(self),
                    &::core::intrinsics::discriminant_value(other)),
        }
    }
}Ord, #[automatically_derived]impl ::core::hash::Hash for InferTy {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&::core::intrinsics::discriminant_value(self),
            state);
        match self {
            Self::TyVar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::IntVar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::FloatVar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::FreshTy(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::FreshIntTy(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            Self::FreshFloatTy(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash)]
818#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<__E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for InferTy {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        InferTy::TyVar(ref __binding_0) => { 0usize }
                        InferTy::IntVar(ref __binding_0) => { 1usize }
                        InferTy::FloatVar(ref __binding_0) => { 2usize }
                        InferTy::FreshTy(ref __binding_0) => { 3usize }
                        InferTy::FreshIntTy(ref __binding_0) => { 4usize }
                        InferTy::FreshFloatTy(ref __binding_0) => { 5usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    InferTy::TyVar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    InferTy::IntVar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    InferTy::FloatVar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    InferTy::FreshTy(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    InferTy::FreshIntTy(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    InferTy::FreshFloatTy(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<__D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for InferTy {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        InferTy::TyVar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => {
                        InferTy::IntVar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    2usize => {
                        InferTy::FloatVar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    3usize => {
                        InferTy::FreshTy(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    4usize => {
                        InferTy::FreshIntTy(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    5usize => {
                        InferTy::FreshFloatTy(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `InferTy`, expected 0..6, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable_NoContext))]
819pub enum InferTy {
820    /// A type variable.
821    TyVar(TyVid),
822    /// An integral type variable (`{integer}`).
823    ///
824    /// These are created when the compiler sees an integer literal like
825    /// `1` that could be several different types (`u8`, `i32`, `u32`, etc.).
826    /// We don't know until it's used what type it's supposed to be, so
827    /// we create a fresh type variable.
828    IntVar(IntVid),
829    /// A floating-point type variable (`{float}`).
830    ///
831    /// These are created when the compiler sees an float literal like
832    /// `1.0` that could be either an `f32` or an `f64`.
833    /// We don't know until it's used what type it's supposed to be, so
834    /// we create a fresh type variable.
835    FloatVar(FloatVid),
836
837    /// A [`FreshTy`][Self::FreshTy] is one that is generated as a replacement
838    /// for an unbound type variable.
839    ///
840    /// This is convenient for caching etc. See `TypeFreshener` for more details.
841    ///
842    /// Compare with [`TyVar`][Self::TyVar].
843    FreshTy(u32),
844    /// Like [`FreshTy`][Self::FreshTy], but as a replacement for [`IntVar`][Self::IntVar].
845    FreshIntTy(u32),
846    /// Like [`FreshTy`][Self::FreshTy], but as a replacement for [`FloatVar`][Self::FloatVar].
847    FreshFloatTy(u32),
848}
849
850impl UnifyValue for IntVarValue {
851    type Error = NoError;
852
853    fn unify_values(value1: &Self, value2: &Self) -> Result<Self, Self::Error> {
854        match (*value1, *value2) {
855            (IntVarValue::Unknown, IntVarValue::Unknown) => Ok(IntVarValue::Unknown),
856            (
857                IntVarValue::Unknown,
858                known @ (IntVarValue::UintType(_) | IntVarValue::IntType(_)),
859            )
860            | (
861                known @ (IntVarValue::UintType(_) | IntVarValue::IntType(_)),
862                IntVarValue::Unknown,
863            ) => Ok(known),
864            _ => {
    ::core::panicking::panic_fmt(format_args!("differing ints should have been resolved first"));
}panic!("differing ints should have been resolved first"),
865        }
866    }
867}
868
869impl UnifyKey for IntVid {
870    type Value = IntVarValue;
871    #[inline] // make this function eligible for inlining - it is quite hot.
872    fn index(&self) -> u32 {
873        self.as_u32()
874    }
875    #[inline]
876    fn from_index(i: u32) -> IntVid {
877        IntVid::from_u32(i)
878    }
879    fn tag() -> &'static str {
880        "IntVid"
881    }
882}
883
884impl UnifyValue for FloatVarValue {
885    type Error = NoError;
886
887    fn unify_values(value1: &Self, value2: &Self) -> Result<Self, Self::Error> {
888        match (*value1, *value2) {
889            (FloatVarValue::Unknown, FloatVarValue::Unknown) => Ok(FloatVarValue::Unknown),
890            (FloatVarValue::Unknown, FloatVarValue::Known(known))
891            | (FloatVarValue::Known(known), FloatVarValue::Unknown) => {
892                Ok(FloatVarValue::Known(known))
893            }
894            (FloatVarValue::Known(_), FloatVarValue::Known(_)) => {
895                {
    ::core::panicking::panic_fmt(format_args!("differing floats should have been resolved first"));
}panic!("differing floats should have been resolved first")
896            }
897        }
898    }
899}
900
901impl UnifyKey for FloatVid {
902    type Value = FloatVarValue;
903    #[inline]
904    fn index(&self) -> u32 {
905        self.as_u32()
906    }
907    #[inline]
908    fn from_index(i: u32) -> FloatVid {
909        FloatVid::from_u32(i)
910    }
911    fn tag() -> &'static str {
912        "FloatVid"
913    }
914}
915
916#[cfg(feature = "nightly")]
917impl StableHash for InferTy {
918    fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHasher) {
919        use InferTy::*;
920
921        #[derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Tag {
            #[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 {
                    Tag::FreshTy => 0u8.stable_hash(__hcx, __hasher),
                    Tag::FreshIntTy => 1u8.stable_hash(__hcx, __hasher),
                    Tag::FreshFloatTy => 2u8.stable_hash(__hcx, __hasher),
                }
                match *self {
                    Tag::FreshTy => {}
                    Tag::FreshIntTy => {}
                    Tag::FreshFloatTy => {}
                }
            }
        }
    };StableHash)]
922        enum Tag {
923            FreshTy,
924            FreshIntTy,
925            FreshFloatTy,
926        }
927
928        match self {
929            TyVar(_) | IntVar(_) | FloatVar(_) => {
930                {
    ::core::panicking::panic_fmt(format_args!("type variables should not be hashed: {0:?}",
            self));
}panic!("type variables should not be hashed: {self:?}")
931            }
932
933            FreshTy(v) => {
934                Tag::FreshTy.stable_hash(hcx, hasher);
935                v.stable_hash(hcx, hasher);
936            }
937            FreshIntTy(v) => {
938                Tag::FreshIntTy.stable_hash(hcx, hasher);
939                v.stable_hash(hcx, hasher);
940            }
941            FreshFloatTy(v) => {
942                Tag::FreshFloatTy.stable_hash(hcx, hasher);
943                v.stable_hash(hcx, hasher);
944            }
945        }
946    }
947}
948
949impl fmt::Display for InferTy {
950    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
951        use InferTy::*;
952        match *self {
953            TyVar(_) => f.write_fmt(format_args!("_"))write!(f, "_"),
954            IntVar(_) => f.write_fmt(format_args!("{0}", "{integer}"))write!(f, "{}", "{integer}"),
955            FloatVar(_) => f.write_fmt(format_args!("{0}", "{float}"))write!(f, "{}", "{float}"),
956            FreshTy(v) => f.write_fmt(format_args!("FreshTy({0})", v))write!(f, "FreshTy({v})"),
957            FreshIntTy(v) => f.write_fmt(format_args!("FreshIntTy({0})", v))write!(f, "FreshIntTy({v})"),
958            FreshFloatTy(v) => f.write_fmt(format_args!("FreshFloatTy({0})", v))write!(f, "FreshFloatTy({v})"),
959        }
960    }
961}
962
963impl fmt::Debug for InferTy {
964    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
965        use InferTy::*;
966        match *self {
967            TyVar(ref v) => v.fmt(f),
968            IntVar(ref v) => v.fmt(f),
969            FloatVar(ref v) => v.fmt(f),
970            FreshTy(v) => f.write_fmt(format_args!("FreshTy({0:?})", v))write!(f, "FreshTy({v:?})"),
971            FreshIntTy(v) => f.write_fmt(format_args!("FreshIntTy({0:?})", v))write!(f, "FreshIntTy({v:?})"),
972            FreshFloatTy(v) => f.write_fmt(format_args!("FreshFloatTy({0:?})", v))write!(f, "FreshFloatTy({v:?})"),
973        }
974    }
975}
976
977#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for TypeAndMut<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for TypeAndMut<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for TypeAndMut<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (TypeAndMut { ty: ref __field_ty, mutbl: ref __field_mutbl },
                TypeAndMut {
                ty: ref __other_field_ty, mutbl: ref __other_field_mutbl }) =>
                true &&
                        ::core::cmp::PartialEq::eq(__field_ty, __other_field_ty) &&
                    ::core::cmp::PartialEq::eq(__field_mutbl,
                        __other_field_mutbl),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for TypeAndMut<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            TypeAndMut { ty: ref __field_ty, mutbl: ref __field_mutbl } => {
                ::core::hash::Hash::hash(__field_ty, __state);
                ::core::hash::Hash::hash(__field_mutbl, __state);
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for TypeAndMut<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            TypeAndMut { ty: ref __field_ty, mutbl: ref __field_mutbl } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "TypeAndMut");
                ::core::fmt::DebugStruct::field(&mut __builder, "ty",
                    __field_ty);
                ::core::fmt::DebugStruct::field(&mut __builder, "mutbl",
                    __field_mutbl);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Copy, PartialEq, Hash, Debug; I: Interner)]
978#[cfg_attr(
979    feature = "nightly",
980    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for TypeAndMut<I> where
            I::Ty: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let TypeAndMut { ty: ref __binding_0, mutbl: ref __binding_1
                        } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for TypeAndMut<I> where
            I::Ty: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                TypeAndMut {
                    ty: ::rustc_serialize::Decodable::decode(__decoder),
                    mutbl: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            TypeAndMut<I> where
            I::Ty: ::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 {
                    TypeAndMut { ty: ref __binding_0, mutbl: ref __binding_1 }
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
981)]
982#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for TypeAndMut<I>
            where I: Interner, I::Ty: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    TypeAndMut { ty: ref __binding_0, mutbl: ref __binding_1 }
                        => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for TypeAndMut<I> where
            I::Ty: ::rustc_type_ir::GenericTypeVisitable<__V>,
            Mutability: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    TypeAndMut { ty: ref __binding_0, mutbl: ref __binding_1 }
                        => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for TypeAndMut<I>
            where I: Interner, I::Ty: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        TypeAndMut { ty: __binding_0, mutbl: __binding_1 } => {
                            TypeAndMut {
                                ty: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                mutbl: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    TypeAndMut { ty: __binding_0, mutbl: __binding_1 } => {
                        TypeAndMut {
                            ty: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            mutbl: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
983pub struct TypeAndMut<I: Interner> {
984    pub ty: I::Ty,
985    pub mutbl: Mutability,
986}
987
988impl<I: Interner> Eq for TypeAndMut<I> {}
989
990/// Error type for splatted argument index errors.
991#[derive(#[automatically_derived]impl ::core::fmt::Debug for SplattedArgIndexError {
    #[inline]
    #[rustc_trivial_field_reads]
    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 args_len", __self_0,
                    &__self_1),
        }
    }
}Debug, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
    for SplattedArgIndexError {
}
#[automatically_derived]impl ::core::clone::Clone for SplattedArgIndexError {
    #[inline]
    #[rustc_trivial_field_reads]
    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)]
992pub enum SplattedArgIndexError {
993    /// The splatted argument index is invalid.
994    /// A `u8::MAX` argument index used to indicate that no argument is splatted.
995    /// Higher values are also not supported, for performance reasons.
996    InvalidIndex { splatted_arg_index: u8 },
997
998    /// The splatted argument index is outside the bounds of the function arguments.
999    OutOfBounds { splatted_arg_index: u8, args_len: u16 },
1000}
1001
1002/// Contains the packed non-type fields of a function signature.
1003#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for FnSigKind<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for FnSigKind<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for FnSigKind<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (FnSigKind {
                flags: ref __field_flags,
                splatted: ref __field_splatted,
                _marker: ref __field__marker }, FnSigKind {
                flags: ref __other_field_flags,
                splatted: ref __other_field_splatted,
                _marker: ref __other_field__marker }) =>
                true &&
                            ::core::cmp::PartialEq::eq(__field_flags,
                                __other_field_flags) &&
                        ::core::cmp::PartialEq::eq(__field_splatted,
                            __other_field_splatted) &&
                    ::core::cmp::PartialEq::eq(__field__marker,
                        __other_field__marker),
        }
    }
}
const _: () =
    {
        trait DeriveWhereAssertEq {
            fn assert(&self);
        }
        impl<I: Interner> DeriveWhereAssertEq for FnSigKind<I> where
            I: Interner {
            fn assert(&self) {
                struct __AssertEq<__T: ::core::cmp::Eq +
                    ?::core::marker::Sized>(::core::marker::PhantomData<__T>);
                let _: __AssertEq<u8>;
                let _: __AssertEq<u8>;
                let _: __AssertEq<PhantomData<fn() -> I>>;
            }
        }
    };
#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for FnSigKind<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for FnSigKind<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            FnSigKind {
                flags: ref __field_flags,
                splatted: ref __field_splatted,
                _marker: ref __field__marker } => {
                ::core::hash::Hash::hash(__field_flags, __state);
                ::core::hash::Hash::hash(__field_splatted, __state);
                ::core::hash::Hash::hash(__field__marker, __state);
            }
        }
    }
}#[derive_where(Copy, Clone, PartialEq, Eq, Hash; I: Interner)]
1004#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for FnSigKind<I>
            where I: Interner {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self { FnSigKind { .. } => {} }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for FnSigKind<I>
            where I: Interner {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        FnSigKind {
                            flags: __binding_0,
                            splatted: __binding_1,
                            _marker: __binding_2 } => {
                            FnSigKind {
                                flags: __binding_0,
                                splatted: __binding_1,
                                _marker: __binding_2,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    FnSigKind {
                        flags: __binding_0,
                        splatted: __binding_1,
                        _marker: __binding_2 } => {
                        FnSigKind {
                            flags: __binding_0,
                            splatted: __binding_1,
                            _marker: __binding_2,
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for FnSigKind<I>
            where J: Interner, I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = FnSigKind<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    FnSigKind {
                        flags: __binding_0,
                        splatted: __binding_1,
                        _marker: __binding_2 } => {
                        FnSigKind {
                            flags: __binding_0,
                            splatted: __binding_1,
                            _marker: PhantomData,
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
1005#[cfg_attr(
1006    feature = "nightly",
1007    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for FnSigKind<I> where
            PhantomData<fn() -> I>: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let FnSigKind {
                        flags: ref __binding_0,
                        splatted: ref __binding_1,
                        _marker: ref __binding_2 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for FnSigKind<I> where
            PhantomData<fn() -> I>: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                FnSigKind {
                    flags: ::rustc_serialize::Decodable::decode(__decoder),
                    splatted: ::rustc_serialize::Decodable::decode(__decoder),
                    _marker: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            FnSigKind<I> where
            PhantomData<fn()
                -> I>: ::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 {
                    FnSigKind {
                        flags: ref __binding_0,
                        splatted: ref __binding_1,
                        _marker: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
1008)]
1009pub struct FnSigKind<I: Interner> {
1010    /// Holds the c_variadic and safety bitflags, and 6 bits for the `ExternAbi` variant and unwind
1011    /// flag.
1012    #[lift(identity)]
1013    #[type_visitable(ignore)]
1014    #[type_foldable(identity)]
1015    flags: u8,
1016
1017    /// Which function argument is splatted into multiple arguments in callers, if any?
1018    /// Splatting functions with `>= u8::MAX` arguments is not supported, for performance reasons.
1019    /// (And spending an extra byte on an edge case is not worth the perf.)
1020    #[lift(identity)]
1021    #[type_visitable(ignore)]
1022    #[type_foldable(identity)]
1023    splatted: u8,
1024
1025    #[type_visitable(ignore)]
1026    #[type_foldable(identity)]
1027    _marker: PhantomData<fn() -> I>,
1028}
1029
1030impl<I: Interner> fmt::Debug for FnSigKind<I> {
1031    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1032        let mut f = f.debug_tuple("FnSigKind");
1033
1034        if self.is_safe() {
1035            f.field(&"Safe");
1036        } else {
1037            f.field(&"Unsafe");
1038        }
1039
1040        f.field(&self.abi());
1041
1042        if self.c_variadic() {
1043            f.field(&"CVariadic");
1044        }
1045
1046        if let Some(index) = self.splatted() {
1047            f.field(&::alloc::__export::must_use({
        ::alloc::fmt::format(format_args!("Splatted({0})", index))
    })format!("Splatted({})", index));
1048        }
1049
1050        f.finish()
1051    }
1052}
1053
1054impl<I: Interner> Default for FnSigKind<I> {
1055    /// Create a new FnSigKind with the "Rust" ABI, "Unsafe" safety, and no C-style variadic or splatted arguments.
1056    /// To modify these flags, use the `set_*` methods, for readability.
1057    fn default() -> Self {
1058        Self { flags: 0, splatted: 0, _marker: PhantomData }
1059            .set_abi(ExternAbi::Rust)
1060            .set_safety(I::Safety::unsafe_mode())
1061            .set_c_variadic(false)
1062            .set_no_splatted_args()
1063    }
1064}
1065
1066impl<I: Interner> FnSigKind<I> {
1067    /// Mask for the `ExternAbi` variant, including the unwind flag.
1068    const EXTERN_ABI_MASK: u8 = 0b111111;
1069
1070    /// Bitflag for `Safety::Safe`. The default is `Unsafe`.
1071    const SAFE_FLAG: u8 = 1 << 6;
1072
1073    /// Bitflag for a trailing C-style variadic argument.
1074    const C_VARIADIC_FLAG: u8 = 1 << 7;
1075
1076    /// The marker index for "no splatted arguments". Higher values are also not supported, for
1077    /// performance reasons.
1078    ///
1079    /// Must have the same value as `FnDeclFlags::NO_SPLATTED_ARG_INDEX` and
1080    /// `rustc_ast::FnDecl::NO_SPLATTED_ARG_INDEX`.
1081    ///
1082    /// This is an implementation detail, which should only be used in low-level encoding.
1083    pub const NO_SPLATTED_ARG_INDEX: u8 = u8::MAX;
1084
1085    /// Create a new FnSigKind with the given ABI, safety, C-style variadic, and splatted argument
1086    /// index.
1087    pub fn new(
1088        abi: ExternAbi,
1089        safety: I::Safety,
1090        c_variadic: bool,
1091        splatted: Option<u8>,
1092        args_len: usize,
1093    ) -> Result<Self, SplattedArgIndexError> {
1094        Self::default()
1095            .set_abi(abi)
1096            .set_safety(safety)
1097            .set_c_variadic(c_variadic)
1098            .set_splatted(splatted, args_len)
1099    }
1100
1101    /// Create a new safe FnSigKind with the `extern "Rust"` ABI, that isn't C-style variadic or splatted.
1102    pub fn dummy() -> Self {
1103        Self::default().set_safety(I::Safety::safe())
1104    }
1105
1106    /// Set the ABI, including the unwind flag.
1107    #[must_use = "this method does not modify the receiver"]
1108    pub fn set_abi(mut self, abi: ExternAbi) -> Self {
1109        let abi_index = abi.as_packed();
1110        if !(abi_index <= Self::EXTERN_ABI_MASK) {
    ::core::panicking::panic("assertion failed: abi_index <= Self::EXTERN_ABI_MASK")
};assert!(abi_index <= Self::EXTERN_ABI_MASK);
1111
1112        self.flags &= !Self::EXTERN_ABI_MASK;
1113        self.flags |= abi_index;
1114
1115        self
1116    }
1117
1118    /// Set the safety flag, `true` is `Safe`.
1119    #[must_use = "this method does not modify the receiver"]
1120    pub fn set_safety(mut self, safety: I::Safety) -> Self {
1121        if safety.is_safe() {
1122            self.flags |= Self::SAFE_FLAG;
1123        } else {
1124            self.flags &= !Self::SAFE_FLAG;
1125        }
1126
1127        self
1128    }
1129
1130    /// Set the C-style variadic argument flag.
1131    #[must_use = "this method does not modify the receiver"]
1132    pub fn set_c_variadic(mut self, c_variadic: bool) -> Self {
1133        if c_variadic {
1134            self.flags |= Self::C_VARIADIC_FLAG;
1135        } else {
1136            self.flags &= !Self::C_VARIADIC_FLAG;
1137        }
1138
1139        self
1140    }
1141
1142    /// Set the splatted argument index.
1143    /// The number of function arguments is used for error checking.
1144    #[must_use = "this method does not modify the receiver"]
1145    pub fn set_splatted(
1146        mut self,
1147        splatted: Option<u8>,
1148        args_len: usize,
1149    ) -> Result<Self, SplattedArgIndexError> {
1150        if let Some(splatted_arg_index) = splatted {
1151            if splatted_arg_index == Self::NO_SPLATTED_ARG_INDEX {
1152                // This index value is used as a marker for "no splatting", so it is unsupported.
1153                // Higher values are also not supported, for performance reasons.
1154                return Err(SplattedArgIndexError::InvalidIndex { splatted_arg_index });
1155            } else if usize::from(splatted_arg_index) >= args_len {
1156                return Err(SplattedArgIndexError::OutOfBounds {
1157                    splatted_arg_index,
1158                    args_len: args_len as u16,
1159                });
1160            }
1161
1162            self.splatted = splatted_arg_index;
1163        } else {
1164            self.splatted = Self::NO_SPLATTED_ARG_INDEX;
1165        }
1166
1167        Ok(self)
1168    }
1169
1170    /// Set the splatted argument index to "no splatted arguments".
1171    #[must_use = "this method does not modify the receiver"]
1172    pub fn set_no_splatted_args(mut self) -> Self {
1173        self.splatted = Self::NO_SPLATTED_ARG_INDEX;
1174        self
1175    }
1176
1177    /// Get the ABI, including the unwind flag.
1178    pub fn abi(self) -> ExternAbi {
1179        let abi_index = self.flags & Self::EXTERN_ABI_MASK;
1180        ExternAbi::from_packed(abi_index)
1181    }
1182
1183    /// Get the safety flag.
1184    pub fn is_safe(self) -> bool {
1185        self.flags & Self::SAFE_FLAG != 0
1186    }
1187
1188    /// Returns the safety mode.
1189    pub fn safety(self) -> I::Safety {
1190        if self.is_safe() { I::Safety::safe() } else { I::Safety::unsafe_mode() }
1191    }
1192
1193    /// Do the function arguments end with a C-style variadic argument?
1194    pub fn c_variadic(self) -> bool {
1195        self.flags & Self::C_VARIADIC_FLAG != 0
1196    }
1197
1198    /// Get the index of the splatted argument, if any.
1199    pub fn splatted(self) -> Option<u8> {
1200        if self.splatted == Self::NO_SPLATTED_ARG_INDEX { None } else { Some(self.splatted) }
1201    }
1202}
1203
1204#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for FnSig<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for FnSig<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for FnSig<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (FnSig {
                inputs_and_output: ref __field_inputs_and_output,
                fn_sig_kind: ref __field_fn_sig_kind }, FnSig {
                inputs_and_output: ref __other_field_inputs_and_output,
                fn_sig_kind: ref __other_field_fn_sig_kind }) =>
                true &&
                        ::core::cmp::PartialEq::eq(__field_inputs_and_output,
                            __other_field_inputs_and_output) &&
                    ::core::cmp::PartialEq::eq(__field_fn_sig_kind,
                        __other_field_fn_sig_kind),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for FnSig<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            FnSig {
                inputs_and_output: ref __field_inputs_and_output,
                fn_sig_kind: ref __field_fn_sig_kind } => {
                ::core::hash::Hash::hash(__field_inputs_and_output, __state);
                ::core::hash::Hash::hash(__field_fn_sig_kind, __state);
            }
        }
    }
}#[derive_where(Clone, Copy, PartialEq, Hash; I: Interner)]
1205#[cfg_attr(
1206    feature = "nightly",
1207    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for FnSig<I> where
            I::Tys: ::rustc_serialize::Encodable<__E>,
            FnSigKind<I>: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let FnSig {
                        inputs_and_output: ref __binding_0,
                        fn_sig_kind: ref __binding_1 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for FnSig<I> where
            I::Tys: ::rustc_serialize::Decodable<__D>,
            FnSigKind<I>: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                FnSig {
                    inputs_and_output: ::rustc_serialize::Decodable::decode(__decoder),
                    fn_sig_kind: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            FnSig<I> where
            I::Tys: ::rustc_data_structures::stable_hash::StableHash,
            FnSigKind<I>: ::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 {
                    FnSig {
                        inputs_and_output: ref __binding_0,
                        fn_sig_kind: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
1208)]
1209#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for FnSig<I> where
            I: Interner, I::Tys: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    FnSig { inputs_and_output: ref __binding_0, .. } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for FnSig<I> where
            I::Tys: ::rustc_type_ir::GenericTypeVisitable<__V>,
            FnSigKind<I>: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    FnSig {
                        inputs_and_output: ref __binding_0,
                        fn_sig_kind: ref __binding_1 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for FnSig<I> where
            I: Interner, I::Tys: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        FnSig {
                            inputs_and_output: __binding_0, fn_sig_kind: __binding_1 }
                            => {
                            FnSig {
                                inputs_and_output: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                fn_sig_kind: __binding_1,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    FnSig {
                        inputs_and_output: __binding_0, fn_sig_kind: __binding_1 }
                        => {
                        FnSig {
                            inputs_and_output: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            fn_sig_kind: __binding_1,
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for FnSig<I> where
            J: Interner, I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = FnSig<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    FnSig {
                        inputs_and_output: __binding_0, fn_sig_kind: __binding_1 }
                        => {
                        FnSig {
                            inputs_and_output: __binding_0.lift_to_interner(interner),
                            fn_sig_kind: __binding_1.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
1210pub struct FnSig<I: Interner> {
1211    pub inputs_and_output: I::Tys,
1212    #[type_visitable(ignore)]
1213    #[type_foldable(identity)]
1214    pub fn_sig_kind: FnSigKind<I>,
1215}
1216
1217impl<I: Interner> Eq for FnSig<I> {}
1218
1219impl<I: Interner> FnSig<I> {
1220    pub fn inputs(self) -> I::FnInputTys {
1221        self.inputs_and_output.inputs()
1222    }
1223
1224    pub fn output(self) -> I::Ty {
1225        self.inputs_and_output.output()
1226    }
1227
1228    pub fn is_fn_trait_compatible(self) -> bool {
1229        !self.c_variadic() && self.safety().is_safe() && self.abi().is_fn_trait_compatible()
1230    }
1231
1232    /// Set the safety flag.
1233    #[must_use = "this method does not modify the receiver"]
1234    pub fn set_safety(self, safety: I::Safety) -> Self {
1235        Self { fn_sig_kind: self.fn_sig_kind.set_safety(safety), ..self }
1236    }
1237
1238    /// Set the splatted argument index.
1239    /// The number of function arguments is used for error checking.
1240    #[must_use = "this method does not modify the receiver"]
1241    pub fn set_splatted(
1242        self,
1243        splatted: Option<u8>,
1244        args_len: usize,
1245    ) -> Result<Self, SplattedArgIndexError> {
1246        Ok(Self { fn_sig_kind: self.fn_sig_kind.set_splatted(splatted, args_len)?, ..self })
1247    }
1248
1249    pub fn safety(self) -> I::Safety {
1250        self.fn_sig_kind.safety()
1251    }
1252
1253    pub fn abi(self) -> ExternAbi {
1254        self.fn_sig_kind.abi()
1255    }
1256
1257    pub fn c_variadic(self) -> bool {
1258        self.fn_sig_kind.c_variadic()
1259    }
1260
1261    pub fn splatted(self) -> Option<u8> {
1262        self.fn_sig_kind.splatted()
1263    }
1264
1265    /// Create a new safe FnSig with no arguments or return type, using the `extern "Rust"` ABI,
1266    /// that isn't C-style variadic or splatted.
1267    pub fn dummy() -> Self {
1268        Self { inputs_and_output: Default::default(), fn_sig_kind: FnSigKind::dummy() }
1269    }
1270}
1271
1272impl<I: Interner> ty::Binder<I, FnSig<I>> {
1273    #[inline]
1274    pub fn inputs(self) -> ty::Binder<I, I::FnInputTys> {
1275        self.map_bound(|fn_sig| fn_sig.inputs())
1276    }
1277
1278    #[inline]
1279    #[track_caller]
1280    pub fn input(self, index: usize) -> ty::Binder<I, I::Ty> {
1281        self.map_bound(|fn_sig| fn_sig.inputs().get(index).unwrap())
1282    }
1283
1284    pub fn inputs_and_output(self) -> ty::Binder<I, I::Tys> {
1285        self.map_bound(|fn_sig| fn_sig.inputs_and_output)
1286    }
1287
1288    #[inline]
1289    pub fn output(self) -> ty::Binder<I, I::Ty> {
1290        self.map_bound(|fn_sig| fn_sig.output())
1291    }
1292
1293    pub fn fn_sig_kind(self) -> FnSigKind<I> {
1294        self.skip_binder().fn_sig_kind
1295    }
1296
1297    pub fn c_variadic(self) -> bool {
1298        self.skip_binder().c_variadic()
1299    }
1300
1301    pub fn splatted(self) -> Option<u8> {
1302        self.skip_binder().splatted()
1303    }
1304
1305    pub fn safety(self) -> I::Safety {
1306        self.skip_binder().safety()
1307    }
1308
1309    pub fn abi(self) -> ExternAbi {
1310        self.skip_binder().abi()
1311    }
1312
1313    pub fn is_fn_trait_compatible(&self) -> bool {
1314        self.skip_binder().is_fn_trait_compatible()
1315    }
1316
1317    // Used to split a single value into the two fields in `TyKind::FnPtr`.
1318    pub fn split(self) -> (ty::Binder<I, FnSigTys<I>>, FnHeader<I>) {
1319        let hdr = FnHeader { fn_sig_kind: self.fn_sig_kind() };
1320        (self.map_bound(|sig| FnSigTys { inputs_and_output: sig.inputs_and_output }), hdr)
1321    }
1322}
1323
1324impl<I: Interner> fmt::Debug for FnSig<I> {
1325    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1326        let sig = self;
1327        let FnSig { inputs_and_output: _, fn_sig_kind } = sig;
1328
1329        f.write_fmt(format_args!("{0}", fn_sig_kind.safety().prefix_str()))write!(f, "{}", fn_sig_kind.safety().prefix_str())?;
1330        if fn_sig_kind.abi() != ExternAbi::Rust {
1331            f.write_fmt(format_args!("extern \"{0:?}\" ", fn_sig_kind.abi()))write!(f, "extern \"{:?}\" ", fn_sig_kind.abi())?;
1332        }
1333
1334        f.write_fmt(format_args!("fn("))write!(f, "fn(")?;
1335        let inputs = sig.inputs();
1336        for (i, ty) in inputs.iter().enumerate() {
1337            if i > 0 {
1338                f.write_fmt(format_args!(", "))write!(f, ", ")?;
1339            }
1340            if Some(i) == fn_sig_kind.splatted().map(usize::from) {
1341                f.write_fmt(format_args!("#[rustc_splat] "))write!(f, "#[rustc_splat] ")?;
1342            }
1343            f.write_fmt(format_args!("{0:?}", ty))write!(f, "{ty:?}")?;
1344        }
1345        if fn_sig_kind.c_variadic() {
1346            if inputs.is_empty() {
1347                f.write_fmt(format_args!("..."))write!(f, "...")?;
1348            } else {
1349                f.write_fmt(format_args!(", ..."))write!(f, ", ...")?;
1350            }
1351        }
1352        f.write_fmt(format_args!(")"))write!(f, ")")?;
1353
1354        let output = sig.output();
1355        match output.kind() {
1356            Tuple(list) if list.is_empty() => Ok(()),
1357            _ => f.write_fmt(format_args!(" -> {0:?}", sig.output()))write!(f, " -> {:?}", sig.output()),
1358        }
1359    }
1360}
1361
1362// FIXME: this is a distinct type because we need to define `Encode`/`Decode`
1363// impls in this crate for `Binder<I, I::Ty>`.
1364#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for UnsafeBinderInner<I> where
    I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for UnsafeBinderInner<I> where
    I: Interner {
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for UnsafeBinderInner<I> where
    I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (UnsafeBinderInner(ref __field_0),
                UnsafeBinderInner(ref __other_field_0)) =>
                true &&
                    ::core::cmp::PartialEq::eq(__field_0, __other_field_0),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for UnsafeBinderInner<I> where
    I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            UnsafeBinderInner(ref __field_0) => {
                ::core::hash::Hash::hash(__field_0, __state);
            }
        }
    }
}#[derive_where(Clone, Copy, PartialEq, Hash; I: Interner)]
1365#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            UnsafeBinderInner<I> where
            ty::Binder<I,
            I::Ty>: ::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 {
                    UnsafeBinderInner(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
1366#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            UnsafeBinderInner<I> where I: Interner,
            ty::Binder<I, I::Ty>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    UnsafeBinderInner(ref __binding_0) => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for
            UnsafeBinderInner<I> where
            ty::Binder<I, I::Ty>: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    UnsafeBinderInner(ref __binding_0) => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            UnsafeBinderInner<I> where I: Interner,
            ty::Binder<I, I::Ty>: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        UnsafeBinderInner(__binding_0) => {
                            UnsafeBinderInner(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    UnsafeBinderInner(__binding_0) => {
                        UnsafeBinderInner(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for
            UnsafeBinderInner<I> where J: Interner,
            I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = UnsafeBinderInner<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    UnsafeBinderInner(__binding_0) => {
                        UnsafeBinderInner(__binding_0.lift_to_interner(interner))
                    }
                }
            }
        }
    };Lift_Generic)]
1367pub struct UnsafeBinderInner<I: Interner>(ty::Binder<I, I::Ty>);
1368
1369impl<I: Interner> Eq for UnsafeBinderInner<I> {}
1370
1371impl<I: Interner> From<ty::Binder<I, I::Ty>> for UnsafeBinderInner<I> {
1372    fn from(value: ty::Binder<I, I::Ty>) -> Self {
1373        UnsafeBinderInner(value)
1374    }
1375}
1376
1377impl<I: Interner> From<UnsafeBinderInner<I>> for ty::Binder<I, I::Ty> {
1378    fn from(value: UnsafeBinderInner<I>) -> Self {
1379        value.0
1380    }
1381}
1382
1383impl<I: Interner> fmt::Debug for UnsafeBinderInner<I> {
1384    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1385        self.0.fmt(f)
1386    }
1387}
1388
1389impl<I: Interner> Deref for UnsafeBinderInner<I> {
1390    type Target = ty::Binder<I, I::Ty>;
1391
1392    fn deref(&self) -> &Self::Target {
1393        &self.0
1394    }
1395}
1396
1397// This is just a `FnSig` without the `FnHeader` fields.
1398#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for FnSigTys<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for FnSigTys<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for FnSigTys<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            FnSigTys { inputs_and_output: ref __field_inputs_and_output } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "FnSigTys");
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "inputs_and_output", __field_inputs_and_output);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for FnSigTys<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (FnSigTys { inputs_and_output: ref __field_inputs_and_output },
                FnSigTys {
                inputs_and_output: ref __other_field_inputs_and_output }) =>
                true &&
                    ::core::cmp::PartialEq::eq(__field_inputs_and_output,
                        __other_field_inputs_and_output),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for FnSigTys<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            FnSigTys { inputs_and_output: ref __field_inputs_and_output } => {
                ::core::hash::Hash::hash(__field_inputs_and_output, __state);
            }
        }
    }
}#[derive_where(Clone, Copy, Debug, PartialEq, Hash; I: Interner)]
1399#[cfg_attr(
1400    feature = "nightly",
1401    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for FnSigTys<I> where
            I::Tys: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let FnSigTys { inputs_and_output: ref __binding_0 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for FnSigTys<I> where
            I::Tys: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                FnSigTys {
                    inputs_and_output: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            FnSigTys<I> where
            I::Tys: ::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 {
                    FnSigTys { inputs_and_output: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
1402)]
1403#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for FnSigTys<I>
            where I: Interner, I::Tys: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    FnSigTys { inputs_and_output: ref __binding_0 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for FnSigTys<I> where
            I::Tys: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    FnSigTys { inputs_and_output: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for FnSigTys<I>
            where I: Interner, I::Tys: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        FnSigTys { inputs_and_output: __binding_0 } => {
                            FnSigTys {
                                inputs_and_output: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    FnSigTys { inputs_and_output: __binding_0 } => {
                        FnSigTys {
                            inputs_and_output: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for FnSigTys<I>
            where J: Interner, I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = FnSigTys<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    FnSigTys { inputs_and_output: __binding_0 } => {
                        FnSigTys {
                            inputs_and_output: __binding_0.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
1404pub struct FnSigTys<I: Interner> {
1405    pub inputs_and_output: I::Tys,
1406}
1407
1408impl<I: Interner> Eq for FnSigTys<I> {}
1409
1410impl<I: Interner> FnSigTys<I> {
1411    pub fn inputs(self) -> I::FnInputTys {
1412        self.inputs_and_output.inputs()
1413    }
1414
1415    pub fn output(self) -> I::Ty {
1416        self.inputs_and_output.output()
1417    }
1418}
1419
1420impl<I: Interner> ty::Binder<I, FnSigTys<I>> {
1421    // Used to combine the two fields in `TyKind::FnPtr` into a single value.
1422    pub fn with(self, hdr: FnHeader<I>) -> ty::Binder<I, FnSig<I>> {
1423        self.map_bound(|sig_tys| FnSig {
1424            inputs_and_output: sig_tys.inputs_and_output,
1425            fn_sig_kind: hdr.fn_sig_kind,
1426        })
1427    }
1428
1429    #[inline]
1430    pub fn inputs(self) -> ty::Binder<I, I::FnInputTys> {
1431        self.map_bound(|sig_tys| sig_tys.inputs())
1432    }
1433
1434    #[inline]
1435    #[track_caller]
1436    pub fn input(self, index: usize) -> ty::Binder<I, I::Ty> {
1437        self.map_bound(|sig_tys| sig_tys.inputs().get(index).unwrap())
1438    }
1439
1440    pub fn inputs_and_output(self) -> ty::Binder<I, I::Tys> {
1441        self.map_bound(|sig_tys| sig_tys.inputs_and_output)
1442    }
1443
1444    #[inline]
1445    pub fn output(self) -> ty::Binder<I, I::Ty> {
1446        self.map_bound(|sig_tys| sig_tys.output())
1447    }
1448}
1449
1450#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for FnHeader<I> where I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for FnHeader<I> where I: Interner { }
#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for FnHeader<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            FnHeader { fn_sig_kind: ref __field_fn_sig_kind } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "FnHeader");
                ::core::fmt::DebugStruct::field(&mut __builder, "fn_sig_kind",
                    __field_fn_sig_kind);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for FnHeader<I> where I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (FnHeader { fn_sig_kind: ref __field_fn_sig_kind }, FnHeader {
                fn_sig_kind: ref __other_field_fn_sig_kind }) =>
                true &&
                    ::core::cmp::PartialEq::eq(__field_fn_sig_kind,
                        __other_field_fn_sig_kind),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for FnHeader<I> where I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            FnHeader { fn_sig_kind: ref __field_fn_sig_kind } => {
                ::core::hash::Hash::hash(__field_fn_sig_kind, __state);
            }
        }
    }
}#[derive_where(Clone, Copy, Debug, PartialEq, Hash; I: Interner)]
1451#[cfg_attr(
1452    feature = "nightly",
1453    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for FnHeader<I> where
            FnSigKind<I>: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let FnHeader { fn_sig_kind: ref __binding_0 } = *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for FnHeader<I> where
            FnSigKind<I>: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                FnHeader {
                    fn_sig_kind: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            FnHeader<I> where
            FnSigKind<I>: ::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 {
                    FnHeader { fn_sig_kind: ref __binding_0 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
1454)]
1455#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for FnHeader<I>
            where I: Interner {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self { FnHeader { .. } => {} }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for FnHeader<I> where
            FnSigKind<I>: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    FnHeader { fn_sig_kind: ref __binding_0 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for FnHeader<I>
            where I: Interner {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        FnHeader { fn_sig_kind: __binding_0 } => {
                            FnHeader { fn_sig_kind: __binding_0 }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    FnHeader { fn_sig_kind: __binding_0 } => {
                        FnHeader { fn_sig_kind: __binding_0 }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for FnHeader<I>
            where J: Interner, I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = FnHeader<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    FnHeader { fn_sig_kind: __binding_0 } => {
                        FnHeader {
                            fn_sig_kind: __binding_0.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
1456pub struct FnHeader<I: Interner> {
1457    #[type_visitable(ignore)]
1458    #[type_foldable(identity)]
1459    pub fn_sig_kind: FnSigKind<I>,
1460}
1461
1462impl<I: Interner> FnHeader<I> {
1463    pub fn c_variadic(self) -> bool {
1464        self.fn_sig_kind.c_variadic()
1465    }
1466
1467    pub fn safety(self) -> I::Safety {
1468        self.fn_sig_kind.safety()
1469    }
1470
1471    pub fn abi(self) -> ExternAbi {
1472        self.fn_sig_kind.abi()
1473    }
1474
1475    pub fn splatted(self) -> Option<u8> {
1476        self.fn_sig_kind.splatted()
1477    }
1478
1479    /// Create a new safe FnHeader with the `extern "Rust"` ABI, that isn't C-style variadic or splatted.
1480    pub fn dummy() -> Self {
1481        Self { fn_sig_kind: FnSigKind::dummy() }
1482    }
1483}
1484
1485impl<I: Interner> Eq for FnHeader<I> {}
1486
1487#[automatically_derived]
impl<I: Interner> ::core::clone::Clone for CoroutineWitnessTypes<I> where
    I: Interner {
    #[inline]
    fn clone(&self) -> Self { *self }
}
#[automatically_derived]
impl<I: Interner> ::core::marker::Copy for CoroutineWitnessTypes<I> where
    I: Interner {
}
#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for CoroutineWitnessTypes<I> where
    I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            CoroutineWitnessTypes {
                types: ref __field_types, assumptions: ref __field_assumptions
                } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f,
                        "CoroutineWitnessTypes");
                ::core::fmt::DebugStruct::field(&mut __builder, "types",
                    __field_types);
                ::core::fmt::DebugStruct::field(&mut __builder, "assumptions",
                    __field_assumptions);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for CoroutineWitnessTypes<I> where
    I: Interner {
    #[inline]
    fn eq(&self, __other: &Self) -> ::core::primitive::bool {
        match (self, __other) {
            (CoroutineWitnessTypes {
                types: ref __field_types, assumptions: ref __field_assumptions
                }, CoroutineWitnessTypes {
                types: ref __other_field_types,
                assumptions: ref __other_field_assumptions }) =>
                true &&
                        ::core::cmp::PartialEq::eq(__field_types,
                            __other_field_types) &&
                    ::core::cmp::PartialEq::eq(__field_assumptions,
                        __other_field_assumptions),
        }
    }
}
#[automatically_derived]
impl<I: Interner> ::core::hash::Hash for CoroutineWitnessTypes<I> where
    I: Interner {
    fn hash<__H: ::core::hash::Hasher>(&self, __state: &mut __H) {
        match self {
            CoroutineWitnessTypes {
                types: ref __field_types, assumptions: ref __field_assumptions
                } => {
                ::core::hash::Hash::hash(__field_types, __state);
                ::core::hash::Hash::hash(__field_assumptions, __state);
            }
        }
    }
}#[derive_where(Clone, Copy, Debug, PartialEq, Hash; I: Interner)]
1488#[cfg_attr(
1489    feature = "nightly",
1490    derive(const _: () =
    {
        impl<I: Interner, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for CoroutineWitnessTypes<I>
            where I::Tys: ::rustc_serialize::Encodable<__E>,
            I::RegionAssumptions: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                let CoroutineWitnessTypes {
                        types: ref __binding_0, assumptions: ref __binding_1 } =
                    *self;
                ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                    __encoder);
                ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                    __encoder);
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for CoroutineWitnessTypes<I>
            where I::Tys: ::rustc_serialize::Decodable<__D>,
            I::RegionAssumptions: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                CoroutineWitnessTypes {
                    types: ::rustc_serialize::Decodable::decode(__decoder),
                    assumptions: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            CoroutineWitnessTypes<I> where
            I::Tys: ::rustc_data_structures::stable_hash::StableHash,
            I::RegionAssumptions: ::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 {
                    CoroutineWitnessTypes {
                        types: ref __binding_0, assumptions: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
1491)]
1492#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            CoroutineWitnessTypes<I> where I: Interner,
            I::Tys: ::rustc_type_ir::TypeVisitable<I>,
            I::RegionAssumptions: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    CoroutineWitnessTypes {
                        types: ref __binding_0, assumptions: ref __binding_1 } => {
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_type_ir::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        unsafe impl<I: Interner, __V>
            ::rustc_type_ir::GenericTypeVisitable<__V> for
            CoroutineWitnessTypes<I> where
            I::Tys: ::rustc_type_ir::GenericTypeVisitable<__V>,
            I::RegionAssumptions: ::rustc_type_ir::GenericTypeVisitable<__V> {
            fn generic_visit_with(&self, __visitor: &mut __V) {
                match *self {
                    CoroutineWitnessTypes {
                        types: ref __binding_0, assumptions: ref __binding_1 } => {
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_0,
                                __visitor);
                        }
                        {
                            ::rustc_type_ir::GenericTypeVisitable::<__V>::generic_visit_with(__binding_1,
                                __visitor);
                        }
                    }
                }
            }
        }
    };GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            CoroutineWitnessTypes<I> where I: Interner,
            I::Tys: ::rustc_type_ir::TypeFoldable<I>,
            I::RegionAssumptions: ::rustc_type_ir::TypeFoldable<I> {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        CoroutineWitnessTypes {
                            types: __binding_0, assumptions: __binding_1 } => {
                            CoroutineWitnessTypes {
                                types: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                assumptions: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    CoroutineWitnessTypes {
                        types: __binding_0, assumptions: __binding_1 } => {
                        CoroutineWitnessTypes {
                            types: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            assumptions: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, J> ::rustc_type_ir::lift::Lift<J> for
            CoroutineWitnessTypes<I> where J: Interner,
            I: ::rustc_type_ir::LiftInto<J> {
            type Lifted = CoroutineWitnessTypes<J>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    CoroutineWitnessTypes {
                        types: __binding_0, assumptions: __binding_1 } => {
                        CoroutineWitnessTypes {
                            types: __binding_0.lift_to_interner(interner),
                            assumptions: __binding_1.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic)]
1493pub struct CoroutineWitnessTypes<I: Interner> {
1494    pub types: I::Tys,
1495    pub assumptions: I::RegionAssumptions,
1496}
1497
1498impl<I: Interner> Eq for CoroutineWitnessTypes<I> {}