about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-05-05 13:50:10 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-05-05 13:50:10 -0400
commit6cb273ed4efb6724b1c713c3ac35d14e52999fb1 (patch)
tree2b7c278d98be88097ea8f24616244c39172e8284
parent0b0b8018a6a1271e6c8e82230e2e8496eebbba3f (diff)
downloadrust-6cb273ed4efb6724b1c713c3ac35d14e52999fb1.tar.gz
rust-6cb273ed4efb6724b1c713c3ac35d14e52999fb1.zip
Address all FIXMEs from #5562
-rw-r--r--src/librustc/middle/astencode.rs8
-rw-r--r--src/librustc/middle/kind.rs8
-rw-r--r--src/librustc/middle/trans/base.rs2
-rw-r--r--src/librustc/middle/trans/callee.rs6
-rw-r--r--src/librustc/middle/trans/type_of.rs6
-rw-r--r--src/librustc/middle/trans/type_use.rs4
6 files changed, 11 insertions, 23 deletions
diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs
index 7a3bdce875d..fad1af749ea 100644
--- a/src/librustc/middle/astencode.rs
+++ b/src/librustc/middle/astencode.rs
@@ -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)
             }
         }
     }
diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs
index 3afe8c3b9d6..44090e32880 100644
--- a/src/librustc/middle/kind.rs
+++ b/src/librustc/middle/kind.rs
@@ -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)
             }
         }
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 5419628cd95..8082e9cce51 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -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)]);
diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs
index c4c6133b405..12f91fb8597 100644
--- a/src/librustc/middle/trans/callee.rs
+++ b/src/librustc/middle/trans/callee.rs
@@ -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,
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index a842f91f0ed..fc27c11c06f 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -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 => ()
     }
 
diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs
index fb2358a57e2..46cc99e71cc 100644
--- a/src/librustc/middle/trans/type_use.rs
+++ b/src/librustc/middle/trans/type_use.rs
@@ -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)
             }
         }