Rollup merge of #123063 - tmiasko:reachability-abi, r=michaelwoerister

Function ABI is irrelevant for reachability
This commit is contained in:
Matthias Krüger 2024-03-28 17:40:49 +01:00 committed by GitHub
commit 732ded92a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,7 +24,6 @@
use rustc_middle::ty::{self, ExistentialTraitRef, TyCtxt};
use rustc_privacy::DefIdVisitor;
use rustc_session::config::CrateType;
use rustc_target::spec::abi::Abi;
/// Determines whether this item is recursive for reachability. See `is_recursively_reachable_local`
/// below for details.
@ -164,16 +163,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 {
@ -182,7 +171,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 {