Skip to content

Commit

Permalink
rustc: Box tag variants to avoid copies
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Dec 16, 2011
1 parent 26db74c commit 1f8f605
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/comp/metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/comp/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1f8f605

Please sign in to comment.