Copy over missing doc comments
diff --git a/src/attr.rs b/src/attr.rs
index e08d9c7..10c8029 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -1,5 +1,6 @@
use super::*;
+/// Doc-comments are promoted to attributes that have is_sugared_doc = true
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Attribute {
pub value: MetaItem,
diff --git a/src/expr.rs b/src/expr.rs
index 9a99911..a66792d 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -280,6 +280,16 @@
Mac(Mac),
}
+/// An arm of a 'match'.
+///
+/// E.g. `0...10 => { println!("match!") }` as in
+///
+/// ```rust,ignore
+/// match n {
+/// 0...10 => { println!("match!") },
+/// // ..
+/// }
+/// ```
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Arm {
pub attrs: Vec<Attribute>,
diff --git a/src/generics.rs b/src/generics.rs
index 68968e1..7e091e5 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -1,5 +1,7 @@
use super::*;
+/// Represents lifetimes and type parameters attached to a declaration
+/// of a function, enum, trait, etc.
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub struct Generics {
pub lifetimes: Vec<LifetimeDef>,
@@ -12,6 +14,7 @@
pub ident: Ident,
}
+/// A lifetime definition, e.g. `'a: 'b+'c+'d`
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct LifetimeDef {
pub lifetime: Lifetime,
@@ -25,18 +28,25 @@
pub default: Option<Ty>,
}
+/// The AST represents all type param bounds as types.
+/// typeck::collect::compute_bounds matches these against
+/// the "special" built-in traits (see middle::lang_items) and
+/// detects Copy, Send and Sync.
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum TyParamBound {
Trait(PolyTraitRef, TraitBoundModifier),
Region(Lifetime),
}
+/// A modifier on a bound, currently this is only used for `?Sized`, where the
+/// modifier is `Maybe`. Negative bounds should also be handled here.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum TraitBoundModifier {
None,
Maybe,
}
+/// A `where` clause in a definition
#[derive(Debug, Clone, Eq, PartialEq, Default)]
pub struct WhereClause {
pub predicates: Vec<WherePredicate>,
diff --git a/src/item.rs b/src/item.rs
index 95af98d..25a520c 100644
--- a/src/item.rs
+++ b/src/item.rs
@@ -1,5 +1,8 @@
use super::*;
+/// An item
+///
+/// The name might be a dummy name in case of anonymous items
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Item {
pub ident: Ident,
@@ -138,6 +141,7 @@
pub vis: Visibility,
}
+/// An item within an `extern` block
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum ForeignItemKind {
/// A foreign function
diff --git a/src/ty.rs b/src/ty.rs
index cdfa697..0dc6eaf 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -1,5 +1,6 @@
use super::*;
+/// The different kinds of types recognized by the compiler
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum Ty {
/// A variable-length array (`[T]`)
@@ -46,6 +47,12 @@
Immutable,
}
+/// A "Path" is essentially Rust's notion of a name.
+///
+/// It's represented as a sequence of identifiers,
+/// along with a bunch of supporting information.
+///
+/// E.g. `std::cmp::PartialEq`
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Path {
pub global: bool,