aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2011-04-28 17:44:28 -0700
committerGraydon Hoare <[email protected]>2011-04-28 17:45:35 -0700
commitbcad52451cb63118ee9b67684b8b70e3cb5f4aff (patch)
treeceaf47380983df319a29b5caf5c7d6cf56cc211a /src/comp
parentstdlib: Provide "array" as a friendlier shorthand for "vec[mutable? T]" (diff)
downloadrust-bcad52451cb63118ee9b67684b8b70e3cb5f4aff.tar.xz
rust-bcad52451cb63118ee9b67684b8b70e3cb5f4aff.zip
Actually hit the no-growth path on vec-append.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index bf96da8b..14eb2e08 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.