about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-03 01:36:37 -0700
committerbors <bors@rust-lang.org>2013-05-03 01:36:37 -0700
commit213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2 (patch)
treea9e831542f534ce191f48a4eab19e46b7466b4be /src
parent984180c600b083b272237c0b343bb3e3dd844086 (diff)
parent6883814a84d584e1fd65a1d40229807ff3d34efb (diff)
downloadrust-213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2.tar.gz
rust-213f7b24ccd9a6833af7e1a329c5e7ffc8f9e3d2.zip
auto merge of #6207 : sanxiyn/rust/tc-big, r=thestinger
Diffstat (limited to 'src')
-rw-r--r--src/librustc/middle/ty.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs
index d1cb9ec4fe1..411c9534343 100644
--- a/src/librustc/middle/ty.rs
+++ b/src/librustc/middle/ty.rs
@@ -1808,15 +1808,6 @@ pub impl TypeContents {
         if cx.vecs_implicitly_copyable {base} else {base + TC_OWNED_VEC}
     }
 
-    fn is_safe_for_default_mode(&self, cx: ctxt) -> bool {
-        !self.intersects(TypeContents::nondefault_mode(cx))
-    }
-
-    fn nondefault_mode(cx: ctxt) -> TypeContents {
-        let tc = TypeContents::nonimplicitly_copyable(cx);
-        tc + TC_BIG + TC_OWNED_VEC // disregard cx.vecs_implicitly_copyable
-    }
-
     fn needs_drop(&self, cx: ctxt) -> bool {
         let tc = TC_MANAGED + TC_DTOR + TypeContents::owned(cx);
         self.intersects(tc)
@@ -1876,9 +1867,6 @@ static TC_MUTABLE: TypeContents =          TypeContents{bits:0b000010000000};
 /// Mutable content, whether owned or by ref
 static TC_ONCE_CLOSURE: TypeContents =     TypeContents{bits:0b000100000000};
 
-/// Something we estimate to be "big"
-static TC_BIG: TypeContents =              TypeContents{bits:0b001000000000};
-
 /// An enum with no variants.
 static TC_EMPTY_ENUM: TypeContents =       TypeContents{bits:0b010000000000};
 
@@ -2099,10 +2087,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
             }
         };
 
-        if type_size(cx, ty) > 4 {
-            result = result + TC_BIG;
-        }
-
         cache.insert(ty_id, result);
         return result;
     }
@@ -2178,68 +2162,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
         debug!("result = %s", r.to_str());
         return r;
     }
-
-    /// gives a rough estimate of how much space it takes to represent
-    /// an instance of `ty`.  Used for the mode transition.
-    fn type_size(cx: ctxt, ty: t) -> uint {
-        match get(ty).sty {
-          ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
-          ty_ptr(_) | ty_box(_) | ty_uniq(_) | ty_estr(vstore_uniq) |
-          ty_trait(*) | ty_rptr(*) | ty_evec(_, vstore_uniq) |
-          ty_evec(_, vstore_box) | ty_estr(vstore_box) => {
-            1
-          }
-
-          ty_evec(_, vstore_slice(_)) |
-          ty_estr(vstore_slice(_)) |
-          ty_bare_fn(*) |
-          ty_closure(*) => {
-            2
-          }
-
-          ty_evec(t, vstore_fixed(n)) => {
-            type_size(cx, t.ty) * n
-          }
-
-          ty_estr(vstore_fixed(n)) => {
-            n
-          }
-
-          ty_struct(did, ref substs) => {
-            let flds = struct_fields(cx, did, substs);
-            flds.foldl(0, |s, f| *s + type_size(cx, f.mt.ty))
-          }
-
-          ty_tup(ref tys) => {
-            tys.foldl(0, |s, t| *s + type_size(cx, *t))
-          }
-
-          ty_enum(did, ref substs) => {
-            let variants = substd_enum_variants(cx, did, substs);
-            variants.foldl( // find max size of any variant
-                0,
-                |m, v| uint::max(
-                    *m,
-                    // find size of this variant:
-                    v.args.foldl(0, |s, a| *s + type_size(cx, *a))))
-          }
-
-          ty_param(_) | ty_self(_) => {
-            1
-          }
-
-          ty_infer(_) => {
-            cx.sess.bug(~"Asked to compute kind of a type variable");
-          }
-          ty_type => 1,
-          ty_opaque_closure_ptr(_) => 1,
-          ty_opaque_box => 1,
-          ty_unboxed_vec(_) => 10,
-          ty_err => {
-            cx.sess.bug(~"Asked to compute kind of fictitious type");
-          }
-        }
-    }
 }
 
 pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool {