1use std::fmt;
2
3use derive_where::derive_where;
4#[cfg(feature = "nightly")]
5use rustc_macros::{Decodable_NoContext, Encodable_NoContext, HashStable_NoContext};
6use rustc_type_ir_macros::{GenericTypeVisitable, TypeFoldable_Generic, TypeVisitable_Generic};
7
8use crate::{self as ty, Interner};
9
10#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for ClauseKind<I> where I: Interner {
#[inline]
fn eq(&self, __other: &Self) -> bool {
if ::core::mem::discriminant(self) ==
::core::mem::discriminant(__other) {
match (self, __other) {
(ClauseKind::Trait(ref __field_0),
ClauseKind::Trait(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::RegionOutlives(ref __field_0),
ClauseKind::RegionOutlives(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::TypeOutlives(ref __field_0),
ClauseKind::TypeOutlives(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::Projection(ref __field_0),
ClauseKind::Projection(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::ConstArgHasType(ref __field_0, ref __field_1),
ClauseKind::ConstArgHasType(ref __other_field_0,
ref __other_field_1)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
::core::cmp::PartialEq::eq(__field_1, __other_field_1),
(ClauseKind::WellFormed(ref __field_0),
ClauseKind::WellFormed(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::ConstEvaluatable(ref __field_0),
ClauseKind::ConstEvaluatable(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::HostEffect(ref __field_0),
ClauseKind::HostEffect(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(ClauseKind::UnstableFeature(ref __field_0),
ClauseKind::UnstableFeature(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
_ => unsafe { ::core::hint::unreachable_unchecked() },
}
} else { false }
}
}#[derive_where(Clone, Copy, Hash, PartialEq; I: Interner)]
13#[derive(const _: () =
{
impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for ClauseKind<I>
where I: Interner,
ty::TraitPredicate<I>: ::rustc_type_ir::TypeVisitable<I>,
ty::OutlivesPredicate<I,
I::Region>: ::rustc_type_ir::TypeVisitable<I>,
ty::OutlivesPredicate<I,
I::Ty>: ::rustc_type_ir::TypeVisitable<I>,
ty::ProjectionPredicate<I>: ::rustc_type_ir::TypeVisitable<I>,
I::Const: ::rustc_type_ir::TypeVisitable<I>,
I::Ty: ::rustc_type_ir::TypeVisitable<I>,
I::Term: ::rustc_type_ir::TypeVisitable<I>,
ty::HostEffectPredicate<I>: ::rustc_type_ir::TypeVisitable<I> {
fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
ClauseKind::Trait(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);
}
}
}
}
ClauseKind::RegionOutlives(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);
}
}
}
}
ClauseKind::TypeOutlives(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);
}
}
}
}
ClauseKind::Projection(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);
}
}
}
}
ClauseKind::ConstArgHasType(ref __binding_0,
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);
}
}
}
}
ClauseKind::WellFormed(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);
}
}
}
}
ClauseKind::ConstEvaluatable(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);
}
}
}
}
ClauseKind::HostEffect(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);
}
}
}
}
ClauseKind::UnstableFeature(..) => {}
}
<__V::Result as ::rustc_type_ir::VisitorResult>::output()
}
}
};TypeVisitable_Generic, GenericTypeVisitable, const _: () =
{
impl<I: Interner> ::rustc_type_ir::TypeFoldable<I> for ClauseKind<I>
where I: Interner,
ty::TraitPredicate<I>: ::rustc_type_ir::TypeFoldable<I>,
ty::OutlivesPredicate<I,
I::Region>: ::rustc_type_ir::TypeFoldable<I>,
ty::OutlivesPredicate<I, I::Ty>: ::rustc_type_ir::TypeFoldable<I>,
ty::ProjectionPredicate<I>: ::rustc_type_ir::TypeFoldable<I>,
I::Const: ::rustc_type_ir::TypeFoldable<I>,
I::Ty: ::rustc_type_ir::TypeFoldable<I>,
I::Term: ::rustc_type_ir::TypeFoldable<I>,
ty::HostEffectPredicate<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 {
ClauseKind::Trait(__binding_0) => {
ClauseKind::Trait(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::RegionOutlives(__binding_0) => {
ClauseKind::RegionOutlives(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::TypeOutlives(__binding_0) => {
ClauseKind::TypeOutlives(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::Projection(__binding_0) => {
ClauseKind::Projection(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::ConstArgHasType(__binding_0, __binding_1) => {
ClauseKind::ConstArgHasType(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
__folder)?)
}
ClauseKind::WellFormed(__binding_0) => {
ClauseKind::WellFormed(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::ConstEvaluatable(__binding_0) => {
ClauseKind::ConstEvaluatable(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::HostEffect(__binding_0) => {
ClauseKind::HostEffect(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ClauseKind::UnstableFeature(__binding_0) => {
ClauseKind::UnstableFeature(__binding_0)
}
})
}
fn fold_with<__F: ::rustc_type_ir::TypeFolder<I>>(self,
__folder: &mut __F) -> Self {
match self {
ClauseKind::Trait(__binding_0) => {
ClauseKind::Trait(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::RegionOutlives(__binding_0) => {
ClauseKind::RegionOutlives(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::TypeOutlives(__binding_0) => {
ClauseKind::TypeOutlives(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::Projection(__binding_0) => {
ClauseKind::Projection(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::ConstArgHasType(__binding_0, __binding_1) => {
ClauseKind::ConstArgHasType(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder),
::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
__folder))
}
ClauseKind::WellFormed(__binding_0) => {
ClauseKind::WellFormed(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::ConstEvaluatable(__binding_0) => {
ClauseKind::ConstEvaluatable(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::HostEffect(__binding_0) => {
ClauseKind::HostEffect(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
ClauseKind::UnstableFeature(__binding_0) => {
ClauseKind::UnstableFeature(__binding_0)
}
}
}
}
};TypeFoldable_Generic)]
14#[cfg_attr(
15 feature = "nightly",
16 derive(const _: () =
{
impl<I: Interner, __E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for ClauseKind<I> where
ty::TraitPredicate<I>: ::rustc_serialize::Encodable<__E>,
ty::OutlivesPredicate<I,
I::Region>: ::rustc_serialize::Encodable<__E>,
ty::OutlivesPredicate<I,
I::Ty>: ::rustc_serialize::Encodable<__E>,
ty::ProjectionPredicate<I>: ::rustc_serialize::Encodable<__E>,
I::Const: ::rustc_serialize::Encodable<__E>,
I::Ty: ::rustc_serialize::Encodable<__E>,
I::Term: ::rustc_serialize::Encodable<__E>,
ty::HostEffectPredicate<I>: ::rustc_serialize::Encodable<__E>,
I::Symbol: ::rustc_serialize::Encodable<__E> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
ClauseKind::Trait(ref __binding_0) => { 0usize }
ClauseKind::RegionOutlives(ref __binding_0) => { 1usize }
ClauseKind::TypeOutlives(ref __binding_0) => { 2usize }
ClauseKind::Projection(ref __binding_0) => { 3usize }
ClauseKind::ConstArgHasType(ref __binding_0,
ref __binding_1) => {
4usize
}
ClauseKind::WellFormed(ref __binding_0) => { 5usize }
ClauseKind::ConstEvaluatable(ref __binding_0) => { 6usize }
ClauseKind::HostEffect(ref __binding_0) => { 7usize }
ClauseKind::UnstableFeature(ref __binding_0) => { 8usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
ClauseKind::Trait(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::RegionOutlives(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::TypeOutlives(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::Projection(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::ConstArgHasType(ref __binding_0,
ref __binding_1) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
ClauseKind::WellFormed(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::ConstEvaluatable(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::HostEffect(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ClauseKind::UnstableFeature(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<I: Interner, __D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for ClauseKind<I> where
ty::TraitPredicate<I>: ::rustc_serialize::Decodable<__D>,
ty::OutlivesPredicate<I,
I::Region>: ::rustc_serialize::Decodable<__D>,
ty::OutlivesPredicate<I,
I::Ty>: ::rustc_serialize::Decodable<__D>,
ty::ProjectionPredicate<I>: ::rustc_serialize::Decodable<__D>,
I::Const: ::rustc_serialize::Decodable<__D>,
I::Ty: ::rustc_serialize::Decodable<__D>,
I::Term: ::rustc_serialize::Decodable<__D>,
ty::HostEffectPredicate<I>: ::rustc_serialize::Decodable<__D>,
I::Symbol: ::rustc_serialize::Decodable<__D> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
ClauseKind::Trait(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
ClauseKind::RegionOutlives(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
ClauseKind::TypeOutlives(::rustc_serialize::Decodable::decode(__decoder))
}
3usize => {
ClauseKind::Projection(::rustc_serialize::Decodable::decode(__decoder))
}
4usize => {
ClauseKind::ConstArgHasType(::rustc_serialize::Decodable::decode(__decoder),
::rustc_serialize::Decodable::decode(__decoder))
}
5usize => {
ClauseKind::WellFormed(::rustc_serialize::Decodable::decode(__decoder))
}
6usize => {
ClauseKind::ConstEvaluatable(::rustc_serialize::Decodable::decode(__decoder))
}
7usize => {
ClauseKind::HostEffect(::rustc_serialize::Decodable::decode(__decoder))
}
8usize => {
ClauseKind::UnstableFeature(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ClauseKind`, expected 0..9, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<I: Interner, __CTX>
::rustc_data_structures::stable_hasher::HashStable<__CTX> for
ClauseKind<I> where
ty::TraitPredicate<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::OutlivesPredicate<I,
I::Region>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::OutlivesPredicate<I,
I::Ty>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::ProjectionPredicate<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Const: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Ty: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Term: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::HostEffectPredicate<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Symbol: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
{
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
ClauseKind::Trait(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::RegionOutlives(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::TypeOutlives(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::Projection(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::ConstArgHasType(ref __binding_0,
ref __binding_1) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
ClauseKind::WellFormed(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::ConstEvaluatable(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::HostEffect(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
ClauseKind::UnstableFeature(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable_NoContext)
17)]
18pub enum ClauseKind<I: Interner> {
19 Trait(ty::TraitPredicate<I>),
23
24 RegionOutlives(ty::OutlivesPredicate<I, I::Region>),
26
27 TypeOutlives(ty::OutlivesPredicate<I, I::Ty>),
29
30 Projection(ty::ProjectionPredicate<I>),
33
34 ConstArgHasType(I::Const, I::Ty),
37
38 WellFormed(I::Term),
40
41 ConstEvaluatable(I::Const),
43
44 HostEffect(ty::HostEffectPredicate<I>),
49
50 UnstableFeature(
52 #[type_foldable(identity)]
53 #[type_visitable(ignore)]
54 I::Symbol,
55 ),
56}
57
58impl<I: Interner> Eq for ClauseKind<I> {}
59
60#[automatically_derived]
impl<I: Interner> ::core::cmp::PartialEq for PredicateKind<I> where
I: Interner {
#[inline]
fn eq(&self, __other: &Self) -> bool {
if ::core::mem::discriminant(self) ==
::core::mem::discriminant(__other) {
match (self, __other) {
(PredicateKind::Clause(ref __field_0),
PredicateKind::Clause(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(PredicateKind::DynCompatible(ref __field_0),
PredicateKind::DynCompatible(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(PredicateKind::Subtype(ref __field_0),
PredicateKind::Subtype(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(PredicateKind::Coerce(ref __field_0),
PredicateKind::Coerce(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(PredicateKind::ConstEquate(ref __field_0, ref __field_1),
PredicateKind::ConstEquate(ref __other_field_0,
ref __other_field_1)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
::core::cmp::PartialEq::eq(__field_1, __other_field_1),
(PredicateKind::NormalizesTo(ref __field_0),
PredicateKind::NormalizesTo(ref __other_field_0)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0),
(PredicateKind::AliasRelate(ref __field_0, ref __field_1,
ref __field_2),
PredicateKind::AliasRelate(ref __other_field_0,
ref __other_field_1, ref __other_field_2)) =>
true &&
::core::cmp::PartialEq::eq(__field_0, __other_field_0) &&
::core::cmp::PartialEq::eq(__field_1, __other_field_1) &&
::core::cmp::PartialEq::eq(__field_2, __other_field_2),
_ => true,
}
} else { false }
}
}#[derive_where(Clone, Copy, Hash, PartialEq; I: Interner)]
61#[derive(const _: () =
{
impl<I: Interner> ::rustc_type_ir::TypeVisitable<I> for
PredicateKind<I> where I: Interner,
ClauseKind<I>: ::rustc_type_ir::TypeVisitable<I>,
I::TraitId: ::rustc_type_ir::TypeVisitable<I>,
ty::SubtypePredicate<I>: ::rustc_type_ir::TypeVisitable<I>,
ty::CoercePredicate<I>: ::rustc_type_ir::TypeVisitable<I>,
I::Const: ::rustc_type_ir::TypeVisitable<I>,
ty::NormalizesTo<I>: ::rustc_type_ir::TypeVisitable<I>,
I::Term: ::rustc_type_ir::TypeVisitable<I> {
fn visit_with<__V: ::rustc_type_ir::TypeVisitor<I>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
PredicateKind::Clause(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);
}
}
}
}
PredicateKind::DynCompatible(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);
}
}
}
}
PredicateKind::Subtype(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);
}
}
}
}
PredicateKind::Coerce(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);
}
}
}
}
PredicateKind::ConstEquate(ref __binding_0, 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);
}
}
}
}
PredicateKind::Ambiguous => {}
PredicateKind::NormalizesTo(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);
}
}
}
}
PredicateKind::AliasRelate(ref __binding_0, ref __binding_1,
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
PredicateKind<I> where I: Interner,
ClauseKind<I>: ::rustc_type_ir::TypeFoldable<I>,
I::TraitId: ::rustc_type_ir::TypeFoldable<I>,
ty::SubtypePredicate<I>: ::rustc_type_ir::TypeFoldable<I>,
ty::CoercePredicate<I>: ::rustc_type_ir::TypeFoldable<I>,
I::Const: ::rustc_type_ir::TypeFoldable<I>,
ty::NormalizesTo<I>: ::rustc_type_ir::TypeFoldable<I>,
I::Term: ::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 {
PredicateKind::Clause(__binding_0) => {
PredicateKind::Clause(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
PredicateKind::DynCompatible(__binding_0) => {
PredicateKind::DynCompatible(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
PredicateKind::Subtype(__binding_0) => {
PredicateKind::Subtype(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
PredicateKind::Coerce(__binding_0) => {
PredicateKind::Coerce(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
PredicateKind::ConstEquate(__binding_0, __binding_1) => {
PredicateKind::ConstEquate(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
__folder)?)
}
PredicateKind::Ambiguous => { PredicateKind::Ambiguous }
PredicateKind::NormalizesTo(__binding_0) => {
PredicateKind::NormalizesTo(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
PredicateKind::AliasRelate(__binding_0, __binding_1,
__binding_2) => {
PredicateKind::AliasRelate(::rustc_type_ir::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
::rustc_type_ir::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
::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 {
PredicateKind::Clause(__binding_0) => {
PredicateKind::Clause(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
PredicateKind::DynCompatible(__binding_0) => {
PredicateKind::DynCompatible(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
PredicateKind::Subtype(__binding_0) => {
PredicateKind::Subtype(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
PredicateKind::Coerce(__binding_0) => {
PredicateKind::Coerce(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
PredicateKind::ConstEquate(__binding_0, __binding_1) => {
PredicateKind::ConstEquate(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder),
::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
__folder))
}
PredicateKind::Ambiguous => { PredicateKind::Ambiguous }
PredicateKind::NormalizesTo(__binding_0) => {
PredicateKind::NormalizesTo(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder))
}
PredicateKind::AliasRelate(__binding_0, __binding_1,
__binding_2) => {
PredicateKind::AliasRelate(::rustc_type_ir::TypeFoldable::fold_with(__binding_0,
__folder),
::rustc_type_ir::TypeFoldable::fold_with(__binding_1,
__folder),
::rustc_type_ir::TypeFoldable::fold_with(__binding_2,
__folder))
}
}
}
}
};TypeFoldable_Generic)]
62#[cfg_attr(
63 feature = "nightly",
64 derive(const _: () =
{
impl<I: Interner, __E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for PredicateKind<I> where
ClauseKind<I>: ::rustc_serialize::Encodable<__E>,
I::TraitId: ::rustc_serialize::Encodable<__E>,
ty::SubtypePredicate<I>: ::rustc_serialize::Encodable<__E>,
ty::CoercePredicate<I>: ::rustc_serialize::Encodable<__E>,
I::Const: ::rustc_serialize::Encodable<__E>,
ty::NormalizesTo<I>: ::rustc_serialize::Encodable<__E>,
I::Term: ::rustc_serialize::Encodable<__E> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
PredicateKind::Clause(ref __binding_0) => { 0usize }
PredicateKind::DynCompatible(ref __binding_0) => { 1usize }
PredicateKind::Subtype(ref __binding_0) => { 2usize }
PredicateKind::Coerce(ref __binding_0) => { 3usize }
PredicateKind::ConstEquate(ref __binding_0, ref __binding_1)
=> {
4usize
}
PredicateKind::Ambiguous => { 5usize }
PredicateKind::NormalizesTo(ref __binding_0) => { 6usize }
PredicateKind::AliasRelate(ref __binding_0, ref __binding_1,
ref __binding_2) => {
7usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
PredicateKind::Clause(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PredicateKind::DynCompatible(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PredicateKind::Subtype(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PredicateKind::Coerce(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PredicateKind::ConstEquate(ref __binding_0, ref __binding_1)
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
PredicateKind::Ambiguous => {}
PredicateKind::NormalizesTo(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
PredicateKind::AliasRelate(ref __binding_0, ref __binding_1,
ref __binding_2) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<I: Interner, __D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for PredicateKind<I> where
ClauseKind<I>: ::rustc_serialize::Decodable<__D>,
I::TraitId: ::rustc_serialize::Decodable<__D>,
ty::SubtypePredicate<I>: ::rustc_serialize::Decodable<__D>,
ty::CoercePredicate<I>: ::rustc_serialize::Decodable<__D>,
I::Const: ::rustc_serialize::Decodable<__D>,
ty::NormalizesTo<I>: ::rustc_serialize::Decodable<__D>,
I::Term: ::rustc_serialize::Decodable<__D> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
PredicateKind::Clause(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => {
PredicateKind::DynCompatible(::rustc_serialize::Decodable::decode(__decoder))
}
2usize => {
PredicateKind::Subtype(::rustc_serialize::Decodable::decode(__decoder))
}
3usize => {
PredicateKind::Coerce(::rustc_serialize::Decodable::decode(__decoder))
}
4usize => {
PredicateKind::ConstEquate(::rustc_serialize::Decodable::decode(__decoder),
::rustc_serialize::Decodable::decode(__decoder))
}
5usize => { PredicateKind::Ambiguous }
6usize => {
PredicateKind::NormalizesTo(::rustc_serialize::Decodable::decode(__decoder))
}
7usize => {
PredicateKind::AliasRelate(::rustc_serialize::Decodable::decode(__decoder),
::rustc_serialize::Decodable::decode(__decoder),
::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `PredicateKind`, expected 0..8, actual {0}",
n));
}
}
}
}
};Decodable_NoContext, const _: () =
{
impl<I: Interner, __CTX>
::rustc_data_structures::stable_hasher::HashStable<__CTX> for
PredicateKind<I> where
ClauseKind<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::TraitId: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::SubtypePredicate<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::CoercePredicate<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Const: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
ty::NormalizesTo<I>: ::rustc_data_structures::stable_hasher::HashStable<__CTX>,
I::Term: ::rustc_data_structures::stable_hasher::HashStable<__CTX>
{
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
PredicateKind::Clause(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
PredicateKind::DynCompatible(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
PredicateKind::Subtype(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
PredicateKind::Coerce(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
PredicateKind::ConstEquate(ref __binding_0, ref __binding_1)
=> {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
}
PredicateKind::Ambiguous => {}
PredicateKind::NormalizesTo(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
PredicateKind::AliasRelate(ref __binding_0, ref __binding_1,
ref __binding_2) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
{ __binding_1.hash_stable(__hcx, __hasher); }
{ __binding_2.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable_NoContext)
65)]
66pub enum PredicateKind<I: Interner> {
67 Clause(ClauseKind<I>),
69
70 DynCompatible(I::TraitId),
72
73 Subtype(ty::SubtypePredicate<I>),
79
80 Coerce(ty::CoercePredicate<I>),
89
90 ConstEquate(I::Const, I::Const),
92
93 Ambiguous,
96
97 NormalizesTo(ty::NormalizesTo<I>),
106
107 AliasRelate(I::Term, I::Term, AliasRelationDirection),
112}
113
114impl<I: Interner> Eq for PredicateKind<I> {}
115
116#[derive(#[automatically_derived]
impl ::core::clone::Clone for AliasRelationDirection {
#[inline]
fn clone(&self) -> AliasRelationDirection { *self }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for AliasRelationDirection {
#[inline]
fn eq(&self, other: &AliasRelationDirection) -> 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 AliasRelationDirection {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialOrd for AliasRelationDirection {
#[inline]
fn partial_cmp(&self, other: &AliasRelationDirection)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr)
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for AliasRelationDirection {
#[inline]
fn cmp(&self, other: &AliasRelationDirection) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr)
}
}Ord, #[automatically_derived]
impl ::core::hash::Hash for AliasRelationDirection {
#[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::fmt::Debug for AliasRelationDirection {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AliasRelationDirection::Equate => "Equate",
AliasRelationDirection::Subtype => "Subtype",
})
}
}Debug, #[automatically_derived]
impl ::core::marker::Copy for AliasRelationDirection { }Copy)]
117#[cfg_attr(
118 feature = "nightly",
119 derive(const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for AliasRelationDirection {
#[inline]
fn hash_stable(&self, __hcx: &mut __CTX,
__hasher:
&mut ::rustc_data_structures::stable_hasher::StableHasher) {
::std::mem::discriminant(self).hash_stable(__hcx, __hasher);
match *self {
AliasRelationDirection::Equate => {}
AliasRelationDirection::Subtype => {}
}
}
}
};HashStable_NoContext, const _: () =
{
impl<__E: ::rustc_serialize::Encoder>
::rustc_serialize::Encodable<__E> for AliasRelationDirection {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
AliasRelationDirection::Equate => { 0usize }
AliasRelationDirection::Subtype => { 1usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
AliasRelationDirection::Equate => {}
AliasRelationDirection::Subtype => {}
}
}
}
};Encodable_NoContext, const _: () =
{
impl<__D: ::rustc_serialize::Decoder>
::rustc_serialize::Decodable<__D> for AliasRelationDirection {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { AliasRelationDirection::Equate }
1usize => { AliasRelationDirection::Subtype }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AliasRelationDirection`, expected 0..2, actual {0}",
n));
}
}
}
}
};Decodable_NoContext)
120)]
121pub enum AliasRelationDirection {
122 Equate,
123 Subtype,
124}
125
126impl std::fmt::Display for AliasRelationDirection {
127 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
128 match self {
129 AliasRelationDirection::Equate => f.write_fmt(format_args!("=="))write!(f, "=="),
130 AliasRelationDirection::Subtype => f.write_fmt(format_args!("<:"))write!(f, "<:"),
131 }
132 }
133}
134
135impl<I: Interner> fmt::Debug for ClauseKind<I> {
136 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
137 match self {
138 ClauseKind::ConstArgHasType(ct, ty) => f.write_fmt(format_args!("ConstArgHasType({0:?}, {1:?})", ct, ty))write!(f, "ConstArgHasType({ct:?}, {ty:?})"),
139 ClauseKind::HostEffect(data) => data.fmt(f),
140 ClauseKind::Trait(a) => a.fmt(f),
141 ClauseKind::RegionOutlives(pair) => pair.fmt(f),
142 ClauseKind::TypeOutlives(pair) => pair.fmt(f),
143 ClauseKind::Projection(pair) => pair.fmt(f),
144 ClauseKind::WellFormed(data) => f.write_fmt(format_args!("WellFormed({0:?})", data))write!(f, "WellFormed({data:?})"),
145 ClauseKind::ConstEvaluatable(ct) => {
146 f.write_fmt(format_args!("ConstEvaluatable({0:?})", ct))write!(f, "ConstEvaluatable({ct:?})")
147 }
148 ClauseKind::UnstableFeature(feature_name) => {
149 f.write_fmt(format_args!("UnstableFeature({0:?})", feature_name))write!(f, "UnstableFeature({feature_name:?})")
150 }
151 }
152 }
153}
154
155impl<I: Interner> fmt::Debug for PredicateKind<I> {
156 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
157 match self {
158 PredicateKind::Clause(a) => a.fmt(f),
159 PredicateKind::Subtype(pair) => pair.fmt(f),
160 PredicateKind::Coerce(pair) => pair.fmt(f),
161 PredicateKind::DynCompatible(trait_def_id) => {
162 f.write_fmt(format_args!("DynCompatible({0:?})", trait_def_id))write!(f, "DynCompatible({trait_def_id:?})")
163 }
164 PredicateKind::ConstEquate(c1, c2) => f.write_fmt(format_args!("ConstEquate({0:?}, {1:?})", c1, c2))write!(f, "ConstEquate({c1:?}, {c2:?})"),
165 PredicateKind::Ambiguous => f.write_fmt(format_args!("Ambiguous"))write!(f, "Ambiguous"),
166 PredicateKind::NormalizesTo(p) => p.fmt(f),
167 PredicateKind::AliasRelate(t1, t2, dir) => {
168 f.write_fmt(format_args!("AliasRelate({0:?}, {1:?}, {2:?})", t1, dir, t2))write!(f, "AliasRelate({t1:?}, {dir:?}, {t2:?})")
169 }
170 }
171 }
172}