some small HIR doc improvements
This commit is contained in:
parent
03dafa7da3
commit
bb832c2560
1 changed files with 12 additions and 1 deletions
|
@ -816,6 +816,9 @@ pub struct MacroDef {
|
||||||
pub legacy: bool,
|
pub legacy: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A block of statements `{ .. }`, which may have a label (in this case the
|
||||||
|
/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
|
||||||
|
/// the `rules` being anything but `DefaultBlock`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// Statements in a block.
|
/// Statements in a block.
|
||||||
|
@ -1178,6 +1181,7 @@ impl fmt::Debug for Stmt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The contents of a statement.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
|
||||||
pub enum StmtKind {
|
pub enum StmtKind {
|
||||||
/// A local (`let`) binding.
|
/// A local (`let`) binding.
|
||||||
|
@ -1208,21 +1212,28 @@ impl StmtKind {
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||||
pub struct Local {
|
pub struct Local {
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
|
/// Type annotation, if any (otherwise the type will be inferred).
|
||||||
pub ty: Option<P<Ty>>,
|
pub ty: Option<P<Ty>>,
|
||||||
/// Initializer expression to set the value, if any.
|
/// Initializer expression to set the value, if any.
|
||||||
pub init: Option<P<Expr>>,
|
pub init: Option<P<Expr>>,
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
|
/// Can be `ForLoopDesugar` if the `let` statement is part of a `for` loop
|
||||||
|
/// desugaring. Otherwise will be `Normal`.
|
||||||
pub source: LocalSource,
|
pub source: LocalSource,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a single arm of a `match` expression.
|
/// Represents a single arm of a `match` expression, e.g.
|
||||||
|
/// `<pats> (if <guard>) => <body>`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
|
||||||
pub struct Arm {
|
pub struct Arm {
|
||||||
pub attrs: HirVec<Attribute>,
|
pub attrs: HirVec<Attribute>,
|
||||||
|
/// Multiple patterns can be combined with `|`
|
||||||
pub pats: HirVec<P<Pat>>,
|
pub pats: HirVec<P<Pat>>,
|
||||||
|
/// Optional guard clause.
|
||||||
pub guard: Option<Guard>,
|
pub guard: Option<Guard>,
|
||||||
|
/// The action to take if this arm matches.
|
||||||
pub body: P<Expr>,
|
pub body: P<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue