From 0ea204a5ff39564b51bf9710c45ead44f9796c28 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 28 Apr 2025 06:33:22 +1000 Subject: Add useful comments on `ExprKind::If` variants. Things that aren't obvious and took me a while to work out. --- compiler/rustc_ast/src/ast.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compiler/rustc_ast/src') 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, P, Option>), /// A while loop, with an optional label. /// -- cgit 1.4.1-3-g733a5