Skip to main content

rustc_type_ir/solve/
mod.rs

1pub mod inspect;
2
3use std::convert::Infallible;
4use std::fmt::Debug;
5use std::hash::Hash;
6
7use derive_where::derive_where;
8#[cfg(feature = "nightly")]
9use rustc_macros::{Decodable_NoContext, Encodable_NoContext, StableHash, StableHash_NoContext};
10use rustc_type_ir_macros::{
11    GenericTypeVisitable, Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic,
12};
13use thin_vec::ThinVec;
14use tracing::debug;
15
16use crate::lang_items::SolverTraitLangItem;
17use crate::region_constraint::RegionConstraint;
18use crate::search_graph::PathKind;
19use crate::{
20    self as ty, Canonical, CanonicalVarValues, CantBeErased, Interner, TyVid, TypingMode, Upcast,
21};
22
23pub type CanonicalInput<I, T = <I as Interner>::Predicate> =
24    ty::CanonicalQueryInput<I, QueryInput<I, T>>;
25pub type CanonicalResponse<I> = Canonical<I, Response<I>>;
26/// The result of evaluating a canonical query.
27///
28/// FIXME: We use a different type than the existing canonical queries. This is because
29/// we need to add a `Certainty` for `overflow` and may want to restructure this code without
30/// having to worry about changes to currently used code. Once we've made progress on this
31/// solver, merge the two responses again.
32pub type QueryResult<I> = Result<CanonicalResponse<I>, NoSolution>;
33pub type QueryResultOrRerunNonErased<I> = Result<CanonicalResponse<I>, NoSolutionOrRerunNonErased>;
34
35#[derive(#[automatically_derived]
impl ::core::marker::Copy for NoSolution { }Copy, #[automatically_derived]
impl ::core::clone::Clone for NoSolution {
    #[inline]
    fn clone(&self) -> NoSolution { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for NoSolution {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "NoSolution")
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for NoSolution {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {}
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for NoSolution {
    #[inline]
    fn eq(&self, other: &NoSolution) -> bool { true }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for NoSolution {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq)]
36#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for NoSolution {
            #[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 { NoSolution => {} }
            }
        }
    };StableHash))]
