@@ -479,20 +479,24 @@ pub struct Crate {
479
479
pub is_placeholder : bool ,
480
480
}
481
481
482
- /// Possible values inside of compile-time attribute lists.
482
+ /// Values inside meta item lists.
483
483
///
484
- /// E.g., the '..' in `#[name(.. )]`.
484
+ /// E.g., each of `Clone`, `Copy` in `#[derive(Clone, Copy )]`.
485
485
#[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
486
486
pub enum NestedMetaItem {
487
487
/// A full MetaItem, for recursive meta items.
488
488
MetaItem ( MetaItem ) ,
489
+
489
490
/// A literal.
490
491
///
491
492
/// E.g., `"foo"`, `64`, `true`.
492
493
Lit ( MetaItemLit ) ,
493
494
}
494
495
495
- /// A spanned compile-time attribute item.
496
+ /// A semantic representation of a meta item. A meta item is a slightly
497
+ /// restricted form of an attribute -- it can only contain expressions in
498
+ /// certain leaf positions, rather than arbitrary token streams -- that is used
499
+ /// for most built-in attributes.
496
500
///
497
501
/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`.
498
502
#[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
@@ -502,22 +506,22 @@ pub struct MetaItem {
502
506
pub span : Span ,
503
507
}
504
508
505
- /// A compile-time attribute item.
506
- ///
507
- /// E.g., `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`.
509
+ /// The meta item kind, containing the data after the initial path.
508
510
#[ derive( Clone , Encodable , Decodable , Debug , HashStable_Generic ) ]
509
511
pub enum MetaItemKind {
510
512
/// Word meta item.
511
513
///
512
- /// E.g., `test` as in `#[ test] `.
514
+ /// E.g., `#[ test]`, which lacks any arguments after ` test`.
513
515
Word ,
516
+
514
517
/// List meta item.
515
518
///
516
- /// E.g., `derive(..)` as in `#[derive(..)] `.
519
+ /// E.g., `#[ derive(..)]`, where the field represents the `.. `.
517
520
List ( Vec < NestedMetaItem > ) ,
521
+
518
522
/// Name value meta item.
519
523
///
520
- /// E.g., `feature = "foo"` as in `#[feature = "foo"] `.
524
+ /// E.g., `#[ feature = "foo"]`, where the field represents the ` "foo"`.
521
525
NameValue ( MetaItemLit ) ,
522
526
}
523
527
@@ -2580,7 +2584,7 @@ pub struct AttrItem {
2580
2584
/// A list of attributes.
2581
2585
pub type AttrVec = ThinVec < Attribute > ;
2582
2586
2583
- /// Metadata associated with an item .
2587
+ /// A syntax-level representation of an attribute .
2584
2588
#[ derive( Clone , Encodable , Decodable , Debug ) ]
2585
2589
pub struct Attribute {
2586
2590
pub kind : AttrKind ,
0 commit comments