about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-07-31 05:43:55 +0000
committerbors <bors@rust-lang.org>2025-07-31 05:43:55 +0000
commitcc0a5b73053c62a3df5f84b3ee85079c9b65fa87 (patch)
treefff3600fcabfaa5b18abf03493ccab74d9f5c1fc /compiler/rustc_codegen_ssa/src/codegen_attrs.rs
parent32e7a4b92b109c24e9822c862a7c74436b50e564 (diff)
parent9c6a618a7b54eacad05e3d3659c61e3cbdc75963 (diff)
downloadrust-cc0a5b73053c62a3df5f84b3ee85079c9b65fa87.tar.gz
rust-cc0a5b73053c62a3df5f84b3ee85079c9b65fa87.zip
Auto merge of #144718 - Zalathar:rollup-76lrtf2, r=Zalathar
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#135975 (Implement `push_mut`)
 - rust-lang/rust#143672 (Fix Box allocator drop elaboration)
 - rust-lang/rust#144232 (Implement support for `become` and explicit tail call codegen for the LLVM backend)
 - rust-lang/rust#144663 (coverage: Re-land "Enlarge empty spans during MIR instrumentation")
 - rust-lang/rust#144685 (Only extract lang items once in codegen_fn_attrs)
 - rust-lang/rust#144717 (Move `rustc_middle::parameterized`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/codegen_attrs.rs')
-rw-r--r--compiler/rustc_codegen_ssa/src/codegen_attrs.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
index 5c54bce6e03..78edc69b237 100644
--- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
+++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs
@@ -527,14 +527,14 @@ fn handle_lang_items(
     attrs: &[Attribute],
     codegen_fn_attrs: &mut CodegenFnAttrs,
 ) {
+    let lang_item = lang_items::extract(attrs).and_then(|(name, _)| LangItem::from_name(name));
+
     // Weak lang items have the same semantics as "std internal" symbols in the
     // sense that they're preserved through all our LTO passes and only
     // strippable by the linker.
     //
     // Additionally weak lang items have predetermined symbol names.
-    if let Some((name, _)) = lang_items::extract(attrs)
-        && let Some(lang_item) = LangItem::from_name(name)
-    {
+    if let Some(lang_item) = lang_item {
         if WEAK_LANG_ITEMS.contains(&lang_item) {
             codegen_fn_attrs.flags |= CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL;
         }
@@ -548,8 +548,6 @@ fn handle_lang_items(
     if codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL)
         && codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::NO_MANGLE)
     {
-        let lang_item =
-            lang_items::extract(attrs).map_or(None, |(name, _span)| LangItem::from_name(name));
         let mut err = tcx
             .dcx()
             .struct_span_err(