aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-31 22:32:02 -0400
committerBrian Anderson <[email protected]>2011-03-31 23:15:11 -0400
commit524e80358254575bb699756c405050da6c920e28 (patch)
tree901b5692ac478a17fb9452c59f9430bee3b820a1 /src
parentAdd more comments to trans_block (diff)
downloadrust-524e80358254575bb699756c405050da6c920e28.tar.xz
rust-524e80358254575bb699756c405050da6c920e28.zip
Only use allocas to hold expression results for boxed types
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index dd11891c..f6d59b92 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,