@@ -535,9 +535,13 @@ impl PartialEq for MetaItem_ {
535
535
536
536
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
537
537
pub struct Block {
538
+ /// Statements in a block
538
539
pub stmts : Vec < P < Stmt > > ,
540
+ /// An expression at the end of the block
541
+ /// without a semicolon, if any
539
542
pub expr : Option < P < Expr > > ,
540
543
pub id : NodeId ,
544
+ /// Unsafety of the block
541
545
pub rules : BlockCheckMode ,
542
546
pub span : Span ,
543
547
}
@@ -550,8 +554,14 @@ pub struct Pat {
550
554
}
551
555
552
556
#[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Hash , Debug ) ]
557
+ /// A single field in a struct pattern
558
+ ///
559
+ /// For patterns like `Foo {x, y, z}`, `pat` and `ident` point to the same identifier
560
+ /// and `is_shorthand` is true.
553
561
pub struct FieldPat {
562
+ /// The identifier for the field
554
563
pub ident : Ident ,
564
+ /// The pattern the field is destructured to
555
565
pub pat : P < Pat > ,
556
566
pub is_shorthand : bool ,
557
567
}
@@ -588,15 +598,23 @@ pub enum Pat_ {
588
598
/// "None" means a * pattern where we don't bind the fields to names.
589
599
PatEnum ( Path , Option < Vec < P < Pat > > > ) ,
590
600
601
+ /// Destructuring of a struct, e.g. `Foo {x, y, ..}`
602
+ /// The `bool` is `true` in the presence of a `..`
591
603
PatStruct ( Path , Vec < Spanned < FieldPat > > , bool ) ,
604
+ /// A tuple pattern (`a, b`)
592
605
PatTup ( Vec < P < Pat > > ) ,
606
+ /// A `box` pattern
593
607
PatBox ( P < Pat > ) ,
594
- PatRegion ( P < Pat > , Mutability ) , // reference pattern
608
+ /// A reference pattern, e.g. `&mut (a, b)`
609
+ PatRegion ( P < Pat > , Mutability ) ,
610
+ /// A literal
595
611
PatLit ( P < Expr > ) ,
612
+ /// A range pattern, e.g. `[1...2]`
596
613
PatRange ( P < Expr > , P < Expr > ) ,
597
614
/// [a, b, ..i, y, z] is represented as:
598
615
/// PatVec(box [a, b], Some(i), box [y, z])
599
616
PatVec ( Vec < P < Pat > > , Option < P < Pat > > , Vec < P < Pat > > ) ,
617
+ /// A macro pattern; pre-expansion
600
618
PatMac ( Mac ) ,
601
619
}
602
620
0 commit comments