@@ -81,19 +81,15 @@ crate struct ExternalCrate {
81
81
/// directly to the AST's concept of an item; it's a strict superset.
82
82
#[ derive( Clone ) ]
83
83
crate struct Item {
84
- /// The [`Span`] of this item in the source code.
85
84
crate span : Span ,
86
85
/// The name of this item.
87
86
/// Optional because not every item has a name, e.g. impls.
88
87
crate name : Option < Symbol > ,
89
- /// Attributes on this item, e.g. `#[derive(...)]` or `#[inline]`.
90
88
crate attrs : Box < Attributes > ,
91
- /// The visibility of this item (private, `pub`, `pub(crate)`, etc.).
92
89
crate visibility : Visibility ,
93
90
/// Information about this item that is specific to what kind of item it is.
94
91
/// E.g., struct vs enum vs function.
95
92
crate kind : Box < ItemKind > ,
96
- /// The [`DefId`] of this item.
97
93
crate def_id : DefId ,
98
94
}
99
95
@@ -565,6 +561,8 @@ impl<'a> FromIterator<&'a DocFragment> for String {
565
561
}
566
562
}
567
563
564
+ /// The attributes on an [`Item`], including attributes like `#[derive(...)]` and `#[inline]`,
565
+ /// as well as doc comments.
568
566
#[ derive( Clone , Debug , Default ) ]
569
567
crate struct Attributes {
570
568
crate doc_strings : Vec < DocFragment > ,
@@ -1804,8 +1802,11 @@ impl From<hir::PrimTy> for PrimitiveType {
1804
1802
1805
1803
#[ derive( Copy , Clone , Debug ) ]
1806
1804
crate enum Visibility {
1805
+ /// `pub`
1807
1806
Public ,
1807
+ /// visibility inherited from parent (e.g. for enum variant fields)
1808
1808
Inherited ,
1809
+ /// `pub(crate)`, `pub(super)`, or `pub(in path::to::somewhere)`
1809
1810
Restricted ( DefId ) ,
1810
1811
}
1811
1812
@@ -1854,7 +1855,8 @@ crate enum Variant {
1854
1855
Struct ( VariantStruct ) ,
1855
1856
}
1856
1857
1857
- /// Small wrapper around `rustc_span::Span` that adds helper methods and enforces calling `source_callsite`.
1858
+ /// Small wrapper around [`rustc_span::Span]` that adds helper methods
1859
+ /// and enforces calling [`rustc_span::Span::source_callsite()`].
1858
1860
#[ derive( Clone , Debug ) ]
1859
1861
crate struct Span ( rustc_span:: Span ) ;
1860
1862
0 commit comments