Skip to content

Commit 61d82f1

Browse files
authored
Unrolled build for #144685
Rollup merge of #144685 - jdonszelmann:lang-items-once, r=wafflelapkin Only extract lang items once in codegen_fn_attrs This one should be obvious. These two extraction points used to be far apart but now that they're refactored to be close it was rather obvious we're just doing double work.... r? ``@WaffleLapkin`` Buils on #144655
2 parents 32e7a4b + 3fe0e24 commit 61d82f1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,14 @@ fn handle_lang_items(
527527
attrs: &[Attribute],
528528
codegen_fn_attrs: &mut CodegenFnAttrs,
529529
) {
530+
let lang_item = lang_items::extract(attrs).and_then(|(name, _)| LangItem::from_name(name));
531+
530532
// Weak lang items have the same semantics as "std internal" symbols in the
531533
// sense that they're preserved through all our LTO passes and only
532534
// strippable by the linker.
533535
//
534536
// Additionally weak lang items have predetermined symbol names.
535-
if let Some((name, _)) = lang_items::extract(attrs)
536-
&& let Some(lang_item) = LangItem::from_name(name)
537-
{
537+
if let Some(lang_item) = lang_item {
538538
if WEAK_LANG_ITEMS.contains(&lang_item) {
539539
codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
540540
}
@@ -548,8 +548,6 @@ fn handle_lang_items(
548548
if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
549549
&& codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
550550
{
551-
let lang_item =
552-
lang_items::extract(attrs).map_or(None, |(name, _span)| LangItem::from_name(name));
553551
let mut err = tcx
554552
.dcx()
555553
.struct_span_err(

0 commit comments

Comments
 (0)