@@ -541,7 +541,7 @@ pub struct Block {
541
541
/// without a semicolon, if any
542
542
pub expr : Option < P < Expr > > ,
543
543
pub id : NodeId ,
544
- /// Unsafety of the block
544
+ /// Distinguishes between `unsafe { ... }` and `{ ... }`
545
545
pub rules : BlockCheckMode ,
546
546
pub span : Span ,
547
547
}
@@ -553,11 +553,12 @@ pub struct Pat {
553
553
pub span : Span ,
554
554
}
555
555
556
- #[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
557
556
/// A single field in a struct pattern
558
557
///
559
- /// For patterns like `Foo {x, y, z}`, `pat` and `ident` point to the same identifier
560
- /// and `is_shorthand` is true.
558
+ /// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
559
+ /// are treated the same as` x: x, y: ref y, z: ref mut z`,
560
+ /// except is_shorthand is true
561
+ #[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
561
562
pub struct FieldPat {
562
563
/// The identifier for the field
563
564
pub ident : Ident ,
@@ -601,15 +602,15 @@ pub enum Pat_ {
601
602
/// Destructuring of a struct, e.g. `Foo {x, y, ..}`
602
603
/// The `bool` is `true` in the presence of a `..`
603
604
PatStruct ( Path , Vec < Spanned < FieldPat > > , bool ) ,
604
- /// A tuple pattern (` a, b`)
605
+ /// A tuple pattern `( a, b)`
605
606
PatTup ( Vec < P < Pat > > ) ,
606
607
/// A `box` pattern
607
608
PatBox ( P < Pat > ) ,
608
609
/// A reference pattern, e.g. `&mut (a, b)`
609
610
PatRegion ( P < Pat > , Mutability ) ,
610
611
/// A literal
611
612
PatLit ( P < Expr > ) ,
612
- /// A range pattern, e.g. `[ 1...2] `
613
+ /// A range pattern, e.g. `1...2`
613
614
PatRange ( P < Expr > , P < Expr > ) ,
614
615
/// [a, b, ..i, y, z] is represented as:
615
616
/// PatVec(box [a, b], Some(i), box [y, z])
@@ -817,28 +818,28 @@ pub enum Expr_ {
817
818
ExprIfLet ( P < Pat > , P < Expr > , P < Block > , Option < P < Expr > > ) ,
818
819
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
819
820
/// A while loop, with an optional label
820
- /// `'label while expr { block }`
821
+ /// `'label: while expr { block }`
821
822
ExprWhile ( P < Expr > , P < Block > , Option < Ident > ) ,
822
823
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
823
824
/// A while-let loop, with an optional label
824
- /// `'label while let pat = expr { block }`
825
+ /// `'label: while let pat = expr { block }`
825
826
/// This is desugared to a combination of `loop` and `match` expressions
826
827
ExprWhileLet ( P < Pat > , P < Expr > , P < Block > , Option < Ident > ) ,
827
828
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
828
829
/// A for loop, with an optional label
829
- /// `'label for pat in expr { block }`
830
+ /// `'label: for pat in expr { block }`
830
831
/// This is desugared to a combination of `loop` and `match` expressions
831
832
ExprForLoop ( P < Pat > , P < Expr > , P < Block > , Option < Ident > ) ,
832
- /// Conditionless loop (can be exited with break, cont , or ret )
833
- /// `'label loop { block }`
833
+ /// Conditionless loop (can be exited with break, continue , or return )
834
+ /// `'label: loop { block }`
834
835
// FIXME #6993: change to Option<Name> ... or not, if these are hygienic.
835
836
ExprLoop ( P < Block > , Option < Ident > ) ,
836
837
/// A `match` block, with a source that indicates whether or not it is
837
838
/// the result of a desugaring, and if so, which kind
838
839
ExprMatch ( P < Expr > , Vec < Arm > , MatchSource ) ,
839
840
/// A closure (for example, `move |a, b, c| {a + b + c}`)
840
841
ExprClosure ( CaptureClause , P < FnDecl > , P < Block > ) ,
841
- /// A block
842
+ /// A block (`{ ... }`)
842
843
ExprBlock ( P < Block > ) ,
843
844
844
845
/// An assignment (`a = foo()`)
@@ -853,7 +854,7 @@ pub enum Expr_ {
853
854
ExprTupField ( P < Expr > , Spanned < usize > ) ,
854
855
/// An indexing operation (`foo[2]`)
855
856
ExprIndex ( P < Expr > , P < Expr > ) ,
856
- /// A range (`[ 1..2] `, `[ 1..] `, or `[ ..2] `)
857
+ /// A range (`1..2`, `1..`, or `..2`)
857
858
ExprRange ( Option < P < Expr > > , Option < P < Expr > > ) ,
858
859
859
860
/// Variable reference, possibly containing `::` and/or type
@@ -877,12 +878,14 @@ pub enum Expr_ {
877
878
ExprMac ( Mac ) ,
878
879
879
880
/// A struct literal expression.
880
- /// For example, `Foo {x: 1, y: 2}`
881
- ExprStruct ( Path , Vec < Field > , Option < P < Expr > > /* base */ ) ,
881
+ /// For example, `Foo {x: 1, y: 2}`, or
882
+ /// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`
883
+ ExprStruct ( Path , Vec < Field > , Option < P < Expr > > ) ,
882
884
883
885
/// A vector literal constructed from one repeated element.
884
- /// For example, `[u8; 5]`
885
- ExprRepeat ( P < Expr > /* element */ , P < Expr > /* count */ ) ,
886
+ /// For example, `[1u8; 5]`. The first expression is the element
887
+ /// to be repeated; the second is the number of times to repeat it
888
+ ExprRepeat ( P < Expr > , P < Expr > ) ,
886
889
887
890
/// No-op: used solely so we can pretty-print faithfully
888
891
ExprParen ( P < Expr > )
@@ -1820,6 +1823,7 @@ pub enum ForeignItem_ {
1820
1823
/// A foreign function
1821
1824
ForeignItemFn ( P < FnDecl > , Generics ) ,
1822
1825
/// A foreign static item (`static ext: u8`), with optional mutability
1826
+ /// (the boolean is true when mutable)
1823
1827
ForeignItemStatic ( P < Ty > , bool ) ,
1824
1828
}
1825
1829
0 commit comments