about summary refs log tree commit diff
path: root/compiler/rustc_attr_data_structures/src
diff options
context:
space:
mode:
authorJonathan Brouwer <jonathantbrouwer@gmail.com>2025-06-22 12:09:14 +0200
committerJonathan Brouwer <jonathantbrouwer@gmail.com>2025-06-22 14:51:58 +0200
commitb24df424888d9db3a22d6d52f3f516e29d5be21a (patch)
treeb6bd93fefab51b75c87bd12ecb46d4a93d7fab6a /compiler/rustc_attr_data_structures/src
parenta30f1783fe136d92545423dd30b12eb619973cdb (diff)
downloadrust-b24df424888d9db3a22d6d52f3f516e29d5be21a.tar.gz
rust-b24df424888d9db3a22d6d52f3f516e29d5be21a.zip
Port `#[must_use]` to new attribute parsing infrastructure
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
Diffstat (limited to 'compiler/rustc_attr_data_structures/src')
-rw-r--r--compiler/rustc_attr_data_structures/src/attributes.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_attr_data_structures/src/attributes.rs b/compiler/rustc_attr_data_structures/src/attributes.rs
index f0f5cc4db07..ce1d8080262 100644
--- a/compiler/rustc_attr_data_structures/src/attributes.rs
+++ b/compiler/rustc_attr_data_structures/src/attributes.rs
@@ -237,6 +237,13 @@ pub enum AttributeKind {
     /// Represents [`#[may_dangle]`](https://std-dev-guide.rust-lang.org/tricky/may-dangle.html).
     MayDangle(Span),
 
+    /// Represents `#[must_use]`.
+    MustUse {
+        span: Span,
+        /// must_use can optionally have a reason: `#[must_use = "reason this must be used"]`
+        reason: Option<Symbol>,
+    },
+
     /// Represents `#[optimize(size|speed)]`
     Optimize(OptimizeAttr, Span),