11use std:: ops:: ControlFlow ;
22use std:: path:: { Path , PathBuf } ;
33
4+ use rustc_abi:: ExternAbi ;
45use rustc_ast:: CRATE_NODE_ID ;
56use rustc_attr as attr;
67use rustc_data_structures:: fx:: FxHashSet ;
@@ -17,7 +18,6 @@ use rustc_session::utils::NativeLibKind;
1718use rustc_span:: def_id:: { DefId , LOCAL_CRATE } ;
1819use rustc_span:: symbol:: { Symbol , sym} ;
1920use rustc_target:: spec:: LinkSelfContainedComponents ;
20- use rustc_target:: spec:: abi:: Abi ;
2121
2222use crate :: { errors, fluent_generated} ;
2323
@@ -203,7 +203,7 @@ impl<'tcx> Collector<'tcx> {
203203
204204 let sess = self . tcx . sess ;
205205
206- if matches ! ( abi, Abi :: Rust | Abi :: RustIntrinsic ) {
206+ if matches ! ( abi, ExternAbi :: Rust | ExternAbi :: RustIntrinsic ) {
207207 return ;
208208 }
209209
@@ -625,7 +625,7 @@ impl<'tcx> Collector<'tcx> {
625625
626626 fn build_dll_import (
627627 & self ,
628- abi : Abi ,
628+ abi : ExternAbi ,
629629 import_name_type : Option < PeImportNameType > ,
630630 item : DefId ,
631631 ) -> DllImport {
@@ -634,12 +634,14 @@ impl<'tcx> Collector<'tcx> {
634634 // this logic is similar to `Target::adjust_abi` (in rustc_target/src/spec/mod.rs) but errors on unsupported inputs
635635 let calling_convention = if self . tcx . sess . target . arch == "x86" {
636636 match abi {
637- Abi :: C { .. } | Abi :: Cdecl { .. } => DllCallingConvention :: C ,
638- Abi :: Stdcall { .. } => DllCallingConvention :: Stdcall ( self . i686_arg_list_size ( item) ) ,
637+ ExternAbi :: C { .. } | ExternAbi :: Cdecl { .. } => DllCallingConvention :: C ,
638+ ExternAbi :: Stdcall { .. } => {
639+ DllCallingConvention :: Stdcall ( self . i686_arg_list_size ( item) )
640+ }
639641 // On Windows, `extern "system"` behaves like msvc's `__stdcall`.
640642 // `__stdcall` only applies on x86 and on non-variadic functions:
641643 // https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
642- Abi :: System { .. } => {
644+ ExternAbi :: System { .. } => {
643645 let c_variadic =
644646 self . tcx . type_of ( item) . instantiate_identity ( ) . fn_sig ( self . tcx ) . c_variadic ( ) ;
645647
@@ -649,10 +651,10 @@ impl<'tcx> Collector<'tcx> {
649651 DllCallingConvention :: Stdcall ( self . i686_arg_list_size ( item) )
650652 }
651653 }
652- Abi :: Fastcall { .. } => {
654+ ExternAbi :: Fastcall { .. } => {
653655 DllCallingConvention :: Fastcall ( self . i686_arg_list_size ( item) )
654656 }
655- Abi :: Vectorcall { .. } => {
657+ ExternAbi :: Vectorcall { .. } => {
656658 DllCallingConvention :: Vectorcall ( self . i686_arg_list_size ( item) )
657659 }
658660 _ => {
@@ -661,7 +663,9 @@ impl<'tcx> Collector<'tcx> {
661663 }
662664 } else {
663665 match abi {
664- Abi :: C { .. } | Abi :: Win64 { .. } | Abi :: System { .. } => DllCallingConvention :: C ,
666+ ExternAbi :: C { .. } | ExternAbi :: Win64 { .. } | ExternAbi :: System { .. } => {
667+ DllCallingConvention :: C
668+ }
665669 _ => {
666670 self . tcx . dcx ( ) . emit_fatal ( errors:: UnsupportedAbi { span } ) ;
667671 }
0 commit comments