rustc: Remove some interior vectors from ty, except the ones that I think were causing crashes before

This commit is contained in:
Patrick Walton 2011-07-13 17:39:33 -07:00
parent c94fc7aad8
commit 196753e4c3

View File

@ -3,7 +3,6 @@ import std::int;
import std::ivec;
import std::str;
import std::uint;
import std::vec;
import std::box;
import std::ufindivec;
import std::map;
@ -1039,24 +1038,16 @@ fn type_has_pointers(&ctxt cx, &t ty) -> bool {
case (ty_tag(?did, ?tps)) {
auto variants = tag_variants(cx, did);
for (variant_info variant in variants) {
// TODO: Remove this vec->ivec conversion.
auto args = ~[];
for (ty::t arg in variant.args) { args += ~[arg]; }
auto tup_ty = mk_imm_tup(cx, variant.args);
auto tup_ty = mk_imm_tup(cx, args);
// Perform any type parameter substitutions.
tup_ty = substitute_type_params(cx, tps, tup_ty);
if (type_has_pointers(cx, tup_ty)) { result = true; }
}
}
case (ty_res(?did, ?inner, ?tps)) {
// FIXME: Remove this vec->ivec conversion.
auto tps_ivec = ~[];
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
result = type_has_pointers
(cx, substitute_type_params(cx, tps_ivec, inner));
result = type_has_pointers(cx,
substitute_type_params(cx, tps, inner));
}
case (_) { result = true; }
}
@ -1221,11 +1212,7 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
case (ty_tag(?did, ?tps)) {
auto variants = tag_variants(cx, did);
for (variant_info variant in variants) {
// TODO: Remove this vec->ivec conversion.
auto args = ~[];
for (ty::t arg in variant.args) { args += ~[arg]; }
auto tup_ty = mk_imm_tup(cx, args);
auto tup_ty = mk_imm_tup(cx, variant.args);
// Perform any type parameter substitutions.
tup_ty = substitute_type_params(cx, tps, tup_ty);
@ -1243,12 +1230,8 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
}
}
case (ty_res(_, ?inner, ?tps)) {
// FIXME: Remove this vec->ivec conversion.
auto tps_ivec = ~[];
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
result = type_owns_heap_mem
(cx, substitute_type_params(cx, tps_ivec, inner));
result = type_owns_heap_mem(cx,
substitute_type_params(cx, tps, inner));
}
case (ty_ptr(_)) { result = false; }
@ -1279,11 +1262,7 @@ fn type_autoderef(&ctxt cx, &ty::t t) -> ty::t {
alt (struct(cx, t1)) {
case (ty::ty_box(?mt)) { t1 = mt.ty; }
case (ty::ty_res(_, ?inner, ?tps)) {
// FIXME: Remove this vec->ivec conversion.
auto tps_ivec = ~[];
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
t1 = substitute_type_params(cx, tps_ivec, inner);
t1 = substitute_type_params(cx, tps, inner);
}
case (ty::ty_tag(?did, ?tps)) {
auto variants = tag_variants(cx, did);
@ -1763,13 +1742,7 @@ fn ty_param_substs_opt_and_ty_to_monotype(&ctxt cx,
t {
alt (tpot._0) {
case (none) { ret tpot._1; }
case (some(?tps)) {
// FIXME: Remove this vec->ivec conversion.
auto tps_ivec = ~[];
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
ret substitute_type_params(cx, tps_ivec, tpot._1);
}
case (some(?tps)) { ret substitute_type_params(cx, tps, tpot._1); }
}
}