1use std::fmt;
2
3#[cfg(feature = "nightly")]
4use rustc_macros::HashStable_Generic;
5
6use crate::ExternAbi;
7
8#[derive(#[automatically_derived]
impl ::core::marker::Copy for CanonAbi { }Copy, #[automatically_derived]
impl ::core::clone::Clone for CanonAbi {
#[inline]
fn clone(&self) -> CanonAbi {
let _: ::core::clone::AssertParamIsClone<ArmCall>;
let _: ::core::clone::AssertParamIsClone<InterruptKind>;
let _: ::core::clone::AssertParamIsClone<X86Call>;
*self
}
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for CanonAbi {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
CanonAbi::C => ::core::fmt::Formatter::write_str(f, "C"),
CanonAbi::Rust => ::core::fmt::Formatter::write_str(f, "Rust"),
CanonAbi::RustCold =>
::core::fmt::Formatter::write_str(f, "RustCold"),
CanonAbi::Custom =>
::core::fmt::Formatter::write_str(f, "Custom"),
CanonAbi::Arm(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "Arm",
&__self_0),
CanonAbi::GpuKernel =>
::core::fmt::Formatter::write_str(f, "GpuKernel"),
CanonAbi::Interrupt(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Interrupt", &__self_0),
CanonAbi::X86(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f, "X86",
&__self_0),
}
}
}Debug)]
20#[derive(#[automatically_derived]
impl ::core::cmp::PartialOrd for CanonAbi {
#[inline]
fn partial_cmp(&self, other: &CanonAbi)
-> ::core::option::Option<::core::cmp::Ordering> {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
match (self, other) {
(CanonAbi::Arm(__self_0), CanonAbi::Arm(__arg1_0)) =>
::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
(CanonAbi::Interrupt(__self_0), CanonAbi::Interrupt(__arg1_0)) =>
::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
(CanonAbi::X86(__self_0), CanonAbi::X86(__arg1_0)) =>
::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0),
_ =>
::core::cmp::PartialOrd::partial_cmp(&__self_discr,
&__arg1_discr),
}
}
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for CanonAbi {
#[inline]
fn cmp(&self, other: &CanonAbi) -> ::core::cmp::Ordering {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) {
::core::cmp::Ordering::Equal =>
match (self, other) {
(CanonAbi::Arm(__self_0), CanonAbi::Arm(__arg1_0)) =>
::core::cmp::Ord::cmp(__self_0, __arg1_0),
(CanonAbi::Interrupt(__self_0),
CanonAbi::Interrupt(__arg1_0)) =>
::core::cmp::Ord::cmp(__self_0, __arg1_0),
(CanonAbi::X86(__self_0), CanonAbi::X86(__arg1_0)) =>
::core::cmp::Ord::cmp(__self_0, __arg1_0),
_ => ::core::cmp::Ordering::Equal,
},
cmp => cmp,
}
}
}Ord, #[automatically_derived]
impl ::core::cmp::PartialEq for CanonAbi {
#[inline]
fn eq(&self, other: &CanonAbi) -> bool {
let __self_discr = ::core::intrinsics::discriminant_value(self);
let __arg1_discr = ::core::intrinsics::discriminant_value(other);
__self_discr == __arg1_discr &&
match (self, other) {
(CanonAbi::Arm(__self_0), CanonAbi::Arm(__arg1_0)) =>
__self_0 == __arg1_0,
(CanonAbi::Interrupt(__self_0), CanonAbi::Interrupt(__arg1_0))
=> __self_0 == __arg1_0,
(CanonAbi::X86(__self_0), CanonAbi::X86(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for CanonAbi {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<ArmCall>;
let _: ::core::cmp::AssertParamIsEq<InterruptKind>;
let _: ::core::cmp::AssertParamIsEq<X86Call>;
}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for CanonAbi {
#[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 {
CanonAbi::Arm(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
CanonAbi::Interrupt(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
CanonAbi::X86(__self_0) =>
::core::hash::Hash::hash(__self_0, state),
_ => {}
}
}
}Hash)]
21#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for CanonAbi where __CTX: crate::HashStableContext {
#[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 {
CanonAbi::C => {}
CanonAbi::Rust => {}
CanonAbi::RustCold => {}
CanonAbi::Custom => {}
CanonAbi::Arm(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
CanonAbi::GpuKernel => {}
CanonAbi::Interrupt(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
CanonAbi::X86(ref __binding_0) => {
{ __binding_0.hash_stable(__hcx, __hasher); }
}
}
}
}
};HashStable_Generic))]
22pub enum CanonAbi {
23 C,
28 Rust,
29 RustCold,
30
31 Custom,
33
34 Arm(ArmCall),
36 GpuKernel,
38
39 Interrupt(InterruptKind),
49
50 X86(X86Call),
52}
53
54impl CanonAbi {
55 pub fn is_rustic_abi(self) -> bool {
56 match self {
57 CanonAbi::Rust | CanonAbi::RustCold => true,
58 CanonAbi::C
59 | CanonAbi::Custom
60 | CanonAbi::Arm(_)
61 | CanonAbi::GpuKernel
62 | CanonAbi::Interrupt(_)
63 | CanonAbi::X86(_) => false,
64 }
65 }
66}
67
68impl fmt::Display for CanonAbi {
69 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
70 let erased_abi = match self {
74 CanonAbi::C => ExternAbi::C { unwind: false },
75 CanonAbi::Rust => ExternAbi::Rust,
76 CanonAbi::RustCold => ExternAbi::RustCold,
77 CanonAbi::Custom => ExternAbi::Custom,
78 CanonAbi::Arm(arm_call) => match arm_call {
79 ArmCall::Aapcs => ExternAbi::Aapcs { unwind: false },
80 ArmCall::CCmseNonSecureCall => ExternAbi::CmseNonSecureCall,
81 ArmCall::CCmseNonSecureEntry => ExternAbi::CmseNonSecureEntry,
82 },
83 CanonAbi::GpuKernel => ExternAbi::GpuKernel,
84 CanonAbi::Interrupt(interrupt_kind) => match interrupt_kind {
85 InterruptKind::Avr => ExternAbi::AvrInterrupt,
86 InterruptKind::AvrNonBlocking => ExternAbi::AvrNonBlockingInterrupt,
87 InterruptKind::Msp430 => ExternAbi::Msp430Interrupt,
88 InterruptKind::RiscvMachine => ExternAbi::RiscvInterruptM,
89 InterruptKind::RiscvSupervisor => ExternAbi::RiscvInterruptS,
90 InterruptKind::X86 => ExternAbi::X86Interrupt,
91 },
92 CanonAbi::X86(x86_call) => match x86_call {
93 X86Call::Fastcall => ExternAbi::Fastcall { unwind: false },
94 X86Call::Stdcall => ExternAbi::Stdcall { unwind: false },
95 X86Call::SysV64 => ExternAbi::SysV64 { unwind: false },
96 X86Call::Thiscall => ExternAbi::Thiscall { unwind: false },
97 X86Call::Vectorcall => ExternAbi::Vectorcall { unwind: false },
98 X86Call::Win64 => ExternAbi::Win64 { unwind: false },
99 },
100 };
101 erased_abi.as_str().fmt(f)
102 }
103}
104
105#[derive(#[automatically_derived]
impl ::core::marker::Copy for InterruptKind { }Copy, #[automatically_derived]
impl ::core::clone::Clone for InterruptKind {
#[inline]
fn clone(&self) -> InterruptKind { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for InterruptKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
InterruptKind::Avr => "Avr",
InterruptKind::AvrNonBlocking => "AvrNonBlocking",
InterruptKind::Msp430 => "Msp430",
InterruptKind::RiscvMachine => "RiscvMachine",
InterruptKind::RiscvSupervisor => "RiscvSupervisor",
InterruptKind::X86 => "X86",
})
}
}Debug)]
111#[derive(#[automatically_derived]
impl ::core::cmp::PartialOrd for InterruptKind {
#[inline]
fn partial_cmp(&self, other: &InterruptKind)
-> ::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 InterruptKind {
#[inline]
fn cmp(&self, other: &InterruptKind) -> ::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::cmp::PartialEq for InterruptKind {
#[inline]
fn eq(&self, other: &InterruptKind) -> 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 InterruptKind {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for InterruptKind {
#[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)]
112#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for InterruptKind where __CTX: crate::HashStableContext {
#[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 {
InterruptKind::Avr => {}
InterruptKind::AvrNonBlocking => {}
InterruptKind::Msp430 => {}
InterruptKind::RiscvMachine => {}
InterruptKind::RiscvSupervisor => {}
InterruptKind::X86 => {}
}
}
}
};HashStable_Generic))]
113pub enum InterruptKind {
114 Avr,
115 AvrNonBlocking,
116 Msp430,
117 RiscvMachine,
118 RiscvSupervisor,
119 X86,
120}
121
122#[derive(#[automatically_derived]
impl ::core::clone::Clone for X86Call {
#[inline]
fn clone(&self) -> X86Call { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for X86Call { }Copy, #[automatically_derived]
impl ::core::fmt::Debug for X86Call {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
X86Call::Fastcall => "Fastcall",
X86Call::Stdcall => "Stdcall",
X86Call::SysV64 => "SysV64",
X86Call::Thiscall => "Thiscall",
X86Call::Vectorcall => "Vectorcall",
X86Call::Win64 => "Win64",
})
}
}Debug)]
126#[derive(#[automatically_derived]
impl ::core::cmp::PartialOrd for X86Call {
#[inline]
fn partial_cmp(&self, other: &X86Call)
-> ::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 X86Call {
#[inline]
fn cmp(&self, other: &X86Call) -> ::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::cmp::PartialEq for X86Call {
#[inline]
fn eq(&self, other: &X86Call) -> 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 X86Call {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for X86Call {
#[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)]
127#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for X86Call where __CTX: crate::HashStableContext {
#[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 {
X86Call::Fastcall => {}
X86Call::Stdcall => {}
X86Call::SysV64 => {}
X86Call::Thiscall => {}
X86Call::Vectorcall => {}
X86Call::Win64 => {}
}
}
}
};HashStable_Generic))]
128pub enum X86Call {
129 Fastcall,
131 Stdcall,
133 SysV64,
134 Thiscall,
135 Vectorcall,
136 Win64,
137}
138
139#[derive(#[automatically_derived]
impl ::core::marker::Copy for ArmCall { }Copy, #[automatically_derived]
impl ::core::clone::Clone for ArmCall {
#[inline]
fn clone(&self) -> ArmCall { *self }
}Clone, #[automatically_derived]
impl ::core::fmt::Debug for ArmCall {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
ArmCall::Aapcs => "Aapcs",
ArmCall::CCmseNonSecureCall => "CCmseNonSecureCall",
ArmCall::CCmseNonSecureEntry => "CCmseNonSecureEntry",
})
}
}Debug)]
141#[derive(#[automatically_derived]
impl ::core::cmp::PartialOrd for ArmCall {
#[inline]
fn partial_cmp(&self, other: &ArmCall)
-> ::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 ArmCall {
#[inline]
fn cmp(&self, other: &ArmCall) -> ::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::cmp::PartialEq for ArmCall {
#[inline]
fn eq(&self, other: &ArmCall) -> 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 ArmCall {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for ArmCall {
#[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)]
142#[cfg_attr(feature = "nightly", derive(const _: () =
{
impl<__CTX> ::rustc_data_structures::stable_hasher::HashStable<__CTX>
for ArmCall where __CTX: crate::HashStableContext {
#[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 {
ArmCall::Aapcs => {}
ArmCall::CCmseNonSecureCall => {}
ArmCall::CCmseNonSecureEntry => {}
}
}
}
};HashStable_Generic))]
143pub enum ArmCall {
144 Aapcs,
145 CCmseNonSecureCall,
146 CCmseNonSecureEntry,
147}