1
Fork 0

Lower condition of if expression before it's "then" block

Fix #82290, fix #82250.
This commit is contained in:
Esteban Küber 2021-02-19 17:00:31 -08:00
parent 8fe989dd76
commit f0637e4e18
3 changed files with 29 additions and 1 deletions

View file

@ -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 {