37pub struct NoSolution;
38
39pub trait RerunResultExt<T> {
40    fn map_err_to_rerun(self) -> Result<Result<T, NoSolution>, RerunNonErased>;
41}
42
43impl<T> RerunResultExt<T> for Result<T, NoSolutionOrRerunNonErased> {
44    fn map_err_to_rerun(self) -> Result<Result<T, NoSolution>, RerunNonErased> {
45        match self {
46            Ok(i) => Ok(Ok(i)),
47            Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Ok(Err(NoSolution)),
48            Err(NoSolutionOrRerunNonErased::RerunNonErased(e)) => Err(e),
49        }
50    }
51}
52
53/// A bit like [`NoSolution`], but for functions that normally cannot fail *unless* they accessed
54/// opaues. (See [`TypingMode::ErasedNotCoherence`]). Getting `OpaquesAccessed` doesn't mean there
55/// truly is no solution. It just means that we want to bail out of the current query as fast as
56/// possible, possibly by returning `NoSolution` if that's fastest. This is okay because when you get
57/// `OpaquesAccessed` we're guaranteed that we're going to retry this query in the original typing
58/// mode to get the correct answer.
59#[derive(#[automatically_derived]
impl ::core::marker::Copy for RerunNonErased { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RerunNonErased {
    #[inline]
    fn clone(&self) -> RerunNonErased {
        let _: ::core::clone::AssertParamIsClone<()>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for RerunNonErased {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_tuple_field1_finish(f, "RerunNonErased",
            &&self.0)
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for RerunNonErased {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.0, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for RerunNonErased {
    #[inline]
    fn eq(&self, other: &RerunNonErased) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RerunNonErased {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<()>;
    }
}Eq)]
60#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            RerunNonErased {
            #[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 {
                    RerunNonErased(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash))]
61pub struct RerunNonErased(());
62
63#[derive(#[automatically_derived]
impl ::core::marker::Copy for NoSolutionOrRerunNonErased { }Copy, #[automatically_derived]
impl ::core::clone::Clone for NoSolutionOrRerunNonErased {
    #[inline]
    fn clone(&self) -> NoSolutionOrRerunNonErased {
        let _: ::core::clone::AssertParamIsClone<NoSolution>;
        let _: ::core::clone::AssertParamIsClone<RerunNonErased>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for NoSolutionOrRerunNonErased {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            NoSolutionOrRerunNonErased::NoSolution(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NoSolution", &__self_0),
            NoSolutionOrRerunNonErased::RerunNonErased(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "RerunNonErased", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for NoSolutionOrRerunNonErased {
    #[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 {
            NoSolutionOrRerunNonErased::NoSolution(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            NoSolutionOrRerunNonErased::RerunNonErased(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
        }
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for NoSolutionOrRerunNonErased {
    #[inline]
    fn eq(&self, other: &NoSolutionOrRerunNonErased) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (NoSolutionOrRerunNonErased::NoSolution(__self_0),
                    NoSolutionOrRerunNonErased::NoSolution(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (NoSolutionOrRerunNonErased::RerunNonErased(__self_0),
                    NoSolutionOrRerunNonErased::RerunNonErased(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => unsafe { ::core::intrinsics::unreachable() }
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for NoSolutionOrRerunNonErased {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<NoSolution>;
        let _: ::core::cmp::AssertParamIsEq<RerunNonErased>;
    }
}Eq)]
64#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            NoSolutionOrRerunNonErased {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    NoSolutionOrRerunNonErased::NoSolution(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    NoSolutionOrRerunNonErased::RerunNonErased(ref __binding_0)
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash))]
65pub enum NoSolutionOrRerunNonErased {
66    NoSolution(NoSolution),
67    RerunNonErased(RerunNonErased),
68}
69
70impl From<NoSolution> for NoSolutionOrRerunNonErased {
71    fn from(value: NoSolution) -> Self {
72        Self::NoSolution(value)
73    }
74}
75
76impl From<RerunNonErased> for NoSolutionOrRerunNonErased {
77    fn from(value: RerunNonErased) -> Self {
78        Self::RerunNonErased(value)
79    }
80}
81
82#[derive(#[automatically_derived]
impl<T: ::core::marker::Copy + Copy + Debug + Hash + Eq> ::core::marker::Copy
    for SmallCopyList<T> {
}Copy, #[automatically_derived]
impl<T: ::core::clone::Clone + Copy + Debug + Hash + Eq> ::core::clone::Clone
    for SmallCopyList<T> {
    #[inline]
    fn clone(&self) -> SmallCopyList<T> {
        match self {
            SmallCopyList::Empty => SmallCopyList::Empty,
            SmallCopyList::One(__self_0) =>
                SmallCopyList::One(::core::clone::Clone::clone(__self_0)),
            SmallCopyList::Two(__self_0) =>
                SmallCopyList::Two(::core::clone::Clone::clone(__self_0)),
            SmallCopyList::Three(__self_0) =>
                SmallCopyList::Three(::core::clone::Clone::clone(__self_0)),
        }
    }
}Clone, #[automatically_derived]
impl<T: ::core::fmt::Debug + Copy + Debug + Hash + Eq> ::core::fmt::Debug for
    SmallCopyList<T> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            SmallCopyList::Empty =>
                ::core::fmt::Formatter::write_str(f, "Empty"),
            SmallCopyList::One(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "One",
                    &__self_0),
            SmallCopyList::Two(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Two",
                    &__self_0),
            SmallCopyList::Three(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Three",
                    &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl<T: ::core::hash::Hash + Copy + Debug + Hash + Eq> ::core::hash::Hash for
    SmallCopyList<T> {
    #[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 {
            SmallCopyList::One(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            SmallCopyList::Two(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            SmallCopyList::Three(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl<T: ::core::cmp::PartialEq + Copy + Debug + Hash + Eq>
    ::core::cmp::PartialEq for SmallCopyList<T> {
    #[inline]
    fn eq(&self, other: &SmallCopyList<T>) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (SmallCopyList::One(__self_0), SmallCopyList::One(__arg1_0))
                    => __self_0 == __arg1_0,
                (SmallCopyList::Two(__self_0), SmallCopyList::Two(__arg1_0))
                    => __self_0 == __arg1_0,
                (SmallCopyList::Three(__self_0),
                    SmallCopyList::Three(__arg1_0)) => __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl<T: ::core::cmp::Eq + Copy + Debug + Hash + Eq> ::core::cmp::Eq for
    SmallCopyList<T> {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<[T; 1]>;
        let _: ::core::cmp::AssertParamIsEq<[T; 2]>;
        let _: ::core::cmp::AssertParamIsEq<[T; 3]>;
    }
}Eq)]
83#[derive(const _: () =
    {
        impl<T: Copy + Debug + Hash + Eq, I> ::rustc_type_ir::TypeVisitable<I>
            for SmallCopyList<T> where I: Interner,
            [T; 1]: ::rustc_type_ir::TypeVisitable<I>,
            [T; 2]: ::rustc_type_ir::TypeVisitable<I>,
            [T; 3]: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    SmallCopyList::Empty => {}
                    SmallCopyList::One(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);
                                }
                            }
                        }
                    }
                    SmallCopyList::Two(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);
                                }
                            }
                        }
                    }
                    SmallCopyList::Three(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 _: () =
    {
        impl<T: Copy + Debug + Hash + Eq, I> ::rustc_type_ir::TypeFoldable<I>
            for SmallCopyList<T> where I: Interner,
            T: ::rustc_type_ir::TypeFoldable<I>,
            [T; 1]: ::rustc_type_ir::TypeFoldable<I>,
            [T; 2]: ::rustc_type_ir::TypeFoldable<I>,
            [T; 3]: ::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 {
                        SmallCopyList::Empty => { SmallCopyList::Empty }
                        SmallCopyList::One(__binding_0) => {
                            SmallCopyList::One(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        SmallCopyList::Two(__binding_0) => {
                            SmallCopyList::Two(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        SmallCopyList::Three(__binding_0) => {
                            SmallCopyList::Three(::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 {
                    SmallCopyList::Empty => { SmallCopyList::Empty }
                    SmallCopyList::One(__binding_0) => {
                        SmallCopyList::One(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    SmallCopyList::Two(__binding_0) => {
                        SmallCopyList::Two(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    SmallCopyList::Three(__binding_0) => {
                        SmallCopyList::Three(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable_Generic, GenericTypeVisitable)]
84#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<T: Copy + Debug + Hash + Eq>
            ::rustc_data_structures::stable_hash::StableHash for
            SmallCopyList<T> where
            [T; 1]: ::rustc_data_structures::stable_hash::StableHash,
            [T; 2]: ::rustc_data_structures::stable_hash::StableHash,
            [T; 3]: ::rustc_data_structures::stable_hash::StableHash {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    SmallCopyList::Empty => {}
                    SmallCopyList::One(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    SmallCopyList::Two(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    SmallCopyList::Three(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
85pub enum SmallCopyList<T: Copy + Debug + Hash + Eq> {
86    Empty,
87    One([T; 1]),
88    Two([T; 2]),
89    Three([T; 3]),
90}
91
92impl<T: Copy + Debug + Hash + Eq> SmallCopyList<T> {
93    fn empty() -> Self {
94        Self::Empty
95    }
96
97    fn new(first: T) -> Self {
98        Self::One([first])
99    }
100
101    /// Computes the union of two lists. Duplicates are removed.
102    fn union(self, other: Self) -> Option<Self> {
103        match (self, other) {
104            (Self::Empty, other) | (other, Self::Empty) => Some(other),
105
106            (Self::One([a]), Self::One([b])) if a == b => Some(Self::One([a])),
107            (Self::One([a]), Self::One([b])) => Some(Self::Two([a, b])),
108            (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c]))
109                if a == b && b == c =>
110            {
111                Some(Self::One([a]))
112            }
113            (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if a == b => {
114                Some(Self::Two([a, c]))
115            }
116            (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if a == c => {
117                Some(Self::Two([a, b]))
118            }
119            (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if b == c => {
120                Some(Self::Two([a, b]))
121            }
122            (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) => {
123                Some(Self::Three([a, b, c]))
124            }
125            _ => None,
126        }
127    }
128}
129
130impl<T: Copy + Debug + Hash + Eq> AsRef<[T]> for SmallCopyList<T> {
131    fn as_ref(&self) -> &[T] {
132        match self {
133            Self::Empty => &[],
134            Self::One(l) => l,
135            Self::Two(l) => l,
136            Self::Three(l) => l,
137        }
138    }
139}
140
141/// Information about how we accessed opaque types
142/// This is what the trait solver does when each states is encountered:
143///
144/// |                         | bail? | rerun goal?                                                                                                          |
145/// | ----------------------- | ----- | -------------------------------------------------------------------------------------------------------------------- |
146/// | never                   | no    | no                                                                                                                   |
147/// | always                  | yes   | yes                                                                                                                  |
148/// | [defid in storage]      | no    | only if any of the defids in the list is in the opaque type storage OR if TypingMode::PostAnalysis                   |
149/// | opaque with hidden type | no    | only if any of the opaques in the opaque type storage has a hidden type in this list AND if TypingMode::Typeck       |
150///
151/// - "bail" is implemented with [`should_bail`](Self::should_bail).
152///   If true, we're abandoning our attempt to canonicalize in [`TypingMode::ErasedNotCoherence`],
153///   and should try to return as soon as possible to waste as little time as possible.
154///   A rerun will be attempted in the original typing mode.
155///
156/// - Rerun goal is implemented with `should_rerun_after_erased_canonicalization`, on the `EvalCtxt`.
157///
158/// Some variant names contain an `Or` here. They rerun when any of the two conditions applies
159#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for RerunCondition<I> where I: Interner { }#[derive_where(Copy, Clone, Debug, Hash, PartialEq, Eq; I: Interner)]
160#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            RerunCondition<I> where I: Interner,
            SmallCopyList<I::LocalDefId>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    RerunCondition::Never => {}
                    RerunCondition::AnyOpaqueHasInferAsHidden => {}
                    RerunCondition::OpaqueInStorage(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);
                                }
                            }
                        }
                    }
                    RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(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);
                                }
                            }
                        }
                    }
                    RerunCondition::Always => {}
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            RerunCondition<I> where I: Interner,
            SmallCopyList<I::LocalDefId>: ::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 {
                        RerunCondition::Never => { RerunCondition::Never }
                        RerunCondition::AnyOpaqueHasInferAsHidden => {
                            RerunCondition::AnyOpaqueHasInferAsHidden
                        }
                        RerunCondition::OpaqueInStorage(__binding_0) => {
                            RerunCondition::OpaqueInStorage(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(__binding_0)
                            => {
                            RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        RerunCondition::Always => { RerunCondition::Always }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    RerunCondition::Never => { RerunCondition::Never }
                    RerunCondition::AnyOpaqueHasInferAsHidden => {
                        RerunCondition::AnyOpaqueHasInferAsHidden
                    }
                    RerunCondition::OpaqueInStorage(__binding_0) => {
                        RerunCondition::OpaqueInStorage(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(__binding_0)
                        => {
                        RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    RerunCondition::Always => { RerunCondition::Always }
                }
            }
        }
    };TypeFoldable_Generic, GenericTypeVisitable)]
161#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            RerunCondition<I> where
            SmallCopyList<I::LocalDefId>: ::rustc_data_structures::stable_hash::StableHash
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    RerunCondition::Never => {}
                    RerunCondition::AnyOpaqueHasInferAsHidden => {}
                    RerunCondition::OpaqueInStorage(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    RerunCondition::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(ref __binding_0)
                        => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    RerunCondition::Always => {}
                }
            }
        }
    };StableHash_NoContext))]
162pub enum RerunCondition<I: Interner> {
163    Never,
164
165    /// Note that this only reruns according to the condition *if* we are in [`TypingMode::Typeck`].
166    AnyOpaqueHasInferAsHidden,
167    /// Note: unconditionally reruns in postanalysis
168    OpaqueInStorage(SmallCopyList<I::LocalDefId>),
169
170    /// Merges [`Self::AnyOpaqueHasInferAsHidden`] and [`Self::OpaqueInStorage`].
171    /// Note that just like the unmerged [`Self::OpaqueInStorage`], that part of the
172    /// condition only matters in [`TypingMode::Typeck`]
173    OpaqueInStorageOrAnyOpaqueHasInferAsHidden(SmallCopyList<I::LocalDefId>),
174
175    Always,
176}
177
178impl<I: Interner> RerunCondition<I> {
179    /// Merge two rerun states according to the following transition diagram
180    /// (some cells are empty because the table is symmetric, i.e. `a.merge(b)` == `b.merge(a)`).
181    ///
182    /// - "self" here means the current state, i.e. the state of the current column
183    /// - square brackets represents that this is a list of things. Even if the state doesn't
184    /// change, we might grow the list to effectively end up in a different state anyway
185    /// - `[o. in s.]` abbreviates "opaque in storage"
186    ///
187    ///
188    /// |                                 | never  | always | [opaque in storage] | opaque has infer as hidden | [o. in s.] or i. as hidden |
189    /// | ------------------------------- | ------ | ------ | ------------------- | -------------------------- | -------------------------- |
190    /// | never                           | self   | self   | self                | self                       | self                       |
191    /// | always                          |        | always | always              | always                     | always                     |
192    /// | [opaque in storage]             |        |        | concat self         | [o. in s.] or i. as hidden | concat to self             |
193    /// | opaque has infer as hidden type |        |        |                     | self                       | to self                    |
194    ///
195    fn merge(self, other: Self) -> Self {
196        let merged = match (self, other) {
197            (Self::Never, other) | (other, Self::Never) => other,
198            (Self::Always, _) | (_, Self::Always) => Self::Always,
199
200            (Self::OpaqueInStorage(a), Self::OpaqueInStorage(b)) => {
201                a.union(b).map(Self::OpaqueInStorage).unwrap_or(Self::Always)
202            }
203            (Self::AnyOpaqueHasInferAsHidden, Self::AnyOpaqueHasInferAsHidden) => {
204                Self::AnyOpaqueHasInferAsHidden
205            }
206            (
207                Self::AnyOpaqueHasInferAsHidden,
208                Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
209            )
210            | (
211                Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
212                Self::AnyOpaqueHasInferAsHidden,
213            ) => Self::OpaqueInStorage(a),
214
215            (
216                Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
217                Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b),
218            ) => a
219                .union(b)
220                .map(Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden)
221                .unwrap_or(Self::Always),
222
223            (Self::OpaqueInStorage(a), Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b))
224            | (Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b), Self::OpaqueInStorage(a)) => a
225                .union(b)
226                .map(Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden)
227                .unwrap_or(Self::Always),
228
229            (Self::OpaqueInStorage(a), Self::AnyOpaqueHasInferAsHidden)
230            | (Self::AnyOpaqueHasInferAsHidden, Self::OpaqueInStorage(a)) => {
231                Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a)
232            }
233        };
234        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_type_ir/src/solve/mod.rs:234",
                        "rustc_type_ir::solve", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_type_ir/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(234u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_type_ir::solve"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("merging rerun state {0:?} + {1:?} => {2:?}",
                                                    self, other, merged) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("merging rerun state {self:?} + {other:?} => {merged:?}");
235        merged
236    }
237
238    #[must_use]
239    fn should_bail(&self) -> Result<(), RerunNonErased> {
240        match self {
241            Self::Always => Err(RerunNonErased(())),
242            Self::Never
243            | Self::OpaqueInStorage(_)
244            | Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_)
245            | Self::AnyOpaqueHasInferAsHidden => Ok(()),
246        }
247    }
248
249    /// Returns true when any access of opaques was attempted.
250    /// i.e. when `self != Self::Never`
251    #[must_use]
252    fn might_rerun(&self) -> bool {
253        match self {
254            Self::Never => false,
255            Self::Always
256            | Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_)
257            | Self::OpaqueInStorage(_)
258            | Self::AnyOpaqueHasInferAsHidden => true,
259        }
260    }
261}
262
263/// Mainly for debugging, to keep track of the source of the rerunning
264/// in [`TypingMode::ErasedNotCoherence`].
265#[derive(#[automatically_derived]
impl ::core::marker::Copy for RerunReason { }Copy, #[automatically_derived]
impl ::core::clone::Clone for RerunReason {
    #[inline]
    fn clone(&self) -> RerunReason { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for RerunReason {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                RerunReason::NormalizeOpaqueTypeRemoteCrate =>
                    "NormalizeOpaqueTypeRemoteCrate",
                RerunReason::NormalizeOpaqueType => "NormalizeOpaqueType",
                RerunReason::MayUseUnstableFeature => "MayUseUnstableFeature",
                RerunReason::EvaluateConst => "EvaluateConst",
                RerunReason::SkipErasedAttempt => "SkipErasedAttempt",
                RerunReason::SelfTyInfer => "SelfTyInfer",
                RerunReason::FetchEligibleAssocItem =>
                    "FetchEligibleAssocItem",
                RerunReason::AutoTraitLeakage => "AutoTraitLeakage",
                RerunReason::TryStallCoroutine => "TryStallCoroutine",
            })
    }
}Debug, #[automatically_derived]
impl ::core::hash::Hash for RerunReason {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for RerunReason {
    #[inline]
    fn eq(&self, other: &RerunReason) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for RerunReason {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq)]
266#[derive(const _: () =
    {
        impl<I> ::rustc_type_ir::TypeVisitable<I> for RerunReason where
            I: Interner {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    RerunReason::NormalizeOpaqueTypeRemoteCrate => {}
                    RerunReason::NormalizeOpaqueType => {}
                    RerunReason::MayUseUnstableFeature => {}
                    RerunReason::EvaluateConst => {}
                    RerunReason::SkipErasedAttempt => {}
                    RerunReason::SelfTyInfer => {}
                    RerunReason::FetchEligibleAssocItem => {}
                    RerunReason::AutoTraitLeakage => {}
                    RerunReason::TryStallCoroutine => {}
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, GenericTypeVisitable)]
267#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for RerunReason
            {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    RerunReason::NormalizeOpaqueTypeRemoteCrate => {}
                    RerunReason::NormalizeOpaqueType => {}
                    RerunReason::MayUseUnstableFeature => {}
                    RerunReason::EvaluateConst => {}
                    RerunReason::SkipErasedAttempt => {}
                    RerunReason::SelfTyInfer => {}
                    RerunReason::FetchEligibleAssocItem => {}
                    RerunReason::AutoTraitLeakage => {}
                    RerunReason::TryStallCoroutine => {}
                }
            }
        }
    };StableHash_NoContext))]
