about summary refs log tree commit diff
path: root/src/comp/middle
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-07-12 18:19:39 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-07-12 18:21:50 -0700
commit01ea0647bb9773f44a8100c461af30046c3293aa (patch)
tree5863d7410873d392cbff4d16bc1a624fc970e1ee /src/comp/middle
parentcdda0fd6d65917174708a376e7e69f6cf66b62fb (diff)
downloadrust-01ea0647bb9773f44a8100c461af30046c3293aa.tar.gz
rust-01ea0647bb9773f44a8100c461af30046c3293aa.zip
rustc: Remove some exterior vectors from ty.rs
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/ty.rs57
1 files changed, 15 insertions, 42 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs
index 678821f0cde..b44386553ee 100644
--- a/src/comp/middle/ty.rs
+++ b/src/comp/middle/ty.rs
@@ -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); }
     }
 }
 
@@ -2979,13 +2952,13 @@ fn is_binopable(&ctxt cx, t ty, ast::binop op) -> bool {
     /*.          add,     shift,   bit
       .             sub,     rel,     logic
       .                mult,    eq,         */
-    auto tbl = [[f, f, f, f, t, t, f, f], /*other*/
-                [f, f, f, f, t, t, t, t], /*bool*/
-                [t, t, t, t, t, t, t, f], /*int*/
-                [t, t, t, f, t, t, f, f], /*float*/
-                [t, f, f, f, t, t, f, f], /*str*/
-                [t, f, f, f, t, t, f, f], /*vec*/
-                [f, f, f, f, t, t, f, f]];/*struct*/
+    auto tbl = ~[~[f, f, f, f, t, t, f, f], /*other*/
+                 ~[f, f, f, f, t, t, t, t], /*bool*/
+                 ~[t, t, t, t, t, t, t, f], /*int*/
+                 ~[t, t, t, f, t, t, f, f], /*float*/
+                 ~[t, f, f, f, t, t, f, f], /*str*/
+                 ~[t, f, f, f, t, t, f, f], /*vec*/
+                 ~[f, f, f, f, t, t, f, f]];/*struct*/
 
     ret tbl.(tycat(cx, ty)).(opcat(op));
 }