11use std:: cell:: LazyCell ;
22use std:: ops:: ControlFlow ;
33
4- use rustc_abi:: FieldIdx ;
4+ use rustc_abi:: { ExternAbi , FieldIdx } ;
55use rustc_attr_data_structures:: ReprAttr :: ReprPacked ;
66use rustc_data_structures:: unord:: { UnordMap , UnordSet } ;
77use rustc_errors:: codes:: * ;
@@ -12,7 +12,6 @@ use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
1212use rustc_infer:: traits:: { Obligation , ObligationCauseCode } ;
1313use rustc_lint_defs:: builtin:: {
1414 REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS , UNSUPPORTED_CALLING_CONVENTIONS ,
15- UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS ,
1615} ;
1716use rustc_middle:: hir:: nested_filter;
1817use rustc_middle:: middle:: resolve_bound_vars:: ResolvedArg ;
@@ -67,21 +66,6 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi
6766 }
6867}
6968
70- pub fn check_abi_fn_ptr ( tcx : TyCtxt < ' _ > , hir_id : hir:: HirId , span : Span , abi : ExternAbi ) {
71- // This is always an FCW, even for `AbiMapping::Invalid`, since we started linting later than
72- // in `check_abi` above.
73- match AbiMap :: from_target ( & tcx. sess . target ) . canonize_abi ( abi, false ) {
74- AbiMapping :: Direct ( ..) => ( ) ,
75- AbiMapping :: Deprecated ( ..) | AbiMapping :: Invalid => {
76- tcx. node_span_lint ( UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS , hir_id, span, |lint| {
77- lint. primary_message ( format ! (
78- "the calling convention {abi} is not supported on this target"
79- ) ) ;
80- } ) ;
81- }
82- }
83- }
84-
8569fn check_struct ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) {
8670 let def = tcx. adt_def ( def_id) ;
8771 let span = tcx. def_span ( def_id) ;
@@ -837,6 +821,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
837821 let hir:: ItemKind :: ForeignMod { abi, items } = it. kind else {
838822 return ;
839823 } ;
824+
840825 check_abi ( tcx, it. hir_id ( ) , it. span , abi) ;
841826
842827 for item in items {
0 commit comments