268pub enum RerunReason {
269    NormalizeOpaqueTypeRemoteCrate,
270    NormalizeOpaqueType,
271    MayUseUnstableFeature,
272    EvaluateConst,
273    SkipErasedAttempt,
274    SelfTyInfer,
275    FetchEligibleAssocItem,
276    AutoTraitLeakage,
277    TryStallCoroutine,
278}
279
280#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for AccessedOpaques<I> where I: Interner { }#[derive_where(Copy, Clone, Debug, Hash, PartialEq, Eq; I: Interner)]
281#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            AccessedOpaques<I> where I: Interner,
            RerunCondition<I>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    AccessedOpaques { rerun: ref __binding_1, .. } => {
                        {
                            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 _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            AccessedOpaques<I> where I: Interner,
            RerunCondition<I>: ::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 {
                        AccessedOpaques { reason: __binding_0, rerun: __binding_1 }
                            => {
                            AccessedOpaques {
                                reason: __binding_0,
                                rerun: ::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 {
                    AccessedOpaques { reason: __binding_0, rerun: __binding_1 }
                        => {
                        AccessedOpaques {
                            reason: __binding_0,
                            rerun: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, GenericTypeVisitable)]
282#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            AccessedOpaques<I> where
            RerunCondition<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 {
                    AccessedOpaques {
                        reason: ref __binding_0, rerun: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
283pub struct AccessedOpaques<I: Interner> {
284    #[cfg_attr(feature = "nightly", type_visitable(ignore))]
285    #[type_foldable(identity)]
286    pub reason: Option<RerunReason>,
287    pub rerun: RerunCondition<I>,
288}
289
290impl<I: Interner> Default for AccessedOpaques<I> {
291    fn default() -> Self {
292        Self { reason: None, rerun: RerunCondition::Never }
293    }
294}
295
296impl<I: Interner> AccessedOpaques<I> {
297    pub fn update(&mut self, other: Self) -> Result<(), RerunNonErased> {
298        *self = Self {
299            // prefer the newest reason
300            reason: other.reason.or(self.reason),
301            // merging accessed states can only result in MultipleOrUnknown
302            rerun: self.rerun.merge(other.rerun),
303        };
304
305        self.should_bail()
306    }
307
308    #[must_use]
309    pub fn might_rerun(&self) -> bool {
310        self.rerun.might_rerun()
311    }
312
313    #[must_use]
314    pub fn should_bail(&self) -> Result<(), RerunNonErased> {
315        self.rerun.should_bail()
316    }
317
318    pub fn rerun_always(&mut self, reason: RerunReason) -> Result<Infallible, RerunNonErased> {
319        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_type_ir/src/solve/mod.rs:319",
                        "rustc_type_ir::solve", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_type_ir/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(319u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_type_ir::solve"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("set rerun always")
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("set rerun always");
320        match self.update(AccessedOpaques { reason: Some(reason), rerun: RerunCondition::Always }) {
321            Ok(_) => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
322            Err(e) => Err(e),
323        }
324    }
325
326    pub fn rerun_if_in_post_analysis(&mut self, reason: RerunReason) -> Result<(), RerunNonErased> {
327        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_type_ir/src/solve/mod.rs:327",
                        "rustc_type_ir::solve", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_type_ir/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(327u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_type_ir::solve"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("set rerun if post analysis")
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("set rerun if post analysis");
328        self.update(AccessedOpaques {
329            reason: Some(reason),
330            rerun: RerunCondition::OpaqueInStorage(SmallCopyList::empty()),
331        })
332    }
333
334    pub fn rerun_if_opaque_in_opaque_type_storage(
335        &mut self,
336        reason: RerunReason,
337        defid: I::LocalOpaqueTyId,
338    ) -> Result<(), RerunNonErased> {
339        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_type_ir/src/solve/mod.rs:339",
                        "rustc_type_ir::solve", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_type_ir/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(339u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_type_ir::solve"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("set rerun if opaque type {0:?} in storage",
                                                    defid) as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("set rerun if opaque type {defid:?} in storage");
340        self.update(AccessedOpaques {
341            reason: Some(reason),
342            rerun: RerunCondition::OpaqueInStorage(SmallCopyList::new(defid.into())),
343        })
344    }
345
346    pub fn rerun_if_any_opaque_has_infer_as_hidden_type(
347        &mut self,
348        reason: RerunReason,
349    ) -> Result<(), RerunNonErased> {
350        {
    use ::tracing::__macro_support::Callsite as _;
    static __CALLSITE: ::tracing::callsite::DefaultCallsite =
        {
            static META: ::tracing::Metadata<'static> =
                {
                    ::tracing_core::metadata::Metadata::new("event compiler/rustc_type_ir/src/solve/mod.rs:350",
                        "rustc_type_ir::solve", ::tracing::Level::DEBUG,
                        ::tracing_core::__macro_support::Option::Some("compiler/rustc_type_ir/src/solve/mod.rs"),
                        ::tracing_core::__macro_support::Option::Some(350u32),
                        ::tracing_core::__macro_support::Option::Some("rustc_type_ir::solve"),
                        ::tracing_core::field::FieldSet::new(&["message"],
                            ::tracing_core::callsite::Identifier(&__CALLSITE)),
                        ::tracing::metadata::Kind::EVENT)
                };
            ::tracing::callsite::DefaultCallsite::new(&META)
        };
    let enabled =
        ::tracing::Level::DEBUG <= ::tracing::level_filters::STATIC_MAX_LEVEL
                &&
                ::tracing::Level::DEBUG <=
                    ::tracing::level_filters::LevelFilter::current() &&
            {
                let interest = __CALLSITE.interest();
                !interest.is_never() &&
                    ::tracing::__macro_support::__is_enabled(__CALLSITE.metadata(),
                        interest)
            };
    if enabled {
        (|value_set: ::tracing::field::ValueSet|
                    {
                        let meta = __CALLSITE.metadata();
                        ::tracing::Event::dispatch(meta, &value_set);
                        ;
                    })({
                #[allow(unused_imports)]
                use ::tracing::field::{debug, display, Value};
                __CALLSITE.metadata().fields().value_set_all(&[(::tracing::__macro_support::Option::Some(&format_args!("set rerun if any opaque in the storage has a hidden type that is an infer var")
                                            as &dyn ::tracing::field::Value))])
            });
    } else { ; }
};debug!("set rerun if any opaque in the storage has a hidden type that is an infer var");
351        self.update(AccessedOpaques {
352            reason: Some(reason),
353            rerun: RerunCondition::AnyOpaqueHasInferAsHidden,
354        })
355    }
356}
357
358/// A goal is a statement, i.e. `predicate`, we want to prove
359/// given some assumptions, i.e. `param_env`.
360///
361/// Most of the time the `param_env` contains the `where`-bounds of the function
362/// we're currently typechecking while the `predicate` is some trait bound.
363#[automatically_derived]
impl<I: Interner, P> ::core::marker::Copy for Goal<I, P> where I: Interner,
    P: Copy {
}#[derive_where(Clone, Hash, PartialEq, Debug; I: Interner, P)]
364#[derive_where(Copy; I: Interner, P: Copy)]
365#[derive(const _: () =
    {
        impl<I: Interner, P> ::rustc_type_ir::TypeVisitable<I> for Goal<I, P>
            where I: Interner, I::ParamEnv: ::rustc_type_ir::TypeVisitable<I>,
            P: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    Goal {
                        param_env: ref __binding_0, predicate: 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 _: () =
    {
        impl<I: Interner, P> ::rustc_type_ir::TypeFoldable<I> for Goal<I, P>
            where I: Interner, P: ::rustc_type_ir::TypeFoldable<I>,
            I::ParamEnv: ::rustc_type_ir::TypeFoldable<I>,
            P: ::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 {
                        Goal { param_env: __binding_0, predicate: __binding_1 } => {
                            Goal {
                                param_env: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                predicate: ::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 {
                    Goal { param_env: __binding_0, predicate: __binding_1 } => {
                        Goal {
                            param_env: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            predicate: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, const _: () =
    {
        impl<I: Interner, P, J> ::rustc_type_ir::lift::Lift<J> for Goal<I, P>
            where J: Interner, I: ::rustc_type_ir::LiftInto<J>,
            P: ::rustc_type_ir::lift::Lift<J> {
            type Lifted =
                Goal<J, <P as ::rustc_type_ir::lift::Lift<J>>::Lifted>;
            fn lift_to_interner(self, interner: J) -> Self::Lifted {
                match self {
                    Goal { param_env: __binding_0, predicate: __binding_1 } => {
                        Goal {
                            param_env: __binding_0.lift_to_interner(interner),
                            predicate: __binding_1.lift_to_interner(interner),
                        }
                    }
                }
            }
        }
    };Lift_Generic, GenericTypeVisitable)]
366#[cfg_attr(
367    feature = "nightly",
368    derive(const _: () =
    {
        impl<I: Interner, P, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for Goal<I, P> where
            I::ParamEnv: ::rustc_serialize::Decodable<__D>,
            P: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                Goal {
                    param_env: ::rustc_serialize::Decodable::decode(__decoder),
                    predicate: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner, P, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for Goal<I, P> where
            I::ParamEnv: ::rustc_serialize::Encodable<__E>,
            P: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    Goal {
                        param_env: ref __binding_0, predicate: ref __binding_1 } =>
                        {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, P> ::rustc_data_structures::stable_hash::StableHash
            for Goal<I, P> where
            I::ParamEnv: ::rustc_data_structures::stable_hash::StableHash,
            P: ::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 {
                    Goal {
                        param_env: ref __binding_0, predicate: ref __binding_1 } =>
                        {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
369)]
370pub struct Goal<I: Interner, P> {
371    pub param_env: I::ParamEnv,
372    pub predicate: P,
373}
374
375impl<I: Interner, P: Eq> Eq for Goal<I, P> {}
376
377impl<I: Interner, P> Goal<I, P> {
378    pub fn new(cx: I, param_env: I::ParamEnv, predicate: impl Upcast<I, P>) -> Goal<I, P> {
379        Goal { param_env, predicate: predicate.upcast(cx) }
380    }
381
382    /// Updates the goal to one with a different `predicate` but the same `param_env`.
383    pub fn with<Q>(self, cx: I, predicate: impl Upcast<I, Q>) -> Goal<I, Q> {
384        Goal { param_env: self.param_env, predicate: predicate.upcast(cx) }
385    }
386}
387
388/// Why a specific goal has to be proven.
389///
390/// This is necessary as we treat nested goals different depending on
391/// their source. This is used to decide whether a cycle is coinductive.
392/// See the documentation of `EvalCtxt::step_kind_for_source` for more details
393/// about this.
394///
395/// It is also used by proof tree visitors, e.g. for diagnostics purposes.
396#[derive(#[automatically_derived]
impl ::core::marker::Copy for GoalSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for GoalSource {
    #[inline]
    fn clone(&self) -> GoalSource {
        let _: ::core::clone::AssertParamIsClone<PathKind>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for GoalSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            GoalSource::Misc => ::core::fmt::Formatter::write_str(f, "Misc"),
            GoalSource::TypeRelating =>
                ::core::fmt::Formatter::write_str(f, "TypeRelating"),
            GoalSource::ImplWhereBound =>
                ::core::fmt::Formatter::write_str(f, "ImplWhereBound"),
            GoalSource::AliasBoundConstCondition =>
                ::core::fmt::Formatter::write_str(f,
                    "AliasBoundConstCondition"),
            GoalSource::AliasWellFormed =>
                ::core::fmt::Formatter::write_str(f, "AliasWellFormed"),
            GoalSource::NormalizeGoal(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "NormalizeGoal", &__self_0),
        }
    }
}Debug, #[automatically_derived]
impl ::core::cmp::PartialEq for GoalSource {
    #[inline]
    fn eq(&self, other: &GoalSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (GoalSource::NormalizeGoal(__self_0),
                    GoalSource::NormalizeGoal(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GoalSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<PathKind>;
    }
}Eq, #[automatically_derived]
impl ::core::hash::Hash for GoalSource {
    #[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 {
            GoalSource::NormalizeGoal(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash)]
397#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for GoalSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    GoalSource::Misc => {}
                    GoalSource::TypeRelating => {}
                    GoalSource::ImplWhereBound => {}
                    GoalSource::AliasBoundConstCondition => {}
                    GoalSource::AliasWellFormed => {}
                    GoalSource::NormalizeGoal(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash))]
398pub enum GoalSource {
399    Misc,
400    /// A nested goal required to prove that types are equal/subtypes.
401    /// This is always an unproductive step.
402    ///
403    /// This is also used for all `NormalizesTo` goals as we they are used
404    /// to relate types in `AliasRelate`.
405    TypeRelating,
406    /// We're proving a where-bound of an impl.
407    ImplWhereBound,
408    /// Const conditions that need to hold for `[const]` alias bounds to hold.
409    AliasBoundConstCondition,
410    /// Predicate required for an alias projection to be well-formed.
411    /// This is used in three places:
412    /// 1. projecting to an opaque whose hidden type is already registered in
413    ///    the opaque type storage,
414    /// 2. for rigid projections's trait goal,
415    /// 3. for GAT where clauses.
416    AliasWellFormed,
417    /// In case normalizing aliases in nested goals cycles, eagerly normalizing these
418    /// aliases in the context of the parent may incorrectly change the cycle kind.
419    /// Normalizing aliases in goals therefore tracks the original path kind for this
420    /// nested goal. See the comment of the `ReplaceAliasWithInfer` visitor for more
421    /// details.
422    NormalizeGoal(PathKind),
423}
424
425#[automatically_derived]
impl<I: Interner, P> ::core::marker::Copy for QueryInput<I, P> where
    I: Interner, Goal<I, P>: Copy {
}#[derive_where(Clone, Hash, PartialEq, Debug; I: Interner, Goal<I, P>)]
426#[derive_where(Copy; I: Interner, Goal<I, P>: Copy)]
427#[derive(const _: () =
    {
        impl<I: Interner, P> ::rustc_type_ir::TypeVisitable<I> for
            QueryInput<I, P> where I: Interner,
            Goal<I, P>: ::rustc_type_ir::TypeVisitable<I>,
            I::PredefinedOpaques: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    QueryInput {
                        goal: ref __binding_0,
                        predefined_opaques_in_body: 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 _: () =
    {
        impl<I: Interner, P> ::rustc_type_ir::TypeFoldable<I> for
            QueryInput<I, P> where I: Interner,
            P: ::rustc_type_ir::TypeFoldable<I>,
            Goal<I, P>: ::rustc_type_ir::TypeFoldable<I>,
            I::PredefinedOpaques: ::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 {
                        QueryInput {
                            goal: __binding_0, predefined_opaques_in_body: __binding_1 }
                            => {
                            QueryInput {
                                goal: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                predefined_opaques_in_body: ::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 {
                    QueryInput {
                        goal: __binding_0, predefined_opaques_in_body: __binding_1 }
                        => {
                        QueryInput {
                            goal: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            predefined_opaques_in_body: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic, GenericTypeVisitable)]
428#[cfg_attr(
429    feature = "nightly",
430    derive(const _: () =
    {
        impl<I: Interner, P, __D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for QueryInput<I, P> where
            Goal<I, P>: ::rustc_serialize::Decodable<__D>,
            I::PredefinedOpaques: ::rustc_serialize::Decodable<__D> {
            fn decode(__decoder: &mut __D) -> Self {
                QueryInput {
                    goal: ::rustc_serialize::Decodable::decode(__decoder),
                    predefined_opaques_in_body: ::rustc_serialize::Decodable::decode(__decoder),
                }
            }
        }
    };Decodable_NoContext, const _: () =
    {
        impl<I: Interner, P, __E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for QueryInput<I, P> where
            Goal<I, P>: ::rustc_serialize::Encodable<__E>,
            I::PredefinedOpaques: ::rustc_serialize::Encodable<__E> {
            fn encode(&self, __encoder: &mut __E) {
                match *self {
                    QueryInput {
                        goal: ref __binding_0,
                        predefined_opaques_in_body: ref __binding_1 } => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_1,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<I: Interner, P> ::rustc_data_structures::stable_hash::StableHash
            for QueryInput<I, P> where
            Goal<I, P>: ::rustc_data_structures::stable_hash::StableHash,
            I::PredefinedOpaques: ::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 {
                    QueryInput {
                        goal: ref __binding_0,
                        predefined_opaques_in_body: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext)
431)]
432pub struct QueryInput<I: Interner, P> {
433    pub goal: Goal<I, P>,
434    pub predefined_opaques_in_body: I::PredefinedOpaques,
435}
436
437impl<I: Interner, P: Eq> Eq for QueryInput<I, P> {}
438
439/// Which trait candidates should be preferred over other candidates? By default, prefer where
440/// bounds over alias bounds. For marker traits, prefer alias bounds over where bounds.
441#[derive(#[automatically_derived]
impl ::core::clone::Clone for CandidatePreferenceMode {
    #[inline]
    fn clone(&self) -> CandidatePreferenceMode { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for CandidatePreferenceMode { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for CandidatePreferenceMode {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                CandidatePreferenceMode::Default => "Default",
                CandidatePreferenceMode::Marker => "Marker",
            })
    }
}Debug)]
442pub enum CandidatePreferenceMode {
443    /// Prefers where bounds over alias bounds
444    Default,
445    /// Prefers alias bounds over where bounds
446    Marker,
447}
448
449impl CandidatePreferenceMode {
450    /// Given `trait_def_id`, which candidate preference mode should be used?
451    pub fn compute<I: Interner>(cx: I, trait_id: I::TraitId) -> CandidatePreferenceMode {
452        let is_sizedness_or_auto_or_default_goal = cx.is_sizedness_trait(trait_id)
453            || cx.trait_is_auto(trait_id)
454            || cx.is_default_trait(trait_id);
455        if is_sizedness_or_auto_or_default_goal {
456            CandidatePreferenceMode::Marker
457        } else {
458            CandidatePreferenceMode::Default
459        }
460    }
461}
462
463/// Possible ways the given goal can be proven.
464#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for CandidateSource<I> where I: Interner
    {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            CandidateSource::Impl(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "Impl");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            CandidateSource::BuiltinImpl(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "BuiltinImpl");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            CandidateSource::ParamEnv(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "ParamEnv");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            CandidateSource::AliasBound(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "AliasBound");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            CandidateSource::CoherenceUnknowable =>
                ::core::fmt::Formatter::write_str(__f, "CoherenceUnknowable"),
        }
    }
}#[derive_where(Clone, Copy, Hash, PartialEq, Debug; I: Interner)]
465pub enum CandidateSource<I: Interner> {
466    /// A user written impl.
467    ///
468    /// ## Examples
469    ///
470    /// ```rust
471    /// fn main() {
472    ///     let x: Vec<u32> = Vec::new();
473    ///     // This uses the impl from the standard library to prove `Vec<T>: Clone`.
474    ///     let y = x.clone();
475    /// }
476    /// ```
477    Impl(I::ImplId),
478    /// A builtin impl generated by the compiler. When adding a new special
479    /// trait, try to use actual impls whenever possible. Builtin impls should
480    /// only be used in cases where the impl cannot be manually be written.
481    ///
482    /// Notable examples are auto traits, `Sized`, and `DiscriminantKind`.
483    /// For a list of all traits with builtin impls, check out the
484    /// `EvalCtxt::assemble_builtin_impl_candidates` method.
485    BuiltinImpl(BuiltinImplSource),
486    /// An assumption from the environment. Stores a [`ParamEnvSource`], since we
487    /// prefer non-global param-env candidates in candidate assembly.
488    ///
489    /// ## Examples
490    ///
491    /// ```rust
492    /// fn is_clone<T: Clone>(x: T) -> (T, T) {
493    ///     // This uses the assumption `T: Clone` from the `where`-bounds
494    ///     // to prove `T: Clone`.
495    ///     (x.clone(), x)
496    /// }
497    /// ```
498    ParamEnv(ParamEnvSource),
499    /// If the self type is an alias type, e.g. an opaque type or a projection,
500    /// we know the bounds on that alias to hold even without knowing its concrete
501    /// underlying type.
502    ///
503    /// More precisely this candidate is using the `n-th` bound in the `item_bounds` of
504    /// the self type.
505    ///
506    /// ## Examples
507    ///
508    /// ```rust
509    /// trait Trait {
510    ///     type Assoc: Clone;
511    /// }
512    ///
513    /// fn foo<T: Trait>(x: <T as Trait>::Assoc) {
514    ///     // We prove `<T as Trait>::Assoc` by looking at the bounds on `Assoc` in
515    ///     // in the trait definition.
516    ///     let _y = x.clone();
517    /// }
518    /// ```
519    AliasBound(AliasBoundKind),
520    /// A candidate that is registered only during coherence to represent some
521    /// yet-unknown impl that could be produced downstream without violating orphan
522    /// rules.
523    // FIXME: Merge this with the forced ambiguity candidates, so those don't use `Misc`.
524    CoherenceUnknowable,
525}
526
527impl<I: Interner> Eq for CandidateSource<I> {}
528
529#[derive(#[automatically_derived]
impl ::core::clone::Clone for ParamEnvSource {
    #[inline]
    fn clone(&self) -> ParamEnvSource { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ParamEnvSource { }Copy, #[automatically_derived]
impl ::core::hash::Hash for ParamEnvSource {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for ParamEnvSource {
    #[inline]
    fn eq(&self, other: &ParamEnvSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for ParamEnvSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for ParamEnvSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                ParamEnvSource::NonGlobal => "NonGlobal",
                ParamEnvSource::Global => "Global",
            })
    }
}Debug)]
530pub enum ParamEnvSource {
531    /// Preferred eagerly.
532    NonGlobal,
533    // Not considered unless there are non-global param-env candidates too.
534    Global,
535}
536
537#[derive(#[automatically_derived]
impl ::core::clone::Clone for AliasBoundKind {
    #[inline]
    fn clone(&self) -> AliasBoundKind { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for AliasBoundKind { }Copy, #[automatically_derived]
impl ::core::hash::Hash for AliasBoundKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for AliasBoundKind {
    #[inline]
    fn eq(&self, other: &AliasBoundKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for AliasBoundKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for AliasBoundKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AliasBoundKind::SelfBounds => "SelfBounds",
                AliasBoundKind::NonSelfBounds => "NonSelfBounds",
            })
    }
}Debug)]
538#[derive(const _: () =
    {
        impl<I> ::rustc_type_ir::TypeVisitable<I> for AliasBoundKind where
            I: Interner {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    AliasBoundKind::SelfBounds => {}
                    AliasBoundKind::NonSelfBounds => {}
                }
                <__V::Result as ::rustc_type_ir::VisitorResult>::output()
            }
        }
    };TypeVisitable_Generic, GenericTypeVisitable, const _: () =
    {
        impl<I> ::rustc_type_ir::TypeFoldable<I> for AliasBoundKind where
            I: Interner {
            fn try_fold_with<__F: ::rustc_type_ir::FallibleTypeFolder<I>>(self,
                __folder: &mut __F) -> Result<Self, __F::Error> {
                Ok(match self {
                        AliasBoundKind::SelfBounds => { AliasBoundKind::SelfBounds }
                        AliasBoundKind::NonSelfBounds => {
                            AliasBoundKind::NonSelfBounds
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    AliasBoundKind::SelfBounds => { AliasBoundKind::SelfBounds }
                    AliasBoundKind::NonSelfBounds => {
                        AliasBoundKind::NonSelfBounds
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
539pub enum AliasBoundKind {
540    /// Alias bound from the self type of a projection
541    SelfBounds,
542    // Alias bound having recursed on the self type of a projection
543    NonSelfBounds,
544}
545
546#[derive(#[automatically_derived]
impl ::core::clone::Clone for BuiltinImplSource {
    #[inline]
    fn clone(&self) -> BuiltinImplSource {
        let _: ::core::clone::AssertParamIsClone<usize>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for BuiltinImplSource { }Copy, #[automatically_derived]
impl ::core::hash::Hash for BuiltinImplSource {
    #[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 {
            BuiltinImplSource::Object(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            BuiltinImplSource::TraitUpcasting(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for BuiltinImplSource {
    #[inline]
    fn eq(&self, other: &BuiltinImplSource) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (BuiltinImplSource::Object(__self_0),
                    BuiltinImplSource::Object(__arg1_0)) =>
                    __self_0 == __arg1_0,
                (BuiltinImplSource::TraitUpcasting(__self_0),
                    BuiltinImplSource::TraitUpcasting(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for BuiltinImplSource {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<usize>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for BuiltinImplSource {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            BuiltinImplSource::Trivial =>
                ::core::fmt::Formatter::write_str(f, "Trivial"),
            BuiltinImplSource::Misc =>
                ::core::fmt::Formatter::write_str(f, "Misc"),
            BuiltinImplSource::Object(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Object",
                    &__self_0),
            BuiltinImplSource::TraitUpcasting(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f,
                    "TraitUpcasting", &__self_0),
        }
    }
}Debug)]
547#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            BuiltinImplSource {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    BuiltinImplSource::Trivial => {}
                    BuiltinImplSource::Misc => {}
                    BuiltinImplSource::Object(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    BuiltinImplSource::TraitUpcasting(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash, const _: () =
    {
        impl<__E: ::rustc_serialize::Encoder>
            ::rustc_serialize::Encodable<__E> for BuiltinImplSource {
            fn encode(&self, __encoder: &mut __E) {
                let disc =
                    match *self {
                        BuiltinImplSource::Trivial => { 0usize }
                        BuiltinImplSource::Misc => { 1usize }
                        BuiltinImplSource::Object(ref __binding_0) => { 2usize }
                        BuiltinImplSource::TraitUpcasting(ref __binding_0) => {
                            3usize
                        }
                    };
                ::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
                match *self {
                    BuiltinImplSource::Trivial => {}
                    BuiltinImplSource::Misc => {}
                    BuiltinImplSource::Object(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                    BuiltinImplSource::TraitUpcasting(ref __binding_0) => {
                        ::rustc_serialize::Encodable::<__E>::encode(__binding_0,
                            __encoder);
                    }
                }
            }
        }
    };Encodable_NoContext, const _: () =
    {
        impl<__D: ::rustc_serialize::Decoder>
            ::rustc_serialize::Decodable<__D> for BuiltinImplSource {
            fn decode(__decoder: &mut __D) -> Self {
                match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
                    {
                    0usize => { BuiltinImplSource::Trivial }
                    1usize => { BuiltinImplSource::Misc }
                    2usize => {
                        BuiltinImplSource::Object(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    3usize => {
                        BuiltinImplSource::TraitUpcasting(::rustc_serialize::Decodable::decode(__decoder))
                    }
                    n => {
                        ::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `BuiltinImplSource`, expected 0..4, actual {0}",
                                n));
                    }
                }
            }
        }
    };Decodable_NoContext))]
548pub enum BuiltinImplSource {
549    /// A built-in impl that is considered trivial, without any nested requirements. They
550    /// are preferred over where-clauses, and we want to track them explicitly.
551    Trivial,
552    /// Some built-in impl we don't need to differentiate. This should be used
553    /// unless more specific information is necessary.
554    Misc,
555    /// A built-in impl for trait objects. The index is only used in winnowing.
556    Object(usize),
557    /// A built-in implementation of `Upcast` for trait objects to other trait objects.
558    ///
559    /// The index is only used for winnowing.
560    TraitUpcasting(usize),
561}
562
563#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for FetchEligibleAssocItemResponse<I>
    where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            FetchEligibleAssocItemResponse::Err(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "Err");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            FetchEligibleAssocItemResponse::Found(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "Found");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            FetchEligibleAssocItemResponse::NotFound(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "NotFound");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            FetchEligibleAssocItemResponse::NotFoundBecauseErased =>
                ::core::fmt::Formatter::write_str(__f,
                    "NotFoundBecauseErased"),
        }
    }
}#[derive_where(Copy, Clone, Debug; I: Interner)]
564pub enum FetchEligibleAssocItemResponse<I: Interner> {
565    Err(I::ErrorGuaranteed),
566    Found(I::ImplOrTraitAssocTermId),
567    NotFound(TypingMode<I, CantBeErased>),
568    NotFoundBecauseErased,
569}
570
571#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for Response<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            Response {
                certainty: ref __field_certainty,
                var_values: ref __field_var_values,
                external_constraints: ref __field_external_constraints } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Response");
                ::core::fmt::DebugStruct::field(&mut __builder, "certainty",
                    __field_certainty);
                ::core::fmt::DebugStruct::field(&mut __builder, "var_values",
                    __field_var_values);
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "external_constraints", __field_external_constraints);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Copy, Hash, PartialEq, Debug; I: Interner)]
572#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for Response<I>
            where I: Interner,
            CanonicalVarValues<I>: ::rustc_type_ir::TypeVisitable<I>,
            I::ExternalConstraints: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    Response {
                        certainty: ref __binding_0,
                        var_values: ref __binding_1,
                        external_constraints: ref __binding_2 } => {
                        {
                            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);
                                }
                            }
                        }
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_2,
                                        __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, GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for Response<I>
            where I: Interner,
            CanonicalVarValues<I>: ::rustc_type_ir::TypeFoldable<I>,
            I::ExternalConstraints: ::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 {
                        Response {
                            certainty: __binding_0,
                            var_values: __binding_1,
                            external_constraints: __binding_2 } => {
                            Response {
                                certainty: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                var_values: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                external_constraints: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    Response {
                        certainty: __binding_0,
                        var_values: __binding_1,
                        external_constraints: __binding_2 } => {
                        Response {
                            certainty: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            var_values: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            external_constraints: ::rustc_type_ir::TypeFoldable::fold_with(__binding_2,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
573#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            Response<I> where
            CanonicalVarValues<I>: ::rustc_data_structures::stable_hash::StableHash,
            I::ExternalConstraints: ::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 {
                    Response {
                        certainty: ref __binding_0,
                        var_values: ref __binding_1,
                        external_constraints: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
574pub struct Response<I: Interner> {
575    pub certainty: Certainty,
576    pub var_values: CanonicalVarValues<I>,
577    /// Additional constraints returned by this query.
578    pub external_constraints: I::ExternalConstraints,
579}
580
581impl<I: Interner> Eq for Response<I> {}
582
583#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for ExternalRegionConstraints<I> where
    I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            ExternalRegionConstraints::Old(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "Old");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
            ExternalRegionConstraints::NextGen(ref __field_0) => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_tuple(__f, "NextGen");
                ::core::fmt::DebugTuple::field(&mut __builder, __field_0);
                ::core::fmt::DebugTuple::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Hash, PartialEq, Debug; I: Interner)]
584#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            ExternalRegionConstraints<I> where I: Interner,
            Vec<(ty::RegionConstraint<I>,
            VisibleForLeakCheck)>: ::rustc_type_ir::TypeVisitable<I>,
            RegionConstraint<I>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    ExternalRegionConstraints::Old(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);
                                }
                            }
                        }
                    }
                    ExternalRegionConstraints::NextGen(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, GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            ExternalRegionConstraints<I> where I: Interner,
            Vec<(ty::RegionConstraint<I>,
            VisibleForLeakCheck)>: ::rustc_type_ir::TypeFoldable<I>,
            RegionConstraint<I>: ::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 {
                        ExternalRegionConstraints::Old(__binding_0) => {
                            ExternalRegionConstraints::Old(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?)
                        }
                        ExternalRegionConstraints::NextGen(__binding_0) => {
                            ExternalRegionConstraints::NextGen(::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 {
                    ExternalRegionConstraints::Old(__binding_0) => {
                        ExternalRegionConstraints::Old(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                    ExternalRegionConstraints::NextGen(__binding_0) => {
                        ExternalRegionConstraints::NextGen(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
585#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            ExternalRegionConstraints<I> where
            Vec<(ty::RegionConstraint<I>,
            VisibleForLeakCheck)>: ::rustc_data_structures::stable_hash::StableHash,
            RegionConstraint<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) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    ExternalRegionConstraints::Old(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                    ExternalRegionConstraints::NextGen(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
586pub enum ExternalRegionConstraints<I: Interner> {
587    /// normal region constraints used on stable/when -Znext-solver is used by itself
588    Old(Vec<(ty::RegionConstraint<I>, VisibleForLeakCheck)>),
589    /// new form of region constraints used when `-Zassumptions-on-binders` is enabled.
590    /// supports ORs.
591    NextGen(RegionConstraint<I>),
592}
593
594impl<I: Interner> ExternalRegionConstraints<I> {
595    pub fn is_empty(&self) -> bool {
596        match self {
597            Self::Old(r) => r.is_empty(),
598            Self::NextGen(r) => r.is_true(),
599        }
600    }
601}
602
603/// Additional constraints returned on success.
604#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for ExternalConstraintsData<I> where
    I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            ExternalConstraintsData {
                region_constraints: ref __field_region_constraints,
                opaque_types: ref __field_opaque_types,
                normalization_nested_goals: ref __field_normalization_nested_goals
                } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f,
                        "ExternalConstraintsData");
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "region_constraints", __field_region_constraints);
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "opaque_types", __field_opaque_types);
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "normalization_nested_goals",
                    __field_normalization_nested_goals);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Hash, PartialEq, Debug; I: Interner)]
605#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            ExternalConstraintsData<I> where I: Interner,
            ExternalRegionConstraints<I>: ::rustc_type_ir::TypeVisitable<I>,
            Vec<(ty::OpaqueTypeKey<I>,
            I::Ty)>: ::rustc_type_ir::TypeVisitable<I>,
            NestedNormalizationGoals<I>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    ExternalConstraintsData {
                        region_constraints: ref __binding_0,
                        opaque_types: ref __binding_1,
                        normalization_nested_goals: ref __binding_2 } => {
                        {
                            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);
                                }
                            }
                        }
                        {
                            match ::rustc_type_ir::VisitorResult::branch(::rustc_type_ir::TypeVisitable::visit_with(__binding_2,
                                        __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, GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            ExternalConstraintsData<I> where I: Interner,
            ExternalRegionConstraints<I>: ::rustc_type_ir::TypeFoldable<I>,
            Vec<(ty::OpaqueTypeKey<I>,
            I::Ty)>: ::rustc_type_ir::TypeFoldable<I>,
            NestedNormalizationGoals<I>: ::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 {
                        ExternalConstraintsData {
                            region_constraints: __binding_0,
                            opaque_types: __binding_1,
                            normalization_nested_goals: __binding_2 } => {
                            ExternalConstraintsData {
                                region_constraints: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
                                        __folder)?,
                                opaque_types: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
                                        __folder)?,
                                normalization_nested_goals: ::rustc_type_ir::TypeFoldable::try_fold_with(__binding_2,
                                        __folder)?,
                            }
                        }
                    })
            }
            fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
                __folder: &mut __F) -> Self {
                match self {
                    ExternalConstraintsData {
                        region_constraints: __binding_0,
                        opaque_types: __binding_1,
                        normalization_nested_goals: __binding_2 } => {
                        ExternalConstraintsData {
                            region_constraints: ::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder),
                            opaque_types: ::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
                                __folder),
                            normalization_nested_goals: ::rustc_type_ir::TypeFoldable::fold_with(__binding_2,
                                __folder),
                        }
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
606#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            ExternalConstraintsData<I> where
            ExternalRegionConstraints<I>: ::rustc_data_structures::stable_hash::StableHash,
            Vec<(ty::OpaqueTypeKey<I>,
            I::Ty)>: ::rustc_data_structures::stable_hash::StableHash,
            NestedNormalizationGoals<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 {
                    ExternalConstraintsData {
                        region_constraints: ref __binding_0,
                        opaque_types: ref __binding_1,
                        normalization_nested_goals: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
607pub struct ExternalConstraintsData<I: Interner> {
608    pub region_constraints: ExternalRegionConstraints<I>,
609    pub opaque_types: Vec<(ty::OpaqueTypeKey<I>, I::Ty)>,
610    pub normalization_nested_goals: NestedNormalizationGoals<I>,
611}
612
613impl<I: Interner> Eq for ExternalConstraintsData<I> {}
614
615impl<I: Interner> ExternalConstraintsData<I> {
616    pub fn new(cx: I) -> Self {
617        let region_constraints = match cx.assumptions_on_binders() {
618            true => ExternalRegionConstraints::NextGen(RegionConstraint::new_true()),
619            false => ExternalRegionConstraints::Old(::alloc::vec::Vec::new()vec![]),
620        };
621
622        Self {
623            region_constraints,
624            opaque_types: ::alloc::vec::Vec::new()vec![],
625            normalization_nested_goals: NestedNormalizationGoals::default(),
626        }
627    }
628
629    pub fn is_empty(&self) -> bool {
630        let ExternalConstraintsData {
631            region_constraints,
632            opaque_types,
633            normalization_nested_goals,
634        } = self;
635        region_constraints.is_empty()
636            && opaque_types.is_empty()
637            && normalization_nested_goals.is_empty()
638    }
639}
640
641/// Whether the given region constraint should be considered/ignored for
642/// leak check. In most part of the compiler, this should be `Yes`, except
643/// for applying constraints from the nested goals in next-solver.
644/// `Unreachable` is used in places in which leak check isn't done, e.g.
645/// borrowck.
646#[derive(#[automatically_derived]
impl ::core::clone::Clone for VisibleForLeakCheck {
    #[inline]
    fn clone(&self) -> VisibleForLeakCheck { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for VisibleForLeakCheck { }Copy, #[automatically_derived]
impl ::core::hash::Hash for VisibleForLeakCheck {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for VisibleForLeakCheck {
    #[inline]
    fn eq(&self, other: &VisibleForLeakCheck) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for VisibleForLeakCheck {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for VisibleForLeakCheck {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                VisibleForLeakCheck::Yes => "Yes",
                VisibleForLeakCheck::No => "No",
                VisibleForLeakCheck::Unreachable => "Unreachable",
            })
    }
}Debug)]
647#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            VisibleForLeakCheck {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    VisibleForLeakCheck::Yes => {}
                    VisibleForLeakCheck::No => {}
                    VisibleForLeakCheck::Unreachable => {}
                }
            }
        }
    };StableHash_NoContext))]
648pub enum VisibleForLeakCheck {
649    Yes,
650    No,
651    Unreachable,
652}
653
654impl VisibleForLeakCheck {
655    pub fn and(self, other: VisibleForLeakCheck) -> VisibleForLeakCheck {
656        match (self, other) {
657            // Make sure that we never overwrite that constraints shouldn't
658            // be encountered by the leak checked
659            (VisibleForLeakCheck::Unreachable, _) | (_, VisibleForLeakCheck::Unreachable) => {
660                VisibleForLeakCheck::Unreachable
661            }
662            (VisibleForLeakCheck::No, _) | (_, VisibleForLeakCheck::No) => VisibleForLeakCheck::No,
663            (VisibleForLeakCheck::Yes, VisibleForLeakCheck::Yes) => VisibleForLeakCheck::Yes,
664        }
665    }
666
667    pub fn or(self, other: VisibleForLeakCheck) -> VisibleForLeakCheck {
668        match (self, other) {
669            // Make sure that we never overwrite that constraints shouldn't
670            // be encountered by the leak checked
671            (VisibleForLeakCheck::Unreachable, _) | (_, VisibleForLeakCheck::Unreachable) => {
672                VisibleForLeakCheck::Unreachable
673            }
674            (VisibleForLeakCheck::Yes, _) | (_, VisibleForLeakCheck::Yes) => {
675                VisibleForLeakCheck::Yes
676            }
677            (VisibleForLeakCheck::No, VisibleForLeakCheck::No) => VisibleForLeakCheck::No,
678        }
679    }
680}
681
682#[automatically_derived]
impl<I: Interner> ::core::default::Default for NestedNormalizationGoals<I>
    where I: Interner {
    fn default() -> Self {
        NestedNormalizationGoals(::core::default::Default::default())
    }
}#[derive_where(Clone, Hash, PartialEq, Debug, Default; I: Interner)]
683#[derive(const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
            NestedNormalizationGoals<I> where I: Interner,
            Vec<(GoalSource,
            Goal<I, I::Predicate>)>: ::rustc_type_ir::TypeVisitable<I> {
            fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
                __visitor: &mut __V) -> __V::Result {
                match *self {
                    NestedNormalizationGoals(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, GenericTypeVisitable, const _: () =
    {
        impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for
            NestedNormalizationGoals<I> where I: Interner,
            Vec<(GoalSource,
            Goal<I, I::Predicate>)>: ::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 {
                        NestedNormalizationGoals(__binding_0) => {
                            NestedNormalizationGoals(::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 {
                    NestedNormalizationGoals(__binding_0) => {
                        NestedNormalizationGoals(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
                                __folder))
                    }
                }
            }
        }
    };TypeFoldable_Generic)]
684#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl<I: Interner> ::rustc_data_structures::stable_hash::StableHash for
            NestedNormalizationGoals<I> where
            Vec<(GoalSource,
            Goal<I,
            I::Predicate>)>: ::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 {
                    NestedNormalizationGoals(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
685pub struct NestedNormalizationGoals<I: Interner>(pub Vec<(GoalSource, Goal<I, I::Predicate>)>);
686
687impl<I: Interner> Eq for NestedNormalizationGoals<I> {}
688
689impl<I: Interner> NestedNormalizationGoals<I> {
690    pub fn empty() -> Self {
691        NestedNormalizationGoals(::alloc::vec::Vec::new()vec![])
692    }
693
694    pub fn is_empty(&self) -> bool {
695        self.0.is_empty()
696    }
697}
698
699#[derive(#[automatically_derived]
impl ::core::clone::Clone for Certainty {
    #[inline]
    fn clone(&self) -> Certainty {
        let _: ::core::clone::AssertParamIsClone<MaybeInfo>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for Certainty { }Copy, #[automatically_derived]
impl ::core::hash::Hash for Certainty {
    #[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 {
            Certainty::Maybe(__self_0) =>
                ::core::hash::Hash::hash(__self_0, state),
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for Certainty {
    #[inline]
    fn eq(&self, other: &Certainty) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (Certainty::Maybe(__self_0), Certainty::Maybe(__arg1_0)) =>
                    __self_0 == __arg1_0,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for Certainty {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<MaybeInfo>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for Certainty {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            Certainty::Yes => ::core::fmt::Formatter::write_str(f, "Yes"),
            Certainty::Maybe(__self_0) =>
                ::core::fmt::Formatter::debug_tuple_field1_finish(f, "Maybe",
                    &__self_0),
        }
    }
}Debug)]
700#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for Certainty {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    Certainty::Yes => {}
                    Certainty::Maybe(ref __binding_0) => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash))]
701pub enum Certainty {
702    Yes,
703    Maybe(MaybeInfo),
704}
705
706#[derive(#[automatically_derived]
impl ::core::clone::Clone for MaybeInfo {
    #[inline]
    fn clone(&self) -> MaybeInfo {
        let _: ::core::clone::AssertParamIsClone<MaybeCause>;
        let _: ::core::clone::AssertParamIsClone<OpaqueTypesJank>;
        let _: ::core::clone::AssertParamIsClone<StalledOnCoroutines>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MaybeInfo { }Copy, #[automatically_derived]
impl ::core::hash::Hash for MaybeInfo {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.cause, state);
        ::core::hash::Hash::hash(&self.opaque_types_jank, state);
        ::core::hash::Hash::hash(&self.stalled_on_coroutines, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for MaybeInfo {
    #[inline]
    fn eq(&self, other: &MaybeInfo) -> bool {
        self.cause == other.cause &&
                self.opaque_types_jank == other.opaque_types_jank &&
            self.stalled_on_coroutines == other.stalled_on_coroutines
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MaybeInfo {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<MaybeCause>;
        let _: ::core::cmp::AssertParamIsEq<OpaqueTypesJank>;
        let _: ::core::cmp::AssertParamIsEq<StalledOnCoroutines>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for MaybeInfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "MaybeInfo",
            "cause", &self.cause, "opaque_types_jank",
            &self.opaque_types_jank, "stalled_on_coroutines",
            &&self.stalled_on_coroutines)
    }
}Debug)]
707#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for MaybeInfo {
            #[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 {
                    MaybeInfo {
                        cause: ref __binding_0,
                        opaque_types_jank: ref __binding_1,
                        stalled_on_coroutines: ref __binding_2 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                        { __binding_2.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash_NoContext))]
708pub struct MaybeInfo {
709    pub cause: MaybeCause,
710    pub opaque_types_jank: OpaqueTypesJank,
711    pub stalled_on_coroutines: StalledOnCoroutines,
712}
713
714impl MaybeInfo {
715    pub const AMBIGUOUS: MaybeInfo = MaybeInfo {
716        cause: MaybeCause::Ambiguity,
717        opaque_types_jank: OpaqueTypesJank::AllGood,
718        stalled_on_coroutines: StalledOnCoroutines::No,
719    };
720
721    fn and(self, other: MaybeInfo) -> MaybeInfo {
722        MaybeInfo {
723            cause: self.cause.and(other.cause),
724            opaque_types_jank: self.opaque_types_jank.and(other.opaque_types_jank),
725            stalled_on_coroutines: self.stalled_on_coroutines.and(other.stalled_on_coroutines),
726        }
727    }
728
729    pub fn or(self, other: MaybeInfo) -> MaybeInfo {
730        MaybeInfo {
731            cause: self.cause.or(other.cause),
732            opaque_types_jank: self.opaque_types_jank.or(other.opaque_types_jank),
733            stalled_on_coroutines: self.stalled_on_coroutines.or(other.stalled_on_coroutines),
734        }
735    }
736}
737
738/// Supporting not-yet-defined opaque types in HIR typeck is somewhat
739/// challenging. Ideally we'd normalize them to a new inference variable
740/// and just defer type inference which relies on the opaque until we've
741/// constrained the hidden type.
742///
743/// This doesn't work for method and function calls as we need to guide type
744/// inference for the function arguments. We treat not-yet-defined opaque types
745/// as if they were rigid instead in these places.
746///
747/// When we encounter a `?hidden_type_of_opaque: Trait<?var>` goal, we use the
748/// item bounds and blanket impls to guide inference by constraining other type
749/// variables, see `EvalCtxt::try_assemble_bounds_via_registered_opaques`. We
750/// always keep the certainty as `Maybe` so that we properly prove these goals
751/// once the hidden type has been constrained.
752///
753/// If we fail to prove the trait goal via item bounds or blanket impls, the
754/// goal would have errored if the opaque type were rigid. In this case, we
755/// set `OpaqueTypesJank::ErrorIfRigidSelfTy` in the [Certainty].
756///
757/// Places in HIR typeck where we want to treat not-yet-defined opaque types as if
758/// they were kind of rigid then use `fn root_goal_may_hold_opaque_types_jank` which
759/// returns `false` if the goal doesn't hold or if `OpaqueTypesJank::ErrorIfRigidSelfTy`
760/// is set (i.e. proving it required relies on some `?hidden_ty: NotInItemBounds` goal).
761///
762/// This is subtly different from actually treating not-yet-defined opaque types as
763/// rigid, e.g. it allows constraining opaque types if they are not the self-type of
764/// a goal. It is good enough for now and only matters for very rare type inference
765/// edge cases. We can improve this later on if necessary.
766#[derive(#[automatically_derived]
impl ::core::clone::Clone for OpaqueTypesJank {
    #[inline]
    fn clone(&self) -> OpaqueTypesJank { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for OpaqueTypesJank { }Copy, #[automatically_derived]
impl ::core::hash::Hash for OpaqueTypesJank {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for OpaqueTypesJank {
    #[inline]
    fn eq(&self, other: &OpaqueTypesJank) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for OpaqueTypesJank {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for OpaqueTypesJank {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                OpaqueTypesJank::AllGood => "AllGood",
                OpaqueTypesJank::ErrorIfRigidSelfTy => "ErrorIfRigidSelfTy",
            })
    }
}Debug)]
767#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            OpaqueTypesJank {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    OpaqueTypesJank::AllGood => {}
                    OpaqueTypesJank::ErrorIfRigidSelfTy => {}
                }
            }
        }
    };StableHash))]
768pub enum OpaqueTypesJank {
769    AllGood,
770    ErrorIfRigidSelfTy,
771}
772impl OpaqueTypesJank {
773    fn and(self, other: OpaqueTypesJank) -> OpaqueTypesJank {
774        match (self, other) {
775            (OpaqueTypesJank::AllGood, OpaqueTypesJank::AllGood) => OpaqueTypesJank::AllGood,
776            (OpaqueTypesJank::ErrorIfRigidSelfTy, _) | (_, OpaqueTypesJank::ErrorIfRigidSelfTy) => {
777                OpaqueTypesJank::ErrorIfRigidSelfTy
778            }
779        }
780    }
781
782    pub fn or(self, other: OpaqueTypesJank) -> OpaqueTypesJank {
783        match (self, other) {
784            (OpaqueTypesJank::ErrorIfRigidSelfTy, OpaqueTypesJank::ErrorIfRigidSelfTy) => {
785                OpaqueTypesJank::ErrorIfRigidSelfTy
786            }
787            (OpaqueTypesJank::AllGood, _) | (_, OpaqueTypesJank::AllGood) => {
788                OpaqueTypesJank::AllGood
789            }
790        }
791    }
792}
793
794#[derive(#[automatically_derived]
impl ::core::clone::Clone for StalledOnCoroutines {
    #[inline]
    fn clone(&self) -> StalledOnCoroutines { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for StalledOnCoroutines { }Copy, #[automatically_derived]
impl ::core::hash::Hash for StalledOnCoroutines {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for StalledOnCoroutines {
    #[inline]
    fn eq(&self, other: &StalledOnCoroutines) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for StalledOnCoroutines {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for StalledOnCoroutines {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                StalledOnCoroutines::Yes => "Yes",
                StalledOnCoroutines::No => "No",
            })
    }
}Debug)]
795#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            StalledOnCoroutines {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    StalledOnCoroutines::Yes => {}
                    StalledOnCoroutines::No => {}
                }
            }
        }
    };StableHash_NoContext))]
796pub enum StalledOnCoroutines {
797    Yes,
798    No,
799}
800
801impl StalledOnCoroutines {
802    fn and(self, other: StalledOnCoroutines) -> StalledOnCoroutines {
803        match (self, other) {
804            (StalledOnCoroutines::No, StalledOnCoroutines::No) => StalledOnCoroutines::No,
805            (StalledOnCoroutines::Yes, _) | (_, StalledOnCoroutines::Yes) => {
806                StalledOnCoroutines::Yes
807            }
808        }
809    }
810
811    pub fn or(self, other: StalledOnCoroutines) -> StalledOnCoroutines {
812        // `StalledOnCoroutines::Yes` is contagious: obtaining `Certainty::Maybe`
813        // while a candidate is stalled on a coroutine might have been
814        // `Certainty::Yes` or `NoSolution` if it were not stalled.
815        StalledOnCoroutines::and(self, other)
816    }
817}
818
819impl Certainty {
820    pub const AMBIGUOUS: Certainty = Certainty::Maybe(MaybeInfo::AMBIGUOUS);
821
822    /// Use this function to merge the certainty of multiple nested subgoals.
823    ///
824    /// Given an impl like `impl<T: Foo + Bar> Baz for T {}`, we have 2 nested
825    /// subgoals whenever we use the impl as a candidate: `T: Foo` and `T: Bar`.
826    /// If evaluating `T: Foo` results in ambiguity and `T: Bar` results in
827    /// success, we merge these two responses. This results in ambiguity.
828    ///
829    /// If we unify ambiguity with overflow, we return overflow. This doesn't matter
830    /// inside of the solver as we do not distinguish ambiguity from overflow. It does
831    /// however matter for diagnostics. If `T: Foo` resulted in overflow and `T: Bar`
832    /// in ambiguity without changing the inference state, we still want to tell the
833    /// user that `T: Baz` results in overflow.
834    pub fn and(self, other: Certainty) -> Certainty {
835        match (self, other) {
836            (Certainty::Yes, Certainty::Yes) => Certainty::Yes,
837            (Certainty::Yes, Certainty::Maybe { .. }) => other,
838            (Certainty::Maybe { .. }, Certainty::Yes) => self,
839            (Certainty::Maybe(a_maybe), Certainty::Maybe(b_maybe)) => {
840                Certainty::Maybe(a_maybe.and(b_maybe))
841            }
842        }
843    }
844
845    pub const fn overflow(suggest_increasing_limit: bool) -> Certainty {
846        Certainty::Maybe(MaybeInfo {
847            cause: MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: false },
848            opaque_types_jank: OpaqueTypesJank::AllGood,
849            stalled_on_coroutines: StalledOnCoroutines::No,
850        })
851    }
852
853    pub fn is_yes(&self) -> bool {
854        match self {
855            Certainty::Yes => true,
856            Certainty::Maybe(_) => false,
857        }
858    }
859
860    pub fn is_overflow(&self) -> bool {
861        match self {
862            Certainty::Maybe(MaybeInfo { cause: MaybeCause::Overflow { .. }, .. }) => true,
863            _ => false,
864        }
865    }
866}
867
868/// Why we failed to evaluate a goal.
869#[derive(#[automatically_derived]
impl ::core::clone::Clone for MaybeCause {
    #[inline]
    fn clone(&self) -> MaybeCause {
        let _: ::core::clone::AssertParamIsClone<bool>;
        *self
    }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for MaybeCause { }Copy, #[automatically_derived]
impl ::core::hash::Hash for MaybeCause {
    #[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 {
            MaybeCause::Overflow {
                suggest_increasing_limit: __self_0, keep_constraints: __self_1
                } => {
                ::core::hash::Hash::hash(__self_0, state);
                ::core::hash::Hash::hash(__self_1, state)
            }
            _ => {}
        }
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for MaybeCause {
    #[inline]
    fn eq(&self, other: &MaybeCause) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr &&
            match (self, other) {
                (MaybeCause::Overflow {
                    suggest_increasing_limit: __self_0,
                    keep_constraints: __self_1 }, MaybeCause::Overflow {
                    suggest_increasing_limit: __arg1_0,
                    keep_constraints: __arg1_1 }) =>
                    __self_0 == __arg1_0 && __self_1 == __arg1_1,
                _ => true,
            }
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for MaybeCause {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
    }
}Eq, #[automatically_derived]
impl ::core::fmt::Debug for MaybeCause {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            MaybeCause::Ambiguity =>
                ::core::fmt::Formatter::write_str(f, "Ambiguity"),
            MaybeCause::Overflow {
                suggest_increasing_limit: __self_0, keep_constraints: __self_1
                } =>
                ::core::fmt::Formatter::debug_struct_field2_finish(f,
                    "Overflow", "suggest_increasing_limit", __self_0,
                    "keep_constraints", &__self_1),
        }
    }
}Debug)]
870#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for MaybeCause {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    MaybeCause::Ambiguity => {}
                    MaybeCause::Overflow {
                        suggest_increasing_limit: ref __binding_0,
                        keep_constraints: ref __binding_1 } => {
                        { __binding_0.stable_hash(__hcx, __hasher); }
                        { __binding_1.stable_hash(__hcx, __hasher); }
                    }
                }
            }
        }
    };StableHash))]
