Skip to content

Commit b108280

Browse files
committed
rustc: Move middle::tstate::collect_locals over to interior vectors
1 parent 48438ba commit b108280

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/comp/middle/tstate/collect_locals.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2+
import std::ivec;
23
import std::vec;
3-
import std::vec::plus_option;
44
import syntax::ast::*;
55
import util::ppaux::fn_ident_to_string;
66
import std::option::*;
@@ -26,22 +26,22 @@ import util::common::new_def_hash;
2626
import syntax::codemap::span;
2727
import syntax::ast::respan;
2828

29-
type ctxt = rec(@mutable vec[aux::constr] cs, ty::ctxt tcx);
29+
type ctxt = rec(@mutable (aux::constr[]) cs, ty::ctxt tcx);
3030

3131
fn collect_local(&@local loc, &ctxt cx, &visit::vt[ctxt] v) {
3232
log "collect_local: pushing " + loc.node.ident;
33-
vec::push(*cx.cs,
34-
respan(loc.span, rec(id=loc.node.id, c=ninit(loc.node.ident))));
33+
*cx.cs += ~[respan(loc.span, rec(id=loc.node.id,
34+
c=ninit(loc.node.ident)))];
3535
visit::visit_local(loc, cx, v);
3636
}
3737

3838
fn collect_pred(&@expr e, &ctxt cx, &visit::vt[ctxt] v) {
3939
alt (e.node) {
4040
case (expr_check(_, ?ch)) {
41-
vec::push(*cx.cs, expr_to_constr(cx.tcx, ch));
41+
*cx.cs += ~[expr_to_constr(cx.tcx, ch)];
4242
}
4343
case (expr_if_check(?ex, _, _)) {
44-
vec::push(*cx.cs, expr_to_constr(cx.tcx, ex));
44+
*cx.cs += ~[expr_to_constr(cx.tcx, ex)];
4545
}
4646
// If it's a call, generate appropriate instances of the
4747
// call's constraints.
@@ -55,7 +55,7 @@ fn collect_pred(&@expr e, &ctxt cx, &visit::vt[ctxt] v) {
5555
rec(id=c.node.id._1,
5656
c=aux::substitute_constr_args(cx.tcx,
5757
operands_ivec, c)));
58-
vec::push(*cx.cs, ct);
58+
*cx.cs += ~[ct];
5959
}
6060
}
6161
case (_) { }
@@ -71,7 +71,7 @@ fn do_nothing(&_fn f, &vec[ty_param] tp, &span sp, &fn_ident i,
7171
fn find_locals(&ty::ctxt tcx, &_fn f, &vec[ty_param] tps,
7272
&span sp, &fn_ident i, node_id id)
7373
-> ctxt {
74-
let ctxt cx = rec(cs=@mutable vec::alloc(0u), tcx=tcx);
74+
let ctxt cx = rec(cs=@mutable ~[], tcx=tcx);
7575
auto visitor = visit::default_visitor[ctxt]();
7676

7777
visitor =
@@ -140,7 +140,7 @@ fn mk_fn_info(&crate_ctxt ccx, &_fn f, &vec[ty_param] tp,
140140
let @mutable node_id[] v = @mutable ~[];
141141
auto rslt =
142142
rec(constrs=res_map,
143-
num_constraints=vec::len(*cx.cs) + 1u,
143+
num_constraints=ivec::len(*cx.cs) + 1u,
144144
cf=f.decl.cf,
145145
used_vars=v);
146146
ccx.fm.insert(id, rslt);

0 commit comments

Comments
 (0)