File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1633,6 +1633,9 @@ pub enum ExprKind {
16331633 /// An `if` block, with an optional `else` block.
16341634 ///
16351635 /// `if expr { block } else { expr }`
1636+ ///
1637+ /// If present, the "else" expr is always `ExprKind::Block` (for `else`) or
1638+ /// `ExprKind::If` (for `else if`).
16361639 If ( P < Expr > , P < Block > , Option < P < Expr > > ) ,
16371640 /// A while loop, with an optional label.
16381641 ///
Original file line number Diff line number Diff line change @@ -2730,6 +2730,9 @@ pub enum ExprKind<'hir> {
27302730 /// An `if` block, with an optional else block.
27312731 ///
27322732 /// I.e., `if <expr> { <expr> } else { <expr> }`.
2733+ ///
2734+ /// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
2735+ /// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
27332736 If ( & ' hir Expr < ' hir > , & ' hir Expr < ' hir > , Option < & ' hir Expr < ' hir > > ) ,
27342737 /// A conditionless loop (can be exited with `break`, `continue`, or `return`).
27352738 ///
Original file line number Diff line number Diff line change @@ -292,7 +292,10 @@ pub enum ExprKind<'tcx> {
292292 If {
293293 if_then_scope : region:: Scope ,
294294 cond : ExprId ,
295+ /// `then` is always `ExprKind::Block`.
295296 then : ExprId ,
297+ /// If present, the `else_opt` expr is always `ExprKind::Block` (for
298+ /// `else`) or `ExprKind::If` (for `else if`).
296299 else_opt : Option < ExprId > ,
297300 } ,
298301 /// A function call. Method calls and overloaded operators are converted to plain function calls.
You can’t perform that action at this time.
0 commit comments