about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJed Davis <jld@panix.com>2013-03-13 23:28:12 -0700
committerJed Davis <jld@panix.com>2013-07-02 09:27:11 -0700
commit2f27d4316663dfecd47396d3655458602df28d29 (patch)
treeee5ff9dcdd304d181a691826195af16d91e80b43
parent451c94343f2c49cfcc790816fd8587bfdc7ecfb8 (diff)
downloadrust-2f27d4316663dfecd47396d3655458602df28d29.tar.gz
rust-2f27d4316663dfecd47396d3655458602df28d29.zip
GC static_size_of_enum, which was unused
-rw-r--r--src/librustc/middle/trans/machine.rs42
-rw-r--r--src/librustc/middle/trans/type_of.rs3
2 files changed, 1 insertions, 44 deletions
diff --git a/src/librustc/middle/trans/machine.rs b/src/librustc/middle/trans/machine.rs
index f55523b2841..2cd313ff431 100644
--- a/src/librustc/middle/trans/machine.rs
+++ b/src/librustc/middle/trans/machine.rs
@@ -14,9 +14,6 @@ use lib::llvm::{ValueRef};
 use lib::llvm::False;
 use lib::llvm::llvm;
 use middle::trans::common::*;
-use middle::trans::type_of;
-use middle::ty;
-use util::ppaux::ty_to_str;
 
 use middle::trans::type_::Type;
 
@@ -116,42 +113,3 @@ pub fn llalign_of(cx: &CrateContext, ty: Type) -> ValueRef {
             llvm::LLVMAlignOf(ty.to_ref()), cx.int_type.to_ref(), False);
     }
 }
-
-// Computes the size of the data part of an enum.
-pub fn static_size_of_enum(cx: &mut CrateContext, t: ty::t) -> uint {
-    if cx.enum_sizes.contains_key(&t) {
-        return cx.enum_sizes.get_copy(&t);
-    }
-
-    debug!("static_size_of_enum %s", ty_to_str(cx.tcx, t));
-
-    match ty::get(t).sty {
-        ty::ty_enum(tid, ref substs) => {
-            // Compute max(variant sizes).
-            let mut max_size = 0;
-            let variants = ty::enum_variants(cx.tcx, tid);
-            for variants.iter().advance |variant| {
-                if variant.args.len() == 0 {
-                    loop;
-                }
-
-                let lltypes = variant.args.map(|&variant_arg| {
-                    let substituted = ty::subst(cx.tcx, substs, variant_arg);
-                    type_of::sizing_type_of(cx, substituted)
-                });
-
-                debug!("static_size_of_enum: variant %s type %s",
-                       cx.tcx.sess.str_of(variant.name),
-                       cx.tn.type_to_str(Type::struct_(lltypes, false)));
-
-                let this_size = llsize_of_real(cx, Type::struct_(lltypes, false));
-                if max_size < this_size {
-                    max_size = this_size;
-                }
-            }
-            cx.enum_sizes.insert(t, max_size);
-            return max_size;
-        }
-        _ => cx.sess.bug("static_size_of_enum called on non-enum")
-    }
-}
diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs
index 481f08ee192..47ce0b7c228 100644
--- a/src/librustc/middle/trans/type_of.rs
+++ b/src/librustc/middle/trans/type_of.rs
@@ -104,8 +104,7 @@ pub fn type_of_non_gc_box(cx: &mut CrateContext, t: ty::t) -> Type {
 //
 // (2) It won't make any recursive calls to determine the structure of the
 //     type behind pointers. This can help prevent infinite loops for
-//     recursive types. For example, `static_size_of_enum()` relies on this
-//     behavior.
+//     recursive types. For example, enum types rely on this behavior.
 
 pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
     match cx.llsizingtypes.find_copy(&t) {