upgrade comments on MIR structures and functions to doc comments
This commit is contained in:
parent
8c77ffb484
commit
4e44ef1e29
3 changed files with 92 additions and 86 deletions
|
|
@ -144,8 +144,8 @@ pub enum BorrowKind {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Variables and temps
|
||||
|
||||
// A "variable" is a binding declared by the user as part of the fn
|
||||
// decl, a let, etc.
|
||||
/// A "variable" is a binding declared by the user as part of the fn
|
||||
/// decl, a let, etc.
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||
pub struct VarDecl<'tcx> {
|
||||
pub mutability: Mutability,
|
||||
|
|
@ -153,24 +153,24 @@ pub struct VarDecl<'tcx> {
|
|||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
// A "temp" is a temporary that we place on the stack. They are
|
||||
// anonymous, always mutable, and have only a type.
|
||||
/// A "temp" is a temporary that we place on the stack. They are
|
||||
/// anonymous, always mutable, and have only a type.
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||
pub struct TempDecl<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
// A "arg" is one of the function's formal arguments. These are
|
||||
// anonymous and distinct from the bindings that the user declares.
|
||||
//
|
||||
// For example, in this function:
|
||||
//
|
||||
// ```
|
||||
// fn foo((x, y): (i32, u32)) { ... }
|
||||
// ```
|
||||
//
|
||||
// there is only one argument, of type `(i32, u32)`, but two bindings
|
||||
// (`x` and `y`).
|
||||
/// A "arg" is one of the function's formal arguments. These are
|
||||
/// anonymous and distinct from the bindings that the user declares.
|
||||
///
|
||||
/// For example, in this function:
|
||||
///
|
||||
/// ```
|
||||
/// fn foo((x, y): (i32, u32)) { ... }
|
||||
/// ```
|
||||
///
|
||||
/// there is only one argument, of type `(i32, u32)`, but two bindings
|
||||
/// (`x` and `y`).
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||
pub struct ArgDecl<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
|
|
@ -495,7 +495,8 @@ pub enum StatementKind<'tcx> {
|
|||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
|
||||
pub enum DropKind {
|
||||
Free, // free a partially constructed box, should go away eventually
|
||||
/// free a partially constructed box, should go away eventually
|
||||
Free,
|
||||
Deep
|
||||
}
|
||||
|
||||
|
|
@ -552,24 +553,27 @@ pub enum ProjectionElem<'tcx, V> {
|
|||
Field(Field),
|
||||
Index(V),
|
||||
|
||||
// These indices are generated by slice patterns. Easiest to explain
|
||||
// by example:
|
||||
//
|
||||
// ```
|
||||
// [X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
|
||||
// [_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
|
||||
// [_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
|
||||
// [_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },
|
||||
// ```
|
||||
/// These indices are generated by slice patterns. Easiest to explain
|
||||
/// by example:
|
||||
///
|
||||
/// ```
|
||||
/// [X, _, .._, _, _] => { offset: 0, min_length: 4, from_end: false },
|
||||
/// [_, X, .._, _, _] => { offset: 1, min_length: 4, from_end: false },
|
||||
/// [_, _, .._, X, _] => { offset: 2, min_length: 4, from_end: true },
|
||||
/// [_, _, .._, _, X] => { offset: 1, min_length: 4, from_end: true },
|
||||
/// ```
|
||||
ConstantIndex {
|
||||
offset: u32, // index or -index (in Python terms), depending on from_end
|
||||
min_length: u32, // thing being indexed must be at least this long
|
||||
from_end: bool, // counting backwards from end?
|
||||
/// index or -index (in Python terms), depending on from_end
|
||||
offset: u32,
|
||||
/// thing being indexed must be at least this long
|
||||
min_length: u32,
|
||||
/// counting backwards from end?
|
||||
from_end: bool,
|
||||
},
|
||||
|
||||
// "Downcast" to a variant of an ADT. Currently, we only introduce
|
||||
// this for ADTs with more than one variant. It may be better to
|
||||
// just introduce it always, or always for enums.
|
||||
/// "Downcast" to a variant of an ADT. Currently, we only introduce
|
||||
/// this for ADTs with more than one variant. It may be better to
|
||||
/// just introduce it always, or always for enums.
|
||||
Downcast(AdtDef<'tcx>, usize),
|
||||
}
|
||||
|
||||
|
|
@ -654,9 +658,9 @@ impl<'tcx> Debug for Lvalue<'tcx> {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Operands
|
||||
//
|
||||
// These are values that can appear inside an rvalue (or an index
|
||||
// lvalue). They are intentionally limited to prevent rvalues from
|
||||
// being nested in one another.
|
||||
/// These are values that can appear inside an rvalue (or an index
|
||||
/// lvalue). They are intentionally limited to prevent rvalues from
|
||||
/// being nested in one another.
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||
pub enum Operand<'tcx> {
|
||||
|
|
@ -675,20 +679,20 @@ impl<'tcx> Debug for Operand<'tcx> {
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Rvalues
|
||||
/// Rvalues
|
||||
|
||||
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||
pub enum Rvalue<'tcx> {
|
||||
// x (either a move or copy, depending on type of x)
|
||||
/// x (either a move or copy, depending on type of x)
|
||||
Use(Operand<'tcx>),
|
||||
|
||||
// [x; 32]
|
||||
/// [x; 32]
|
||||
Repeat(Operand<'tcx>, TypedConstVal<'tcx>),
|
||||
|
||||
// &x or &mut x
|
||||
/// &x or &mut x
|
||||
Ref(Region, BorrowKind, Lvalue<'tcx>),
|
||||
|
||||
// length of a [X] or [X;n] value
|
||||
/// length of a [X] or [X;n] value
|
||||
Len(Lvalue<'tcx>),
|
||||
|
||||
Cast(CastKind, Operand<'tcx>, Ty<'tcx>),
|
||||
|
|
@ -697,21 +701,21 @@ pub enum Rvalue<'tcx> {
|
|||
|
||||
UnaryOp(UnOp, Operand<'tcx>),
|
||||
|
||||
// Creates an *uninitialized* Box
|
||||
/// Creates an *uninitialized* Box
|
||||
Box(Ty<'tcx>),
|
||||
|
||||
// Create an aggregate value, like a tuple or struct. This is
|
||||
// only needed because we want to distinguish `dest = Foo { x:
|
||||
// ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
|
||||
// that `Foo` has a destructor. These rvalues can be optimized
|
||||
// away after type-checking and before lowering.
|
||||
/// Create an aggregate value, like a tuple or struct. This is
|
||||
/// only needed because we want to distinguish `dest = Foo { x:
|
||||
/// ..., y: ... }` from `dest.x = ...; dest.y = ...;` in the case
|
||||
/// that `Foo` has a destructor. These rvalues can be optimized
|
||||
/// away after type-checking and before lowering.
|
||||
Aggregate(AggregateKind<'tcx>, Vec<Operand<'tcx>>),
|
||||
|
||||
// Generates a slice of the form `&input[from_start..L-from_end]`
|
||||
// where `L` is the length of the slice. This is only created by
|
||||
// slice pattern matching, so e.g. a pattern of the form `[x, y,
|
||||
// .., z]` might create a slice with `from_start=2` and
|
||||
// `from_end=1`.
|
||||
/// Generates a slice of the form `&input[from_start..L-from_end]`
|
||||
/// where `L` is the length of the slice. This is only created by
|
||||
/// slice pattern matching, so e.g. a pattern of the form `[x, y,
|
||||
/// .., z]` might create a slice with `from_start=2` and
|
||||
/// `from_end=1`.
|
||||
Slice {
|
||||
input: Lvalue<'tcx>,
|
||||
from_start: usize,
|
||||
|
|
@ -878,11 +882,11 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Constants
|
||||
//
|
||||
// Two constants are equal if they are the same constant. Note that
|
||||
// this does not necessarily mean that they are "==" in Rust -- in
|
||||
// particular one must be wary of `NaN`!
|
||||
/// Constants
|
||||
///
|
||||
/// Two constants are equal if they are the same constant. Note that
|
||||
/// this does not necessarily mean that they are "==" in Rust -- in
|
||||
/// particular one must be wary of `NaN`!
|
||||
|
||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||
pub struct Constant<'tcx> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue