diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index a139dd152f006..e1e681b7aff35 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -836,7 +836,7 @@ pub enum Expr_ { ExprVec(HirVec
>),
/// A function call
///
- /// The first field resolves to the function itself,
+ /// The first field resolves to the function itself (usually an `ExprPath`),
/// and the second field is the list of arguments
ExprCall(P >),
/// A method call (`x.foo:: >, Vec >),
- /// A struct literal expression.
+ /// A struct or struct-like variant literal expression.
///
/// For example, `Foo {x: 1, y: 2}`, or
/// `Foo {x: 1, .. base}`, where `base` is the `Option >),
- /// A vector literal constructed from one repeated element.
+ /// An array literal constructed from one repeated element.
///
/// For example, `[1; 5]`. The first expression is the element
/// to be repeated; the second is the number of times to repeat it.
@@ -950,14 +950,21 @@ pub struct QSelf {
pub position: usize,
}
+/// Hints at the original code for a `match _ { .. }`
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
pub enum MatchSource {
+ /// A `match _ { .. }`
Normal,
+ /// An `if let _ = _ { .. }` (optionally with `else { .. }`)
IfLetDesugar {
contains_else_clause: bool,
},
+ /// A `while let _ = _ { .. }` (which was desugared to a
+ /// `loop { match _ { .. } }`)
WhileLetDesugar,
+ /// A desugared `for _ in _ { .. }` loop
ForLoopDesugar,
+ /// A desugared `?` operator
TryDesugar,
}
@@ -975,8 +982,7 @@ pub struct MutTy {
pub mutbl: Mutability,
}
-/// Represents a method's signature in a trait declaration,
-/// or in an implementation.
+/// Represents a method's signature in a trait declaration or implementation.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct MethodSig {
pub unsafety: Unsafety,
@@ -999,13 +1005,20 @@ pub struct TraitItem {
pub span: Span,
}
+/// Represents a trait method or associated constant or type
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum TraitItem_ {
+ /// An associated constant with an optional value (otherwise `impl`s
+ /// must contain a value)
ConstTraitItem(P >),
+ /// A method with an optional body
MethodTraitItem(MethodSig, Option >),
+ /// An associated type with (possibly empty) bounds and optional concrete
+ /// type
TypeTraitItem(TyParamBounds, Option >),
}
+/// Represents anything within an `impl` block
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct ImplItem {
pub id: NodeId,
@@ -1017,10 +1030,15 @@ pub struct ImplItem {
pub span: Span,
}
+/// Represents different contents within `impl`s
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum ImplItemKind {
+ /// An associated constant of the given type, set to the constant result
+ /// of the expression
Const(P