@@ -836,7 +836,7 @@ pub enum Expr_ {
836836 ExprVec ( HirVec < P < Expr > > ) ,
837837 /// A function call
838838 ///
839- /// The first field resolves to the function itself,
839+ /// The first field resolves to the function itself (usually an `ExprPath`) ,
840840 /// and the second field is the list of arguments
841841 ExprCall ( P < Expr > , HirVec < P < Expr > > ) ,
842842 /// A method call (`x.foo::<Bar, Baz>(a, b, c, d)`)
@@ -845,9 +845,9 @@ pub enum Expr_ {
845845 /// The vector of `Ty`s are the ascripted type parameters for the method
846846 /// (within the angle brackets).
847847 ///
848- /// The first element of the vector of `Expr`s is the expression that evaluates
849- /// to the object on which the method is being called on (the receiver),
850- /// and the remaining elements are the rest of the arguments.
848+ /// The first element of the vector of `Expr`s is the expression that
849+ /// evaluates to the object on which the method is being called on (the
850+ /// receiver), and the remaining elements are the rest of the arguments.
851851 ///
852852 /// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
853853 /// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])`.
@@ -919,13 +919,13 @@ pub enum Expr_ {
919919 /// Inline assembly (from `asm!`), with its outputs and inputs.
920920 ExprInlineAsm ( InlineAsm , Vec < P < Expr > > , Vec < P < Expr > > ) ,
921921
922- /// A struct literal expression.
922+ /// A struct or struct-like variant literal expression.
923923 ///
924924 /// For example, `Foo {x: 1, y: 2}`, or
925925 /// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
926926 ExprStruct ( Path , HirVec < Field > , Option < P < Expr > > ) ,
927927
928- /// A vector literal constructed from one repeated element.
928+ /// An array literal constructed from one repeated element.
929929 ///
930930 /// For example, `[1; 5]`. The first expression is the element
931931 /// to be repeated; the second is the number of times to repeat it.
@@ -950,14 +950,21 @@ pub struct QSelf {
950950 pub position : usize ,
951951}
952952
953+ /// Hints at the original code for a `match _ { .. }`
953954#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug , Copy ) ]
954955pub enum MatchSource {
956+ /// A `match _ { .. }`
955957 Normal ,
958+ /// An `if let _ = _ { .. }` (optionally with `else { .. }`)
956959 IfLetDesugar {
957960 contains_else_clause : bool ,
958961 } ,
962+ /// A `while let _ = _ { .. }` (which was desugared to a
963+ /// `loop { match _ { .. } }`)
959964 WhileLetDesugar ,
965+ /// A desugared `for _ in _ { .. }` loop
960966 ForLoopDesugar ,
967+ /// A desugared `?` operator
961968 TryDesugar ,
962969}
963970
@@ -975,8 +982,7 @@ pub struct MutTy {
975982 pub mutbl : Mutability ,
976983}
977984
978- /// Represents a method's signature in a trait declaration,
979- /// or in an implementation.
985+ /// Represents a method's signature in a trait declaration or implementation.
980986#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
981987pub struct MethodSig {
982988 pub unsafety : Unsafety ,
@@ -999,13 +1005,20 @@ pub struct TraitItem {
9991005 pub span : Span ,
10001006}
10011007
1008+ /// Represents a trait method or associated constant or type
10021009#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
10031010pub enum TraitItem_ {
1011+ /// An associated constant with an optional value (otherwise `impl`s
1012+ /// must contain a value)
10041013 ConstTraitItem ( P < Ty > , Option < P < Expr > > ) ,
1014+ /// A method with an optional body
10051015 MethodTraitItem ( MethodSig , Option < P < Block > > ) ,
1016+ /// An associated type with (possibly empty) bounds and optional concrete
1017+ /// type
10061018 TypeTraitItem ( TyParamBounds , Option < P < Ty > > ) ,
10071019}
10081020
1021+ /// Represents anything within an `impl` block
10091022#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
10101023pub struct ImplItem {
10111024 pub id : NodeId ,
@@ -1017,10 +1030,15 @@ pub struct ImplItem {
10171030 pub span : Span ,
10181031}
10191032
1033+ /// Represents different contents within `impl`s
10201034#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
10211035pub enum ImplItemKind {
1036+ /// An associated constant of the given type, set to the constant result
1037+ /// of the expression
10221038 Const ( P < Ty > , P < Expr > ) ,
1039+ /// A method implementation with the given signature and body
10231040 Method ( MethodSig , P < Block > ) ,
1041+ /// An associated type
10241042 Type ( P < Ty > ) ,
10251043}
10261044
0 commit comments