1use std::fmt::{self, Debug};
4
5use rustc_abi::{FieldIdx, VariantIdx};
6use rustc_errors::ErrorGuaranteed;
7use rustc_index::IndexVec;
8use rustc_index::bit_set::BitMatrix;
9use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
10use rustc_span::{Span, Symbol};
11
12use super::{ConstValue, SourceInfo};
13use crate::ty::{self, CoroutineArgsExt, Ty};
14
15impl ::std::fmt::Debug for CoroutineSavedLocal {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("_s{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
16 #[stable_hash]
17 #[encodable]
18 #[debug_format = "_s{}"]
19 pub struct CoroutineSavedLocal {}
20}
21
22#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineSavedTy<'tcx> {
#[inline]
fn clone(&self) -> CoroutineSavedTy<'tcx> {
CoroutineSavedTy {
ty: ::core::clone::Clone::clone(&self.ty),
source_info: ::core::clone::Clone::clone(&self.source_info),
ignore_for_traits: ::core::clone::Clone::clone(&self.ignore_for_traits),
debuginfo_name: ::core::clone::Clone::clone(&self.debuginfo_name),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for CoroutineSavedTy<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f,
"CoroutineSavedTy", "ty", &self.ty, "source_info",
&self.source_info, "ignore_for_traits", &self.ignore_for_traits,
"debuginfo_name", &&self.debuginfo_name)
}
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for CoroutineSavedTy<'tcx> {
#[inline]
fn eq(&self, other: &CoroutineSavedTy<'tcx>) -> bool {
self.ignore_for_traits == other.ignore_for_traits &&
self.ty == other.ty && self.source_info == other.source_info
&& self.debuginfo_name == other.debuginfo_name
}
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for CoroutineSavedTy<'tcx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<Ty<'tcx>>;
let _: ::core::cmp::AssertParamIsEq<SourceInfo>;
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Option<Symbol>>;
}
}Eq)]
23#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for CoroutineSavedTy<'tcx> {
fn encode(&self, __encoder: &mut __E) {
match *self {
CoroutineSavedTy {
ty: ref __binding_0,
source_info: ref __binding_1,
ignore_for_traits: ref __binding_2,
debuginfo_name: ref __binding_3 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for CoroutineSavedTy<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
CoroutineSavedTy {
ty: ::rustc_serialize::Decodable::decode(__decoder),
source_info: ::rustc_serialize::Decodable::decode(__decoder),
ignore_for_traits: ::rustc_serialize::Decodable::decode(__decoder),
debuginfo_name: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
CoroutineSavedTy<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
CoroutineSavedTy {
ty: ref __binding_0,
source_info: ref __binding_1,
ignore_for_traits: ref __binding_2,
debuginfo_name: ref __binding_3 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineSavedTy<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
CoroutineSavedTy {
ty: __binding_0,
source_info: __binding_1,
ignore_for_traits: __binding_2,
debuginfo_name: __binding_3 } => {
CoroutineSavedTy {
ty: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
ignore_for_traits: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
debuginfo_name: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_3,
__folder)?,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
CoroutineSavedTy {
ty: __binding_0,
source_info: __binding_1,
ignore_for_traits: __binding_2,
debuginfo_name: __binding_3 } => {
CoroutineSavedTy {
ty: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
ignore_for_traits: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
debuginfo_name: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_3,
__folder),
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineSavedTy<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
CoroutineSavedTy {
ty: ref __binding_0,
source_info: ref __binding_1,
ignore_for_traits: ref __binding_2,
debuginfo_name: ref __binding_3 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_3,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
24pub struct CoroutineSavedTy<'tcx> {
25 pub ty: Ty<'tcx>,
26 pub source_info: SourceInfo,
28 pub ignore_for_traits: bool,
30 pub debuginfo_name: Option<Symbol>,
32}
33
34#[derive(#[automatically_derived]
impl<'tcx> ::core::clone::Clone for CoroutineLayout<'tcx> {
#[inline]
fn clone(&self) -> CoroutineLayout<'tcx> {
CoroutineLayout {
field_tys: ::core::clone::Clone::clone(&self.field_tys),
variant_fields: ::core::clone::Clone::clone(&self.variant_fields),
variant_source_info: ::core::clone::Clone::clone(&self.variant_source_info),
storage_conflicts: ::core::clone::Clone::clone(&self.storage_conflicts),
}
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for CoroutineLayout<'tcx> {
#[inline]
fn eq(&self, other: &CoroutineLayout<'tcx>) -> bool {
self.field_tys == other.field_tys &&
self.variant_fields == other.variant_fields &&
self.variant_source_info == other.variant_source_info &&
self.storage_conflicts == other.storage_conflicts
}
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for CoroutineLayout<'tcx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _:
::core::cmp::AssertParamIsEq<IndexVec<CoroutineSavedLocal,
CoroutineSavedTy<'tcx>>>;
let _:
::core::cmp::AssertParamIsEq<IndexVec<VariantIdx,
IndexVec<FieldIdx, CoroutineSavedLocal>>>;
let _: ::core::cmp::AssertParamIsEq<IndexVec<VariantIdx, SourceInfo>>;
let _:
::core::cmp::AssertParamIsEq<BitMatrix<CoroutineSavedLocal,
CoroutineSavedLocal>>;
}
}Eq)]
36#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for CoroutineLayout<'tcx> {
fn encode(&self, __encoder: &mut __E) {
match *self {
CoroutineLayout {
field_tys: ref __binding_0,
variant_fields: ref __binding_1,
variant_source_info: ref __binding_2,
storage_conflicts: ref __binding_3 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for CoroutineLayout<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
CoroutineLayout {
field_tys: ::rustc_serialize::Decodable::decode(__decoder),
variant_fields: ::rustc_serialize::Decodable::decode(__decoder),
variant_source_info: ::rustc_serialize::Decodable::decode(__decoder),
storage_conflicts: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
CoroutineLayout<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
CoroutineLayout {
field_tys: ref __binding_0,
variant_fields: ref __binding_1,
variant_source_info: ref __binding_2,
storage_conflicts: ref __binding_3 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineLayout<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
CoroutineLayout {
field_tys: __binding_0,
variant_fields: __binding_1,
variant_source_info: __binding_2,
storage_conflicts: __binding_3 } => {
CoroutineLayout {
field_tys: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
variant_fields: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
variant_source_info: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
storage_conflicts: __binding_3,
}
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
CoroutineLayout {
field_tys: __binding_0,
variant_fields: __binding_1,
variant_source_info: __binding_2,
storage_conflicts: __binding_3 } => {
CoroutineLayout {
field_tys: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
variant_fields: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
variant_source_info: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
storage_conflicts: __binding_3,
}
}
}
}
}
};TypeFoldable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for CoroutineLayout<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
CoroutineLayout {
field_tys: ref __binding_0,
variant_fields: ref __binding_1,
variant_source_info: ref __binding_2, .. } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable)]
37pub struct CoroutineLayout<'tcx> {
38 pub field_tys: IndexVec<CoroutineSavedLocal, CoroutineSavedTy<'tcx>>,
40
41 pub variant_fields: IndexVec<VariantIdx, IndexVec<FieldIdx, CoroutineSavedLocal>>,
44
45 pub variant_source_info: IndexVec<VariantIdx, SourceInfo>,
48
49 #[type_foldable(identity)]
53 #[type_visitable(ignore)]
54 pub storage_conflicts: BitMatrix<CoroutineSavedLocal, CoroutineSavedLocal>,
55}
56
57impl Debug for CoroutineLayout<'_> {
58 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
59 fmt.debug_struct("CoroutineLayout")
60 .field_with("field_tys", |fmt| {
61 fmt.debug_map().entries(self.field_tys.iter_enumerated()).finish()
62 })
63 .field_with("variant_fields", |fmt| {
64 let mut map = fmt.debug_map();
65 for (idx, fields) in self.variant_fields.iter_enumerated() {
66 map.key_with(|fmt| {
67 let variant_name = ty::CoroutineArgs::variant_name(idx);
68 if fmt.alternate() {
69 fmt.write_fmt(format_args!("{0:9}({1:?})", variant_name, idx))write!(fmt, "{variant_name:9}({idx:?})")
70 } else {
71 fmt.write_fmt(format_args!("{0}", variant_name))write!(fmt, "{variant_name}")
72 }
73 });
74 map.value_with(|fmt| fmt.write_fmt(format_args!("{0:?}", fields))write!(fmt, "{fields:?}"));
76 }
77 map.finish()
78 })
79 .field("storage_conflicts", &self.storage_conflicts)
80 .finish()
81 }
82}
83
84#[derive(#[automatically_derived]
impl ::core::clone::Clone for ConstQualifs {
#[inline]
fn clone(&self) -> ConstQualifs {
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Option<ErrorGuaranteed>>;
*self
}
}Clone, #[automatically_derived]
impl ::core::marker::Copy for ConstQualifs { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for ConstQualifs {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field4_finish(f, "ConstQualifs",
"has_mut_interior", &self.has_mut_interior, "needs_drop",
&self.needs_drop, "needs_non_const_drop",
&self.needs_non_const_drop, "tainted_by_errors",
&&self.tainted_by_errors)
}
}Debug, #[automatically_derived]
impl ::core::default::Default for ConstQualifs {
#[inline]
fn default() -> ConstQualifs {
ConstQualifs {
has_mut_interior: ::core::default::Default::default(),
needs_drop: ::core::default::Default::default(),
needs_non_const_drop: ::core::default::Default::default(),
tainted_by_errors: ::core::default::Default::default(),
}
}
}Default, const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for ConstQualifs {
fn encode(&self, __encoder: &mut __E) {
match *self {
ConstQualifs {
has_mut_interior: ref __binding_0,
needs_drop: ref __binding_1,
needs_non_const_drop: ref __binding_2,
tainted_by_errors: ref __binding_3 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for ConstQualifs {
fn decode(__decoder: &mut __D) -> Self {
ConstQualifs {
has_mut_interior: ::rustc_serialize::Decodable::decode(__decoder),
needs_drop: ::rustc_serialize::Decodable::decode(__decoder),
needs_non_const_drop: ::rustc_serialize::Decodable::decode(__decoder),
tainted_by_errors: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for ConstQualifs
{
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
ConstQualifs {
has_mut_interior: ref __binding_0,
needs_drop: ref __binding_1,
needs_non_const_drop: ref __binding_2,
tainted_by_errors: ref __binding_3 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
{ __binding_3.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
90pub struct ConstQualifs {
91 pub has_mut_interior: bool,
92 pub needs_drop: bool,
93 pub needs_non_const_drop: bool,
94 pub tainted_by_errors: Option<ErrorGuaranteed>,
95}
96#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for ConstraintCategory<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for ConstraintCategory<'tcx> {
#[inline]
fn clone(&self) -> ConstraintCategory<'tcx> {
let _: ::core::clone::AssertParamIsClone<ReturnConstraint>;
let _: ::core::clone::AssertParamIsClone<AnnotationSource>;
let _: ::core::clone::AssertParamIsClone<bool>;
let _: ::core::clone::AssertParamIsClone<Option<Ty<'tcx>>>;
let _: ::core::clone::AssertParamIsClone<Option<Ty<'tcx>>>;
let _: ::core::clone::AssertParamIsClone<FieldIdx>;
let _: ::core::clone::AssertParamIsClone<Span>;
let _: ::core::clone::AssertParamIsClone<ty::RegionVid>;
*self
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for ConstraintCategory<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ConstraintCategory::Return(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Return",
&__self_0),
ConstraintCategory::Yield =>
::core::fmt::Formatter::write_str(f, "Yield"),
ConstraintCategory::UseAsConst =>
::core::fmt::Formatter::write_str(f, "UseAsConst"),
ConstraintCategory::UseAsStatic =>
::core::fmt::Formatter::write_str(f, "UseAsStatic"),
ConstraintCategory::TypeAnnotation(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"TypeAnnotation", &__self_0),
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __self_0,
is_implicit_coercion: __self_1,
unsize_to: __self_2 } =>
::core::fmt::Formatter::debug_struct_field3_finish(f, "Cast",
"is_raw_ptr_dyn_type_cast", __self_0,
"is_implicit_coercion", __self_1, "unsize_to", &__self_2),
ConstraintCategory::CallArgument(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"CallArgument", &__self_0),
ConstraintCategory::CopyBound =>
::core::fmt::Formatter::write_str(f, "CopyBound"),
ConstraintCategory::SizedBound =>
::core::fmt::Formatter::write_str(f, "SizedBound"),
ConstraintCategory::Assignment =>
::core::fmt::Formatter::write_str(f, "Assignment"),
ConstraintCategory::Usage =>
::core::fmt::Formatter::write_str(f, "Usage"),
ConstraintCategory::OpaqueType =>
::core::fmt::Formatter::write_str(f, "OpaqueType"),
ConstraintCategory::ClosureUpvar(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ClosureUpvar", &__self_0),
ConstraintCategory::Predicate(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Predicate", &__self_0),
ConstraintCategory::Boring =>
::core::fmt::Formatter::write_str(f, "Boring"),
ConstraintCategory::BoringNoLocation =>
::core::fmt::Formatter::write_str(f, "BoringNoLocation"),
ConstraintCategory::Internal =>
::core::fmt::Formatter::write_str(f, "Internal"),
ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"OutlivesUnnameablePlaceholder", &__self_0),
ConstraintCategory::SolverRegionConstraint(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"SolverRegionConstraint", &__self_0),
}
}
}Debug, #[automatically_derived]
impl<'tcx> ::core::cmp::Eq for ConstraintCategory<'tcx> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<ReturnConstraint>;
let _: ::core::cmp::AssertParamIsEq<AnnotationSource>;
let _: ::core::cmp::AssertParamIsEq<bool>;
let _: ::core::cmp::AssertParamIsEq<Option<Ty<'tcx>>>;
let _: ::core::cmp::AssertParamIsEq<Option<Ty<'tcx>>>;
let _: ::core::cmp::AssertParamIsEq<FieldIdx>;
let _: ::core::cmp::AssertParamIsEq<Span>;
let _: ::core::cmp::AssertParamIsEq<ty::RegionVid>;
}
}Eq, #[automatically_derived]
impl<'tcx> ::core::cmp::PartialEq for ConstraintCategory<'tcx> {
#[inline]
fn eq(&self, other: &ConstraintCategory<'tcx>) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(ConstraintCategory::Return(__self_0),
ConstraintCategory::Return(__arg1_0)) =>
__self_0 == __arg1_0,
(ConstraintCategory::TypeAnnotation(__self_0),
ConstraintCategory::TypeAnnotation(__arg1_0)) =>
__self_0 == __arg1_0,
(ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __self_0,
is_implicit_coercion: __self_1,
unsize_to: __self_2 }, ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __arg1_0,
is_implicit_coercion: __arg1_1,
unsize_to: __arg1_2 }) =>
__self_0 == __arg1_0 && __self_1 == __arg1_1 &&
__self_2 == __arg1_2,
(ConstraintCategory::CallArgument(__self_0),
ConstraintCategory::CallArgument(__arg1_0)) =>
__self_0 == __arg1_0,
(ConstraintCategory::ClosureUpvar(__self_0),
ConstraintCategory::ClosureUpvar(__arg1_0)) =>
__self_0 == __arg1_0,
(ConstraintCategory::Predicate(__self_0),
ConstraintCategory::Predicate(__arg1_0)) =>
__self_0 == __arg1_0,
(ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0),
ConstraintCategory::OutlivesUnnameablePlaceholder(__arg1_0))
=> __self_0 == __arg1_0,
(ConstraintCategory::SolverRegionConstraint(__self_0),
ConstraintCategory::SolverRegionConstraint(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl<'tcx> ::core::hash::Hash for ConstraintCategory<'tcx> {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
ConstraintCategory::Return(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::TypeAnnotation(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __self_0,
is_implicit_coercion: __self_1,
unsize_to: __self_2 } => {
::core::hash::Hash::hash(__self_0, state);
::core::hash::Hash::hash(__self_1, state);
::core::hash::Hash::hash(__self_2, state)
}
ConstraintCategory::CallArgument(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::ClosureUpvar(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::Predicate(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::OutlivesUnnameablePlaceholder(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
ConstraintCategory::SolverRegionConstraint(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash)]
102#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for ConstraintCategory<'tcx> {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
ConstraintCategory::Return(ref __binding_0) => { 0usize }
ConstraintCategory::Yield => { 1usize }
ConstraintCategory::UseAsConst => { 2usize }
ConstraintCategory::UseAsStatic => { 3usize }
ConstraintCategory::TypeAnnotation(ref __binding_0) => {
4usize
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ref __binding_0,
is_implicit_coercion: ref __binding_1,
unsize_to: ref __binding_2 } => {
5usize
}
ConstraintCategory::CallArgument(ref __binding_0) => {
6usize
}
ConstraintCategory::CopyBound => { 7usize }
ConstraintCategory::SizedBound => { 8usize }
ConstraintCategory::Assignment => { 9usize }
ConstraintCategory::Usage => { 10usize }
ConstraintCategory::OpaqueType => { 11usize }
ConstraintCategory::ClosureUpvar(ref __binding_0) => {
12usize
}
ConstraintCategory::Predicate(ref __binding_0) => {
13usize
}
ConstraintCategory::Boring => { 14usize }
ConstraintCategory::BoringNoLocation => { 15usize }
ConstraintCategory::Internal => { 16usize }
ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
=> {
17usize
}
ConstraintCategory::SolverRegionConstraint(ref __binding_0)
=> {
18usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
ConstraintCategory::Return(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::Yield => {}
ConstraintCategory::UseAsConst => {}
ConstraintCategory::UseAsStatic => {}
ConstraintCategory::TypeAnnotation(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ref __binding_0,
is_implicit_coercion: ref __binding_1,
unsize_to: ref __binding_2 } => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
}
ConstraintCategory::CallArgument(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::CopyBound => {}
ConstraintCategory::SizedBound => {}
ConstraintCategory::Assignment => {}
ConstraintCategory::Usage => {}
ConstraintCategory::OpaqueType => {}
ConstraintCategory::ClosureUpvar(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::Predicate(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::Boring => {}
ConstraintCategory::BoringNoLocation => {}
ConstraintCategory::Internal => {}
ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
ConstraintCategory::SolverRegionConstraint(ref __binding_0)
=> {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for ConstraintCategory<'tcx> {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
ConstraintCategory::Return(::rustc_serialize::Decodable::decode(__decoder))
}
1usize => { ConstraintCategory::Yield }
2usize => { ConstraintCategory::UseAsConst }
3usize => { ConstraintCategory::UseAsStatic }
4usize => {
ConstraintCategory::TypeAnnotation(::rustc_serialize::Decodable::decode(__decoder))
}
5usize => {
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ::rustc_serialize::Decodable::decode(__decoder),
is_implicit_coercion: ::rustc_serialize::Decodable::decode(__decoder),
unsize_to: ::rustc_serialize::Decodable::decode(__decoder),
}
}
6usize => {
ConstraintCategory::CallArgument(::rustc_serialize::Decodable::decode(__decoder))
}
7usize => { ConstraintCategory::CopyBound }
8usize => { ConstraintCategory::SizedBound }
9usize => { ConstraintCategory::Assignment }
10usize => { ConstraintCategory::Usage }
11usize => { ConstraintCategory::OpaqueType }
12usize => {
ConstraintCategory::ClosureUpvar(::rustc_serialize::Decodable::decode(__decoder))
}
13usize => {
ConstraintCategory::Predicate(::rustc_serialize::Decodable::decode(__decoder))
}
14usize => { ConstraintCategory::Boring }
15usize => { ConstraintCategory::BoringNoLocation }
16usize => { ConstraintCategory::Internal }
17usize => {
ConstraintCategory::OutlivesUnnameablePlaceholder(::rustc_serialize::Decodable::decode(__decoder))
}
18usize => {
ConstraintCategory::SolverRegionConstraint(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ConstraintCategory`, expected 0..19, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
ConstraintCategory<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
ConstraintCategory::Return(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::Yield => {}
ConstraintCategory::UseAsConst => {}
ConstraintCategory::UseAsStatic => {}
ConstraintCategory::TypeAnnotation(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ref __binding_0,
is_implicit_coercion: ref __binding_1,
unsize_to: ref __binding_2 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
{ __binding_2.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::CallArgument(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::CopyBound => {}
ConstraintCategory::SizedBound => {}
ConstraintCategory::Assignment => {}
ConstraintCategory::Usage => {}
ConstraintCategory::OpaqueType => {}
ConstraintCategory::ClosureUpvar(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::Predicate(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::Boring => {}
ConstraintCategory::BoringNoLocation => {}
ConstraintCategory::Internal => {}
ConstraintCategory::OutlivesUnnameablePlaceholder(ref __binding_0)
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
ConstraintCategory::SolverRegionConstraint(ref __binding_0)
=> {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for ConstraintCategory<'tcx> {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
ConstraintCategory::Return(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::Yield => {}
ConstraintCategory::UseAsConst => {}
ConstraintCategory::UseAsStatic => {}
ConstraintCategory::TypeAnnotation(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ref __binding_0,
is_implicit_coercion: ref __binding_1,
unsize_to: ref __binding_2 } => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_1,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_2,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::CallArgument(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::CopyBound => {}
ConstraintCategory::SizedBound => {}
ConstraintCategory::Assignment => {}
ConstraintCategory::Usage => {}
ConstraintCategory::OpaqueType => {}
ConstraintCategory::ClosureUpvar(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::Predicate(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
ConstraintCategory::Boring => {}
ConstraintCategory::BoringNoLocation => {}
ConstraintCategory::Internal => {}
ConstraintCategory::OutlivesUnnameablePlaceholder(..) => {}
ConstraintCategory::SolverRegionConstraint(ref __binding_0)
=> {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for ConstraintCategory<'tcx> {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
ConstraintCategory::Return(__binding_0) => {
ConstraintCategory::Return(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ConstraintCategory::Yield => { ConstraintCategory::Yield }
ConstraintCategory::UseAsConst => {
ConstraintCategory::UseAsConst
}
ConstraintCategory::UseAsStatic => {
ConstraintCategory::UseAsStatic
}
ConstraintCategory::TypeAnnotation(__binding_0) => {
ConstraintCategory::TypeAnnotation(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __binding_0,
is_implicit_coercion: __binding_1,
unsize_to: __binding_2 } => {
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?,
is_implicit_coercion: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_1,
__folder)?,
unsize_to: ::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_2,
__folder)?,
}
}
ConstraintCategory::CallArgument(__binding_0) => {
ConstraintCategory::CallArgument(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ConstraintCategory::CopyBound => {
ConstraintCategory::CopyBound
}
ConstraintCategory::SizedBound => {
ConstraintCategory::SizedBound
}
ConstraintCategory::Assignment => {
ConstraintCategory::Assignment
}
ConstraintCategory::Usage => { ConstraintCategory::Usage }
ConstraintCategory::OpaqueType => {
ConstraintCategory::OpaqueType
}
ConstraintCategory::ClosureUpvar(__binding_0) => {
ConstraintCategory::ClosureUpvar(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ConstraintCategory::Predicate(__binding_0) => {
ConstraintCategory::Predicate(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
ConstraintCategory::Boring => { ConstraintCategory::Boring }
ConstraintCategory::BoringNoLocation => {
ConstraintCategory::BoringNoLocation
}
ConstraintCategory::Internal => {
ConstraintCategory::Internal
}
ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
=> {
ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
}
ConstraintCategory::SolverRegionConstraint(__binding_0) => {
ConstraintCategory::SolverRegionConstraint(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
ConstraintCategory::Return(__binding_0) => {
ConstraintCategory::Return(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
ConstraintCategory::Yield => { ConstraintCategory::Yield }
ConstraintCategory::UseAsConst => {
ConstraintCategory::UseAsConst
}
ConstraintCategory::UseAsStatic => {
ConstraintCategory::UseAsStatic
}
ConstraintCategory::TypeAnnotation(__binding_0) => {
ConstraintCategory::TypeAnnotation(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: __binding_0,
is_implicit_coercion: __binding_1,
unsize_to: __binding_2 } => {
ConstraintCategory::Cast {
is_raw_ptr_dyn_type_cast: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder),
is_implicit_coercion: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_1,
__folder),
unsize_to: ::rustc_middle::ty::TypeFoldable::fold_with(__binding_2,
__folder),
}
}
ConstraintCategory::CallArgument(__binding_0) => {
ConstraintCategory::CallArgument(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
ConstraintCategory::CopyBound => {
ConstraintCategory::CopyBound
}
ConstraintCategory::SizedBound => {
ConstraintCategory::SizedBound
}
ConstraintCategory::Assignment => {
ConstraintCategory::Assignment
}
ConstraintCategory::Usage => { ConstraintCategory::Usage }
ConstraintCategory::OpaqueType => {
ConstraintCategory::OpaqueType
}
ConstraintCategory::ClosureUpvar(__binding_0) => {
ConstraintCategory::ClosureUpvar(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
ConstraintCategory::Predicate(__binding_0) => {
ConstraintCategory::Predicate(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
ConstraintCategory::Boring => { ConstraintCategory::Boring }
ConstraintCategory::BoringNoLocation => {
ConstraintCategory::BoringNoLocation
}
ConstraintCategory::Internal => {
ConstraintCategory::Internal
}
ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
=> {
ConstraintCategory::OutlivesUnnameablePlaceholder(__binding_0)
}
ConstraintCategory::SolverRegionConstraint(__binding_0) => {
ConstraintCategory::SolverRegionConstraint(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
}
}
}
};TypeFoldable)]
103pub enum ConstraintCategory<'tcx> {
104 Return(ReturnConstraint),
105 Yield,
106 UseAsConst,
107 UseAsStatic,
108 TypeAnnotation(AnnotationSource),
109 Cast {
110 is_raw_ptr_dyn_type_cast: bool,
111 is_implicit_coercion: bool,
113 unsize_to: Option<Ty<'tcx>>,
116 },
117
118 CallArgument(Option<Ty<'tcx>>),
120 CopyBound,
121 SizedBound,
122 Assignment,
123 Usage,
126 OpaqueType,
127 ClosureUpvar(FieldIdx),
128
129 Predicate(Span),
133
134 Boring,
138 BoringNoLocation,
140
141 Internal,
143
144 OutlivesUnnameablePlaceholder(
149 #[type_foldable(identity)]
150 #[type_visitable(ignore)]
151 ty::RegionVid,
152 ),
153
154 SolverRegionConstraint(Span),
157}
158
159#[derive(#[automatically_derived]
impl ::core::marker::Copy for ReturnConstraint { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ReturnConstraint {
#[inline]
fn clone(&self) -> ReturnConstraint {
let _: ::core::clone::AssertParamIsClone<FieldIdx>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ReturnConstraint {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
ReturnConstraint::Normal =>
::core::fmt::Formatter::write_str(f, "Normal"),
ReturnConstraint::ClosureUpvar(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"ClosureUpvar", &__self_0),
}
}
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for ReturnConstraint {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<FieldIdx>;
}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for ReturnConstraint {
#[inline]
fn eq(&self, other: &ReturnConstraint) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(ReturnConstraint::ClosureUpvar(__self_0),
ReturnConstraint::ClosureUpvar(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for ReturnConstraint {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state);
match self {
ReturnConstraint::ClosureUpvar(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash)]
160#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for ReturnConstraint {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
ReturnConstraint::Normal => { 0usize }
ReturnConstraint::ClosureUpvar(ref __binding_0) => {
1usize
}
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
ReturnConstraint::Normal => {}
ReturnConstraint::ClosureUpvar(ref __binding_0) => {
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for ReturnConstraint {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { ReturnConstraint::Normal }
1usize => {
ReturnConstraint::ClosureUpvar(::rustc_serialize::Decodable::decode(__decoder))
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ReturnConstraint`, expected 0..2, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
ReturnConstraint {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
ReturnConstraint::Normal => {}
ReturnConstraint::ClosureUpvar(ref __binding_0) => {
{ __binding_0.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for ReturnConstraint {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
ReturnConstraint::Normal => {}
ReturnConstraint::ClosureUpvar(ref __binding_0) => {
{
match ::rustc_middle::ty::VisitorResult::branch(::rustc_middle::ty::TypeVisitable::visit_with(__binding_0,
__visitor)) {
::core::ops::ControlFlow::Continue(()) => {}
::core::ops::ControlFlow::Break(r) => {
return ::rustc_middle::ty::VisitorResult::from_residual(r);
}
}
}
}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for ReturnConstraint {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
ReturnConstraint::Normal => { ReturnConstraint::Normal }
ReturnConstraint::ClosureUpvar(__binding_0) => {
ReturnConstraint::ClosureUpvar(::rustc_middle::ty::TypeFoldable::try_fold_with(__binding_0,
__folder)?)
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
ReturnConstraint::Normal => { ReturnConstraint::Normal }
ReturnConstraint::ClosureUpvar(__binding_0) => {
ReturnConstraint::ClosureUpvar(::rustc_middle::ty::TypeFoldable::fold_with(__binding_0,
__folder))
}
}
}
}
};TypeFoldable)]
161pub enum ReturnConstraint {
162 Normal,
163 ClosureUpvar(FieldIdx),
164}
165
166#[derive(#[automatically_derived]
impl ::core::marker::Copy for AnnotationSource { }Copy, #[automatically_derived]
impl ::core::clone::Clone for AnnotationSource {
#[inline]
fn clone(&self) -> AnnotationSource { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for AnnotationSource {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
AnnotationSource::Ascription => "Ascription",
AnnotationSource::Declaration => "Declaration",
AnnotationSource::OpaqueCast => "OpaqueCast",
AnnotationSource::GenericArg => "GenericArg",
})
}
}Debug, #[automatically_derived]
impl ::core::cmp::Eq for AnnotationSource {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::cmp::PartialEq for AnnotationSource {
#[inline]
fn eq(&self, other: &AnnotationSource) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr
}
}PartialEq, #[automatically_derived]
impl ::core::hash::Hash for AnnotationSource {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
let __self_discr = ::core::intrinsics::discriminant_value(self);
::core::hash::Hash::hash(&__self_discr, state)
}
}Hash)]
167#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for AnnotationSource {
fn encode(&self, __encoder: &mut __E) {
let disc =
match *self {
AnnotationSource::Ascription => { 0usize }
AnnotationSource::Declaration => { 1usize }
AnnotationSource::OpaqueCast => { 2usize }
AnnotationSource::GenericArg => { 3usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
AnnotationSource::Ascription => {}
AnnotationSource::Declaration => {}
AnnotationSource::OpaqueCast => {}
AnnotationSource::GenericArg => {}
}
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for AnnotationSource {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => { AnnotationSource::Ascription }
1usize => { AnnotationSource::Declaration }
2usize => { AnnotationSource::OpaqueCast }
3usize => { AnnotationSource::GenericArg }
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `AnnotationSource`, expected 0..4, actual {0}",
n));
}
}
}
}
};TyDecodable, const _: () =
{
impl ::rustc_data_structures::stable_hash::StableHash for
AnnotationSource {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
::std::mem::discriminant(self).stable_hash(__hcx, __hasher);
match *self {
AnnotationSource::Ascription => {}
AnnotationSource::Declaration => {}
AnnotationSource::OpaqueCast => {}
AnnotationSource::GenericArg => {}
}
}
}
};StableHash, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeVisitable<::rustc_middle::ty::TyCtxt<'tcx>>
for AnnotationSource {
fn visit_with<__V: ::rustc_middle::ty::TypeVisitor<::rustc_middle::ty::TyCtxt<'tcx>>>(&self,
__visitor: &mut __V) -> __V::Result {
match *self {
AnnotationSource::Ascription => {}
AnnotationSource::Declaration => {}
AnnotationSource::OpaqueCast => {}
AnnotationSource::GenericArg => {}
}
<__V::Result as ::rustc_middle::ty::VisitorResult>::output()
}
}
};TypeVisitable, const _: () =
{
impl<'tcx>
::rustc_middle::ty::TypeFoldable<::rustc_middle::ty::TyCtxt<'tcx>>
for AnnotationSource {
fn try_fold_with<__F: ::rustc_middle::ty::FallibleTypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Result<Self, __F::Error> {
Ok(match self {
AnnotationSource::Ascription => {
AnnotationSource::Ascription
}
AnnotationSource::Declaration => {
AnnotationSource::Declaration
}
AnnotationSource::OpaqueCast => {
AnnotationSource::OpaqueCast
}
AnnotationSource::GenericArg => {
AnnotationSource::GenericArg
}
})
}
fn fold_with<__F: ::rustc_middle::ty::TypeFolder<::rustc_middle::ty::TyCtxt<'tcx>>>(self,
__folder: &mut __F) -> Self {
match self {
AnnotationSource::Ascription => {
AnnotationSource::Ascription
}
AnnotationSource::Declaration => {
AnnotationSource::Declaration
}
AnnotationSource::OpaqueCast => {
AnnotationSource::OpaqueCast
}
AnnotationSource::GenericArg => {
AnnotationSource::GenericArg
}
}
}
}
};TypeFoldable)]
168pub enum AnnotationSource {
169 Ascription,
170 Declaration,
171 OpaqueCast,
172 GenericArg,
173}
174
175#[derive(#[automatically_derived]
impl<'tcx> ::core::marker::Copy for DestructuredConstant<'tcx> { }Copy, #[automatically_derived]
impl<'tcx> ::core::clone::Clone for DestructuredConstant<'tcx> {
#[inline]
fn clone(&self) -> DestructuredConstant<'tcx> {
let _: ::core::clone::AssertParamIsClone<Option<VariantIdx>>;
let _:
::core::clone::AssertParamIsClone<&'tcx [(ConstValue,
Ty<'tcx>)]>;
*self
}
}Clone, #[automatically_derived]
impl<'tcx> ::core::fmt::Debug for DestructuredConstant<'tcx> {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field2_finish(f,
"DestructuredConstant", "variant", &self.variant, "fields",
&&self.fields)
}
}Debug, const _: () =
{
impl<'tcx> ::rustc_data_structures::stable_hash::StableHash for
DestructuredConstant<'tcx> {
#[inline]
fn stable_hash<__Hcx: ::rustc_data_structures::stable_hash::StableHashCtxt>(&self,
__hcx: &mut __Hcx,
__hasher:
&mut ::rustc_data_structures::stable_hash::StableHasher) {
match *self {
DestructuredConstant {
variant: ref __binding_0, fields: ref __binding_1 } => {
{ __binding_0.stable_hash(__hcx, __hasher); }
{ __binding_1.stable_hash(__hcx, __hasher); }
}
}
}
}
};StableHash)]
177pub struct DestructuredConstant<'tcx> {
178 pub variant: Option<VariantIdx>,
179 pub fields: &'tcx [(ConstValue, Ty<'tcx>)],
180}