Skip to main content

rustc_middle/mir/
query.rs

1//! Values computed by queries that use MIR.
2
3use std::fmt::{self, Debug};
4
5use rustc_abi::{FieldIdx, VariantIdx};
6use rustc_errors::ErrorGuaranteed;
7use rustc_index::IndexVec;
8use rustc_index::bit_set::BitMatrix;
9use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
10use rustc_span::{Span, Symbol};
11
12use super::{ConstValue, SourceInfo};
13use crate::ty::{self, CoroutineArgsExt, Ty};
14
15impl ::std::fmt::Debug for CoroutineSavedLocal {
    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        fmt.write_fmt(format_args!("_s{0}", self.as_u32()))
    }
}rustc_index::newtype_index! {
16    #[derive(HashStable)]
17    #[encodable]
18    #[debug_format = "_s{}"]
19    pub struct CoroutineSavedLocal {}
20}
21
22#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineSavedTy<'tcx> {
    #[inline]
    fn clone(&self) -> CoroutineSavedTy<'tcx> {
        CoroutineSavedTy {
            ty: ::core::clone::Clone::clone(&self.ty),
            source_info: ::core::clone::Clone::clone(&self.source_info),
            ignore_for_traits: ::core::clone::Clone::clone(&self.ignore_for_traits),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for CoroutineSavedTy<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "CoroutineSavedTy", "ty", &self.ty, "source_info",
            &self.source_info, "ignore_for_traits", &&self.ignore_for_traits)
    }
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for CoroutineSavedTy<'tcx> {
    #[inline]
    fn eq(&self, other: &CoroutineSavedTy<'tcx>) -> bool {
        self.ignore_for_traits == other.ignore_for_traits &&
                self.ty == other.ty && self.source_info == other.source_info
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for CoroutineSavedTy<'tcx> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
        let _: ::core::cmp::AssertParamIsEq<SourceInfo>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq)]
