@@ -144,33 +144,33 @@ pub enum BorrowKind {
144
144
///////////////////////////////////////////////////////////////////////////
145
145
// Variables and temps
146
146
147
- // A "variable" is a binding declared by the user as part of the fn
148
- // decl, a let, etc.
147
+ /// A "variable" is a binding declared by the user as part of the fn
148
+ /// decl, a let, etc.
149
149
#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
150
150
pub struct VarDecl < ' tcx > {
151
151
pub mutability : Mutability ,
152
152
pub name : Name ,
153
153
pub ty : Ty < ' tcx > ,
154
154
}
155
155
156
- // A "temp" is a temporary that we place on the stack. They are
157
- // anonymous, always mutable, and have only a type.
156
+ /// A "temp" is a temporary that we place on the stack. They are
157
+ /// anonymous, always mutable, and have only a type.
158
158
#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
159
159
pub struct TempDecl < ' tcx > {
160
160
pub ty : Ty < ' tcx > ,
161
161
}
162
162
163
- // A "arg" is one of the function's formal arguments. These are
164
- // anonymous and distinct from the bindings that the user declares.
165
- //
166
- // For example, in this function:
167
- //
168
- // ```
169
- // fn foo((x, y): (i32, u32)) { ... }
170
- // ```
171
- //
172
- // there is only one argument, of type `(i32, u32)`, but two bindings
173
- // (`x` and `y`).
163
+ /// A "arg" is one of the function's formal arguments. These are
164
+ /// anonymous and distinct from the bindings that the user declares.
165
+ ///
166
+ /// For example, in this function:
167
+ ///
168
+ /// ```
169
+ /// fn foo((x, y): (i32, u32)) { ... }
170
+ /// ```
171
+ ///
172
+ /// there is only one argument, of type `(i32, u32)`, but two bindings
173
+ /// (`x` and `y`).
174
174
#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
175
175
pub struct ArgDecl < ' tcx > {
176
176
pub ty : Ty < ' tcx > ,
@@ -495,7 +495,8 @@ pub enum StatementKind<'tcx> {
495
495
496
496
#[ derive( Copy , Clone , Debug , PartialEq , Eq , RustcEncodable , RustcDecodable ) ]
497
497
pub enum DropKind {
498
- Free , // free a partially constructed box, should go away eventually
498
+ /// free a partially constructed box, should go away eventually
499
+ Free ,
499
500
Deep
500
501
}
501
502
@@ -552,24 +553,27 @@ pub enum ProjectionElem<'tcx, V> {
552
553
Field ( Field ) ,
553
554
Index ( V ) ,
554
555
555
- // These indices are generated by slice patterns. Easiest to explain
556
- // by example:
557
- //
558
- // ```
559
- // [X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
560
- // [_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
561
- // [_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
562
- // [_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },
563
- // ```
556
+ /// These indices are generated by slice patterns. Easiest to explain
557
+ /// by example:
558
+ ///
559
+ /// ```
560
+ /// [X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
561
+ /// [_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
562
+ /// [_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
563
+ /// [_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },
564
+ /// ```
564
565
ConstantIndex {
565
- offset : u32 , // index or -index (in Python terms), depending on from_end
566
- min_length : u32 , // thing being indexed must be at least this long
567
- from_end : bool , // counting backwards from end?
566
+ /// index or -index (in Python terms), depending on from_end
567
+ offset : u32 ,
568
+ /// thing being indexed must be at least this long
569
+ min_length : u32 ,
570
+ /// counting backwards from end?
571
+ from_end : bool ,
568
572
} ,
569
573
570
- // "Downcast" to a variant of an ADT. Currently, we only introduce
571
- // this for ADTs with more than one variant. It may be better to
572
- // just introduce it always, or always for enums.
574
+ /// "Downcast" to a variant of an ADT. Currently, we only introduce
575
+ /// this for ADTs with more than one variant. It may be better to
576
+ /// just introduce it always, or always for enums.
573
577
Downcast ( AdtDef < ' tcx > , usize ) ,
574
578
}
575
579
@@ -654,9 +658,9 @@ impl<'tcx> Debug for Lvalue<'tcx> {
654
658
///////////////////////////////////////////////////////////////////////////
655
659
// Operands
656
660
//
657
- // These are values that can appear inside an rvalue (or an index
658
- // lvalue). They are intentionally limited to prevent rvalues from
659
- // being nested in one another.
661
+ /// These are values that can appear inside an rvalue (or an index
662
+ /// lvalue). They are intentionally limited to prevent rvalues from
663
+ /// being nested in one another.
660
664
661
665
#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable ) ]
662
666
pub enum Operand < ' tcx > {
@@ -675,20 +679,20 @@ impl<'tcx> Debug for Operand<'tcx> {
675
679
}
676
680
677
681
///////////////////////////////////////////////////////////////////////////
678
- // Rvalues
682
+ /// Rvalues
679
683
680
684
#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
681
685
pub enum Rvalue < ' tcx > {
682
- // x (either a move or copy, depending on type of x)
686
+ /// x (either a move or copy, depending on type of x)
683
687
Use ( Operand < ' tcx > ) ,
684
688
685
- // [x; 32]
689
+ /// [x; 32]
686
690
Repeat ( Operand < ' tcx > , TypedConstVal < ' tcx > ) ,
687
691
688
- // &x or &mut x
692
+ /// &x or &mut x
689
693
Ref ( Region , BorrowKind , Lvalue < ' tcx > ) ,
690
694
691
- // length of a [X] or [X;n] value
695
+ /// length of a [X] or [X;n] value
692
696
Len ( Lvalue < ' tcx > ) ,
693
697
694
698
Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
@@ -697,21 +701,21 @@ pub enum Rvalue<'tcx> {
697
701
698
702
UnaryOp ( UnOp , Operand < ' tcx > ) ,
699
703
700
- // Creates an *uninitialized* Box
704
+ /// Creates an *uninitialized* Box
701
705
Box ( Ty < ' tcx > ) ,
702
706
703
- // Create an aggregate value, like a tuple or struct. This is
704
- // only needed because we want to distinguish `dest = Foo { x:
705
- // ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
706
- // that `Foo` has a destructor. These rvalues can be optimized
707
- // away after type-checking and before lowering.
707
+ /// Create an aggregate value, like a tuple or struct. This is
708
+ /// only needed because we want to distinguish `dest = Foo { x:
709
+ /// ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
710
+ /// that `Foo` has a destructor. These rvalues can be optimized
711
+ /// away after type-checking and before lowering.
708
712
Aggregate ( AggregateKind < ' tcx > , Vec < Operand < ' tcx > > ) ,
709
713
710
- // Generates a slice of the form `&input[from_start..L-from_end]`
711
- // where `L` is the length of the slice. This is only created by
712
- // slice pattern matching, so e.g. a pattern of the form `[x, y,
713
- // .., z]` might create a slice with `from_start=2` and
714
- // `from_end=1`.
714
+ /// Generates a slice of the form `&input[from_start..L-from_end]`
715
+ /// where `L` is the length of the slice. This is only created by
716
+ /// slice pattern matching, so e.g. a pattern of the form `[x, y,
717
+ /// .., z]` might create a slice with `from_start=2` and
718
+ /// `from_end=1`.
715
719
Slice {
716
720
input : Lvalue < ' tcx > ,
717
721
from_start : usize ,
@@ -878,11 +882,11 @@ impl<'tcx> Debug for Rvalue<'tcx> {
878
882
}
879
883
880
884
///////////////////////////////////////////////////////////////////////////
881
- // Constants
882
- //
883
- // Two constants are equal if they are the same constant. Note that
884
- // this does not necessarily mean that they are "==" in Rust -- in
885
- // particular one must be wary of `NaN`!
885
+ /// Constants
886
+ ///
887
+ /// Two constants are equal if they are the same constant. Note that
888
+ /// this does not necessarily mean that they are "==" in Rust -- in
889
+ /// particular one must be wary of `NaN`!
886
890
887
891
#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable ) ]
888
892
pub struct Constant < ' tcx > {
0 commit comments