]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Box tag variants to avoid copies
authorBrian Anderson <banderson@mozilla.com>
Fri, 16 Dec 2011 01:25:58 +0000 (17:25 -0800)
committerBrian Anderson <banderson@mozilla.com>
Fri, 16 Dec 2011 01:25:58 +0000 (17:25 -0800)
src/comp/metadata/decoder.rs
src/comp/middle/ty.rs

index bd8c02d0cb7adf1492259be7f31097920cdd5ad7..d5d981bb81c4badfe16ae6121914390f451a28f8 100644 (file)
@@ -244,7 +244,7 @@ fn get_tag_variants(_data: @[u8], def: ast::def_id, tcx: ty::ctxt,
 
           }
         }
-        infos += [{args: arg_tys, ctor_ty: ctor_ty, id: did}];
+        infos += [@{args: arg_tys, ctor_ty: ctor_ty, id: did}];
     }
     ret infos;
 }
index 57ef16ded610fc1bdda5272fcf000a72d8a6b205..2ff7f0b1b74779b53c82d6e50f09d5d62ab7f76e 100644 (file)
@@ -2721,7 +2721,7 @@ fn def_has_ty_params(def: ast::def) -> bool {
 
 
 // Tag information
-type variant_info = {args: [ty::t], ctor_ty: ty::t, id: ast::def_id};
+type variant_info = @{args: [ty::t], ctor_ty: ty::t, id: ast::def_id};
 
 fn tag_variants(cx: ctxt, id: ast::def_id) -> @mutable [variant_info] {
     if ast::local_crate != id.crate {
@@ -2752,9 +2752,9 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @mutable [variant_info] {
                 }
                 let did = variant.node.id;
                 *result +=
-                    [{args: arg_tys,
-                      ctor_ty: ctor_ty,
-                      id: ast_util::local_def(did)}];
+                    [@{args: arg_tys,
+                       ctor_ty: ctor_ty,
+                       id: ast_util::local_def(did)}];
             }
             smallintmap::insert(*cx.tag_var_cache, id.node as uint, result);
             ret result;