From 524e80358254575bb699756c405050da6c920e28 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 31 Mar 2011 22:32:02 -0400 Subject: [PATCH] Only use allocas to hold expression results for boxed types --- src/comp/middle/trans.rs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index dd11891c074..f6d59b9292d 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -5393,25 +5393,10 @@ fn trans_block(@block_ctxt cx, &ast.block b) -> result { auto r_ty = ty.expr_ty(e); - fn is_nil(@ty.t r_ty) -> bool { - alt (r_ty.struct) { - case (ty.ty_nil) { - ret true; - } - case (_) { - ret false; - } - } - } + if (ty.type_is_boxed(r_ty)) { - // FIXME: This is a temporary hack to prevent compile - // failures. There's some expression variant that claims - // to be ty_nil but but does not translate to T_nil. Need - // to hunt it down. Of course, if we're talking about nil, - // do we really want to do this whole business anyway? - if (!is_nil(r_ty)) { - // This alloca is declared at the function level, above - // the block scope + // Create an alloca up in the llallocas block to hold the + // expression result. auto res_alloca = alloc_ty(bcx, r_ty); bcx = res_alloca.bcx; auto res_copy = copy_ty(bcx, INIT,