Skip to content

Commit e544d92

Browse files
compiler: Remove unsupported_fn_ptr_calling_conventions lint
1 parent 7a03d0b commit e544d92

File tree

5 files changed

+5
-27
lines changed

5 files changed

+5
-27
lines changed

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::cell::LazyCell;
22
use std::ops::ControlFlow;
33

4-
use rustc_abi::FieldIdx;
4+
use rustc_abi::{ExternAbi, FieldIdx};
55
use rustc_attr_data_structures::ReprAttr::ReprPacked;
66
use rustc_data_structures::unord::{UnordMap, UnordSet};
77
use rustc_errors::codes::*;
@@ -12,7 +12,6 @@ use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
1212
use rustc_infer::traits::{Obligation, ObligationCauseCode};
1313
use rustc_lint_defs::builtin::{
1414
REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS, UNSUPPORTED_CALLING_CONVENTIONS,
15-
UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS,
1615
};
1716
use rustc_middle::hir::nested_filter;
1817
use 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-
8569
fn 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 {

compiler/rustc_hir_analysis/src/check/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ pub mod wfcheck;
7272

7373
use std::num::NonZero;
7474

75-
pub use check::{check_abi, check_abi_fn_ptr};
76-
use rustc_abi::{ExternAbi, VariantIdx};
75+
pub use check::check_abi;
76+
use rustc_abi::VariantIdx;
7777
use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
7878
use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err};
7979
use rustc_hir::def_id::{DefId, LocalDefId};

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ use rustc_trait_selection::traits::wf::object_region_bounds;
5050
use rustc_trait_selection::traits::{self, ObligationCtxt};
5151
use tracing::{debug, instrument};
5252

53-
use crate::check::check_abi_fn_ptr;
5453
use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation};
5554
use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint};
5655
use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_args};
@@ -2736,12 +2735,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
27362735
let fn_ty = tcx.mk_fn_sig(input_tys, output_ty, decl.c_variadic, safety, abi);
27372736
let bare_fn_ty = ty::Binder::bind_with_vars(fn_ty, bound_vars);
27382737

2739-
if let hir::Node::Ty(hir::Ty { kind: hir::TyKind::BareFn(bare_fn_ty), span, .. }) =
2740-
tcx.hir_node(hir_id)
2741-
{
2742-
check_abi_fn_ptr(tcx, hir_id, *span, bare_fn_ty.abi);
2743-
}
2744-
27452738
// reject function types that violate cmse ABI requirements
27462739
cmse::validate_cmse_abi(self.tcx(), self.dcx(), hir_id, abi, bare_fn_ty);
27472740

compiler/rustc_lint/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ fn register_builtins(store: &mut LintStore) {
609609
"converted into hard error, see issue #127323 \
610610
<https://github.com/rust-lang/rust/issues/127323> for more information",
611611
);
612+
store.register_removed("unsupported_fn_ptr_calling_conventions", "converted into hard error");
612613
store.register_removed(
613614
"undefined_naked_function_abi",
614615
"converted into hard error, see PR #139001 \

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ declare_lint_pass! {
123123
UNSAFE_OP_IN_UNSAFE_FN,
124124
UNSTABLE_NAME_COLLISIONS,
125125
UNSTABLE_SYNTAX_PRE_EXPANSION,
126-
UNSUPPORTED_FN_PTR_CALLING_CONVENTIONS,
127126
UNUSED_ASSIGNMENTS,
128127
UNUSED_ASSOCIATED_TYPE_BOUNDS,
129128
UNUSED_ATTRIBUTES,

0 commit comments

Comments
 (0)