Skip to content

Commit 6cb273e

Browse files
committed
Address all FIXMEs from rust-lang#5562
1 parent 0b0b801 commit 6cb273e

File tree

6 files changed

+11
-23
lines changed

6 files changed

+11
-23
lines changed

src/librustc/middle/astencode.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ trait ebml_writer_helpers {
739739
fn emit_arg(&self, ecx: @e::EncodeContext, arg: ty::arg);
740740
fn emit_ty(&self, ecx: @e::EncodeContext, ty: ty::t);
741741
fn emit_vstore(&self, ecx: @e::EncodeContext, vstore: ty::vstore);
742-
fn emit_tys(&self, ecx: @e::EncodeContext, tys: ~[ty::t]);
742+
fn emit_tys(&self, ecx: @e::EncodeContext, tys: &[ty::t]);
743743
fn emit_type_param_def(&self,
744744
ecx: @e::EncodeContext,
745745
type_param_def: &ty::TypeParameterDef);
@@ -766,7 +766,7 @@ impl ebml_writer_helpers for writer::Encoder {
766766
}
767767
}
768768
769-
fn emit_tys(&self, ecx: @e::EncodeContext, tys: ~[ty::t]) {
769+
fn emit_tys(&self, ecx: @e::EncodeContext, tys: &[ty::t]) {
770770
do self.emit_from_vec(tys) |ty| {
771771
self.emit_ty(ecx, *ty)
772772
}
@@ -868,9 +868,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
868868
do ebml_w.tag(c::tag_table_node_type_subst) {
869869
ebml_w.id(id);
870870
do ebml_w.tag(c::tag_table_val) {
871-
// FIXME(#5562): removing this copy causes a segfault
872-
// before stage2
873-
ebml_w.emit_tys(ecx, /*bad*/copy **tys)
871+
ebml_w.emit_tys(ecx, **tys)
874872
}
875873
}
876874
}

src/librustc/middle/kind.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,6 @@ pub fn check_expr(e: @expr, cx: Context, v: visit::vt<Context>) {
268268
_ => e.id
269269
};
270270
for cx.tcx.node_type_substs.find(&type_parameter_id).each |ts| {
271-
// FIXME(#5562): removing this copy causes a segfault before stage2
272-
let ts = /*bad*/ copy **ts;
273271
let type_param_defs = match e.node {
274272
expr_path(_) => {
275273
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>) {
293291
ts.repr(cx.tcx),
294292
type_param_defs.repr(cx.tcx)));
295293
}
296-
for vec::each2(ts, *type_param_defs) |&ty, type_param_def| {
294+
for vec::each2(**ts, *type_param_defs) |&ty, type_param_def| {
297295
check_bounds(cx, type_parameter_id, e.span, ty, type_param_def)
298296
}
299297
}
@@ -331,12 +329,10 @@ fn check_ty(aty: @Ty, cx: Context, v: visit::vt<Context>) {
331329
match aty.node {
332330
ty_path(_, id) => {
333331
for cx.tcx.node_type_substs.find(&id).each |ts| {
334-
// FIXME(#5562): removing this copy causes a segfault before stage2
335-
let ts = /*bad*/ copy **ts;
336332
let did = ast_util::def_id_of_def(cx.tcx.def_map.get_copy(&id));
337333
let type_param_defs =
338334
ty::lookup_item_type(cx.tcx, did).generics.type_param_defs;
339-
for vec::each2(ts, *type_param_defs) |&ty, type_param_def| {
335+
for vec::each2(**ts, *type_param_defs) |&ty, type_param_def| {
340336
check_bounds(cx, aty.id, aty.span, ty, type_param_def)
341337
}
342338
}

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,7 @@ pub fn get_item_val(ccx: @CrateContext, id: ast::node_id) -> ValueRef {
25012501
Some(&v) => v,
25022502
None => {
25032503
let mut exprt = false;
2504-
let val = match *ccx.tcx.items.get(&id) {
2504+
let val = match ccx.tcx.items.get_copy(&id) {
25052505
ast_map::node_item(i, pth) => {
25062506
let my_path = vec::append(/*bad*/copy *pth,
25072507
~[path_name(i.ident)]);

src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,16 +339,12 @@ pub fn trans_method_call(in_cx: block,
339339
node_id_type(in_cx, call_ex.callee_id),
340340
expr_ty(in_cx, call_ex),
341341
|cx| {
342-
match cx.ccx().maps.method_map.find(&call_ex.id) {
342+
match cx.ccx().maps.method_map.find_copy(&call_ex.id) {
343343
Some(origin) => {
344344
debug!("origin for %s: %s",
345345
call_ex.repr(in_cx.tcx()),
346346
origin.repr(in_cx.tcx()));
347347

348-
// FIXME(#5562): removing this copy causes a segfault
349-
// before stage2
350-
let origin = /*bad*/ copy *origin;
351-
352348
meth::trans_method_callee(cx,
353349
call_ex.callee_id,
354350
rcvr,

src/librustc/middle/trans/type_of.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ pub fn type_of_non_gc_box(cx: @CrateContext, t: ty::t) -> TypeRef {
110110

111111
pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
112112
match cx.llsizingtypes.find(&t) {
113-
// FIXME(#5562): removing this copy causes a segfault in stage1 core
114-
Some(t) => return /*bad*/ copy *t,
113+
Some(t) => return *t,
115114
None => ()
116115
}
117116

@@ -178,8 +177,7 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
178177

179178
// Check the cache.
180179
match cx.lltypes.find(&t) {
181-
// FIXME(#5562): removing this copy causes a segfault in stage1 core
182-
Some(t) => return /*bad*/ copy *t,
180+
Some(&t) => return t,
183181
None => ()
184182
}
185183

src/librustc/middle/trans/type_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,10 @@ pub fn mark_for_method_call(cx: Context, e_id: node_id, callee_id: node_id) {
260260
// above because the recursive call to `type_needs` can trigger
261261
// inlining and hence can cause `method_map` and
262262
// `node_type_substs` to be modified.
263-
for opt_static_did.each |did| {
263+
for opt_static_did.each |&did| {
264264
for cx.ccx.tcx.node_type_substs.find_copy(&callee_id).each |ts| {
265265
let type_uses = type_uses_for(cx.ccx, did, ts.len());
266-
for vec::each2(*type_uses, ts) |uses, subst| {
266+
for vec::each2(*type_uses, *ts) |uses, subst| {
267267
type_needs(cx, *uses, *subst)
268268
}
269269
}

0 commit comments

Comments
 (0)