Add comments about attribute tokens.

This clarifies something that has puzzled me for some time.
This commit is contained in:
Nicholas Nethercote 2024-04-25 10:14:17 +10:00
parent 78e7c7b9f9
commit 2ae0765ffb

View File

@ -2786,6 +2786,7 @@ pub enum AttrKind {
#[derive(Clone, Encodable, Decodable, Debug)] #[derive(Clone, Encodable, Decodable, Debug)]
pub struct NormalAttr { pub struct NormalAttr {
pub item: AttrItem, pub item: AttrItem,
// Tokens for the full attribute, e.g. `#[foo]`, `#![bar]`.
pub tokens: Option<LazyAttrTokenStream>, pub tokens: Option<LazyAttrTokenStream>,
} }
@ -2802,6 +2803,7 @@ pub fn from_ident(ident: Ident) -> Self {
pub struct AttrItem { pub struct AttrItem {
pub path: Path, pub path: Path,
pub args: AttrArgs, pub args: AttrArgs,
// Tokens for the meta item, e.g. just the `foo` within `#[foo]` or `#![foo]`.
pub tokens: Option<LazyAttrTokenStream>, pub tokens: Option<LazyAttrTokenStream>,
} }