From bcad52451cb63118ee9b67684b8b70e3cb5f4aff Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 28 Apr 2011 17:44:28 -0700 Subject: [PATCH] Actually hit the no-growth path on vec-append. --- src/comp/middle/trans.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index bf96da8b118..14eb2e08d89 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -5075,9 +5075,19 @@ fn trans_expr(@block_ctxt cx, @ast.expr e) -> result { auto t = node_ann_type(cx.fcx.lcx.ccx, ann); auto lhs_res = trans_lval(cx, dst); check (lhs_res.is_mem); - auto lhs_val = load_if_immediate(lhs_res.res.bcx, - lhs_res.res.val, t); auto rhs_res = trans_expr(lhs_res.res.bcx, src); + if (ty.type_is_sequence(cx.fcx.lcx.ccx.tcx, t)) { + alt (op) { + case (ast.add) { + ret trans_vec_append(rhs_res.bcx, t, + lhs_res.res.val, + rhs_res.val); + } + case (_) { } + } + } + auto lhs_val = load_if_immediate(rhs_res.bcx, + lhs_res.res.val, t); auto v = trans_eager_binop(rhs_res.bcx, op, t, lhs_val, rhs_res.val); // FIXME: calculate copy init-ness in typestate.