Skip to content

Commit bf5fc6e

Browse files
committed
Remove some depgraph edges on the HIR by invoking the intrinsic query instead of checking the attribute
1 parent b3dcbc2 commit bf5fc6e

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use rustc_middle::ty::{self, SymbolName, TyCtxt};
1616
use rustc_middle::ty::{GenericArgKind, GenericArgsRef};
1717
use rustc_middle::util::Providers;
1818
use rustc_session::config::{CrateType, OomStrategy};
19-
use rustc_span::sym;
2019
use rustc_target::spec::{SanitizerSet, TlsModel};
2120

2221
pub fn threshold(tcx: TyCtxt<'_>) -> SymbolExportLevel {
@@ -82,7 +81,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
8281
return library.kind.is_statically_included().then_some(def_id);
8382
}
8483

85-
if tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden) {
84+
if tcx.intrinsic(def_id).is_some_and(|i| i.must_be_overridden) {
8685
return None;
8786
}
8887

compiler/rustc_mir_transform/src/cross_crate_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn cross_crate_inlinable(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
2323
return false;
2424
}
2525

26-
if tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden) {
26+
if tcx.intrinsic(def_id).is_some_and(|i| i.must_be_overridden) {
2727
return false;
2828
}
2929

compiler/rustc_mir_transform/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,9 @@ fn optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> &Body<'_> {
632632
}
633633

634634
fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
635-
if let Some(attr) = tcx.get_attr(did, sym::rustc_intrinsic_must_be_overridden) {
635+
if tcx.intrinsic(did).is_some_and(|i| i.must_be_overridden) {
636636
span_bug!(
637-
attr.span,
637+
tcx.def_span(did),
638638
"this intrinsic must be overridden by the codegen backend, it has no meaningful body",
639639
)
640640
}

compiler/rustc_monomorphize/src/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) ->
10191019
return false;
10201020
}
10211021

1022-
if tcx.has_attr(def_id, sym::rustc_intrinsic_must_be_overridden) {
1022+
if tcx.intrinsic(def_id).is_some_and(|i| i.must_be_overridden) {
10231023
// These are implemented by backends directly and have no meaningful body.
10241024
return false;
10251025
}

0 commit comments

Comments
 (0)