Skip to content

Commit a3add84

Browse files
committed
rustc: Remove some interior vectors from typestate and some useless vec-related imports
1 parent ccd0fff commit a3add84

File tree

6 files changed

+7
-26
lines changed

6 files changed

+7
-26
lines changed

src/comp/middle/trans.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
import std::int;
1616
import std::str;
1717
import std::uint;
18-
import std::vec;
1918
import std::str::rustrt::sbuf;
20-
import std::vec::rustrt::vbuf;
2119
import std::map;
2220
import std::map::hashmap;
2321
import std::option;
@@ -256,10 +254,10 @@ type fn_ctxt =
256254
// Derived tydescs are tydescs created at runtime, for types that
257255
// involve type parameters inside type constructors. For example,
258256
// suppose a function parameterized by T creates a vector of type
259-
// vec[T]. The function doesn't know what T is until runtime, and the
257+
// [T]. The function doesn't know what T is until runtime, and the
260258
// function's caller knows T but doesn't know that a vector is
261-
// involved. So a tydesc for vec[T] can't be created until runtime,
262-
// when information about both "vec" and "T" are available. When such
259+
// involved. So a tydesc for [T] can't be created until runtime,
260+
// when information about both "[T]" and "T" are available. When such
263261
// a tydesc is created, we cache it in the derived_tydescs table for
264262
// the next time that such a tydesc is needed.
265263
hashmap[ty::t, derived_tydesc_info] derived_tydescs,

src/comp/middle/tstate/auxiliary.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,10 @@ fn expr_to_constr(ty::ctxt tcx, &@expr e) -> constr {
591591
expr_call(?operator, ?args)) {
592592
alt (operator.node) {
593593
case (expr_path(?p)) {
594-
// FIXME: Remove this vec->ivec conversion.
595-
auto args_ivec = ~[];
596-
for (@expr e in args) { args_ivec += ~[e]; }
597-
598594
ret respan(e.span,
599595
rec(id=node_id_for_constr(tcx, operator.id),
600596
c=npred(p, exprs_to_constr_args(tcx,
601-
args_ivec))));
597+
args))));
602598
}
603599
case (_) {
604600
tcx.sess.span_fatal(operator.span,
@@ -698,9 +694,9 @@ type inst = tup(ident, def_id);
698694
type subst = tup(inst, inst)[];
699695

700696
fn find_instances(&fn_ctxt fcx, &subst subst, &constraint c)
701-
-> vec[tup(uint, uint)] {
697+
-> (tup(uint, uint))[] {
702698

703-
let vec[tup(uint, uint)] rslt = [];
699+
let (tup(uint, uint))[] rslt = ~[];
704700
if (ivec::len(subst) == 0u) {
705701
ret rslt;
706702
}
@@ -714,7 +710,7 @@ fn find_instances(&fn_ctxt fcx, &subst subst, &constraint c)
714710
auto new = replace(subst, d);
715711
alt (find_instance_(new, *descs)) {
716712
case (some(?d1)) {
717-
rslt += [tup(old_bit_num, d1)];
713+
rslt += ~[tup(old_bit_num, d1)];
718714
}
719715
case (_) { }
720716
}

src/comp/middle/tstate/states.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import std::ivec;
2-
import std::vec;
3-
import std::vec::plus_option;
4-
import std::vec::cat_options;
52
import std::option;
63
import std::option::get;
74
import std::option::is_none;

src/comp/syntax/ext/base.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import std::ivec;
2-
import std::vec;
32
import std::option;
43
import std::map::hashmap;
54
import driver::session::session;

src/comp/syntax/ext/env.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88
import std::ivec;
99
import std::str;
10-
import std::vec;
1110
import std::option;
1211
import std::generic_os;
1312
import base::*;

src/comp/util/common.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,6 @@ fn lit_eq(&@ast::lit l, &@ast::lit m) -> bool {
174174
}
175175
}
176176

177-
// FIXME move to vec
178-
fn any[T](&fn(&T) -> bool f, &vec[T] v) -> bool {
179-
for (T t in v) {
180-
if (f(t)) { ret true; }
181-
}
182-
ret false;
183-
}
184-
185177
tag call_kind {
186178
kind_call;
187179
kind_spawn;

0 commit comments

Comments
 (0)