@@ -836,7 +836,7 @@ pub enum Expr_ {
836
836
ExprVec ( HirVec < P < Expr > > ) ,
837
837
/// A function call
838
838
///
839
- /// The first field resolves to the function itself,
839
+ /// The first field resolves to the function itself (usually an `ExprPath`) ,
840
840
/// and the second field is the list of arguments
841
841
ExprCall ( P < Expr > , HirVec < P < Expr > > ) ,
842
842
/// A method call (`x.foo::<Bar, Baz>(a, b, c, d)`)
@@ -845,9 +845,9 @@ pub enum Expr_ {
845
845
/// The vector of `Ty`s are the ascripted type parameters for the method
846
846
/// (within the angle brackets).
847
847
///
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.
851
851
///
852
852
/// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
853
853
/// `ExprMethodCall(foo, [Bar, Baz], [x, a, b, c, d])`.
@@ -919,13 +919,13 @@ pub enum Expr_ {
919
919
/// Inline assembly (from `asm!`), with its outputs and inputs.
920
920
ExprInlineAsm ( InlineAsm , Vec < P < Expr > > , Vec < P < Expr > > ) ,
921
921
922
- /// A struct literal expression.
922
+ /// A struct or struct-like variant literal expression.
923
923
///
924
924
/// For example, `Foo {x: 1, y: 2}`, or
925
925
/// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
926
926
ExprStruct ( Path , HirVec < Field > , Option < P < Expr > > ) ,
927
927
928
- /// A vector literal constructed from one repeated element.
928
+ /// An array literal constructed from one repeated element.
929
929
///
930
930
/// For example, `[1; 5]`. The first expression is the element
931
931
/// to be repeated; the second is the number of times to repeat it.
@@ -950,14 +950,21 @@ pub struct QSelf {
950
950
pub position : usize ,
951
951
}
952
952
953
+ /// Hints at the original code for a `match _ { .. }`
953
954
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug , Copy ) ]
954
955
pub enum MatchSource {
956
+ /// A `match _ { .. }`
955
957
Normal ,
958
+ /// An `if let _ = _ { .. }` (optionally with `else { .. }`)
956
959
IfLetDesugar {
957
960
contains_else_clause : bool ,
958
961
} ,
962
+ /// A `while let _ = _ { .. }` (which was desugared to a
963
+ /// `loop { match _ { .. } }`)
959
964
WhileLetDesugar ,
965
+ /// A desugared `for _ in _ { .. }` loop
960
966
ForLoopDesugar ,
967
+ /// A desugared `?` operator
961
968
TryDesugar ,
962
969
}
963
970
@@ -975,8 +982,7 @@ pub struct MutTy {
975
982
pub mutbl : Mutability ,
976
983
}
977
984
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.
980
986
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
981
987
pub struct MethodSig {
982
988
pub unsafety : Unsafety ,
@@ -999,13 +1005,20 @@ pub struct TraitItem {
999
1005
pub span : Span ,
1000
1006
}
1001
1007
1008
+ /// Represents a trait method or associated constant or type
1002
1009
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1003
1010
pub enum TraitItem_ {
1011
+ /// An associated constant with an optional value (otherwise `impl`s
1012
+ /// must contain a value)
1004
1013
ConstTraitItem ( P < Ty > , Option < P < Expr > > ) ,
1014
+ /// A method with an optional body
1005
1015
MethodTraitItem ( MethodSig , Option < P < Block > > ) ,
1016
+ /// An associated type with (possibly empty) bounds and optional concrete
1017
+ /// type
1006
1018
TypeTraitItem ( TyParamBounds , Option < P < Ty > > ) ,
1007
1019
}
1008
1020
1021
+ /// Represents anything within an `impl` block
1009
1022
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1010
1023
pub struct ImplItem {
1011
1024
pub id : NodeId ,
@@ -1017,10 +1030,15 @@ pub struct ImplItem {
1017
1030
pub span : Span ,
1018
1031
}
1019
1032
1033
+ /// Represents different contents within `impl`s
1020
1034
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
1021
1035
pub enum ImplItemKind {
1036
+ /// An associated constant of the given type, set to the constant result
1037
+ /// of the expression
1022
1038
Const ( P < Ty > , P < Expr > ) ,
1039
+ /// A method implementation with the given signature and body
1023
1040
Method ( MethodSig , P < Block > ) ,
1041
+ /// An associated type
1024
1042
Type ( P < Ty > ) ,
1025
1043
}
1026
1044
0 commit comments