Lower condition of if
expression before it's "then" block
Fix #82290, fix #82250.
This commit is contained in:
parent
8fe989dd76
commit
f0637e4e18
3 changed files with 29 additions and 1 deletions
|
@ -347,8 +347,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
) -> hir::ExprKind<'hir> {
|
||||
macro_rules! make_if {
|
||||
($opt:expr) => {{
|
||||
let cond = self.lower_expr(cond);
|
||||
let then_expr = self.lower_block_expr(then);
|
||||
hir::ExprKind::If(self.lower_expr(cond), self.arena.alloc(then_expr), $opt)
|
||||
hir::ExprKind::If(cond, self.arena.alloc(then_expr), $opt)
|
||||
}};
|
||||
}
|
||||
if let Some(rslt) = else_opt {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue