Skip to content

Commit

Permalink
Rollup merge of rust-lang#59273 - llogiq:hir-docs, r=matthewjasper
Browse files Browse the repository at this point in the history
some small HIR doc improvements
  • Loading branch information
Mark-Simulacrum authored Mar 22, 2019
2 parents 4103238 + 37789c4 commit bd6a70d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,9 @@ pub struct MacroDef {
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)]
pub struct Block {
/// Statements in a block.
Expand Down Expand Up @@ -1177,6 +1180,7 @@ impl fmt::Debug for Stmt {
}
}

/// The contents of a statement.
#[derive(Clone, RustcEncodable, RustcDecodable, HashStable)]
pub enum StmtKind {
/// A local (`let`) binding.
Expand Down Expand Up @@ -1207,21 +1211,28 @@ impl StmtKind {
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]
pub struct Local {
pub pat: P<Pat>,
/// Type annotation, if any (otherwise the type will be inferred).
pub ty: Option<P<Ty>>,
/// Initializer expression to set the value, if any.
pub init: Option<P<Expr>>,
pub hir_id: HirId,
pub span: Span,
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,
}

/// 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)]
pub struct Arm {
pub attrs: HirVec<Attribute>,
/// Multiple patterns can be combined with `|`
pub pats: HirVec<P<Pat>>,
/// Optional guard clause.
pub guard: Option<Guard>,
/// The expression the arm evaluates to if this arm matches.
pub body: P<Expr>,
}

Expand Down

0 comments on commit bd6a70d

Please sign in to comment.