File tree 3 files changed +9
-0
lines changed
3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -1633,6 +1633,9 @@ pub enum ExprKind {
1633
1633
/// An `if` block, with an optional `else` block.
1634
1634
///
1635
1635
/// `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`).
1636
1639
If ( P < Expr > , P < Block > , Option < P < Expr > > ) ,
1637
1640
/// A while loop, with an optional label.
1638
1641
///
Original file line number Diff line number Diff line change @@ -2741,6 +2741,9 @@ pub enum ExprKind<'hir> {
2741
2741
/// An `if` block, with an optional else block.
2742
2742
///
2743
2743
/// I.e., `if <expr> { <expr> } else { <expr> }`.
2744
+ ///
2745
+ /// The "then" expr is always `ExprKind::Block`. If present, the "else" expr is always
2746
+ /// `ExprKind::Block` (for `else`) or `ExprKind::If` (for `else if`).
2744
2747
If ( & ' hir Expr < ' hir > , & ' hir Expr < ' hir > , Option < & ' hir Expr < ' hir > > ) ,
2745
2748
/// A conditionless loop (can be exited with `break`, `continue`, or `return`).
2746
2749
///
Original file line number Diff line number Diff line change @@ -292,7 +292,10 @@ pub enum ExprKind<'tcx> {
292
292
If {
293
293
if_then_scope : region:: Scope ,
294
294
cond : ExprId ,
295
+ /// `then` is always `ExprKind::Block`.
295
296
then : ExprId ,
297
+ /// If present, the `else_opt` expr is always `ExprKind::Block` (for
298
+ /// `else`) or `ExprKind::If` (for `else if`).
296
299
else_opt : Option < ExprId > ,
297
300
} ,
298
301
/// 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