@@ -144,33 +144,33 @@ pub enum BorrowKind {
144144///////////////////////////////////////////////////////////////////////////
145145// Variables and temps
146146
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.
149149#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
150150pub struct VarDecl < ' tcx > {
151151 pub mutability : Mutability ,
152152 pub name : Name ,
153153 pub ty : Ty < ' tcx > ,
154154}
155155
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.
158158#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
159159pub struct TempDecl < ' tcx > {
160160 pub ty : Ty < ' tcx > ,
161161}
162162
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`).
174174#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
175175pub struct ArgDecl < ' tcx > {
176176 pub ty : Ty < ' tcx > ,
@@ -495,7 +495,8 @@ pub enum StatementKind<'tcx> {
495495
496496#[ derive( Copy , Clone , Debug , PartialEq , Eq , RustcEncodable , RustcDecodable ) ]
497497pub 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 ,
499500 Deep
500501}
501502
@@ -552,24 +553,27 @@ pub enum ProjectionElem<'tcx, V> {
552553 Field ( Field ) ,
553554 Index ( V ) ,
554555
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+ /// ```
564565 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 ,
568572 } ,
569573
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.
573577 Downcast ( AdtDef < ' tcx > , usize ) ,
574578}
575579
@@ -654,9 +658,9 @@ impl<'tcx> Debug for Lvalue<'tcx> {
654658///////////////////////////////////////////////////////////////////////////
655659// Operands
656660//
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.
660664
661665#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable ) ]
662666pub enum Operand < ' tcx > {
@@ -675,20 +679,20 @@ impl<'tcx> Debug for Operand<'tcx> {
675679}
676680
677681///////////////////////////////////////////////////////////////////////////
678- // Rvalues
682+ /// Rvalues
679683
680684#[ derive( Clone , RustcEncodable , RustcDecodable ) ]
681685pub 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)
683687 Use ( Operand < ' tcx > ) ,
684688
685- // [x; 32]
689+ /// [x; 32]
686690 Repeat ( Operand < ' tcx > , TypedConstVal < ' tcx > ) ,
687691
688- // &x or &mut x
692+ /// &x or &mut x
689693 Ref ( Region , BorrowKind , Lvalue < ' tcx > ) ,
690694
691- // length of a [X] or [X;n] value
695+ /// length of a [X] or [X;n] value
692696 Len ( Lvalue < ' tcx > ) ,
693697
694698 Cast ( CastKind , Operand < ' tcx > , Ty < ' tcx > ) ,
@@ -697,21 +701,21 @@ pub enum Rvalue<'tcx> {
697701
698702 UnaryOp ( UnOp , Operand < ' tcx > ) ,
699703
700- // Creates an *uninitialized* Box
704+ /// Creates an *uninitialized* Box
701705 Box ( Ty < ' tcx > ) ,
702706
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.
708712 Aggregate ( AggregateKind < ' tcx > , Vec < Operand < ' tcx > > ) ,
709713
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`.
715719 Slice {
716720 input : Lvalue < ' tcx > ,
717721 from_start : usize ,
@@ -878,11 +882,11 @@ impl<'tcx> Debug for Rvalue<'tcx> {
878882}
879883
880884///////////////////////////////////////////////////////////////////////////
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`!
886890
887891#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable ) ]
888892pub struct Constant < ' tcx > {
0 commit comments