871pub enum MaybeCause {
872    /// We failed due to ambiguity. This ambiguity can either
873    /// be a true ambiguity, i.e. there are multiple different answers,
874    /// or we hit a case where we just don't bother, e.g. `?x: Trait` goals.
875    Ambiguity,
876    /// We gave up due to an overflow, most often by hitting the recursion limit.
877    Overflow { suggest_increasing_limit: bool, keep_constraints: bool },
878}
879
880impl MaybeCause {
881    fn and(self, other: MaybeCause) -> MaybeCause {
882        match (self, other) {
883            (MaybeCause::Ambiguity, MaybeCause::Ambiguity) => MaybeCause::Ambiguity,
884            (MaybeCause::Ambiguity, MaybeCause::Overflow { .. }) => other,
885            (MaybeCause::Overflow { .. }, MaybeCause::Ambiguity) => self,
886            (
887                MaybeCause::Overflow {
888                    suggest_increasing_limit: limit_a,
889                    keep_constraints: keep_a,
890                },
891                MaybeCause::Overflow {
892                    suggest_increasing_limit: limit_b,
893                    keep_constraints: keep_b,
894                },
895            ) => MaybeCause::Overflow {
896                suggest_increasing_limit: limit_a && limit_b,
897                keep_constraints: keep_a && keep_b,
898            },
899        }
900    }
901
902    pub fn or(self, other: MaybeCause) -> MaybeCause {
903        match (self, other) {
904            (MaybeCause::Ambiguity, MaybeCause::Ambiguity) => MaybeCause::Ambiguity,
905
906            // When combining ambiguity + overflow, we can keep constraints.
907            (
908                MaybeCause::Ambiguity,
909                MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: _ },
910            ) => MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: true },
911            (
912                MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: _ },
913                MaybeCause::Ambiguity,
914            ) => MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: true },
915
916            (
917                MaybeCause::Overflow {
918                    suggest_increasing_limit: limit_a,
919                    keep_constraints: keep_a,
920                },
921                MaybeCause::Overflow {
922                    suggest_increasing_limit: limit_b,
923                    keep_constraints: keep_b,
924                },
925            ) => MaybeCause::Overflow {
926                suggest_increasing_limit: limit_a || limit_b,
927                keep_constraints: keep_a || keep_b,
928            },
929        }
930    }
931}
932
933/// Indicates that a `impl Drop for Adt` is `const` or not.
934#[derive(#[automatically_derived]
impl ::core::fmt::Debug for AdtDestructorKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                AdtDestructorKind::NotConst => "NotConst",
                AdtDestructorKind::Const => "Const",
            })
    }
}Debug)]
935pub enum AdtDestructorKind {
936    NotConst,
937    Const,
938}
939
940/// Which sizedness trait - `Sized`, `MetaSized`? `PointeeSized` is omitted as it is removed during
941/// lowering.
942#[derive(#[automatically_derived]
impl ::core::marker::Copy for SizedTraitKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for SizedTraitKind {
    #[inline]
    fn clone(&self) -> SizedTraitKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for SizedTraitKind {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f,
            match self {
                SizedTraitKind::Sized => "Sized",
                SizedTraitKind::MetaSized => "MetaSized",
            })
    }
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for SizedTraitKind {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for SizedTraitKind {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        ::core::hash::Hash::hash(&__self_discr, state)
    }
}Hash, #[automatically_derived]
impl ::core::cmp::PartialEq for SizedTraitKind {
    #[inline]
    fn eq(&self, other: &SizedTraitKind) -> bool {
        let __self_discr = ::core::intrinsics::discriminant_value(self);
        let __arg1_discr = ::core::intrinsics::discriminant_value(other);
        __self_discr == __arg1_discr
    }
}PartialEq)]
943#[cfg_attr(feature = "nightly", derive(const _: () =
    {
        impl ::rustc_data_structures::stable_hash::StableHash for
            SizedTraitKind {
            #[inline]
            fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
                __hcx: &mut __Hcx,
                __hasher:
                    &mut ::rustc_data_structures::stable_hash::StableHasher) {
                ::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
                match *self {
                    SizedTraitKind::Sized => {}
                    SizedTraitKind::MetaSized => {}
                }
            }
        }
    };StableHash))]
