Skip to content

Commit 58eb70a

Browse files
committed
auto merge of #7554 : jld/rust/rm-ssoe, r=catamorphism
2 parents 8c50ee3 + 2f27d43 commit 58eb70a

File tree

2 files changed

+1
-44
lines changed

2 files changed

+1
-44
lines changed

src/librustc/middle/trans/machine.rs

-42
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ use lib::llvm::{ValueRef};
1414
use lib::llvm::False;
1515
use lib::llvm::llvm;
1616
use middle::trans::common::*;
17-
use middle::trans::type_of;
18-
use middle::ty;
19-
use util::ppaux::ty_to_str;
2017

2118
use middle::trans::type_::Type;
2219

@@ -116,42 +113,3 @@ pub fn llalign_of(cx: &CrateContext, ty: Type) -> ValueRef {
116113
llvm::LLVMAlignOf(ty.to_ref()), cx.int_type.to_ref(), False);
117114
}
118115
}
119-
120-
// Computes the size of the data part of an enum.
121-
pub fn static_size_of_enum(cx: &mut CrateContext, t: ty::t) -> uint {
122-
if cx.enum_sizes.contains_key(&t) {
123-
return cx.enum_sizes.get_copy(&t);
124-
}
125-
126-
debug!("static_size_of_enum %s", ty_to_str(cx.tcx, t));
127-
128-
match ty::get(t).sty {
129-
ty::ty_enum(tid, ref substs) => {
130-
// Compute max(variant sizes).
131-
let mut max_size = 0;
132-
let variants = ty::enum_variants(cx.tcx, tid);
133-
for variants.iter().advance |variant| {
134-
if variant.args.len() == 0 {
135-
loop;
136-
}
137-
138-
let lltypes = variant.args.map(|&variant_arg| {
139-
let substituted = ty::subst(cx.tcx, substs, variant_arg);
140-
type_of::sizing_type_of(cx, substituted)
141-
});
142-
143-
debug!("static_size_of_enum: variant %s type %s",
144-
cx.tcx.sess.str_of(variant.name),
145-
cx.tn.type_to_str(Type::struct_(lltypes, false)));
146-
147-
let this_size = llsize_of_real(cx, Type::struct_(lltypes, false));
148-
if max_size < this_size {
149-
max_size = this_size;
150-
}
151-
}
152-
cx.enum_sizes.insert(t, max_size);
153-
return max_size;
154-
}
155-
_ => cx.sess.bug("static_size_of_enum called on non-enum")
156-
}
157-
}

src/librustc/middle/trans/type_of.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ pub fn type_of_non_gc_box(cx: &mut CrateContext, t: ty::t) -> Type {
104104
//
105105
// (2) It won't make any recursive calls to determine the structure of the
106106
// type behind pointers. This can help prevent infinite loops for
107-
// recursive types. For example, `static_size_of_enum()` relies on this
108-
// behavior.
107+
// recursive types. For example, enum types rely on this behavior.
109108

110109
pub fn sizing_type_of(cx: &mut CrateContext, t: ty::t) -> Type {
111110
match cx.llsizingtypes.find_copy(&t) {

0 commit comments

Comments
 (0)