Skip to content

Commit 05954f3

Browse files
committed
rustc: Use an interior vector for ty::count_ty_params
1 parent e066bae commit 05954f3

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/comp/middle/ty.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1788,24 +1788,22 @@ fn node_id_to_monotype(&ctxt cx, ast::node_id id) -> t {
17881788

17891789
// Returns the number of distinct type parameters in the given type.
17901790
fn count_ty_params(&ctxt cx, t ty) -> uint {
1791-
fn counter(&ctxt cx, @mutable vec[uint] param_indices, t ty) {
1791+
fn counter(&ctxt cx, @mutable (uint[]) param_indices, t ty) {
17921792
alt (struct(cx, ty)) {
17931793
case (ty_param(?param_idx)) {
17941794
auto seen = false;
17951795
for (uint other_param_idx in *param_indices) {
17961796
if (param_idx == other_param_idx) { seen = true; }
17971797
}
1798-
if (!seen) { *param_indices += [param_idx]; }
1798+
if (!seen) { *param_indices += ~[param_idx]; }
17991799
}
18001800
case (_) {/* fall through */ }
18011801
}
18021802
}
1803-
let vec[uint] v = []; // FIXME: typechecker botch
1804-
1805-
let @mutable vec[uint] param_indices = @mutable v;
1803+
let @mutable (uint[]) param_indices = @mutable ~[];
18061804
auto f = bind counter(cx, param_indices, _);
18071805
walk_ty(cx, f, ty);
1808-
ret vec::len[uint](*param_indices);
1806+
ret ivec::len[uint](*param_indices);
18091807
}
18101808

18111809
fn type_contains_vars(&ctxt cx, &t typ) -> bool {

0 commit comments

Comments
 (0)