944pub enum SizedTraitKind {
945    /// `Sized` trait
946    Sized,
947    /// `MetaSized` trait
948    MetaSized,
949}
950
951impl SizedTraitKind {
952    /// Returns `DefId` of corresponding language item.
953    pub fn require_lang_item<I: Interner>(self, cx: I) -> I::TraitId {
954        cx.require_trait_lang_item(match self {
955            SizedTraitKind::Sized => SolverTraitLangItem::Sized,
956            SizedTraitKind::MetaSized => SolverTraitLangItem::MetaSized,
957        })
958    }
959}
960
961#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for SucceededInErased<I> where
    I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            SucceededInErased::Yes {
                accessed_opaques: ref __field_accessed_opaques } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Yes");
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "accessed_opaques", __field_accessed_opaques);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
            SucceededInErased::No =>
                ::core::fmt::Formatter::write_str(__f, "No"),
        }
    }
}#[derive_where(Clone, Debug; I: Interner)]
962pub enum SucceededInErased<I: Interner> {
963    /// This goal previously succeeded in erased mode, which based on `accessed_opaques`
964    /// might make us take a fast path slightly more often.
965    Yes {
966        accessed_opaques: AccessedOpaques<I>,
967    },
968    No,
969}
970
971#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for GoalStalledOnOpaques<I> where
    I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            GoalStalledOnOpaques::No =>
                ::core::fmt::Formatter::write_str(__f, "No"),
            GoalStalledOnOpaques::Yes {
                num_opaques_in_storage: ref __field_num_opaques_in_storage,
                previously_succeeded_in_erased: ref __field_previously_succeeded_in_erased
                } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "Yes");
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "num_opaques_in_storage", __field_num_opaques_in_storage);
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "previously_succeeded_in_erased",
                    __field_previously_succeeded_in_erased);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Debug; I: Interner)]
