1
1
use std:: cell:: LazyCell ;
2
2
use std:: ops:: ControlFlow ;
3
3
4
- use rustc_abi:: FieldIdx ;
4
+ use rustc_abi:: { ExternAbi , FieldIdx } ;
5
5
use rustc_attr_data_structures:: ReprAttr :: ReprPacked ;
6
6
use rustc_data_structures:: unord:: { UnordMap , UnordSet } ;
7
7
use rustc_errors:: codes:: * ;
@@ -12,7 +12,6 @@ use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
12
12
use rustc_infer:: traits:: { Obligation , ObligationCauseCode } ;
13
13
use rustc_lint_defs:: builtin:: {
14
14
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS , UNSUPPORTED_CALLING_CONVENTIONS ,
15
- UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS ,
16
15
} ;
17
16
use rustc_middle:: hir:: nested_filter;
18
17
use rustc_middle:: middle:: resolve_bound_vars:: ResolvedArg ;
@@ -68,28 +67,6 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi
68
67
}
69
68
}
70
69
71
- pub fn check_abi_fn_ptr ( tcx : TyCtxt < ' _ > , hir_id : hir:: HirId , span : Span , abi : ExternAbi ) {
72
- // This is always an FCW, even for `AbiMapping::Invalid`, since we started linting later than
73
- // in `check_abi` above.
74
- match AbiMap :: from_target ( & tcx. sess . target ) . canonize_abi ( abi, false ) {
75
- AbiMapping :: Direct ( ..) => ( ) ,
76
- // this is not a redundant match arm: these ABIs started linting after reviving this lint
77
- AbiMapping :: Deprecated ( ..) => {
78
- tcx. node_span_lint ( UNSUPPORTED_CALLING_CONVENTIONS , hir_id, span, |lint| {
79
- lint. primary_message ( "use of calling convention not supported on this target" ) ;
80
- add_abi_diag_help ( abi, lint) ;
81
- } ) ;
82
- }
83
- AbiMapping :: Invalid => {
84
- tcx. node_span_lint ( UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS , hir_id, span, |lint| {
85
- lint. primary_message ( format ! (
86
- "the calling convention {abi} is not supported on this target"
87
- ) ) ;
88
- } ) ;
89
- }
90
- }
91
- }
92
-
93
70
fn check_struct ( tcx : TyCtxt < ' _ > , def_id : LocalDefId ) {
94
71
let def = tcx. adt_def ( def_id) ;
95
72
let span = tcx. def_span ( def_id) ;
@@ -845,6 +822,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
845
822
let hir:: ItemKind :: ForeignMod { abi, items } = it. kind else {
846
823
return ;
847
824
} ;
825
+
848
826
check_abi ( tcx, it. hir_id ( ) , it. span , abi) ;
849
827
850
828
for item in items {
0 commit comments