diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2019-03-18 09:02:57 +0100 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2019-03-18 09:02:57 +0100 |
| commit | bb832c2560c8d2c6d1a47d9a9bb0eed518f0b3ad (patch) | |
| tree | c8104b4bbb3bfb486354d6619019a2e69f4ce41a | |
| parent | 03dafa7da38decbe74fcd8a23d7ec835e637c8e4 (diff) | |
| download | rust-bb832c2560c8d2c6d1a47d9a9bb0eed518f0b3ad.tar.gz rust-bb832c2560c8d2c6d1a47d9a9bb0eed518f0b3ad.zip | |
some small HIR doc improvements
| -rw-r--r-- | src/librustc/hir/mod.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 88ab58d10fc..8941158e561 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -816,6 +816,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. @@ -1178,6 +1181,7 @@ impl fmt::Debug for Stmt { } } +/// The contents of a statement. #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] pub enum StmtKind { /// A local (`let`) binding. @@ -1208,21 +1212,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 action to take if this arm matches. pub body: P<Expr>, } |
