Skip to content

Commit 1f8f605

Browse files
committed
rustc: Box tag variants to avoid copies
1 parent 26db74c commit 1f8f605

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/comp/metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn get_tag_variants(_data: @[u8], def: ast::def_id, tcx: ty::ctxt,
244244

245245
}
246246
}
247-
infos += [{args: arg_tys, ctor_ty: ctor_ty, id: did}];
247+
infos += [@{args: arg_tys, ctor_ty: ctor_ty, id: did}];
248248
}
249249
ret infos;
250250
}

src/comp/middle/ty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2721,7 +2721,7 @@ fn def_has_ty_params(def: ast::def) -> bool {
27212721

27222722

27232723
// Tag information
2724-
type variant_info = {args: [ty::t], ctor_ty: ty::t, id: ast::def_id};
2724+
type variant_info = @{args: [ty::t], ctor_ty: ty::t, id: ast::def_id};
27252725

27262726
fn tag_variants(cx: ctxt, id: ast::def_id) -> @mutable [variant_info] {
27272727
if ast::local_crate != id.crate {
@@ -2752,9 +2752,9 @@ fn tag_variants(cx: ctxt, id: ast::def_id) -> @mutable [variant_info] {
27522752
}
27532753
let did = variant.node.id;
27542754
*result +=
2755-
[{args: arg_tys,
2756-
ctor_ty: ctor_ty,
2757-
id: ast_util::local_def(did)}];
2755+
[@{args: arg_tys,
2756+
ctor_ty: ctor_ty,
2757+
id: ast_util::local_def(did)}];
27582758
}
27592759
smallintmap::insert(*cx.tag_var_cache, id.node as uint, result);
27602760
ret result;

0 commit comments

Comments
 (0)