@@ -882,34 +882,35 @@ impl FromStr for Conv {
882882 }
883883}
884884
885+ fn conv_to_externabi ( conv : & Conv ) -> ExternAbi {
886+ match conv {
887+ Conv :: Rust => ExternAbi :: Rust ,
888+ Conv :: PreserveMost => ExternAbi :: RustCold ,
889+ Conv :: X86Stdcall => ExternAbi :: Stdcall { unwind : false } ,
890+ Conv :: X86Fastcall => ExternAbi :: Fastcall { unwind : false } ,
891+ Conv :: X86VectorCall => ExternAbi :: Vectorcall { unwind : false } ,
892+ Conv :: X86ThisCall => ExternAbi :: Thiscall { unwind : false } ,
893+ Conv :: C => ExternAbi :: C { unwind : false } ,
894+ Conv :: X86_64Win64 => ExternAbi :: Win64 { unwind : false } ,
895+ Conv :: X86_64SysV => ExternAbi :: SysV64 { unwind : false } ,
896+ Conv :: ArmAapcs => ExternAbi :: Aapcs { unwind : false } ,
897+ Conv :: CCmseNonSecureCall => ExternAbi :: CCmseNonSecureCall ,
898+ Conv :: CCmseNonSecureEntry => ExternAbi :: CCmseNonSecureEntry ,
899+ Conv :: PtxKernel => ExternAbi :: PtxKernel ,
900+ Conv :: Msp430Intr => ExternAbi :: Msp430Interrupt ,
901+ Conv :: X86Intr => ExternAbi :: X86Interrupt ,
902+ Conv :: GpuKernel => ExternAbi :: GpuKernel ,
903+ Conv :: AvrInterrupt => ExternAbi :: AvrInterrupt ,
904+ Conv :: AvrNonBlockingInterrupt => ExternAbi :: AvrNonBlockingInterrupt ,
905+ Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Machine } => ExternAbi :: RiscvInterruptM ,
906+ Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Supervisor } => ExternAbi :: RiscvInterruptS ,
907+ Conv :: Cold | Conv :: PreserveAll => panic ! ( "This is deadcode" ) ,
908+ }
909+ }
910+
885911impl Display for Conv {
886912 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
887- f. write_str ( match self {
888- Conv :: C => "C" ,
889- Conv :: Rust => "Rust" ,
890- Conv :: Cold => "Cold" ,
891- Conv :: PreserveMost => "PreserveMost" ,
892- Conv :: PreserveAll => "PreserveAll" ,
893- Conv :: ArmAapcs => "ArmAapcs" ,
894- Conv :: CCmseNonSecureCall => "CCmseNonSecureCall" ,
895- Conv :: CCmseNonSecureEntry => "CCmseNonSecureEntry" ,
896- Conv :: Msp430Intr => "Msp430Intr" ,
897- Conv :: PtxKernel => "PtxKernel" ,
898- Conv :: GpuKernel => "GpuKernel" ,
899- Conv :: X86Fastcall => "X86Fastcall" ,
900- Conv :: X86Intr => "X86Intr" ,
901- Conv :: X86Stdcall => "X86Stdcall" ,
902- Conv :: X86ThisCall => "X86ThisCall" ,
903- Conv :: X86VectorCall => "X86VectorCall" ,
904- Conv :: X86_64SysV => "X86_64SysV" ,
905- Conv :: X86_64Win64 => "X86_64Win64" ,
906- Conv :: AvrInterrupt => "AvrInterrupt" ,
907- Conv :: AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt" ,
908- Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Machine } => "RiscvInterrupt(machine)" ,
909- Conv :: RiscvInterrupt { kind : RiscvInterruptKind :: Supervisor } => {
910- "RiscvInterrupt(supervisor)"
911- }
912- } )
913+ write ! ( f, "{}" , conv_to_externabi( self ) )
913914 }
914915}
915916
0 commit comments