Function ABI is irrelevant for reachability

This commit is contained in:
Tomasz Miąsko 2024-03-25 00:00:00 +00:00
parent 35936c4839
commit 955f762fc1

View File

@ -19,7 +19,6 @@
use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt};
use rustc_privacy::DefIdVisitor;
use rustc_session::config::CrateType;
use rustc_target::spec::abi::Abi;
fn item_might_be_inlined(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.generics_of(def_id).requires_monomorphization(tcx)
@ -141,16 +140,6 @@ fn propagate_node(&mut self, node: &Node<'tcx>, search_item: LocalDefId) {
if !self.any_library {
// If we are building an executable, only explicitly extern
// types need to be exported.
let reachable =
if let Node::Item(hir::Item { kind: hir::ItemKind::Fn(sig, ..), .. })
| Node::ImplItem(hir::ImplItem {
kind: hir::ImplItemKind::Fn(sig, ..), ..
}) = *node
{
sig.header.abi != Abi::Rust
} else {
false
};
let codegen_attrs = if self.tcx.def_kind(search_item).has_codegen_attrs() {
self.tcx.codegen_fn_attrs(search_item)
} else {
@ -159,7 +148,7 @@ fn propagate_node(&mut self, node: &Node<'tcx>, search_item: LocalDefId) {
let is_extern = codegen_attrs.contains_extern_indicator();
let std_internal =
codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
if reachable || is_extern || std_internal {
if is_extern || std_internal {
self.reachable_symbols.insert(search_item);
}
} else {