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 tracing::debug;
14
15use crate::lang_items::SolverTraitLangItem;
16use crate::search_graph::PathKind;
17use crate::{
18 self as ty, Canonical, CanonicalVarValues, CantBeErased, Interner, TypingMode, Upcast,
19};
20
21pub type CanonicalInput<I, T = <I as Interner>::Predicate> =
22 ty::CanonicalQueryInput<I, QueryInput<I, T>>;
23pub type CanonicalResponse<I> = Canonical<I, Response<I>>;
24pub type QueryResult<I> = Result<CanonicalResponse<I>, NoSolution>;
31pub type QueryResultOrRerunNonErased<I> = Result<CanonicalResponse<I>, NoSolutionOrRerunNonErased>;
32
33#[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)]
34#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for NoSolution
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self { NoSolution => {} }
}
}
};StableHash))]
35pub struct NoSolution;
36
37pub trait RerunResultExt<T> {
38 fn map_err_to_rerun(self) -> Result<Result<T, NoSolution>, RerunNonErased>;
39}
40
41impl<T> RerunResultExt<T> for Result<T, NoSolutionOrRerunNonErased> {
42 fn map_err_to_rerun(self) -> Result<Result<T, NoSolution>, RerunNonErased> {
43 match self {
44 Ok(i) => Ok(Ok(i)),
45 Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution)) => Ok(Err(NoSolution)),
46 Err(NoSolutionOrRerunNonErased::RerunNonErased(e)) => Err(e),
47 }
48 }
49}
50
51#[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)]
58#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
RerunNonErased {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
RerunNonErased(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash))]
59pub struct RerunNonErased(());
60
61#[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)]
62#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
NoSolutionOrRerunNonErased {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
63pub enum NoSolutionOrRerunNonErased {
64 NoSolution(NoSolution),
65 RerunNonErased(RerunNonErased),
66}
67
68impl From<NoSolution> for NoSolutionOrRerunNonErased {
69 fn from(value: NoSolution) -> Self {
70 Self::NoSolution(value)
71 }
72}
73
74impl From<RerunNonErased> for NoSolutionOrRerunNonErased {
75 fn from(value: RerunNonErased) -> Self {
76 Self::RerunNonErased(value)
77 }
78}
79
80#[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)]
81#[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; 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)]
82#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<T: Copy + Debug + Hash + Eq>
::rustc_data_structures::stable_hasher::StableHash for
SmallCopyList<T> where
[T; 1]: ::rustc_data_structures::stable_hasher::StableHash,
[T; 2]: ::rustc_data_structures::stable_hasher::StableHash,
[T; 3]: ::rustc_data_structures::stable_hasher::StableHash {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
83pub enum SmallCopyList<T: Copy + Debug + Hash + Eq> {
84 Empty,
85 One([T; 1]),
86 Two([T; 2]),
87 Three([T; 3]),
88}
89
90impl<T: Copy + Debug + Hash + Eq> SmallCopyList<T> {
91 fn empty() -> Self {
92 Self::Empty
93 }
94
95 fn new(first: T) -> Self {
96 Self::One([first])
97 }
98
99 fn union(self, other: Self) -> Option<Self> {
101 match (self, other) {
102 (Self::Empty, other) | (other, Self::Empty) => Some(other),
103
104 (Self::One([a]), Self::One([b])) if a == b => Some(Self::One([a])),
105 (Self::One([a]), Self::One([b])) => Some(Self::Two([a, b])),
106 (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c]))
107 if a == b && b == c =>
108 {
109 Some(Self::One([a]))
110 }
111 (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if a == b => {
112 Some(Self::Two([a, c]))
113 }
114 (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if a == c => {
115 Some(Self::Two([a, b]))
116 }
117 (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) if b == c => {
118 Some(Self::Two([a, b]))
119 }
120 (Self::One([a]), Self::Two([b, c])) | (Self::Two([a, b]), Self::One([c])) => {
121 Some(Self::Three([a, b, c]))
122 }
123 _ => None,
124 }
125 }
126}
127
128impl<T: Copy + Debug + Hash + Eq> AsRef<[T]> for SmallCopyList<T> {
129 fn as_ref(&self) -> &[T] {
130 match self {
131 Self::Empty => &[],
132 Self::One(l) => l,
133 Self::Two(l) => l,
134 Self::Three(l) => l,
135 }
136 }
137}
138
139#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for RerunCondition<I> where I: Interner { }#[derive_where(Copy, Clone, Debug, Hash, PartialEq, Eq; I: Interner)]
158#[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)]
159#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<I: Interner> ::rustc_data_structures::stable_hasher::StableHash
for RerunCondition<I> where
SmallCopyList<I::LocalDefId>: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
160pub enum RerunCondition<I: Interner> {
161 Never,
162
163 AnyOpaqueHasInferAsHidden,
165 OpaqueInStorage(SmallCopyList<I::LocalDefId>),
167
168 OpaqueInStorageOrAnyOpaqueHasInferAsHidden(SmallCopyList<I::LocalDefId>),
172
173 Always,
174}
175
176impl<I: Interner> RerunCondition<I> {
177 fn merge(self, other: Self) -> Self {
194 let merged = match (self, other) {
195 (Self::Never, other) | (other, Self::Never) => other,
196 (Self::Always, _) | (_, Self::Always) => Self::Always,
197
198 (Self::OpaqueInStorage(a), Self::OpaqueInStorage(b)) => {
199 a.union(b).map(Self::OpaqueInStorage).unwrap_or(Self::Always)
200 }
201 (Self::AnyOpaqueHasInferAsHidden, Self::AnyOpaqueHasInferAsHidden) => {
202 Self::AnyOpaqueHasInferAsHidden
203 }
204 (
205 Self::AnyOpaqueHasInferAsHidden,
206 Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
207 )
208 | (
209 Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
210 Self::AnyOpaqueHasInferAsHidden,
211 ) => Self::OpaqueInStorage(a),
212
213 (
214 Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a),
215 Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b),
216 ) => a
217 .union(b)
218 .map(Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden)
219 .unwrap_or(Self::Always),
220
221 (Self::OpaqueInStorage(a), Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b))
222 | (Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(b), Self::OpaqueInStorage(a)) => a
223 .union(b)
224 .map(Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden)
225 .unwrap_or(Self::Always),
226
227 (Self::OpaqueInStorage(a), Self::AnyOpaqueHasInferAsHidden)
228 | (Self::AnyOpaqueHasInferAsHidden, Self::OpaqueInStorage(a)) => {
229 Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(a)
230 }
231 };
232 {
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:232",
"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(232u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("merging rerun state {0:?} + {1:?} => {2:?}",
self, other, merged) as &dyn Value))])
});
} else { ; }
};debug!("merging rerun state {self:?} + {other:?} => {merged:?}");
233 merged
234 }
235
236 #[must_use]
237 fn should_bail(&self) -> Result<(), RerunNonErased> {
238 match self {
239 Self::Always => Err(RerunNonErased(())),
240 Self::Never
241 | Self::OpaqueInStorage(_)
242 | Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_)
243 | Self::AnyOpaqueHasInferAsHidden => Ok(()),
244 }
245 }
246
247 #[must_use]
250 fn might_rerun(&self) -> bool {
251 match self {
252 Self::Never => false,
253 Self::Always
254 | Self::OpaqueInStorageOrAnyOpaqueHasInferAsHidden(_)
255 | Self::OpaqueInStorage(_)
256 | Self::AnyOpaqueHasInferAsHidden => true,
257 }
258 }
259}
260
261#[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)]
264#[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)]
265#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
RerunReason {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
266pub enum RerunReason {
267 NormalizeOpaqueTypeRemoteCrate,
268 NormalizeOpaqueType,
269 MayUseUnstableFeature,
270 EvaluateConst,
271 SkipErasedAttempt,
272 SelfTyInfer,
273 FetchEligibleAssocItem,
274 AutoTraitLeakage,
275 TryStallCoroutine,
276}
277
278#[automatically_derived]
impl<I: Interner> ::core::cmp::Eq for AccessedOpaques<I> where I: Interner { }#[derive_where(Copy, Clone, Debug, Hash, PartialEq, Eq; I: Interner)]
279#[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)]
280#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<I: Interner> ::rustc_data_structures::stable_hasher::StableHash
for AccessedOpaques<I> where
RerunCondition<I>: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
281pub struct AccessedOpaques<I: Interner> {
282 #[cfg_attr(feature = "nightly", type_visitable(ignore))]
283 #[type_foldable(identity)]
284 pub reason: Option<RerunReason>,
285 pub rerun: RerunCondition<I>,
286}
287
288impl<I: Interner> Default for AccessedOpaques<I> {
289 fn default() -> Self {
290 Self { reason: None, rerun: RerunCondition::Never }
291 }
292}
293
294impl<I: Interner> AccessedOpaques<I> {
295 pub fn update(&mut self, other: Self) -> Result<(), RerunNonErased> {
296 *self = Self {
297 reason: other.reason.or(self.reason),
299 rerun: self.rerun.merge(other.rerun),
301 };
302
303 self.should_bail()
304 }
305
306 #[must_use]
307 pub fn might_rerun(&self) -> bool {
308 self.rerun.might_rerun()
309 }
310
311 #[must_use]
312 pub fn should_bail(&self) -> Result<(), RerunNonErased> {
313 self.rerun.should_bail()
314 }
315
316 pub fn rerun_always(&mut self, reason: RerunReason) -> Result<Infallible, RerunNonErased> {
317 {
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:317",
"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(317u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("set rerun always")
as &dyn Value))])
});
} else { ; }
};debug!("set rerun always");
318 match self.update(AccessedOpaques { reason: Some(reason), rerun: RerunCondition::Always }) {
319 Ok(_) => ::core::panicking::panic("internal error: entered unreachable code")unreachable!(),
320 Err(e) => Err(e),
321 }
322 }
323
324 pub fn rerun_if_in_post_analysis(&mut self, reason: RerunReason) -> Result<(), RerunNonErased> {
325 {
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:325",
"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(325u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("set rerun if post analysis")
as &dyn Value))])
});
} else { ; }
};debug!("set rerun if post analysis");
326 self.update(AccessedOpaques {
327 reason: Some(reason),
328 rerun: RerunCondition::OpaqueInStorage(SmallCopyList::empty()),
329 })
330 }
331
332 pub fn rerun_if_opaque_in_opaque_type_storage(
333 &mut self,
334 reason: RerunReason,
335 defid: I::LocalDefId,
336 ) -> Result<(), RerunNonErased> {
337 {
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:337",
"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(337u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("set rerun if opaque type {0:?} in storage",
defid) as &dyn Value))])
});
} else { ; }
};debug!("set rerun if opaque type {defid:?} in storage");
338 self.update(AccessedOpaques {
339 reason: Some(reason),
340 rerun: RerunCondition::OpaqueInStorage(SmallCopyList::new(defid)),
341 })
342 }
343
344 pub fn rerun_if_any_opaque_has_infer_as_hidden_type(
345 &mut self,
346 reason: RerunReason,
347 ) -> Result<(), RerunNonErased> {
348 {
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:348",
"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(348u32),
::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};
let mut iter = __CALLSITE.metadata().fields().iter();
__CALLSITE.metadata().fields().value_set(&[(&::tracing::__macro_support::Iterator::next(&mut iter).expect("FieldSet corrupted (this is a bug)"),
::tracing::__macro_support::Option::Some(&format_args!("set rerun if any opaque in the storage has a hidden type that is an infer var")
as &dyn Value))])
});
} else { ; }
};debug!("set rerun if any opaque in the storage has a hidden type that is an infer var");
349 self.update(AccessedOpaques {
350 reason: Some(reason),
351 rerun: RerunCondition::AnyOpaqueHasInferAsHidden,
352 })
353 }
354}
355
356#[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)]
362#[derive_where(Copy; I: Interner, P: Copy)]
363#[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, 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 I: Interner, J: Interner,
I::ParamEnv: ::rustc_type_ir::lift::Lift<J, Lifted = J::ParamEnv>,
P: ::rustc_type_ir::lift::Lift<J, Lifted = P> {
type Lifted = Goal<J, P>;
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)]
364#[cfg_attr(
365 feature = "nightly",
366 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_hasher::StableHash for Goal<I, P>
where
I::ParamEnv: ::rustc_data_structures::stable_hasher::StableHash,
P: ::rustc_data_structures::stable_hasher::StableHash {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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)
367)]
368pub struct Goal<I: Interner, P> {
369 pub param_env: I::ParamEnv,
370 pub predicate: P,
371}
372
373impl<I: Interner, P: Eq> Eq for Goal<I, P> {}
374
375impl<I: Interner, P> Goal<I, P> {
376 pub fn new(cx: I, param_env: I::ParamEnv, predicate: impl Upcast<I, P>) -> Goal<I, P> {
377 Goal { param_env, predicate: predicate.upcast(cx) }
378 }
379
380 pub fn with<Q>(self, cx: I, predicate: impl Upcast<I, Q>) -> Goal<I, Q> {
382 Goal { param_env: self.param_env, predicate: predicate.upcast(cx) }
383 }
384}
385
386#[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)]
395#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for GoalSource
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
396pub enum GoalSource {
397 Misc,
398 TypeRelating,
404 ImplWhereBound,
406 AliasBoundConstCondition,
408 AliasWellFormed,
415 NormalizeGoal(PathKind),
421}
422
423#[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>)]
424#[derive_where(Copy; I: Interner, Goal<I, P>: Copy)]
425#[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,
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)]
426#[cfg_attr(
427 feature = "nightly",
428 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_hasher::StableHash for
QueryInput<I, P> where
Goal<I, P>: ::rustc_data_structures::stable_hasher::StableHash,
I::PredefinedOpaques: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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)
429)]
430pub struct QueryInput<I: Interner, P> {
431 pub goal: Goal<I, P>,
432 pub predefined_opaques_in_body: I::PredefinedOpaques,
433}
434
435impl<I: Interner, P: Eq> Eq for QueryInput<I, P> {}
436
437#[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)]
440pub enum CandidatePreferenceMode {
441 Default,
443 Marker,
445}
446
447impl CandidatePreferenceMode {
448 pub fn compute<I: Interner>(cx: I, trait_id: I::TraitId) -> CandidatePreferenceMode {
450 let is_sizedness_or_auto_or_default_goal = cx.is_sizedness_trait(trait_id)
451 || cx.trait_is_auto(trait_id)
452 || cx.is_default_trait(trait_id);
453 if is_sizedness_or_auto_or_default_goal {
454 CandidatePreferenceMode::Marker
455 } else {
456 CandidatePreferenceMode::Default
457 }
458 }
459}
460
461#[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)]
463pub enum CandidateSource<I: Interner> {
464 Impl(I::ImplId),
476 BuiltinImpl(BuiltinImplSource),
484 ParamEnv(ParamEnvSource),
497 AliasBound(AliasBoundKind),
518 CoherenceUnknowable,
523}
524
525impl<I: Interner> Eq for CandidateSource<I> {}
526
527#[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)]
528pub enum ParamEnvSource {
529 NonGlobal,
531 Global,
533}
534
535#[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)]
536#[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)]
537pub enum AliasBoundKind {
538 SelfBounds,
540 NonSelfBounds,
542}
543
544#[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)]
545#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
BuiltinImplSource {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
546pub enum BuiltinImplSource {
547 Trivial,
550 Misc,
553 Object(usize),
555 TraitUpcasting(usize),
559}
560
561#[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)]
562pub enum FetchEligibleAssocItemResponse<I: Interner> {
563 Err(I::ErrorGuaranteed),
564 Found(I::ImplOrTraitAssocTermId),
565 NotFound(TypingMode<I, CantBeErased>),
566 NotFoundBecauseErased,
567}
568
569#[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)]
570#[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)]
571#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<I: Interner> ::rustc_data_structures::stable_hasher::StableHash
for Response<I> where
CanonicalVarValues<I>: ::rustc_data_structures::stable_hasher::StableHash,
I::ExternalConstraints: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
572pub struct Response<I: Interner> {
573 pub certainty: Certainty,
574 pub var_values: CanonicalVarValues<I>,
575 pub external_constraints: I::ExternalConstraints,
577}
578
579impl<I: Interner> Eq for Response<I> {}
580
581#[automatically_derived]
impl<I: Interner> ::core::default::Default for ExternalConstraintsData<I>
where I: Interner {
fn default() -> Self {
ExternalConstraintsData {
region_constraints: ::core::default::Default::default(),
opaque_types: ::core::default::Default::default(),
normalization_nested_goals: ::core::default::Default::default(),
}
}
}#[derive_where(Clone, Hash, PartialEq, Debug, Default; I: Interner)]
583#[derive(const _: () =
{
impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
ExternalConstraintsData<I> where I: Interner,
Vec<(ty::RegionConstraint<I>,
VisibleForLeakCheck)>: ::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,
Vec<(ty::RegionConstraint<I>,
VisibleForLeakCheck)>: ::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)]
584#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<I: Interner> ::rustc_data_structures::stable_hasher::StableHash
for ExternalConstraintsData<I> where
Vec<(ty::RegionConstraint<I>,
VisibleForLeakCheck)>: ::rustc_data_structures::stable_hasher::StableHash,
Vec<(ty::OpaqueTypeKey<I>,
I::Ty)>: ::rustc_data_structures::stable_hasher::StableHash,
NestedNormalizationGoals<I>: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
585pub struct ExternalConstraintsData<I: Interner> {
586 pub region_constraints: Vec<(ty::RegionConstraint<I>, VisibleForLeakCheck)>,
587 pub opaque_types: Vec<(ty::OpaqueTypeKey<I>, I::Ty)>,
588 pub normalization_nested_goals: NestedNormalizationGoals<I>,
589}
590
591impl<I: Interner> Eq for ExternalConstraintsData<I> {}
592
593impl<I: Interner> ExternalConstraintsData<I> {
594 pub fn is_empty(&self) -> bool {
595 self.region_constraints.is_empty()
596 && self.opaque_types.is_empty()
597 && self.normalization_nested_goals.is_empty()
598 }
599}
600
601#[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)]
607#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
VisibleForLeakCheck {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
VisibleForLeakCheck::Yes => {}
VisibleForLeakCheck::No => {}
VisibleForLeakCheck::Unreachable => {}
}
}
}
};StableHash_NoContext))]
608pub enum VisibleForLeakCheck {
609 Yes,
610 No,
611 Unreachable,
612}
613
614impl VisibleForLeakCheck {
615 pub fn and(self, other: VisibleForLeakCheck) -> VisibleForLeakCheck {
616 match (self, other) {
617 (VisibleForLeakCheck::Unreachable, _) | (_, VisibleForLeakCheck::Unreachable) => {
620 VisibleForLeakCheck::Unreachable
621 }
622 (VisibleForLeakCheck::No, _) | (_, VisibleForLeakCheck::No) => VisibleForLeakCheck::No,
623 (VisibleForLeakCheck::Yes, VisibleForLeakCheck::Yes) => VisibleForLeakCheck::Yes,
624 }
625 }
626
627 pub fn or(self, other: VisibleForLeakCheck) -> VisibleForLeakCheck {
628 match (self, other) {
629 (VisibleForLeakCheck::Unreachable, _) | (_, VisibleForLeakCheck::Unreachable) => {
632 VisibleForLeakCheck::Unreachable
633 }
634 (VisibleForLeakCheck::Yes, _) | (_, VisibleForLeakCheck::Yes) => {
635 VisibleForLeakCheck::Yes
636 }
637 (VisibleForLeakCheck::No, VisibleForLeakCheck::No) => VisibleForLeakCheck::No,
638 }
639 }
640}
641
642#[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)]
643#[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)]
644#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<I: Interner> ::rustc_data_structures::stable_hasher::StableHash
for NestedNormalizationGoals<I> where
Vec<(GoalSource,
Goal<I,
I::Predicate>)>: ::rustc_data_structures::stable_hasher::StableHash
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
match *self {
NestedNormalizationGoals(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash_NoContext))]
645pub struct NestedNormalizationGoals<I: Interner>(pub Vec<(GoalSource, Goal<I, I::Predicate>)>);
646
647impl<I: Interner> Eq for NestedNormalizationGoals<I> {}
648
649impl<I: Interner> NestedNormalizationGoals<I> {
650 pub fn empty() -> Self {
651 NestedNormalizationGoals(::alloc::vec::Vec::new()vec![])
652 }
653
654 pub fn is_empty(&self) -> bool {
655 self.0.is_empty()
656 }
657}
658
659#[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)]
660#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for Certainty
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
661pub enum Certainty {
662 Yes,
663 Maybe(MaybeInfo),
664}
665
666#[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)]
667#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for MaybeInfo
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
668pub struct MaybeInfo {
669 pub cause: MaybeCause,
670 pub opaque_types_jank: OpaqueTypesJank,
671 pub stalled_on_coroutines: StalledOnCoroutines,
672}
673
674impl MaybeInfo {
675 pub const AMBIGUOUS: MaybeInfo = MaybeInfo {
676 cause: MaybeCause::Ambiguity,
677 opaque_types_jank: OpaqueTypesJank::AllGood,
678 stalled_on_coroutines: StalledOnCoroutines::No,
679 };
680
681 fn and(self, other: MaybeInfo) -> MaybeInfo {
682 MaybeInfo {
683 cause: self.cause.and(other.cause),
684 opaque_types_jank: self.opaque_types_jank.and(other.opaque_types_jank),
685 stalled_on_coroutines: self.stalled_on_coroutines.and(other.stalled_on_coroutines),
686 }
687 }
688
689 pub fn or(self, other: MaybeInfo) -> MaybeInfo {
690 MaybeInfo {
691 cause: self.cause.or(other.cause),
692 opaque_types_jank: self.opaque_types_jank.or(other.opaque_types_jank),
693 stalled_on_coroutines: self.stalled_on_coroutines.or(other.stalled_on_coroutines),
694 }
695 }
696}
697
698#[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)]
727#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
OpaqueTypesJank {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
OpaqueTypesJank::AllGood => {}
OpaqueTypesJank::ErrorIfRigidSelfTy => {}
}
}
}
};StableHash))]
728pub enum OpaqueTypesJank {
729 AllGood,
730 ErrorIfRigidSelfTy,
731}
732impl OpaqueTypesJank {
733 fn and(self, other: OpaqueTypesJank) -> OpaqueTypesJank {
734 match (self, other) {
735 (OpaqueTypesJank::AllGood, OpaqueTypesJank::AllGood) => OpaqueTypesJank::AllGood,
736 (OpaqueTypesJank::ErrorIfRigidSelfTy, _) | (_, OpaqueTypesJank::ErrorIfRigidSelfTy) => {
737 OpaqueTypesJank::ErrorIfRigidSelfTy
738 }
739 }
740 }
741
742 pub fn or(self, other: OpaqueTypesJank) -> OpaqueTypesJank {
743 match (self, other) {
744 (OpaqueTypesJank::ErrorIfRigidSelfTy, OpaqueTypesJank::ErrorIfRigidSelfTy) => {
745 OpaqueTypesJank::ErrorIfRigidSelfTy
746 }
747 (OpaqueTypesJank::AllGood, _) | (_, OpaqueTypesJank::AllGood) => {
748 OpaqueTypesJank::AllGood
749 }
750 }
751 }
752}
753
754#[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)]
755#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
StalledOnCoroutines {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
StalledOnCoroutines::Yes => {}
StalledOnCoroutines::No => {}
}
}
}
};StableHash_NoContext))]
756pub enum StalledOnCoroutines {
757 Yes,
758 No,
759}
760
761impl StalledOnCoroutines {
762 fn and(self, other: StalledOnCoroutines) -> StalledOnCoroutines {
763 match (self, other) {
764 (StalledOnCoroutines::No, StalledOnCoroutines::No) => StalledOnCoroutines::No,
765 (StalledOnCoroutines::Yes, _) | (_, StalledOnCoroutines::Yes) => {
766 StalledOnCoroutines::Yes
767 }
768 }
769 }
770
771 pub fn or(self, other: StalledOnCoroutines) -> StalledOnCoroutines {
772 StalledOnCoroutines::and(self, other)
776 }
777}
778
779impl Certainty {
780 pub const AMBIGUOUS: Certainty = Certainty::Maybe(MaybeInfo::AMBIGUOUS);
781
782 pub fn and(self, other: Certainty) -> Certainty {
795 match (self, other) {
796 (Certainty::Yes, Certainty::Yes) => Certainty::Yes,
797 (Certainty::Yes, Certainty::Maybe { .. }) => other,
798 (Certainty::Maybe { .. }, Certainty::Yes) => self,
799 (Certainty::Maybe(a_maybe), Certainty::Maybe(b_maybe)) => {
800 Certainty::Maybe(a_maybe.and(b_maybe))
801 }
802 }
803 }
804
805 pub const fn overflow(suggest_increasing_limit: bool) -> Certainty {
806 Certainty::Maybe(MaybeInfo {
807 cause: MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: false },
808 opaque_types_jank: OpaqueTypesJank::AllGood,
809 stalled_on_coroutines: StalledOnCoroutines::No,
810 })
811 }
812}
813
814#[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)]
816#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for MaybeCause
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::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))]
817pub enum MaybeCause {
818 Ambiguity,
822 Overflow { suggest_increasing_limit: bool, keep_constraints: bool },
824}
825
826impl MaybeCause {
827 fn and(self, other: MaybeCause) -> MaybeCause {
828 match (self, other) {
829 (MaybeCause::Ambiguity, MaybeCause::Ambiguity) => MaybeCause::Ambiguity,
830 (MaybeCause::Ambiguity, MaybeCause::Overflow { .. }) => other,
831 (MaybeCause::Overflow { .. }, MaybeCause::Ambiguity) => self,
832 (
833 MaybeCause::Overflow {
834 suggest_increasing_limit: limit_a,
835 keep_constraints: keep_a,
836 },
837 MaybeCause::Overflow {
838 suggest_increasing_limit: limit_b,
839 keep_constraints: keep_b,
840 },
841 ) => MaybeCause::Overflow {
842 suggest_increasing_limit: limit_a && limit_b,
843 keep_constraints: keep_a && keep_b,
844 },
845 }
846 }
847
848 pub fn or(self, other: MaybeCause) -> MaybeCause {
849 match (self, other) {
850 (MaybeCause::Ambiguity, MaybeCause::Ambiguity) => MaybeCause::Ambiguity,
851
852 (
854 MaybeCause::Ambiguity,
855 MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: _ },
856 ) => MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: true },
857 (
858 MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: _ },
859 MaybeCause::Ambiguity,
860 ) => MaybeCause::Overflow { suggest_increasing_limit, keep_constraints: true },
861
862 (
863 MaybeCause::Overflow {
864 suggest_increasing_limit: limit_a,
865 keep_constraints: keep_a,
866 },
867 MaybeCause::Overflow {
868 suggest_increasing_limit: limit_b,
869 keep_constraints: keep_b,
870 },
871 ) => MaybeCause::Overflow {
872 suggest_increasing_limit: limit_a || limit_b,
873 keep_constraints: keep_a || keep_b,
874 },
875 }
876 }
877}
878
879#[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)]
881pub enum AdtDestructorKind {
882 NotConst,
883 Const,
884}
885
886#[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)]
889#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl ::rustc_data_structures::stable_hasher::StableHash for
SizedTraitKind {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hasher::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
SizedTraitKind::Sized => {}
SizedTraitKind::MetaSized => {}
}
}
}
};StableHash))]
890pub enum SizedTraitKind {
891 Sized,
893 MetaSized,
895}
896
897impl SizedTraitKind {
898 pub fn require_lang_item<I: Interner>(self, cx: I) -> I::TraitId {
900 cx.require_trait_lang_item(match self {
901 SizedTraitKind::Sized => SolverTraitLangItem::Sized,
902 SizedTraitKind::MetaSized => SolverTraitLangItem::MetaSized,
903 })
904 }
905}