]> git.lizzy.rs Git - rust.git/commitdiff
Make trans_anon_obj properly thread its bcx
authorMarijn Haverbeke <marijnh@gmail.com>
Thu, 13 Oct 2011 16:04:09 +0000 (18:04 +0200)
committerMarijn Haverbeke <marijnh@gmail.com>
Thu, 13 Oct 2011 16:04:09 +0000 (18:04 +0200)
Closes #893

Unfortunately, anon objs are still so broken as to be useless
(fields don't work).

src/comp/middle/trans_objects.rs

index a2a63d88306fe5959fc4e6d7f07ec0cc33b51f8b..f2212b1a5fa4f422cf305bed84f368dda7dc9a8b 100644 (file)
@@ -367,16 +367,10 @@ fn trans_anon_obj(bcx: @block_ctxt, sp: span, anon_obj: ast::anon_obj,
             // If inner_obj (the object being extended) exists, translate it.
             // Translating inner_obj returns a ValueRef (pointer to a 2-word
             // value) wrapped in a result.
-            let inner_obj_val: result = trans_temp_expr(bcx, e);
-
             check type_is_tup_like(bcx, body_ty);
-            let body_inner_obj =
-                GEP_tup_like(bcx, body_ty, body,
-                             [0, abi::obj_body_elt_inner_obj]);
-            bcx = body_inner_obj.bcx;
-            bcx =
-                copy_val(bcx, INIT, body_inner_obj.val, inner_obj_val.val,
-                         inner_obj_ty);
+            let {bcx: cx, val: body_inner_obj} = GEP_tup_like
+                (bcx, body_ty, body, [0, abi::obj_body_elt_inner_obj]);
+            bcx = trans_expr(cx, e, save_in(body_inner_obj));
           }
         }
         revoke_clean(bcx, box);