From b24df424888d9db3a22d6d52f3f516e29d5be21a Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Sun, 22 Jun 2025 12:09:14 +0200 Subject: Port `#[must_use]` to new attribute parsing infrastructure Signed-off-by: Jonathan Brouwer --- compiler/rustc_attr_data_structures/src/attributes.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'compiler/rustc_attr_data_structures') 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, + }, + /// Represents `#[optimize(size|speed)]` Optimize(OptimizeAttr, Span), -- cgit 1.4.1-3-g733a5