Only use allocas to hold expression results for boxed types
This commit is contained in:
parent
f05d3c516b
commit
524e803582
1 changed files with 3 additions and 18 deletions
|
@ -5393,25 +5393,10 @@ fn trans_block(@block_ctxt cx, &ast.block b) -> result {
|
||||||
|
|
||||||
auto r_ty = ty.expr_ty(e);
|
auto r_ty = ty.expr_ty(e);
|
||||||
|
|
||||||
fn is_nil(@ty.t r_ty) -> bool {
|
if (ty.type_is_boxed(r_ty)) {
|
||||||
alt (r_ty.struct) {
|
|
||||||
case (ty.ty_nil) {
|
|
||||||
ret true;
|
|
||||||
}
|
|
||||||
case (_) {
|
|
||||||
ret false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: This is a temporary hack to prevent compile
|
// Create an alloca up in the llallocas block to hold the
|
||||||
// failures. There's some expression variant that claims
|
// expression result.
|
||||||
// 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
|
|
||||||
auto res_alloca = alloc_ty(bcx, r_ty);
|
auto res_alloca = alloc_ty(bcx, r_ty);
|
||||||
bcx = res_alloca.bcx;
|
bcx = res_alloca.bcx;
|
||||||
auto res_copy = copy_ty(bcx, INIT,
|
auto res_copy = copy_ty(bcx, INIT,
|
||||||
|
|
Loading…
Reference in a new issue