about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/ast.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-04-28 06:33:22 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-05-02 15:53:39 +1000
commit0ea204a5ff39564b51bf9710c45ead44f9796c28 (patch)
treeacecc4717739e617760ccc00ad14593588a2ef96 /compiler/rustc_ast/src/ast.rs
parent251cda5e1f0057eb04fd9fc1653f2f1e010e8f97 (diff)
downloadrust-0ea204a5ff39564b51bf9710c45ead44f9796c28.tar.gz
rust-0ea204a5ff39564b51bf9710c45ead44f9796c28.zip
Add useful comments on `ExprKind::If` variants.
Things that aren't obvious and took me a while to work out.
Diffstat (limited to 'compiler/rustc_ast/src/ast.rs')
-rw-r--r--compiler/rustc_ast/src/ast.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 9d216ef3dd8..114b9835b98 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -1633,6 +1633,9 @@ pub enum ExprKind {
     /// An `if` block, with an optional `else` block.
     ///
     /// `if expr { block } else { expr }`
+    ///
+    /// If present, the "else" expr is always `ExprKind::Block` (for `else`) or
+    /// `ExprKind::If` (for `else if`).
     If(P<Expr>, P<Block>, Option<P<Expr>>),
     /// A while loop, with an optional label.
     ///