about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/default_could_be_derived.rs
diff options
context:
space:
mode:
authorJonathan Brouwer <jonathantbrouwer@gmail.com>2025-07-11 12:01:11 +0200
committerJonathan Brouwer <jonathantbrouwer@gmail.com>2025-07-12 17:48:50 +0200
commitef82007ed7b7833e3efdec0d80712849048c5c1f (patch)
tree76a8c855164384dd5daa3c36a99fff02aacc00c3 /compiler/rustc_lint/src/default_could_be_derived.rs
parent915e5352448afb3c24f89117468935283bc7d2cf (diff)
downloadrust-ef82007ed7b7833e3efdec0d80712849048c5c1f.tar.gz
rust-ef82007ed7b7833e3efdec0d80712849048c5c1f.zip
Port `#[automatically_derived]` to the new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Diffstat (limited to 'compiler/rustc_lint/src/default_could_be_derived.rs')
-rw-r--r--compiler/rustc_lint/src/default_could_be_derived.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/default_could_be_derived.rs b/compiler/rustc_lint/src/default_could_be_derived.rs
index 0bc772d081f..b5fc083a095 100644
--- a/compiler/rustc_lint/src/default_could_be_derived.rs
+++ b/compiler/rustc_lint/src/default_could_be_derived.rs
@@ -1,3 +1,4 @@
+use rustc_attr_data_structures::{AttributeKind, find_attr};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::{Applicability, Diag};
 use rustc_hir as hir;
@@ -62,7 +63,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived {
         let hir::ImplItemKind::Fn(_sig, body_id) = impl_item.kind else { return };
         let assoc = cx.tcx.associated_item(impl_item.owner_id);
         let parent = assoc.container_id(cx.tcx);
-        if cx.tcx.has_attr(parent, sym::automatically_derived) {
+        if find_attr!(cx.tcx.get_all_attrs(parent), AttributeKind::AutomaticallyDerived(..)) {
             // We don't care about what `#[derive(Default)]` produces in this lint.
             return;
         }