about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-04-25 10:14:17 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-04-25 10:14:17 +1000
commit2ae0765ffb743de9845ee953bb6020db866e5b63 (patch)
tree81112009fb370e7eb55610e73501dc4ad622289c
parent78e7c7b9f9f6a671255ff0fb88b5a6fd6dbc7a58 (diff)
downloadrust-2ae0765ffb743de9845ee953bb6020db866e5b63.tar.gz
rust-2ae0765ffb743de9845ee953bb6020db866e5b63.zip
Add comments about attribute tokens.
This clarifies something that has puzzled me for some time.
-rw-r--r--compiler/rustc_ast/src/ast.rs2
1 files changed, 2 insertions, 0 deletions
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<LazyAttrTokenStream>,
 }
 
@@ -2802,6 +2803,7 @@ impl NormalAttr {
 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<LazyAttrTokenStream>,
 }