Skip to content

Commit 4d62bf1

Browse files
committed
All weak lang items have an explicit link name and vice versa
1 parent 3507a74 commit 4d62bf1

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_ast::{LitKind, MetaItem, MetaItemInner, attr};
66
use rustc_hir::attrs::{AttributeKind, InlineAttr, InstructionSetAttr, UsedBy};
77
use rustc_hir::def::DefKind;
88
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
9-
use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS;
109
use rustc_hir::{self as hir, Attribute, LangItem, find_attr, lang_items};
1110
use rustc_middle::middle::codegen_fn_attrs::{
1211
CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
@@ -520,14 +519,12 @@ fn handle_lang_items(
520519
// strippable by the linker.
521520
//
522521
// Additionally weak lang items have predetermined symbol names.
523-
if let Some(lang_item) = lang_item {
524-
if WEAK_LANG_ITEMS.contains(&lang_item) {
525-
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
526-
}
527-
if let Some(link_name) = lang_item.link_name() {
528-
codegen_fn_attrs.export_name = Some(link_name);
529-
codegen_fn_attrs.link_name = Some(link_name);
530-
}
522+
if let Some(lang_item) = lang_item
523+
&& let Some(link_name) = lang_item.link_name()
524+
{
525+
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
526+
codegen_fn_attrs.export_name = Some(link_name);
527+
codegen_fn_attrs.link_name = Some(link_name);
531528
}
532529

533530
// error when using no_mangle on a lang item item

0 commit comments

Comments
 (0)