Skip to content

Commit 6883814

Browse files
committed
Remove codes related to modes
1 parent b42ea7f commit 6883814

File tree

1 file changed

+0
-78
lines changed

1 file changed

+0
-78
lines changed

src/librustc/middle/ty.rs

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,15 +1818,6 @@ pub impl TypeContents {
18181818
if cx.vecs_implicitly_copyable {base} else {base + TC_OWNED_VEC}
18191819
}
18201820
1821-
fn is_safe_for_default_mode(&self, cx: ctxt) -> bool {
1822-
!self.intersects(TypeContents::nondefault_mode(cx))
1823-
}
1824-
1825-
fn nondefault_mode(cx: ctxt) -> TypeContents {
1826-
let tc = TypeContents::nonimplicitly_copyable(cx);
1827-
tc + TC_BIG + TC_OWNED_VEC // disregard cx.vecs_implicitly_copyable
1828-
}
1829-
18301821
fn needs_drop(&self, cx: ctxt) -> bool {
18311822
let tc = TC_MANAGED + TC_DTOR + TypeContents::owned(cx);
18321823
self.intersects(tc)
@@ -1886,9 +1877,6 @@ static TC_MUTABLE: TypeContents = TypeContents{bits:0b000010000000};
18861877
/// Mutable content, whether owned or by ref
18871878
static TC_ONCE_CLOSURE: TypeContents = TypeContents{bits:0b000100000000};
18881879
1889-
/// Something we estimate to be "big"
1890-
static TC_BIG: TypeContents = TypeContents{bits:0b001000000000};
1891-
18921880
/// An enum with no variants.
18931881
static TC_EMPTY_ENUM: TypeContents = TypeContents{bits:0b010000000000};
18941882
@@ -2109,10 +2097,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
21092097
}
21102098
};
21112099
2112-
if type_size(cx, ty) > 4 {
2113-
result = result + TC_BIG;
2114-
}
2115-
21162100
cache.insert(ty_id, result);
21172101
return result;
21182102
}
@@ -2188,68 +2172,6 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents {
21882172
debug!("result = %s", r.to_str());
21892173
return r;
21902174
}
2191-
2192-
/// gives a rough estimate of how much space it takes to represent
2193-
/// an instance of `ty`. Used for the mode transition.
2194-
fn type_size(cx: ctxt, ty: t) -> uint {
2195-
match get(ty).sty {
2196-
ty_nil | ty_bot | ty_bool | ty_int(_) | ty_uint(_) | ty_float(_) |
2197-
ty_ptr(_) | ty_box(_) | ty_uniq(_) | ty_estr(vstore_uniq) |
2198-
ty_trait(*) | ty_rptr(*) | ty_evec(_, vstore_uniq) |
2199-
ty_evec(_, vstore_box) | ty_estr(vstore_box) => {
2200-
1
2201-
}
2202-
2203-
ty_evec(_, vstore_slice(_)) |
2204-
ty_estr(vstore_slice(_)) |
2205-
ty_bare_fn(*) |
2206-
ty_closure(*) => {
2207-
2
2208-
}
2209-
2210-
ty_evec(t, vstore_fixed(n)) => {
2211-
type_size(cx, t.ty) * n
2212-
}
2213-
2214-
ty_estr(vstore_fixed(n)) => {
2215-
n
2216-
}
2217-
2218-
ty_struct(did, ref substs) => {
2219-
let flds = struct_fields(cx, did, substs);
2220-
flds.foldl(0, |s, f| *s + type_size(cx, f.mt.ty))
2221-
}
2222-
2223-
ty_tup(ref tys) => {
2224-
tys.foldl(0, |s, t| *s + type_size(cx, *t))
2225-
}
2226-
2227-
ty_enum(did, ref substs) => {
2228-
let variants = substd_enum_variants(cx, did, substs);
2229-
variants.foldl( // find max size of any variant
2230-
0,
2231-
|m, v| uint::max(
2232-
*m,
2233-
// find size of this variant:
2234-
v.args.foldl(0, |s, a| *s + type_size(cx, *a))))
2235-
}
2236-
2237-
ty_param(_) | ty_self(_) => {
2238-
1
2239-
}
2240-
2241-
ty_infer(_) => {
2242-
cx.sess.bug(~"Asked to compute kind of a type variable");
2243-
}
2244-
ty_type => 1,
2245-
ty_opaque_closure_ptr(_) => 1,
2246-
ty_opaque_box => 1,
2247-
ty_unboxed_vec(_) => 10,
2248-
ty_err => {
2249-
cx.sess.bug(~"Asked to compute kind of fictitious type");
2250-
}
2251-
}
2252-
}
22532175
}
22542176
22552177
pub fn type_moves_by_default(cx: ctxt, ty: t) -> bool {

0 commit comments

Comments
 (0)