@@ -898,34 +898,35 @@ impl FromStr for Conv {
898898 }
899899}
900900
901+ fn conv_to_externabi ( conv : & Conv ) -> ExternAbi {
902+ match conv {
903+ Conv :: Rust => ExternAbi :: Rust ,
904+ Conv :: PreserveMost => ExternAbi :: RustCold ,
905+ Conv :: X86Stdcall => ExternAbi :: Stdcall { unwind : false } ,
906+ Conv :: X86Fastcall => ExternAbi :: Fastcall { unwind : false } ,
907+ Conv :: X86VectorCall => ExternAbi :: Vectorcall { unwind : false } ,
908+ Conv :: X86ThisCall => ExternAbi :: Thiscall { unwind : false } ,
909+ Conv :: C => ExternAbi :: C { unwind : false } ,
910+ Conv :: X86_64Win64 => ExternAbi :: Win64 { unwind : false } ,
911+ Conv :: X86_64SysV => ExternAbi :: SysV64 { unwind : false } ,
912+ Conv :: ArmAapcs => ExternAbi :: Aapcs { unwind : false } ,
913+ Conv :: CCmseNonSecureCall => ExternAbi :: CCmseNonSecureCall ,
914+ Conv :: CCmseNonSecureEntry => ExternAbi :: CCmseNonSecureEntry ,
915+ Conv :: PtxKernel => ExternAbi :: PtxKernel ,
916+ Conv :: Msp430Intr => ExternAbi :: Msp430Interrupt ,
917+ Conv :: X86Intr => ExternAbi :: X86Interrupt ,
918+ Conv :: GpuKernel => ExternAbi :: GpuKernel ,
919+ Conv :: AvrInterrupt => ExternAbi :: AvrInterrupt ,
920+ Conv :: AvrNonBlockingInterrupt => ExternAbi :: AvrNonBlockingInterrupt ,
921+ Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Machine } => ExternAbi :: RiscvInterruptM ,
922+ Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Supervisor } => ExternAbi :: RiscvInterruptS ,
923+ Conv :: Cold | Conv :: PreserveAll => panic ! ( "This is deadcode" ) ,
924+ }
925+ }
926+
901927impl Display for Conv {
902928 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
903- f. write_str ( match self {
904- Conv :: C => "C" ,
905- Conv :: Rust => "Rust" ,
906- Conv :: Cold => "Cold" ,
907- Conv :: PreserveMost => "PreserveMost" ,
908- Conv :: PreserveAll => "PreserveAll" ,
909- Conv :: ArmAapcs => "ArmAapcs" ,
910- Conv :: CCmseNonSecureCall => "CCmseNonSecureCall" ,
911- Conv :: CCmseNonSecureEntry => "CCmseNonSecureEntry" ,
912- Conv :: Msp430Intr => "Msp430Intr" ,
913- Conv :: PtxKernel => "PtxKernel" ,
914- Conv :: GpuKernel => "GpuKernel" ,
915- Conv :: X86Fastcall => "X86Fastcall" ,
916- Conv :: X86Intr => "X86Intr" ,
917- Conv :: X86Stdcall => "X86Stdcall" ,
918- Conv :: X86ThisCall => "X86ThisCall" ,
919- Conv :: X86VectorCall => "X86VectorCall" ,
920- Conv :: X86_64SysV => "X86_64SysV" ,
921- Conv :: X86_64Win64 => "X86_64Win64" ,
922- Conv :: AvrInterrupt => "AvrInterrupt" ,
923- Conv :: AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt" ,
924- Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Machine } => "RiscvInterrupt(machine)" ,
925- Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Supervisor } => {
926- "RiscvInterrupt(supervisor)"
927- }
928- } )
929+ write ! ( f, "{}" , conv_to_externabi( self ) )
929930 }
930931}
931932
0 commit comments