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_middle/src/thir.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'compiler/rustc_middle/src') diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs index 086ec529f33..b9a014d14c0 100644 --- a/compiler/rustc_middle/src/thir.rs +++ b/compiler/rustc_middle/src/thir.rs @@ -292,7 +292,10 @@ pub enum ExprKind<'tcx> { If { if_then_scope: region::Scope, cond: ExprId, + /// `then` is always `ExprKind::Block`. then: ExprId, + /// If present, the `else_opt` expr is always `ExprKind::Block` (for + /// `else`) or `ExprKind::If` (for `else if`). else_opt: Option, }, /// A function call. Method calls and overloaded operators are converted to plain function calls. -- cgit 1.4.1-3-g733a5