972pub enum GoalStalledOnOpaques<I: Interner> {
973    /// This goal got stalled in `compute_goal_fast_path`. Usually this means
974    /// the goal is stalled on not that much, only one or two variables, and
975    /// definitely nothing to do with opaque types. So we don't store that information.
976    No,
977    Yes {
978        num_opaques_in_storage: usize,
979        previously_succeeded_in_erased: SucceededInErased<I>,
980    },
981}
982
983/// The conditions that must change for a goal to warrant
984#[automatically_derived]
impl<I: Interner> ::core::fmt::Debug for GoalStalledOn<I> where I: Interner {
    fn fmt(&self, __f: &mut ::core::fmt::Formatter<'_>)
        -> ::core::fmt::Result {
        match self {
            GoalStalledOn {
                stalled_vars: ref __field_stalled_vars,
                sub_roots: ref __field_sub_roots,
                stalled_certainty: ref __field_stalled_certainty,
                opaques: ref __field_opaques } => {
                let mut __builder =
                    ::core::fmt::Formatter::debug_struct(__f, "GoalStalledOn");
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "stalled_vars", __field_stalled_vars);
                ::core::fmt::DebugStruct::field(&mut __builder, "sub_roots",
                    __field_sub_roots);
                ::core::fmt::DebugStruct::field(&mut __builder,
                    "stalled_certainty", __field_stalled_certainty);
                ::core::fmt::DebugStruct::field(&mut __builder, "opaques",
                    __field_opaques);
                ::core::fmt::DebugStruct::finish(&mut __builder)
            }
        }
    }
}#[derive_where(Clone, Debug; I: Interner)]
985pub struct GoalStalledOn<I: Interner> {
986    // `ThinVec` is important for performance. See #160005.
987    pub stalled_vars: ThinVec<I::GenericArg>,
988    // `ThinVec` is important for performance. See #160005.
989    pub sub_roots: ThinVec<TyVid>,
990    /// The certainty that will be returned on subsequent evaluations if this
991    /// goal remains stalled.
992    pub stalled_certainty: Certainty,
993    pub opaques: GoalStalledOnOpaques<I>,
994}
995
996/// For some goals we can trivially answer some questions without going through
997/// canonicalization. There are three options:
998
999#[derive(#[automatically_derived]
impl<I: ::core::clone::Clone + Interner> ::core::clone::Clone for
    ComputeGoalFastPathOutcome<I> {
    #[inline]
    fn clone(&self) -> ComputeGoalFastPathOutcome<I> {
        match self {
            ComputeGoalFastPathOutcome::NoFastPath =>
                ComputeGoalFastPathOutcome::NoFastPath,
            ComputeGoalFastPathOutcome::TriviallyHolds =>
                ComputeGoalFastPathOutcome::TriviallyHolds,
            ComputeGoalFastPathOutcome::TriviallyStalled {
                stalled_on: __self_0 } =>
                ComputeGoalFastPathOutcome::TriviallyStalled {
                    stalled_on: ::core::clone::Clone::clone(__self_0),
                },
        }
    }
}Clone, #[automatically_derived]
impl<I: ::core::fmt::Debug + Interner> ::core::fmt::Debug for
    ComputeGoalFastPathOutcome<I> {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        match self {
            ComputeGoalFastPathOutcome::NoFastPath =>
                ::core::fmt::Formatter::write_str(f, "NoFastPath"),
            ComputeGoalFastPathOutcome::TriviallyHolds =>
                ::core::fmt::Formatter::write_str(f, "TriviallyHolds"),
            ComputeGoalFastPathOutcome::TriviallyStalled {
                stalled_on: __self_0 } =>
                ::core::fmt::Formatter::debug_struct_field1_finish(f,
                    "TriviallyStalled", "stalled_on", &__self_0),
        }
    }
}Debug)]
1000pub enum ComputeGoalFastPathOutcome<I: Interner> {
1001    /// Do not attempt the fast path. Compute as normal.
1002    NoFastPath,
1003    /// The goal trivially holds, immediately produce a result with [`Certainty::Yes`]
1004    TriviallyHolds,
1005    /// The goal is trivially stalled: we know for sure that it makes no sense to compute it right
1006    /// now, but can return information about what its stalled on and when it can be computed for real.
1007    TriviallyStalled { stalled_on: GoalStalledOn<I> },
1008}