23#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoroutineSavedTy<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    CoroutineSavedTy {
                        ty: ref __binding_0,
                        source_info: ref __binding_1,
                        ignore_for_traits: 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);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoroutineSavedTy<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                CoroutineSavedTy {
                    ty: ::rustc_serialize::Decodable::decode(__decoder),
                    source_info: ::rustc_serialize::Decodable::decode(__decoder),
                    ignore_for_traits: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx, '__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for CoroutineSavedTy<'tcx> {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    CoroutineSavedTy {
                        ty: ref __binding_0,
                        source_info: ref __binding_1,
                        ignore_for_traits: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineSavedTy<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        CoroutineSavedTy {
                            ty: __binding_0,
                            source_info: __binding_1,
                            ignore_for_traits: __binding_2 } => {
                            CoroutineSavedTy {
                                ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                ignore_for_traits: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    CoroutineSavedTy {
                        ty: __binding_0,
                        source_info: __binding_1,
                        ignore_for_traits: __binding_2 } => {
                        CoroutineSavedTy {
                            ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            ignore_for_traits: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineSavedTy<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    CoroutineSavedTy {
                        ty: ref __binding_0,
                        source_info: ref __binding_1,
                        ignore_for_traits: ref __binding_2 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
24pub struct CoroutineSavedTy<'tcx> {
25    pub ty: Ty<'tcx>,
26    /// Source info corresponding to the local in the original MIR body.
27    pub source_info: SourceInfo,
28    /// Whether the local should be ignored for trait bound computations.
29    pub ignore_for_traits: bool,
30}
31
32/// The layout of coroutine state.
33#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineLayout<'tcx> {
    #[inline]
    fn clone(&self) -> CoroutineLayout<'tcx> {
        CoroutineLayout {
            field_tys: ::core::clone::Clone::clone(&self.field_tys),
            field_names: ::core::clone::Clone::clone(&self.field_names),
            variant_fields: ::core::clone::Clone::clone(&self.variant_fields),
            variant_source_info: ::core::clone::Clone::clone(&self.variant_source_info),
            storage_conflicts: ::core::clone::Clone::clone(&self.storage_conflicts),
        }
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for CoroutineLayout<'tcx> {
    #[inline]
    fn eq(&self, other: &CoroutineLayout<'tcx>) -> bool {
        self.field_tys == other.field_tys &&
                        self.field_names == other.field_names &&
                    self.variant_fields == other.variant_fields &&
                self.variant_source_info == other.variant_source_info &&
            self.storage_conflicts == other.storage_conflicts
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for CoroutineLayout<'tcx> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {
        let _:
                ::core::cmp::AssertParamIsEq<IndexVec<CoroutineSavedLocal,
                CoroutineSavedTy<'tcx>>>;
        let _:
                ::core::cmp::AssertParamIsEq<IndexVec<CoroutineSavedLocal,
                Option<Symbol>>>;
        let _:
                ::core::cmp::AssertParamIsEq<IndexVec<VariantIdx,
                IndexVec<FieldIdx, CoroutineSavedLocal>>>;
        let _: ::core::cmp::AssertParamIsEq<IndexVec<VariantIdx, SourceInfo>>;
        let _:
                ::core::cmp::AssertParamIsEq<BitMatrix<CoroutineSavedLocal,
                CoroutineSavedLocal>>;
    }
}Eq)]
34#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for CoroutineLayout<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    CoroutineLayout {
                        field_tys: ref __binding_0,
                        field_names: ref __binding_1,
                        variant_fields: ref __binding_2,
                        variant_source_info: ref __binding_3,
                        storage_conflicts: ref __binding_4 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_4,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for CoroutineLayout<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                CoroutineLayout {
                    field_tys: ::rustc_serialize::Decodable::decode(__decoder),
                    field_names: ::rustc_serialize::Decodable::decode(__decoder),
                    variant_fields: ::rustc_serialize::Decodable::decode(__decoder),
                    variant_source_info: ::rustc_serialize::Decodable::decode(__decoder),
                    storage_conflicts: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx, '__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for CoroutineLayout<'tcx> {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    CoroutineLayout {
                        field_tys: ref __binding_0,
                        field_names: ref __binding_1,
                        variant_fields: ref __binding_2,
                        variant_source_info: ref __binding_3,
                        storage_conflicts: ref __binding_4 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                        { __binding_4.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineLayout<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        CoroutineLayout {
                            field_tys: __binding_0,
                            field_names: __binding_1,
                            variant_fields: __binding_2,
                            variant_source_info: __binding_3,
                            storage_conflicts: __binding_4 } => {
                            CoroutineLayout {
                                field_tys: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                field_names: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                variant_fields: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                                variant_source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
                                        __folder)?,
                                storage_conflicts: __binding_4,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    CoroutineLayout {
                        field_tys: __binding_0,
                        field_names: __binding_1,
                        variant_fields: __binding_2,
                        variant_source_info: __binding_3,
                        storage_conflicts: __binding_4 } => {
                        CoroutineLayout {
                            field_tys: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            field_names: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            variant_fields: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                            variant_source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
                                __folder),
                            storage_conflicts: __binding_4,
                        }
                    }
                }
            }
        }
    };TypeFoldable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for CoroutineLayout<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    CoroutineLayout {
                        field_tys: ref __binding_0,
                        field_names: ref __binding_1,
                        variant_fields: ref __binding_2,
                        variant_source_info: ref __binding_3, .. } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable)]
35pub struct CoroutineLayout<'tcx> {
36    /// The type of every local stored inside the coroutine.
37    pub field_tys: IndexVec<CoroutineSavedLocal, CoroutineSavedTy<'tcx>>,
38
39    /// The name for debuginfo.
40    pub field_names: IndexVec<CoroutineSavedLocal, Option<Symbol>>,
41
42    /// Which of the above fields are in each variant. Note that one field may
43    /// be stored in multiple variants.
44    pub variant_fields: IndexVec<VariantIdx, IndexVec<FieldIdx, CoroutineSavedLocal>>,
45
46    /// The source that led to each variant being created (usually, a yield or
47    /// await).
48    pub variant_source_info: IndexVec<VariantIdx, SourceInfo>,
49
50    /// Which saved locals are storage-live at the same time. Locals that do not
51    /// have conflicts with each other are allowed to overlap in the computed
52    /// layout.
53    #[type_foldable(identity)]
54    #[type_visitable(ignore)]
55    pub storage_conflicts: BitMatrix<CoroutineSavedLocal, CoroutineSavedLocal>,
56}
57
58impl Debug for CoroutineLayout<'_> {
59    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
60        fmt.debug_struct("CoroutineLayout")
61            .field_with("field_tys", |fmt| {
62                fmt.debug_map().entries(self.field_tys.iter_enumerated()).finish()
63            })
64            .field_with("variant_fields", |fmt| {
65                let mut map = fmt.debug_map();
66                for (idx, fields) in self.variant_fields.iter_enumerated() {
67                    map.key_with(|fmt| {
68                        let variant_name = ty::CoroutineArgs::variant_name(idx);
69                        if fmt.alternate() {
70                            fmt.write_fmt(format_args!("{0:9}({1:?})", variant_name, idx))write!(fmt, "{variant_name:9}({idx:?})")
71                        } else {
72                            fmt.write_fmt(format_args!("{0}", variant_name))write!(fmt, "{variant_name}")
73                        }
74                    });
75                    // Force variant fields to print in regular mode instead of alternate mode.
76                    map.value_with(|fmt| fmt.write_fmt(format_args!("{0:?}", fields))write!(fmt, "{fields:?}"));
77                }
78                map.finish()
79            })
80            .field("storage_conflicts", &self.storage_conflicts)
81            .finish()
82    }
83}
84
85/// The result of the `mir_const_qualif` query.
86///
87/// Each field (except `tainted_by_errors`) corresponds to an implementer of the `Qualif` trait in
88/// `rustc_const_eval/src/transform/check_consts/qualifs.rs`. See that file for more information on each
89/// `Qualif`.
90#[derive(#[automatically_derived]
impl ::core::clone::Clone for ConstQualifs {
    #[inline]
    fn clone(&self) -> ConstQualifs {
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Option<ErrorGuaranteed>>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ConstQualifs { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for ConstQualifs {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "ConstQualifs",
            "has_mut_interior", &self.has_mut_interior, "needs_drop",
            &self.needs_drop, "needs_non_const_drop",
            &self.needs_non_const_drop, "tainted_by_errors",
            &&self.tainted_by_errors)
    }
}Debug, #[automatically_derived]
impl ::core::default::Default for ConstQualifs {
    #[inline]
    fn default() -> ConstQualifs {
        ConstQualifs {
            has_mut_interior: ::core::default::Default::default(),
            needs_drop: ::core::default::Default::default(),
            needs_non_const_drop: ::core::default::Default::default(),
            tainted_by_errors: ::core::default::Default::default(),
        }
    }
}Default, const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for ConstQualifs {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    ConstQualifs {
                        has_mut_interior: ref __binding_0,
                        needs_drop: ref __binding_1,
                        needs_non_const_drop: ref __binding_2,
                        tainted_by_errors: ref __binding_3 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_2,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_3,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for ConstQualifs {
            fn decode(__decoder: &mut __D) -> Self {
                ConstQualifs {
                    has_mut_interior: ::rustc_serialize::Decodable::decode(__decoder),
                    needs_drop: ::rustc_serialize::Decodable::decode(__decoder),
                    needs_non_const_drop: ::rustc_serialize::Decodable::decode(__decoder),
                    tainted_by_errors: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for ConstQualifs {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    ConstQualifs {
                        has_mut_interior: ref __binding_0,
                        needs_drop: ref __binding_1,
                        needs_non_const_drop: ref __binding_2,
                        tainted_by_errors: ref __binding_3 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                        { __binding_3.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable)]
91pub struct ConstQualifs {
92    pub has_mut_interior: bool,
93    pub needs_drop: bool,
94    pub needs_non_const_drop: bool,
95    pub tainted_by_errors: Option<ErrorGuaranteed>,
96}
97/// Outlives-constraints can be categorized to determine whether and why they
98/// are interesting (for error reporting). Order of variants indicates sort
99/// order of the category, thereby influencing diagnostic output.
100///
101/// See also `rustc_const_eval::borrow_check::constraints`.
102#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for ConstraintCategory<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for ConstraintCategory<'tcx> {
    #[inline]
    fn clone(&self) -> ConstraintCategory<'tcx> {
        let _: ::core::clone::AssertParamIsClone<ReturnConstraint>;
        let _: ::core::clone::AssertParamIsClone<AnnotationSource>;
        let _: ::core::clone::AssertParamIsClone<bool>;
        let _: ::core::clone::AssertParamIsClone<Option<Ty<'tcx>>>;
        let _: ::core::clone::AssertParamIsClone<Option<Ty<'tcx>>>;
        let _: ::core::clone::AssertParamIsClone<FieldIdx>;
        let _: ::core::clone::AssertParamIsClone<Span>;
        let _: ::core::clone::AssertParamIsClone<ty::RegionVid>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for ConstraintCategory<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ConstraintCategory::Return(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Return",
                    &__self_0),
            ConstraintCategory::Yield =>
                ::core::fmt::Formatter::write_str(f, "Yield"),
            ConstraintCategory::UseAsConst =>
                ::core::fmt::Formatter::write_str(f, "UseAsConst"),
            ConstraintCategory::UseAsStatic =>
                ::core::fmt::Formatter::write_str(f, "UseAsStatic"),
            ConstraintCategory::TypeAnnotation(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TypeAnnotation", &__self_0),
            ConstraintCategory::Cast {
                is_raw_ptr_dyn_type_cast: __self_0,
                is_implicit_coercion: __self_1,
                unsize_to: __self_2 } =>
                ::core::fmt::Formatter::debug_struct_field3_finish(f, "Cast",
                    "is_raw_ptr_dyn_type_cast", __self_0,
                    "is_implicit_coercion", __self_1, "unsize_to", &__self_2),
            ConstraintCategory::CallArgument(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "CallArgument", &__self_0),
            ConstraintCategory::CopyBound =>
                ::core::fmt::Formatter::write_str(f, "CopyBound"),
            ConstraintCategory::SizedBound =>
                ::core::fmt::Formatter::write_str(f, "SizedBound"),
            ConstraintCategory::Assignment =>
                ::core::fmt::Formatter::write_str(f, "Assignment"),
            ConstraintCategory::Usage =>
                ::core::fmt::Formatter::write_str(f, "Usage"),
            ConstraintCategory::OpaqueType =>
                ::core::fmt::Formatter::write_str(f, "OpaqueType"),
            ConstraintCategory::ClosureUpvar(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ClosureUpvar", &__self_0),
            ConstraintCategory::Predicate(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "Predicate", &__self_0),
            ConstraintCategory::Boring =>
                ::core::fmt::Formatter::write_str(f, "Boring"),
            ConstraintCategory::BoringNoLocation =>
                ::core::fmt::Formatter::write_str(f, "BoringNoLocation"),
            ConstraintCategory::Internal =>
                ::core::fmt::Formatter::write_str(f, "Internal"),
            ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "OutlivesUnnameablePlaceholder", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for ConstraintCategory<'tcx> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<ReturnConstraint>;
        let _: ::core::cmp::AssertParamIsEq<AnnotationSource>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Option<Ty<'tcx>>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Ty<'tcx>>>;
        let _: ::core::cmp::AssertParamIsEq<FieldIdx>;
        let _: ::core::cmp::AssertParamIsEq<Span>;
        let _: ::core::cmp::AssertParamIsEq<ty::RegionVid>;
    }
}Eq, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for ConstraintCategory<'tcx> {
    #[inline]
    fn eq(&self, other: &ConstraintCategory<'tcx>) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ConstraintCategory::Return(__self_0),
                    ConstraintCategory::Return(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ConstraintCategory::TypeAnnotation(__self_0),
                    ConstraintCategory::TypeAnnotation(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ConstraintCategory::Cast {
                    is_raw_ptr_dyn_type_cast: __self_0,
                    is_implicit_coercion: __self_1,
                    unsize_to: __self_2 }, ConstraintCategory::Cast {
                    is_raw_ptr_dyn_type_cast: __arg1_0,
                    is_implicit_coercion: __arg1_1,
                    unsize_to: __arg1_2 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1 &&
                        __self_2 == __arg1_2,
                (ConstraintCategory::CallArgument(__self_0),
                    ConstraintCategory::CallArgument(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ConstraintCategory::ClosureUpvar(__self_0),
                    ConstraintCategory::ClosureUpvar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ConstraintCategory::Predicate(__self_0),
                    ConstraintCategory::Predicate(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0),
                    ConstraintCategory::OutlivesUnnameablePlaceholder(__arg1_0))
                    => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::hash::Hash for ConstraintCategory<'tcx> {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            ConstraintCategory::Return(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ConstraintCategory::TypeAnnotation(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ConstraintCategory::Cast {
                is_raw_ptr_dyn_type_cast: __self_0,
                is_implicit_coercion: __self_1,
                unsize_to: __self_2 } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state);
                ::core::hash::Hash::hash(__self_2, state)
            }
            ConstraintCategory::CallArgument(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ConstraintCategory::ClosureUpvar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ConstraintCategory::Predicate(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash)]
103#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for ConstraintCategory<'tcx> {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        ConstraintCategory::Return(ref __binding_0) => { 0usize }
                        ConstraintCategory::Yield => { 1usize }
                        ConstraintCategory::UseAsConst => { 2usize }
                        ConstraintCategory::UseAsStatic => { 3usize }
                        ConstraintCategory::TypeAnnotation(ref __binding_0) => {
                            4usize
                        }
                        ConstraintCategory::Cast {
                            is_raw_ptr_dyn_type_cast: ref __binding_0,
                            is_implicit_coercion: ref __binding_1,
                            unsize_to: ref __binding_2 } => {
                            5usize
                        }
                        ConstraintCategory::CallArgument(ref __binding_0) => {
                            6usize
                        }
                        ConstraintCategory::CopyBound => { 7usize }
                        ConstraintCategory::SizedBound => { 8usize }
                        ConstraintCategory::Assignment => { 9usize }
                        ConstraintCategory::Usage => { 10usize }
                        ConstraintCategory::OpaqueType => { 11usize }
                        ConstraintCategory::ClosureUpvar(ref __binding_0) => {
                            12usize
                        }
                        ConstraintCategory::Predicate(ref __binding_0) => {
                            13usize
                        }
                        ConstraintCategory::Boring => { 14usize }
                        ConstraintCategory::BoringNoLocation => { 15usize }
                        ConstraintCategory::Internal => { 16usize }
                        ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
                            => {
                            17usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    ConstraintCategory::Return(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ConstraintCategory::Yield => {}
                    ConstraintCategory::UseAsConst => {}
                    ConstraintCategory::UseAsStatic => {}
                    ConstraintCategory::TypeAnnotation(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ConstraintCategory::Cast {
                        is_raw_ptr_dyn_type_cast: ref __binding_0,
                        is_implicit_coercion: ref __binding_1,
                        unsize_to: 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);
                    }
                    ConstraintCategory::CallArgument(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ConstraintCategory::CopyBound => {}
                    ConstraintCategory::SizedBound => {}
                    ConstraintCategory::Assignment => {}
                    ConstraintCategory::Usage => {}
                    ConstraintCategory::OpaqueType => {}
                    ConstraintCategory::ClosureUpvar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ConstraintCategory::Predicate(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    ConstraintCategory::Boring => {}
                    ConstraintCategory::BoringNoLocation => {}
                    ConstraintCategory::Internal => {}
                    ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
                        => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for ConstraintCategory<'tcx> {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => {
                        ConstraintCategory::Return(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    1usize => { ConstraintCategory::Yield }
                    2usize => { ConstraintCategory::UseAsConst }
                    3usize => { ConstraintCategory::UseAsStatic }
                    4usize => {
                        ConstraintCategory::TypeAnnotation(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    5usize => {
                        ConstraintCategory::Cast {
                            is_raw_ptr_dyn_type_cast: ::rustc_serialize::Decodable::decode(__decoder),
                            is_implicit_coercion: ::rustc_serialize::Decodable::decode(__decoder),
                            unsize_to: ::rustc_serialize::Decodable::decode(__decoder),
                        }
                    }
                    6usize => {
                        ConstraintCategory::CallArgument(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    7usize => { ConstraintCategory::CopyBound }
                    8usize => { ConstraintCategory::SizedBound }
                    9usize => { ConstraintCategory::Assignment }
                    10usize => { ConstraintCategory::Usage }
                    11usize => { ConstraintCategory::OpaqueType }
                    12usize => {
                        ConstraintCategory::ClosureUpvar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    13usize => {
                        ConstraintCategory::Predicate(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    14usize => { ConstraintCategory::Boring }
                    15usize => { ConstraintCategory::BoringNoLocation }
                    16usize => { ConstraintCategory::Internal }
                    17usize => {
                        ConstraintCategory::OutlivesUnnameablePlaceholder(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ConstraintCategory`, expected 0..18, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'tcx, '__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for ConstraintCategory<'tcx> {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ConstraintCategory::Return(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::Yield => {}
                    ConstraintCategory::UseAsConst => {}
                    ConstraintCategory::UseAsStatic => {}
                    ConstraintCategory::TypeAnnotation(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::Cast {
                        is_raw_ptr_dyn_type_cast: ref __binding_0,
                        is_implicit_coercion: ref __binding_1,
                        unsize_to: ref __binding_2 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                        { __binding_2.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::CallArgument(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::CopyBound => {}
                    ConstraintCategory::SizedBound => {}
                    ConstraintCategory::Assignment => {}
                    ConstraintCategory::Usage => {}
                    ConstraintCategory::OpaqueType => {}
                    ConstraintCategory::ClosureUpvar(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::Predicate(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                    ConstraintCategory::Boring => {}
                    ConstraintCategory::BoringNoLocation => {}
                    ConstraintCategory::Internal => {}
                    ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
                        => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ConstraintCategory<'tcx> {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    ConstraintCategory::Return(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::Yield => {}
                    ConstraintCategory::UseAsConst => {}
                    ConstraintCategory::UseAsStatic => {}
                    ConstraintCategory::TypeAnnotation(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::Cast {
                        is_raw_ptr_dyn_type_cast: ref __binding_0,
                        is_implicit_coercion: ref __binding_1,
                        unsize_to: ref __binding_2 } => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::CallArgument(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::CopyBound => {}
                    ConstraintCategory::SizedBound => {}
                    ConstraintCategory::Assignment => {}
                    ConstraintCategory::Usage => {}
                    ConstraintCategory::OpaqueType => {}
                    ConstraintCategory::ClosureUpvar(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::Predicate(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                    ConstraintCategory::Boring => {}
                    ConstraintCategory::BoringNoLocation => {}
                    ConstraintCategory::Internal => {}
                    ConstraintCategory::OutlivesUnnameablePlaceholder(..) => {}
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ConstraintCategory<'tcx> {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        ConstraintCategory::Return(__binding_0) => {
                            ConstraintCategory::Return(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ConstraintCategory::Yield => { ConstraintCategory::Yield }
                        ConstraintCategory::UseAsConst => {
                            ConstraintCategory::UseAsConst
                        }
                        ConstraintCategory::UseAsStatic => {
                            ConstraintCategory::UseAsStatic
                        }
                        ConstraintCategory::TypeAnnotation(__binding_0) => {
                            ConstraintCategory::TypeAnnotation(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ConstraintCategory::Cast {
                            is_raw_ptr_dyn_type_cast: __binding_0,
                            is_implicit_coercion: __binding_1,
                            unsize_to: __binding_2 } => {
                            ConstraintCategory::Cast {
                                is_raw_ptr_dyn_type_cast: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                is_implicit_coercion: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                unsize_to: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                            }
                        }
                        ConstraintCategory::CallArgument(__binding_0) => {
                            ConstraintCategory::CallArgument(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ConstraintCategory::CopyBound => {
                            ConstraintCategory::CopyBound
                        }
                        ConstraintCategory::SizedBound => {
                            ConstraintCategory::SizedBound
                        }
                        ConstraintCategory::Assignment => {
                            ConstraintCategory::Assignment
                        }
                        ConstraintCategory::Usage => { ConstraintCategory::Usage }
                        ConstraintCategory::OpaqueType => {
                            ConstraintCategory::OpaqueType
                        }
                        ConstraintCategory::ClosureUpvar(__binding_0) => {
                            ConstraintCategory::ClosureUpvar(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ConstraintCategory::Predicate(__binding_0) => {
                            ConstraintCategory::Predicate(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ConstraintCategory::Boring => { ConstraintCategory::Boring }
                        ConstraintCategory::BoringNoLocation => {
                            ConstraintCategory::BoringNoLocation
                        }
                        ConstraintCategory::Internal => {
                            ConstraintCategory::Internal
                        }
                        ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
                            => {
                            ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    ConstraintCategory::Return(__binding_0) => {
                        ConstraintCategory::Return(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ConstraintCategory::Yield => { ConstraintCategory::Yield }
                    ConstraintCategory::UseAsConst => {
                        ConstraintCategory::UseAsConst
                    }
                    ConstraintCategory::UseAsStatic => {
                        ConstraintCategory::UseAsStatic
                    }
                    ConstraintCategory::TypeAnnotation(__binding_0) => {
                        ConstraintCategory::TypeAnnotation(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ConstraintCategory::Cast {
                        is_raw_ptr_dyn_type_cast: __binding_0,
                        is_implicit_coercion: __binding_1,
                        unsize_to: __binding_2 } => {
                        ConstraintCategory::Cast {
                            is_raw_ptr_dyn_type_cast: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            is_implicit_coercion: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            unsize_to: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
                                __folder),
                        }
                    }
                    ConstraintCategory::CallArgument(__binding_0) => {
                        ConstraintCategory::CallArgument(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ConstraintCategory::CopyBound => {
                        ConstraintCategory::CopyBound
                    }
                    ConstraintCategory::SizedBound => {
                        ConstraintCategory::SizedBound
                    }
                    ConstraintCategory::Assignment => {
                        ConstraintCategory::Assignment
                    }
                    ConstraintCategory::Usage => { ConstraintCategory::Usage }
                    ConstraintCategory::OpaqueType => {
                        ConstraintCategory::OpaqueType
                    }
                    ConstraintCategory::ClosureUpvar(__binding_0) => {
                        ConstraintCategory::ClosureUpvar(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ConstraintCategory::Predicate(__binding_0) => {
                        ConstraintCategory::Predicate(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ConstraintCategory::Boring => { ConstraintCategory::Boring }
                    ConstraintCategory::BoringNoLocation => {
                        ConstraintCategory::BoringNoLocation
                    }
                    ConstraintCategory::Internal => {
                        ConstraintCategory::Internal
                    }
                    ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
                        => {
                        ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
                    }
                }
            }
        }
    };TypeFoldable)]
104pub enum ConstraintCategory<'tcx> {
105    Return(ReturnConstraint),
106    Yield,
107    UseAsConst,
108    UseAsStatic,
109    TypeAnnotation(AnnotationSource),
110    Cast {
111        is_raw_ptr_dyn_type_cast: bool,
112        /// Whether this cast is a coercion that was automatically inserted by the compiler.
113        is_implicit_coercion: bool,
114        /// Whether this is an unsizing coercion and if yes, this contains the target type.
115        /// Region variables are erased to ReErased.
116        unsize_to: Option<Ty<'tcx>>,
117    },
118
119    /// Contains the function type if available.
120    CallArgument(Option<Ty<'tcx>>),
121    CopyBound,
122    SizedBound,
123    Assignment,
124    /// A constraint that came from a usage of a variable (e.g. in an ADT expression
125    /// like `Foo { field: my_val }`)
126    Usage,
127    OpaqueType,
128    ClosureUpvar(FieldIdx),
129
130    /// A constraint from a user-written predicate
131    /// with the provided span, written on the item
132    /// with the given `DefId`
133    Predicate(Span),
134
135    /// A "boring" constraint (caused by the given location) is one that
136    /// the user probably doesn't want to see described in diagnostics,
137    /// because it is kind of an artifact of the type system setup.
138    Boring,
139    // Boring and applicable everywhere.
140    BoringNoLocation,
141
142    /// A constraint that doesn't correspond to anything the user sees.
143    Internal,
144
145    /// An internal constraint added when a region outlives a placeholder
146    /// it cannot name and therefore has to outlive `'static`. The argument
147    /// is the unnameable placeholder and the constraint is always between
148    /// an SCC representative and `'static`.
149    OutlivesUnnameablePlaceholder(
150        #[type_foldable(identity)]
151        #[type_visitable(ignore)]
152        ty::RegionVid,
153    ),
154}
155
156#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReturnConstraint { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ReturnConstraint {
    #[inline]
    fn clone(&self) -> ReturnConstraint {
        let _: ::core::clone::AssertParamIsClone<FieldIdx>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ReturnConstraint {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ReturnConstraint::Normal =>
                ::core::fmt::Formatter::write_str(f, "Normal"),
            ReturnConstraint::ClosureUpvar(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "ClosureUpvar", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for ReturnConstraint {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<FieldIdx>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for ReturnConstraint {
    #[inline]
    fn eq(&self, other: &ReturnConstraint) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (ReturnConstraint::ClosureUpvar(__self_0),
                    ReturnConstraint::ClosureUpvar(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for ReturnConstraint {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state);
        match self {
            ReturnConstraint::ClosureUpvar(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash)]
157#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for ReturnConstraint {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        ReturnConstraint::Normal => { 0usize }
                        ReturnConstraint::ClosureUpvar(ref __binding_0) => {
                            1usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    ReturnConstraint::Normal => {}
                    ReturnConstraint::ClosureUpvar(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for ReturnConstraint {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { ReturnConstraint::Normal }
                    1usize => {
                        ReturnConstraint::ClosureUpvar(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ReturnConstraint`, expected 0..2, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for ReturnConstraint {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    ReturnConstraint::Normal => {}
                    ReturnConstraint::ClosureUpvar(ref __binding_0) => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ReturnConstraint {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    ReturnConstraint::Normal => {}
                    ReturnConstraint::ClosureUpvar(ref __binding_0) => {
                        {
                            match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
                                        __visitor)) {
                                ::core::ops::ControlFlow::Continue(()) => {}
                                ::core::ops::ControlFlow::Break(r) => {
                                    return ::rustc_middle::ty::VisitorResult::from_residual(r);
                                }
                            }
                        }
                    }
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for ReturnConstraint {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        ReturnConstraint::Normal => { ReturnConstraint::Normal }
                        ReturnConstraint::ClosureUpvar(__binding_0) => {
                            ReturnConstraint::ClosureUpvar(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    ReturnConstraint::Normal => { ReturnConstraint::Normal }
                    ReturnConstraint::ClosureUpvar(__binding_0) => {
                        ReturnConstraint::ClosureUpvar(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable)]
158pub enum ReturnConstraint {
159    Normal,
160    ClosureUpvar(FieldIdx),
161}
162
163#[derive(#[automatically_derived]
impl ::core::marker::Copy for AnnotationSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AnnotationSource {
    #[inline]
    fn clone(&self) -> AnnotationSource { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AnnotationSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AnnotationSource::Ascription => "Ascription",
                AnnotationSource::Declaration => "Declaration",
                AnnotationSource::OpaqueCast => "OpaqueCast",
                AnnotationSource::GenericArg => "GenericArg",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for AnnotationSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_receiver_is_total_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for AnnotationSource {
    #[inline]
    fn eq(&self, other: &AnnotationSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for AnnotationSource {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash)]
164#[derive(const _: () =
    {
        impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
            ::rustc_serialize::Encodable<__E> for AnnotationSource {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        AnnotationSource::Ascription => { 0usize }
                        AnnotationSource::Declaration => { 1usize }
                        AnnotationSource::OpaqueCast => { 2usize }
                        AnnotationSource::GenericArg => { 3usize }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    AnnotationSource::Ascription => {}
                    AnnotationSource::Declaration => {}
                    AnnotationSource::OpaqueCast => {}
                    AnnotationSource::GenericArg => {}
                }
            }
        }
    };TyEncodable, const _: () =
    {
        impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
            ::rustc_serialize::Decodable<__D> for AnnotationSource {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { AnnotationSource::Ascription }
                    1usize => { AnnotationSource::Declaration }
                    2usize => { AnnotationSource::OpaqueCast }
                    3usize => { AnnotationSource::GenericArg }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AnnotationSource`, expected 0..4, actual {0}",
                                n));
                    }
                }
            }
        }
    };TyDecodable, const _: () =
    {
        impl<'__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for AnnotationSource {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                ::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
                match *self {
                    AnnotationSource::Ascription => {}
                    AnnotationSource::Declaration => {}
                    AnnotationSource::OpaqueCast => {}
                    AnnotationSource::GenericArg => {}
                }
            }
        }
    };HashStable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
            for AnnotationSource {
            fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    AnnotationSource::Ascription => {}
                    AnnotationSource::Declaration => {}
                    AnnotationSource::OpaqueCast => {}
                    AnnotationSource::GenericArg => {}
                }
                <__V::Result as ::rustc_middle::ty::VisitorResult>::output()
            }
        }
    };TypeVisitable, const _: () =
    {
        impl<'tcx>
            ::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
            for AnnotationSource {
            fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        AnnotationSource::Ascription => {
                            AnnotationSource::Ascription
                        }
                        AnnotationSource::Declaration => {
                            AnnotationSource::Declaration
                        }
                        AnnotationSource::OpaqueCast => {
                            AnnotationSource::OpaqueCast
                        }
                        AnnotationSource::GenericArg => {
                            AnnotationSource::GenericArg
                        }
                    })
            }
            fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    AnnotationSource::Ascription => {
                        AnnotationSource::Ascription
                    }
                    AnnotationSource::Declaration => {
                        AnnotationSource::Declaration
                    }
                    AnnotationSource::OpaqueCast => {
                        AnnotationSource::OpaqueCast
                    }
                    AnnotationSource::GenericArg => {
                        AnnotationSource::GenericArg
                    }
                }
            }
        }
    };TypeFoldable)]
165pub enum AnnotationSource {
166    Ascription,
167    Declaration,
168    OpaqueCast,
169    GenericArg,
170}
171
172/// The constituent parts of a mir constant of kind ADT or array.
173#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for DestructuredConstant<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for DestructuredConstant<'tcx> {
    #[inline]
    fn clone(&self) -> DestructuredConstant<'tcx> {
        let _: ::core::clone::AssertParamIsClone<Option<VariantIdx>>;
        let _:
                ::core::clone::AssertParamIsClone<&'tcx [(ConstValue,
                Ty<'tcx>)]>;
        *self
    }
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for DestructuredConstant<'tcx> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f,
            "DestructuredConstant", "variant", &self.variant, "fields",
            &&self.fields)
    }
}Debug, const _: () =
    {
        impl<'tcx, '__ctx>
            ::rustc_data_structures::stable_hasher::HashStable<::rustc_query_system::ich::StableHashingContext<'__ctx>>
            for DestructuredConstant<'tcx> {
            #[inline]
            fn hash_stable(&self,
                __hcx:
                    &mut ::rustc_query_system::ich::StableHashingContext<'__ctx>,
                __hasher:
                    &mut ::rustc_data_structures::stable_hasher::StableHasher) {
                match *self {
                    DestructuredConstant {
                        variant: ref __binding_0, fields: ref __binding_1 } => {
                        { __binding_0.hash_stable(__hcx, __hasher); }
                        { __binding_1.hash_stable(__hcx, __hasher); }
                    }
                }
            }
        }
    };HashStable)]
174pub struct DestructuredConstant<'tcx> {
175    pub variant: Option<VariantIdx>,
176    pub fields: &'tcx [(ConstValue, Ty<'tcx>)],
177}