about summary refs log tree commit diff
path: root/compiler/rustc_feature/src/builtin_attrs.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2024-11-20 01:54:24 -0500
committerGitHub <noreply@github.com>2024-11-20 01:54:24 -0500
commit25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab (patch)
tree7c9d4b78935af6a6e3aeb4e5a8e7910f5262aca0 /compiler/rustc_feature/src/builtin_attrs.rs
parentbcfea1f8d253fd43eab36832fa601d192ac603d5 (diff)
parent01fd384d5800deb1e96b0d8921e82317e9fcdb8b (diff)
downloadrust-25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab.tar.gz
rust-25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab.zip
Rollup merge of #132732 - gavincrawford:as_ptr_attribute, r=Urgau
Use attributes for `dangling_pointers_from_temporaries` lint

Checking for dangling pointers by function name isn't ideal, and leaves out certain pointer-returning methods that don't follow the `as_ptr` naming convention. Using an attribute for this lint cleans things up and allows more thorough coverage of other methods, such as `UnsafeCell::get()`.
Diffstat (limited to 'compiler/rustc_feature/src/builtin_attrs.rs')
-rw-r--r--compiler/rustc_feature/src/builtin_attrs.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs
index ce2b47ed1ea..fd08b35d242 100644
--- a/compiler/rustc_feature/src/builtin_attrs.rs
+++ b/compiler/rustc_feature/src/builtin_attrs.rs
@@ -880,6 +880,11 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
         "lang items are subject to change",
     ),
     rustc_attr!(
+        rustc_as_ptr, Normal, template!(Word), ErrorFollowing,
+        EncodeCrossCrate::Yes,
+        "#[rustc_as_ptr] is used to mark functions returning pointers to their inner allocations."
+    ),
+    rustc_attr!(
         rustc_pass_by_value, Normal, template!(Word), ErrorFollowing,
         EncodeCrossCrate::Yes,
         "#[rustc_pass_by_value] is used to mark types that must be passed by value instead of reference."