From 2ae0765ffb743de9845ee953bb6020db866e5b63 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 25 Apr 2024 10:14:17 +1000 Subject: [PATCH] Add comments about attribute tokens. This clarifies something that has puzzled me for some time. --- compiler/rustc_ast/src/ast.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index bddb50568d4..dc3377f6bad 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -2786,6 +2786,7 @@ pub enum AttrKind { #[derive(Clone, Encodable, Decodable, Debug)] pub struct NormalAttr { pub item: AttrItem, + // Tokens for the full attribute, e.g. `#[foo]`, `#![bar]`. pub tokens: Option, } @@ -2802,6 +2803,7 @@ pub fn from_ident(ident: Ident) -> Self { pub struct AttrItem { pub path: Path, pub args: AttrArgs, + // Tokens for the meta item, e.g. just the `foo` within `#[foo]` or `#![foo]`. pub tokens: Option, }