Skip to content

Commit 524e803

Browse files
committed
Only use allocas to hold expression results for boxed types
1 parent f05d3c5 commit 524e803

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5393,25 +5393,10 @@ fn trans_block(@block_ctxt cx, &ast.block b) -> result {
53935393

53945394
auto r_ty = ty.expr_ty(e);
53955395

5396-
fn is_nil(@ty.t r_ty) -> bool {
5397-
alt (r_ty.struct) {
5398-
case (ty.ty_nil) {
5399-
ret true;
5400-
}
5401-
case (_) {
5402-
ret false;
5403-
}
5404-
}
5405-
}
5396+
if (ty.type_is_boxed(r_ty)) {
54065397

5407-
// FIXME: This is a temporary hack to prevent compile
5408-
// failures. There's some expression variant that claims
5409-
// to be ty_nil but but does not translate to T_nil. Need
5410-
// to hunt it down. Of course, if we're talking about nil,
5411-
// do we really want to do this whole business anyway?
5412-
if (!is_nil(r_ty)) {
5413-
// This alloca is declared at the function level, above
5414-
// the block scope
5398+
// Create an alloca up in the llallocas block to hold the
5399+
// expression result.
54155400
auto res_alloca = alloc_ty(bcx, r_ty);
54165401
bcx = res_alloca.bcx;
54175402
auto res_copy = copy_ty(bcx, INIT,

0 commit comments

Comments
 (0)