Skip to content

Commit d673f76

Browse files
committed
Remove misguided indirect return in trans_closure
Closes #1528
1 parent 498ad91 commit d673f76

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/comp/middle/trans.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4463,14 +4463,10 @@ fn trans_closure(cx: @local_ctxt, sp: span, decl: ast::fn_decl,
44634463
// translation calls that don't have a return value (trans_crate,
44644464
// trans_mod, trans_item, et cetera) and those that do
44654465
// (trans_block, trans_expr, et cetera).
4466-
if ty::type_is_bot(cx.ccx.tcx, block_ty) ||
4467-
ty::type_is_nil(cx.ccx.tcx, block_ty) ||
4468-
option::is_none(body.node.expr) {
4469-
bcx = trans_block_dps(bcx, body, ignore);
4470-
} else if ty::type_is_immediate(cx.ccx.tcx, block_ty) {
4471-
let cell = empty_dest_cell();
4472-
bcx = trans_block_dps(bcx, body, by_val(cell));
4473-
Store(bcx, *cell, fcx.llretptr);
4466+
if option::is_none(body.node.expr) ||
4467+
ty::type_is_bot(cx.ccx.tcx, block_ty) ||
4468+
ty::type_is_nil(cx.ccx.tcx, block_ty) {
4469+
bcx = trans_block(bcx, body);
44744470
} else {
44754471
bcx = trans_block_dps(bcx, body, save_in(fcx.llretptr));
44764472
}

0 commit comments

Comments
 (0)