diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-05-02 19:38:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-02 19:38:00 +0200 |
| commit | bcf2490c64dc62fd07f28b0b00665eb29040738f (patch) | |
| tree | df042a35ed81df0bb3b3316c4d3b819cb1197e5c /compiler/rustc_middle/src | |
| parent | bfb8f73933e62e14ba3830eada38e23fd1a081ba (diff) | |
| parent | 0ea204a5ff39564b51bf9710c45ead44f9796c28 (diff) | |
| download | rust-bcf2490c64dc62fd07f28b0b00665eb29040738f.tar.gz rust-bcf2490c64dc62fd07f28b0b00665eb29040738f.zip | |
Rollup merge of #140572 - nnethercote:comment-ExprKind-If, r=compiler-errors
Add useful comments on `ExprKind::If` variants. Things that aren't obvious and took me a while to work out. r? `@BoxyUwU`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/thir.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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<ExprId>, }, /// A function call. Method calls and overloaded operators are converted to plain function calls. |
