1
1
use std:: ops:: ControlFlow ;
2
2
use std:: path:: { Path , PathBuf } ;
3
3
4
+ use rustc_abi:: ExternAbi ;
4
5
use rustc_ast:: CRATE_NODE_ID ;
5
6
use rustc_attr as attr;
6
7
use rustc_data_structures:: fx:: FxHashSet ;
@@ -17,7 +18,6 @@ use rustc_session::utils::NativeLibKind;
17
18
use rustc_span:: def_id:: { DefId , LOCAL_CRATE } ;
18
19
use rustc_span:: symbol:: { Symbol , sym} ;
19
20
use rustc_target:: spec:: LinkSelfContainedComponents ;
20
- use rustc_target:: spec:: abi:: Abi ;
21
21
22
22
use crate :: { errors, fluent_generated} ;
23
23
@@ -203,7 +203,7 @@ impl<'tcx> Collector<'tcx> {
203
203
204
204
let sess = self . tcx . sess ;
205
205
206
- if matches ! ( abi, Abi :: Rust | Abi :: RustIntrinsic ) {
206
+ if matches ! ( abi, ExternAbi :: Rust | ExternAbi :: RustIntrinsic ) {
207
207
return ;
208
208
}
209
209
@@ -625,7 +625,7 @@ impl<'tcx> Collector<'tcx> {
625
625
626
626
fn build_dll_import (
627
627
& self ,
628
- abi : Abi ,
628
+ abi : ExternAbi ,
629
629
import_name_type : Option < PeImportNameType > ,
630
630
item : DefId ,
631
631
) -> DllImport {
@@ -634,12 +634,14 @@ impl<'tcx> Collector<'tcx> {
634
634
// this logic is similar to `Target::adjust_abi` (in rustc_target/src/spec/mod.rs) but errors on unsupported inputs
635
635
let calling_convention = if self . tcx . sess . target . arch == "x86" {
636
636
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
+ }
639
641
// On Windows, `extern "system"` behaves like msvc's `__stdcall`.
640
642
// `__stdcall` only applies on x86 and on non-variadic functions:
641
643
// https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
642
- Abi :: System { .. } => {
644
+ ExternAbi :: System { .. } => {
643
645
let c_variadic =
644
646
self . tcx . type_of ( item) . instantiate_identity ( ) . fn_sig ( self . tcx ) . c_variadic ( ) ;
645
647
@@ -649,10 +651,10 @@ impl<'tcx> Collector<'tcx> {
649
651
DllCallingConvention :: Stdcall ( self . i686_arg_list_size ( item) )
650
652
}
651
653
}
652
- Abi :: Fastcall { .. } => {
654
+ ExternAbi :: Fastcall { .. } => {
653
655
DllCallingConvention :: Fastcall ( self . i686_arg_list_size ( item) )
654
656
}
655
- Abi :: Vectorcall { .. } => {
657
+ ExternAbi :: Vectorcall { .. } => {
656
658
DllCallingConvention :: Vectorcall ( self . i686_arg_list_size ( item) )
657
659
}
658
660
_ => {
@@ -661,7 +663,9 @@ impl<'tcx> Collector<'tcx> {
661
663
}
662
664
} else {
663
665
match abi {
664
- Abi :: C { .. } | Abi :: Win64 { .. } | Abi :: System { .. } => DllCallingConvention :: C ,
666
+ ExternAbi :: C { .. } | ExternAbi :: Win64 { .. } | ExternAbi :: System { .. } => {
667
+ DllCallingConvention :: C
668
+ }
665
669
_ => {
666
670
self . tcx . dcx ( ) . emit_fatal ( errors:: UnsupportedAbi { span } ) ;
667
671
}
0 commit comments