Skip to content

Commit 0574242

Browse files
committed
Remove some dead or leftover code related to rustc-intrinsic abi removal
1 parent c6c1796 commit 0574242

File tree

5 files changed

+8
-56
lines changed

5 files changed

+8
-56
lines changed

compiler/rustc_error_codes/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ E0618: 0618,
397397
E0619: 0619,
398398
E0620: 0620,
399399
E0621: 0621,
400-
E0622: 0622,
401400
E0623: 0623,
402401
E0624: 0624,
403402
E0625: 0625,

compiler/rustc_hir_analysis/src/check/check.rs

-10
Original file line numberDiff line numberDiff line change
@@ -787,16 +787,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
787787
for item in items {
788788
let def_id = item.id.owner_id.def_id;
789789

790-
if tcx.has_attr(def_id, sym::rustc_intrinsic) {
791-
intrinsic::check_intrinsic_type(
792-
tcx,
793-
item.id.owner_id.def_id,
794-
item.span,
795-
item.ident.name,
796-
abi,
797-
);
798-
}
799-
800790
let generics = tcx.generics_of(def_id);
801791
let own_counts = generics.own_counts();
802792
if generics.own_params.len() - own_counts.lifetimes != 0 {

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+8-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Type-checking for the `#[rustc_intrinsic]` intrinsics that the compiler exposes.
22
33
use rustc_abi::ExternAbi;
4-
use rustc_errors::codes::*;
5-
use rustc_errors::{DiagMessage, struct_span_code_err};
6-
use rustc_hir::{self as hir, Safety};
4+
use rustc_errors::DiagMessage;
5+
use rustc_hir::{self as hir};
76
use rustc_middle::bug;
87
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
98
use rustc_middle::ty::{self, Ty, TyCtxt};
@@ -26,17 +25,10 @@ fn equate_intrinsic_type<'tcx>(
2625
sig: ty::PolyFnSig<'tcx>,
2726
) {
2827
let (generics, span) = match tcx.hir_node_by_def_id(def_id) {
29-
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. })
30-
| hir::Node::ForeignItem(hir::ForeignItem {
31-
kind: hir::ForeignItemKind::Fn(_, _, generics),
32-
..
33-
}) => (tcx.generics_of(def_id), generics.span),
34-
_ => {
35-
struct_span_code_err!(tcx.dcx(), span, E0622, "intrinsic must be a function")
36-
.with_span_label(span, "expected a function")
37-
.emit();
38-
return;
28+
hir::Node::Item(hir::Item { kind: hir::ItemKind::Fn { generics, .. }, .. }) => {
29+
(tcx.generics_of(def_id), generics.span)
3930
}
31+
_ => tcx.dcx().span_bug(span, "intrinsic must be a function"),
4032
};
4133
let own_counts = generics.own_counts();
4234

@@ -70,13 +62,7 @@ fn equate_intrinsic_type<'tcx>(
7062
}
7163

7264
/// Returns the unsafety of the given intrinsic.
73-
pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
74-
let has_safe_attr = if tcx.has_attr(intrinsic_id, sym::rustc_intrinsic) {
75-
tcx.fn_sig(intrinsic_id).skip_binder().safety()
76-
} else {
77-
// Old-style intrinsics are never safe
78-
Safety::Unsafe
79-
};
65+
fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -> hir::Safety {
8066
let is_in_list = match tcx.item_name(intrinsic_id.into()) {
8167
// When adding a new intrinsic to this list,
8268
// it's usually worth updating that intrinsic's documentation
@@ -148,7 +134,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -
148134
_ => hir::Safety::Unsafe,
149135
};
150136

151-
if has_safe_attr != is_in_list {
137+
if tcx.fn_sig(intrinsic_id).skip_binder().safety() != is_in_list {
152138
tcx.dcx().struct_span_err(
153139
tcx.def_span(intrinsic_id),
154140
DiagMessage::from(format!(
@@ -163,7 +149,7 @@ pub fn intrinsic_operation_unsafety(tcx: TyCtxt<'_>, intrinsic_id: LocalDefId) -
163149

164150
/// Remember to add all intrinsics here, in `compiler/rustc_codegen_llvm/src/intrinsic.rs`,
165151
/// and in `library/core/src/intrinsics.rs`.
166-
pub fn check_intrinsic_type(
152+
pub(crate) fn check_intrinsic_type(
167153
tcx: TyCtxt<'_>,
168154
intrinsic_id: LocalDefId,
169155
span: Span,

tests/ui/error-codes/E0622.rs

-14
This file was deleted.

tests/ui/error-codes/E0622.stderr

-9
This file was deleted.

0 commit comments

Comments
 (0)