aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-27 18:51:25 -0400
committerGraydon Hoare <[email protected]>2011-03-28 21:14:04 -0700
commitaced4ce145bf23cc945c58a6c9c1bc1f33359a06 (patch)
tree92d233fd79b9ee0f119bc89ee329b6be07047c09 /src/comp
parentTeach rustc to use the result of if expressions (diff)
downloadrust-aced4ce145bf23cc945c58a6c9c1bc1f33359a06.tar.xz
rust-aced4ce145bf23cc945c58a6c9c1bc1f33359a06.zip
Handle structural types as the result of if expressions
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 82ba8654..433a8012 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3049,6 +3049,9 @@ fn trans_if(@block_ctxt cx, @ast.expr cond,
// FIXME: Handle dynamic type sizes
auto expr_ty = ty.expr_ty(elexpr);
expr_llty = type_of(else_res.bcx.fcx.ccx, expr_ty);
+ if (ty.type_is_structural(expr_ty)) {
+ expr_llty = T_ptr(expr_llty);
+ }
}
case (_) {
else_res = res(else_cx, C_nil());