about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/dangling.rs
diff options
context:
space:
mode:
authorPavel Grigorenko <GrigorenkoPV@ya.ru>2025-06-14 13:01:15 +0300
committerPavel Grigorenko <GrigorenkoPV@ya.ru>2025-06-16 18:13:27 +0300
commitda8d6bbd5043e8f4ea83a2431117c32b0339ac54 (patch)
treec368bd22c1a07fdb24081eb35687ac7ccb22b79d /compiler/rustc_lint/src/dangling.rs
parent68ac5abb067806a88464ddbfbd3c7eec877b488d (diff)
downloadrust-da8d6bbd5043e8f4ea83a2431117c32b0339ac54.tar.gz
rust-da8d6bbd5043e8f4ea83a2431117c32b0339ac54.zip
Port `#[rustc_as_ptr]` to the new attribute system
Diffstat (limited to 'compiler/rustc_lint/src/dangling.rs')
-rw-r--r--compiler/rustc_lint/src/dangling.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/dangling.rs b/compiler/rustc_lint/src/dangling.rs
index 91c7922638d..c737919db9c 100644
--- a/compiler/rustc_lint/src/dangling.rs
+++ b/compiler/rustc_lint/src/dangling.rs
@@ -1,4 +1,5 @@
 use rustc_ast::visit::{visit_opt, walk_list};
+use rustc_attr_data_structures::{AttributeKind, find_attr};
 use rustc_hir::def_id::LocalDefId;
 use rustc_hir::intravisit::{FnKind, Visitor, walk_expr};
 use rustc_hir::{Block, Body, Expr, ExprKind, FnDecl, LangItem};
@@ -133,7 +134,7 @@ fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
         && let ty = cx.typeck_results().expr_ty(receiver)
         && owns_allocation(cx.tcx, ty)
         && let Some(fn_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id)
-        && cx.tcx.has_attr(fn_id, sym::rustc_as_ptr)
+        && find_attr!(cx.tcx.get_all_attrs(fn_id), AttributeKind::AsPtr(_))
     {
         // FIXME: use `emit_node_lint` when `#[primary_span]` is added.
         cx.tcx.emit_node_span_lint(