@@ -1476,9 +1476,9 @@ impl fmt::Display for Unsafety {
1476
1476
1477
1477
#[ derive( Copy , Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash ) ]
1478
1478
pub enum ImplPolarity {
1479
- /// impl Trait for Type
1479
+ /// ` impl Trait for Type`
1480
1480
Positive ,
1481
- /// impl !Trait for Type
1481
+ /// ` impl !Trait for Type`
1482
1482
Negative ,
1483
1483
}
1484
1484
@@ -1494,10 +1494,10 @@ impl fmt::Debug for ImplPolarity {
1494
1494
1495
1495
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1496
1496
pub enum FunctionRetTy {
1497
- /// Functions with return type ! that always
1497
+ /// Functions with return type `!` that always
1498
1498
/// raise an error or exit (i.e. never return to the caller)
1499
1499
NoReturn ( Span ) ,
1500
- /// Return type is not specified. Functions default to () and
1500
+ /// Return type is not specified. Functions default to `()` and
1501
1501
/// closures default to inference. Span points to where return
1502
1502
/// type would be inserted.
1503
1503
DefaultReturn ( Span ) ,
@@ -1553,7 +1553,9 @@ pub struct VariantArg {
1553
1553
1554
1554
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1555
1555
pub enum VariantKind {
1556
+ /// Tuple variant, e.g. `Foo(A, B)`
1556
1557
TupleVariantKind ( Vec < VariantArg > ) ,
1558
+ /// Struct variant, e.g. `Foo {x: A, y: B}`
1557
1559
StructVariantKind ( P < StructDef > ) ,
1558
1560
}
1559
1561
@@ -1568,6 +1570,7 @@ pub struct Variant_ {
1568
1570
pub attrs : Vec < Attribute > ,
1569
1571
pub kind : VariantKind ,
1570
1572
pub id : NodeId ,
1573
+ /// Explicit discriminant, eg `Foo = 1`
1571
1574
pub disr_expr : Option < P < Expr > > ,
1572
1575
pub vis : Visibility ,
1573
1576
}
@@ -1718,6 +1721,9 @@ pub struct StructDef {
1718
1721
FIXME (#3300): Should allow items to be anonymous. Right now
1719
1722
we just use dummy names for anon items.
1720
1723
*/
1724
+ /// An item
1725
+ ///
1726
+ /// The name might be a dummy name in case of anonymous items
1721
1727
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1722
1728
pub struct Item {
1723
1729
pub ident : Ident ,
@@ -1730,19 +1736,27 @@ pub struct Item {
1730
1736
1731
1737
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1732
1738
pub enum Item_ {
1733
- // Optional location (containing arbitrary characters) from which
1734
- // to fetch the crate sources.
1735
- // For example, extern crate whatever = "github.com/rust-lang/rust".
1739
+ /// An`extern crate` item, with optional original crate name,
1740
+ /// e.g. `extern crate foo` or `extern crate "foo-bar" as foo`
1736
1741
ItemExternCrate ( Option < ( InternedString , StrStyle ) > ) ,
1742
+ /// A `use` or `pub use` item
1737
1743
ItemUse ( P < ViewPath > ) ,
1738
1744
1745
+ /// A `static` item
1739
1746
ItemStatic ( P < Ty > , Mutability , P < Expr > ) ,
1747
+ /// A `const` item
1740
1748
ItemConst ( P < Ty > , P < Expr > ) ,
1749
+ /// A function declaration
1741
1750
ItemFn ( P < FnDecl > , Unsafety , Abi , Generics , P < Block > ) ,
1751
+ /// A module
1742
1752
ItemMod ( Mod ) ,
1753
+ /// An external module
1743
1754
ItemForeignMod ( ForeignMod ) ,
1755
+ /// A type alias, e.g. `type Foo = Bar<u8>`
1744
1756
ItemTy ( P < Ty > , Generics ) ,
1757
+ /// An enum definition, e.g. `enum Foo<A, B> {C<A>, D<B>}`
1745
1758
ItemEnum ( EnumDef , Generics ) ,
1759
+ /// A struct definition, e.g. `struct Foo<A> {x: A}`
1746
1760
ItemStruct ( P < StructDef > , Generics ) ,
1747
1761
/// Represents a Trait Declaration
1748
1762
ItemTrait ( Unsafety ,
@@ -1751,8 +1765,9 @@ pub enum Item_ {
1751
1765
Vec < P < TraitItem > > ) ,
1752
1766
1753
1767
// Default trait implementations
1754
- // `impl Trait for ..`
1768
+ // `impl Trait for .. {} `
1755
1769
ItemDefaultImpl ( Unsafety , TraitRef ) ,
1770
+ /// An implementation, eg `impl<A> Trait for Foo { .. }`
1756
1771
ItemImpl ( Unsafety ,
1757
1772
ImplPolarity ,
1758
1773
Generics ,
@@ -1794,10 +1809,13 @@ pub struct ForeignItem {
1794
1809
pub vis : Visibility ,
1795
1810
}
1796
1811
1812
+ /// An item within an `extern` block
1797
1813
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1798
1814
pub enum ForeignItem_ {
1815
+ /// A foreign function
1799
1816
ForeignItemFn ( P < FnDecl > , Generics ) ,
1800
- ForeignItemStatic ( P < Ty > , /* is_mutbl */ bool ) ,
1817
+ /// A foreign static item (`static ext: u8`), with optional mutability
1818
+ ForeignItemStatic ( P < Ty > , bool ) ,
1801
1819
}
1802
1820
1803
1821
impl ForeignItem_ {
0 commit comments