Address all FIXMEs from #5562

This commit is contained in:
Niko Matsakis 2013-05-05 13:50:10 -04:00
parent 0b0b8018a6
commit 6cb273ed4e
6 changed files with 11 additions and 23 deletions

View file

@ -739,7 +739,7 @@ trait ebml_writer_helpers {
fn emit_arg(&self, ecx: @e::EncodeContext, arg: ty::arg);
fn emit_ty(&self, ecx: @e::EncodeContext, ty: ty::t);
fn emit_vstore(&self, ecx: @e::EncodeContext, vstore: ty::vstore);
fn emit_tys(&self, ecx: @e::EncodeContext, tys: ~[ty::t]);
fn emit_tys(&self, ecx: @e::EncodeContext, tys: &[ty::t]);
fn emit_type_param_def(&self,
ecx: @e::EncodeContext,
type_param_def: &ty::TypeParameterDef);
@ -766,7 +766,7 @@ impl ebml_writer_helpers for writer::Encoder {
}
}
fn emit_tys(&self, ecx: @e::EncodeContext, tys: ~[ty::t]) {
fn emit_tys(&self, ecx: @e::EncodeContext, tys: &[ty::t]) {
do self.emit_from_vec(tys) |ty| {
self.emit_ty(ecx, *ty)
}
@ -868,9 +868,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
do ebml_w.tag(c::tag_table_node_type_subst) {
ebml_w.id(id);
do ebml_w.tag(c::tag_table_val) {
// FIXME(#5562): removing this copy causes a segfault
// before stage2
ebml_w.emit_tys(ecx, /*bad*/copy **tys)
ebml_w.emit_tys(ecx, **tys)
}
}
}

View file

@ -268,8 +268,6 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
_ => e.id
};
for cx.tcx.node_type_substs.find(&type_parameter_id).each |ts| {
// FIXME(#5562): removing this copy causes a segfault before stage2
let ts = /*bad*/ copy **ts;
let type_param_defs = match e.node {
expr_path(_) => {
let did = ast_util::def_id_of_def(cx.tcx.def_map.get_copy(&e.id));
@ -293,7 +291,7 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
ts.repr(cx.tcx),
type_param_defs.repr(cx.tcx)));
}
for vec::each2(ts, *type_param_defs) |&ty, type_param_def| {
for vec::each2(**ts, *type_param_defs) |&ty, type_param_def| {
check_bounds(cx, type_parameter_id, e.span, ty, type_param_def)
}
}
@ -331,12 +329,10 @@ fn check_ty(aty: @Ty, cx: Context, v: visit::vt<Context>) {
match aty.node {
ty_path(_, id) => {
for cx.tcx.node_type_substs.find(&id).each |ts| {
// FIXME(#5562): removing this copy causes a segfault before stage2
let ts = /*bad*/ copy **ts;
let did = ast_util::def_id_of_def(cx.tcx.def_map.get_copy(&id));
let type_param_defs =
ty::lookup_item_type(cx.tcx, did).generics.type_param_defs;
for vec::each2(ts, *type_param_defs) |&ty, type_param_def| {
for vec::each2(**ts, *type_param_defs) |&ty, type_param_def| {
check_bounds(cx, aty.id, aty.span, ty, type_param_def)
}
}

View file

@ -2501,7 +2501,7 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef {
Some(&v) => v,
None => {
let mut exprt = false;
let val = match *ccx.tcx.items.get(&id) {
let val = match ccx.tcx.items.get_copy(&id) {
ast_map::node_item(i, pth) => {
let my_path = vec::append(/*bad*/copy *pth,
~[path_name(i.ident)]);

View file

@ -339,16 +339,12 @@ pub fn trans_method_call(in_cx: block,
node_id_type(in_cx, call_ex.callee_id),
expr_ty(in_cx, call_ex),
|cx| {
match cx.ccx().maps.method_map.find(&call_ex.id) {
match cx.ccx().maps.method_map.find_copy(&call_ex.id) {
Some(origin) => {
debug!("origin for %s: %s",
call_ex.repr(in_cx.tcx()),
origin.repr(in_cx.tcx()));
// FIXME(#5562): removing this copy causes a segfault
// before stage2
let origin = /*bad*/ copy *origin;
meth::trans_method_callee(cx,
call_ex.callee_id,
rcvr,

View file

@ -110,8 +110,7 @@ pub fn type_of_non_gc_box(cx: @CrateContext, t: ty::t) -> TypeRef {
pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
match cx.llsizingtypes.find(&t) {
// FIXME(#5562): removing this copy causes a segfault in stage1 core
Some(t) => return /*bad*/ copy *t,
Some(t) => return *t,
None => ()
}
@ -178,8 +177,7 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
// Check the cache.
match cx.lltypes.find(&t) {
// FIXME(#5562): removing this copy causes a segfault in stage1 core
Some(t) => return /*bad*/ copy *t,
Some(&t) => return t,
None => ()
}

View file

@ -260,10 +260,10 @@ pub fn mark_for_method_call(cx: Context, e_id: node_id, callee_id: node_id) {
// above because the recursive call to `type_needs` can trigger
// inlining and hence can cause `method_map` and
// `node_type_substs` to be modified.
for opt_static_did.each |did| {
for opt_static_did.each |&did| {
for cx.ccx.tcx.node_type_substs.find_copy(&callee_id).each |ts| {
let type_uses = type_uses_for(cx.ccx, did, ts.len());
for vec::each2(*type_uses, ts) |uses, subst| {
for vec::each2(*type_uses, *ts) |uses, subst| {
type_needs(cx, *uses, *subst)
}
}