11use std:: iter;
22
33use rustc_abi:: Primitive :: Pointer ;
4- use rustc_abi:: { BackendRepr , PointerKind , Scalar , Size } ;
4+ use rustc_abi:: { BackendRepr , ExternAbi , PointerKind , Scalar , Size } ;
55use rustc_hir as hir;
66use rustc_hir:: lang_items:: LangItem ;
77use rustc_middle:: bug;
@@ -12,10 +12,9 @@ use rustc_middle::ty::layout::{
1212use rustc_middle:: ty:: { self , InstanceKind , Ty , TyCtxt } ;
1313use rustc_session:: config:: OptLevel ;
1414use rustc_span:: def_id:: DefId ;
15- use rustc_target:: abi :: call :: {
15+ use rustc_target:: callconv :: {
1616 ArgAbi , ArgAttribute , ArgAttributes , ArgExtension , Conv , FnAbi , PassMode , RiscvInterruptKind ,
1717} ;
18- use rustc_target:: spec:: abi:: Abi as SpecAbi ;
1918use tracing:: debug;
2019
2120pub ( crate ) fn provide ( providers : & mut Providers ) {
@@ -39,7 +38,7 @@ fn fn_sig_for_fn_abi<'tcx>(
3938 tcx. thread_local_ptr_ty ( instance. def_id ( ) ) ,
4039 false ,
4140 hir:: Safety :: Safe ,
42- rustc_target :: spec :: abi :: Abi :: Unadjusted ,
41+ rustc_abi :: ExternAbi :: Unadjusted ,
4342 ) ) ;
4443 }
4544
@@ -270,7 +269,7 @@ fn fn_sig_for_fn_abi<'tcx>(
270269 ret_ty,
271270 false ,
272271 hir:: Safety :: Safe ,
273- rustc_target :: spec :: abi :: Abi :: Rust ,
272+ rustc_abi :: ExternAbi :: Rust ,
274273 )
275274 } else {
276275 // `Iterator::next` doesn't have a `resume` argument.
@@ -279,7 +278,7 @@ fn fn_sig_for_fn_abi<'tcx>(
279278 ret_ty,
280279 false ,
281280 hir:: Safety :: Safe ,
282- rustc_target :: spec :: abi :: Abi :: Rust ,
281+ rustc_abi :: ExternAbi :: Rust ,
283282 )
284283 } ;
285284 ty:: Binder :: bind_with_vars ( fn_sig, bound_vars)
@@ -289,8 +288,8 @@ fn fn_sig_for_fn_abi<'tcx>(
289288}
290289
291290#[ inline]
292- fn conv_from_spec_abi ( tcx : TyCtxt < ' _ > , abi : SpecAbi , c_variadic : bool ) -> Conv {
293- use rustc_target :: spec :: abi :: Abi :: * ;
291+ fn conv_from_spec_abi ( tcx : TyCtxt < ' _ > , abi : ExternAbi , c_variadic : bool ) -> Conv {
292+ use rustc_abi :: ExternAbi :: * ;
294293 match tcx. sess . target . adjust_abi ( abi, c_variadic) {
295294 RustIntrinsic | Rust | RustCall => Conv :: Rust ,
296295
@@ -453,12 +452,12 @@ fn adjust_for_rust_scalar<'tcx>(
453452fn fn_abi_sanity_check < ' tcx > (
454453 cx : & LayoutCx < ' tcx > ,
455454 fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
456- spec_abi : SpecAbi ,
455+ spec_abi : ExternAbi ,
457456) {
458457 fn fn_arg_sanity_check < ' tcx > (
459458 cx : & LayoutCx < ' tcx > ,
460459 fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
461- spec_abi : SpecAbi ,
460+ spec_abi : ExternAbi ,
462461 arg : & ArgAbi < ' tcx , Ty < ' tcx > > ,
463462 ) {
464463 let tcx = cx. tcx ( ) ;
@@ -489,7 +488,7 @@ fn fn_abi_sanity_check<'tcx>(
489488 // (See issue: https://github.com/rust-lang/rust/issues/117271)
490489 assert ! (
491490 matches!( & * tcx. sess. target. arch, "wasm32" | "wasm64" )
492- || matches!( spec_abi, SpecAbi :: PtxKernel | SpecAbi :: Unadjusted ) ,
491+ || matches!( spec_abi, ExternAbi :: PtxKernel | ExternAbi :: Unadjusted ) ,
493492 "`PassMode::Direct` for aggregates only allowed for \" unadjusted\" and \" ptx-kernel\" functions and on wasm\n \
494493 Problematic type: {:#?}",
495494 arg. layout,
@@ -556,7 +555,7 @@ fn fn_abi_new_uncached<'tcx>(
556555 let conv = conv_from_spec_abi ( cx. tcx ( ) , sig. abi , sig. c_variadic ) ;
557556
558557 let mut inputs = sig. inputs ( ) ;
559- let extra_args = if sig. abi == SpecAbi :: RustCall {
558+ let extra_args = if sig. abi == ExternAbi :: RustCall {
560559 assert ! ( !sig. c_variadic && extra_args. is_empty( ) ) ;
561560
562561 if let Some ( input) = sig. inputs ( ) . last ( ) {
@@ -649,10 +648,10 @@ fn fn_abi_new_uncached<'tcx>(
649648fn fn_abi_adjust_for_abi < ' tcx > (
650649 cx : & LayoutCx < ' tcx > ,
651650 fn_abi : & mut FnAbi < ' tcx , Ty < ' tcx > > ,
652- abi : SpecAbi ,
651+ abi : ExternAbi ,
653652 fn_def_id : Option < DefId > ,
654653) -> Result < ( ) , & ' tcx FnAbiError < ' tcx > > {
655- if abi == SpecAbi :: Unadjusted {
654+ if abi == ExternAbi :: Unadjusted {
656655 // The "unadjusted" ABI passes aggregates in "direct" mode. That's fragile but needed for
657656 // some LLVM intrinsics.
658657 fn unadjust < ' tcx > ( arg : & mut ArgAbi < ' tcx , Ty < ' tcx > > ) {
@@ -676,7 +675,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
676675
677676 let tcx = cx. tcx ( ) ;
678677
679- if abi == SpecAbi :: Rust || abi == SpecAbi :: RustCall || abi == SpecAbi :: RustIntrinsic {
678+ if abi == ExternAbi :: Rust || abi == ExternAbi :: RustCall || abi == ExternAbi :: RustIntrinsic {
680679 fn_abi. adjust_for_rust_abi ( cx, abi) ;
681680
682681 // Look up the deduced parameter attributes for this function, if we have its def ID and
0 commit comments