Skip to content

Commit 196753e

Browse files
committed
rustc: Remove some interior vectors from ty, except the ones that I think were causing crashes before
1 parent c94fc7a commit 196753e

File tree

1 file changed

+8
-35
lines changed

1 file changed

+8
-35
lines changed

src/comp/middle/ty.rs

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import std::int;
33
import std::ivec;
44
import std::str;
55
import std::uint;
6-
import std::vec;
76
import std::box;
87
import std::ufindivec;
98
import std::map;
@@ -1039,24 +1038,16 @@ fn type_has_pointers(&ctxt cx, &t ty) -> bool {
10391038
case (ty_tag(?did, ?tps)) {
10401039
auto variants = tag_variants(cx, did);
10411040
for (variant_info variant in variants) {
1042-
// TODO: Remove this vec->ivec conversion.
1043-
auto args = ~[];
1044-
for (ty::t arg in variant.args) { args += ~[arg]; }
1041+
auto tup_ty = mk_imm_tup(cx, variant.args);
10451042

1046-
auto tup_ty = mk_imm_tup(cx, args);
10471043
// Perform any type parameter substitutions.
1048-
10491044
tup_ty = substitute_type_params(cx, tps, tup_ty);
10501045
if (type_has_pointers(cx, tup_ty)) { result = true; }
10511046
}
10521047
}
10531048
case (ty_res(?did, ?inner, ?tps)) {
1054-
// FIXME: Remove this vec->ivec conversion.
1055-
auto tps_ivec = ~[];
1056-
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
1057-
1058-
result = type_has_pointers
1059-
(cx, substitute_type_params(cx, tps_ivec, inner));
1049+
result = type_has_pointers(cx,
1050+
substitute_type_params(cx, tps, inner));
10601051
}
10611052
case (_) { result = true; }
10621053
}
@@ -1221,11 +1212,7 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
12211212
case (ty_tag(?did, ?tps)) {
12221213
auto variants = tag_variants(cx, did);
12231214
for (variant_info variant in variants) {
1224-
// TODO: Remove this vec->ivec conversion.
1225-
auto args = ~[];
1226-
for (ty::t arg in variant.args) { args += ~[arg]; }
1227-
1228-
auto tup_ty = mk_imm_tup(cx, args);
1215+
auto tup_ty = mk_imm_tup(cx, variant.args);
12291216

12301217
// Perform any type parameter substitutions.
12311218
tup_ty = substitute_type_params(cx, tps, tup_ty);
@@ -1243,12 +1230,8 @@ fn type_owns_heap_mem(&ctxt cx, &t ty) -> bool {
12431230
}
12441231
}
12451232
case (ty_res(_, ?inner, ?tps)) {
1246-
// FIXME: Remove this vec->ivec conversion.
1247-
auto tps_ivec = ~[];
1248-
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
1249-
1250-
result = type_owns_heap_mem
1251-
(cx, substitute_type_params(cx, tps_ivec, inner));
1233+
result = type_owns_heap_mem(cx,
1234+
substitute_type_params(cx, tps, inner));
12521235
}
12531236

12541237
case (ty_ptr(_)) { result = false; }
@@ -1279,11 +1262,7 @@ fn type_autoderef(&ctxt cx, &ty::t t) -> ty::t {
12791262
alt (struct(cx, t1)) {
12801263
case (ty::ty_box(?mt)) { t1 = mt.ty; }
12811264
case (ty::ty_res(_, ?inner, ?tps)) {
1282-
// FIXME: Remove this vec->ivec conversion.
1283-
auto tps_ivec = ~[];
1284-
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
1285-
1286-
t1 = substitute_type_params(cx, tps_ivec, inner);
1265+
t1 = substitute_type_params(cx, tps, inner);
12871266
}
12881267
case (ty::ty_tag(?did, ?tps)) {
12891268
auto variants = tag_variants(cx, did);
@@ -1763,13 +1742,7 @@ fn ty_param_substs_opt_and_ty_to_monotype(&ctxt cx,
17631742
t {
17641743
alt (tpot._0) {
17651744
case (none) { ret tpot._1; }
1766-
case (some(?tps)) {
1767-
// FIXME: Remove this vec->ivec conversion.
1768-
auto tps_ivec = ~[];
1769-
for (ty::t tp in tps) { tps_ivec += ~[tp]; }
1770-
1771-
ret substitute_type_params(cx, tps_ivec, tpot._1);
1772-
}
1745+
case (some(?tps)) { ret substitute_type_params(cx, tps, tpot._1); }
17731746
}
17741747
}
17751748

0 commit comments

Comments
 (0)