about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-28 13:41:38 +0000
committerbors <bors@rust-lang.org>2025-08-28 13:41:38 +0000
commit1f7dcc878d73c45cc40018aac6e5c767446df110 (patch)
tree1aea0e97a7daea5e9b5377eccdb8601a47446ac4 /compiler/rustc_passes/src
parentb41634205b549a62cfa55363d1e00c4143d30033 (diff)
parent556d2fa94b7d6da252bdf34b683970e1cd016b14 (diff)
downloadrust-1f7dcc878d73c45cc40018aac6e5c767446df110.tar.gz
rust-1f7dcc878d73c45cc40018aac6e5c767446df110.zip
Auto merge of #145958 - Zalathar:rollup-ii9z77c, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#142727 (wasm: rm static mut)
 - rust-lang/rust#143193 (Port `#[link]` to the new attribute parsing infrastructure )
 - rust-lang/rust#144864 (No source fixes)
 - rust-lang/rust#145913 (Add spin_loop hint for LoongArch)
 - rust-lang/rust#145926 (compiletest: Remove several remnants of the old libtest-based executor)
 - rust-lang/rust#145928 (Rename `Location::file_with_nul` to `file_as_c_str`)
 - rust-lang/rust#145930 (`const`ify (the unstable) `str::as_str`)
 - rust-lang/rust#145941 (Disable `integer_to_ptr_transmutes` suggestion for unsized types)
 - rust-lang/rust#145953 (Update `icu_list` to 2.0)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 3a79176f914..c47b488465b 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -200,6 +200,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
                 &Attribute::Parsed(AttributeKind::Sanitize { on_set, off_set, span: attr_span}) => {
                     self.check_sanitize(attr_span, on_set | off_set, span, target);
                 },
+                Attribute::Parsed(AttributeKind::Link(_, attr_span)) => {
+                    self.check_link(hir_id, *attr_span, span, target)
+                }
                 Attribute::Parsed(
                     AttributeKind::BodyStability { .. }
                     | AttributeKind::ConstStabilityIndirect
@@ -305,7 +308,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
                         [sym::rustc_has_incoherent_inherent_impls, ..] => {
                             self.check_has_incoherent_inherent_impls(attr, span, target)
                         }
-                        [sym::link, ..] => self.check_link(hir_id, attr, span, target),
                         [sym::macro_export, ..] => self.check_macro_export(hir_id, attr, target),
                         [sym::autodiff_forward, ..] | [sym::autodiff_reverse, ..] => {
                             self.check_autodiff(hir_id, attr, span, target)
@@ -1324,7 +1326,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
     }
 
     /// Checks if `#[link]` is applied to an item other than a foreign module.
-    fn check_link(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Target) {
+    fn check_link(&self, hir_id: HirId, attr_span: Span, span: Span, target: Target) {
         if target == Target::ForeignMod
             && let hir::Node::Item(item) = self.tcx.hir_node(hir_id)
             && let Item { kind: ItemKind::ForeignMod { abi, .. }, .. } = item
@@ -1336,7 +1338,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
         self.tcx.emit_node_span_lint(
             UNUSED_ATTRIBUTES,
             hir_id,
-            attr.span(),
+            attr_span,
             errors::Link { span: (target != Target::ForeignMod).then_some(span) },
         );
     }