Skip to content

Commit 780a4c7

Browse files
compiler: Remove unsupported_fn_ptr_calling_conventions lint
1 parent 0b35295 commit 780a4c7

File tree

5 files changed

+7
-29
lines changed

5 files changed

+7
-29
lines changed

compiler/rustc_hir_analysis/src/check/check.rs

Lines changed: 2 additions & 24 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;
@@ -68,28 +67,6 @@ pub fn check_abi(tcx: TyCtxt<'_>, hir_id: hir::HirId, span: Span, abi: ExternAbi
6867
}
6968
}
7069

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-
9370
fn check_struct(tcx: TyCtxt<'_>, def_id: LocalDefId) {
9471
let def = tcx.adt_def(def_id);
9572
let span = tcx.def_span(def_id);
@@ -845,6 +822,7 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
845822
let hir::ItemKind::ForeignMod { abi, items } = it.kind else {
846823
return;
847824
};
825+
848826
check_abi(tcx, it.hir_id(), it.span, abi);
849827

850828
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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ 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;
53+
use crate::check::check_abi;
5454
use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation};
5555
use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint};
5656
use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_args};
@@ -2739,7 +2739,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
27392739
if let hir::Node::Ty(hir::Ty { kind: hir::TyKind::BareFn(bare_fn_ty), span, .. }) =
27402740
tcx.hir_node(hir_id)
27412741
{
2742-
check_abi_fn_ptr(tcx, hir_id, *span, bare_fn_ty.abi);
2742+
check_abi(tcx, hir_id, *span, bare_fn_ty.abi);
27432743
}
27442744

27452745
// reject function types that violate cmse ABI requirements

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)