Skip to content

Commit 4504e23

Browse files
committed
rustc: Remove unnecessary pushdown from check_expr in the expr_if case
1 parent 4bcdf57 commit 4504e23

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

src/comp/middle/typeck.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,28 +2134,23 @@ fn check_expr(&@stmt_ctxt scx, &@ast::expr expr) {
21342134
cond);
21352135

21362136
check_block(scx, thn);
2137-
auto thn_t = block_ty(scx.fcx.ccx.tcx, thn);
21382137

2139-
auto if_t;
2140-
alt (elsopt) {
2138+
auto if_t = alt (elsopt) {
21412139
case (some[@ast::expr](?els)) {
21422140
check_expr(scx, els);
2141+
2142+
auto thn_t = block_ty(scx.fcx.ccx.tcx, thn);
21432143
auto elsopt_t = expr_ty(scx.fcx.ccx.tcx, els);
21442144
if (!ty::type_is_bot(scx.fcx.ccx.tcx, elsopt_t)) {
2145-
Pushdown::pushdown_expr(scx, thn_t, els);
2146-
if_t = elsopt_t;
2145+
elsopt_t
21472146
} else {
2148-
if_t = thn_t;
2147+
thn_t
21492148
}
21502149
}
21512150
case (none[@ast::expr]) {
2152-
if_t = ty::mk_nil(scx.fcx.ccx.tcx);
2151+
ty::mk_nil(scx.fcx.ccx.tcx)
21532152
}
2154-
}
2155-
2156-
if (!ty::type_is_bot(scx.fcx.ccx.tcx, thn_t)) {
2157-
Pushdown::pushdown_block(scx, if_t, thn);
2158-
}
2153+
};
21592154

21602155
write::ty_only_fixup(scx, a.id, if_t);
21612156
}

0 commit comments

Comments
 (0)