Skip to content

Commit 787c57e

Browse files
committed
---
yaml --- r: 3610 b: refs/heads/master c: 0eb889f h: refs/heads/master v: v3
1 parent ac6f445 commit 787c57e

File tree

4 files changed

+35
-36
lines changed

4 files changed

+35
-36
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 8bee69da25871dc135dd95ac869ecbb17e2a87c0
2+
refs/heads/master: 0eb889f9d2512c60a8edbf2a3f06049191c07d93

trunk/src/comp/middle/trans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4891,7 +4891,7 @@ fn lval_generic_fn(&@block_ctxt cx, &ty::ty_param_count_and_ty tpt,
48914891
lv = trans_external_path(cx, fn_id, tpt);
48924892
}
48934893
auto tys = ty::node_id_to_type_params(cx.fcx.lcx.ccx.tcx, id);
4894-
if (vec::len[ty::t](tys) != 0u) {
4894+
if (std::ivec::len[ty::t](tys) != 0u) {
48954895
auto bcx = lv.res.bcx;
48964896
let vec[ValueRef] tydescs = [];
48974897
let vec[option::t[@tydesc_info]] tis = [];

trunk/src/comp/middle/ty.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ const uint idx_first_others = 21u;
351351

352352
type type_store = interner::interner[raw_t];
353353

354-
type ty_param_substs_opt_and_ty = tup(option::t[vec[ty::t]], ty::t);
354+
type ty_param_substs_opt_and_ty = tup(option::t[ty::t[]], ty::t);
355355

356356
type node_type_table =
357357
@smallintmap::smallintmap[ty::ty_param_substs_opt_and_ty];
@@ -1748,16 +1748,16 @@ fn node_id_to_type(&ctxt cx, &ast::node_id id) -> t {
17481748
ret node_id_to_ty_param_substs_opt_and_ty(cx, id)._1;
17491749
}
17501750

1751-
fn node_id_to_type_params(&ctxt cx, &ast::node_id id) -> vec[t] {
1751+
fn node_id_to_type_params(&ctxt cx, &ast::node_id id) -> t[] {
17521752
alt (node_id_to_ty_param_substs_opt_and_ty(cx, id)._0) {
1753-
case (none) { let vec[t] result = []; ret result; }
1753+
case (none) { ret ~[]; }
17541754
case (some(?tps)) { ret tps; }
17551755
}
17561756
}
17571757

17581758
fn node_id_has_type_params(&ctxt cx, &ast::node_id id) -> bool {
17591759
auto tpt = node_id_to_ty_param_substs_opt_and_ty(cx, id);
1760-
ret !option::is_none[vec[t]](tpt._0);
1760+
ret !option::is_none[t[]](tpt._0);
17611761
}
17621762

17631763

@@ -1883,7 +1883,7 @@ fn expr_ty(&ctxt cx, &@ast::expr expr) -> t {
18831883
ret node_id_to_monotype(cx, expr.id);
18841884
}
18851885

1886-
fn expr_ty_params_and_ty(&ctxt cx, &@ast::expr expr) -> tup(vec[t], t) {
1886+
fn expr_ty_params_and_ty(&ctxt cx, &@ast::expr expr) -> tup(t[], t) {
18871887
ret tup(node_id_to_type_params(cx, expr.id),
18881888
node_id_to_type(cx, expr.id));
18891889
}

trunk/src/comp/middle/typeck.rs

+28-29
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
157157
auto ty_substs_opt;
158158
auto ty_substs_len = vec::len[@ast::ty](pth.node.types);
159159
if (ty_substs_len > 0u) {
160-
let vec[ty::t] ty_substs = [];
160+
let ty::t[] ty_substs = ~[];
161161
auto i = 0u;
162162
while (i < ty_substs_len) {
163163
// TODO: Report an error if the number of type params in the item
@@ -166,10 +166,10 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
166166
auto ty_var = ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i));
167167
auto ty_subst = ast_ty_to_ty_crate(fcx.ccx, pth.node.types.(i));
168168
auto res_ty = demand::simple(fcx, pth.span, ty_var, ty_subst);
169-
ty_substs += [res_ty];
169+
ty_substs += ~[res_ty];
170170
i += 1u;
171171
}
172-
ty_substs_opt = some[vec[ty::t]](ty_substs);
172+
ty_substs_opt = some[ty::t[]](ty_substs);
173173
if (ty_param_count == 0u) {
174174
fcx.ccx.tcx.sess.span_fatal(sp,
175175
"this item does not take type " +
@@ -179,13 +179,13 @@ fn instantiate_path(&@fn_ctxt fcx, &ast::path pth, &ty_param_count_and_ty tpt,
179179
} else {
180180
// We will acquire the type parameters through unification.
181181

182-
let vec[ty::t] ty_substs = [];
182+
let ty::t[] ty_substs = ~[];
183183
auto i = 0u;
184184
while (i < ty_param_count) {
185-
ty_substs += [ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i))];
185+
ty_substs += ~[ty::mk_var(fcx.ccx.tcx, ty_param_vars.(i))];
186186
i += 1u;
187187
}
188-
ty_substs_opt = some[vec[ty::t]](ty_substs);
188+
ty_substs_opt = some[ty::t[]](ty_substs);
189189
}
190190
ret tup(ty_substs_opt, tpt._1);
191191
}
@@ -435,23 +435,23 @@ mod write {
435435

436436
// Writes a type with no type parameters into the node type table.
437437
fn ty_only(&ty::ctxt tcx, ast::node_id node_id, ty::t typ) {
438-
ret ty(tcx, node_id, tup(none[vec[ty::t]], typ));
438+
ret ty(tcx, node_id, tup(none[ty::t[]], typ));
439439
}
440440

441441
// Writes a type with no type parameters into the node type table. This
442442
// function allows for the possibility of type variables.
443443
fn ty_only_fixup(@fn_ctxt fcx, ast::node_id node_id, ty::t typ) {
444-
ret ty_fixup(fcx, node_id, tup(none[vec[ty::t]], typ));
444+
ret ty_fixup(fcx, node_id, tup(none[ty::t[]], typ));
445445
}
446446

447447
// Writes a nil type into the node type table.
448448
fn nil_ty(&ty::ctxt tcx, ast::node_id node_id) {
449-
ret ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_nil(tcx)));
449+
ret ty(tcx, node_id, tup(none[ty::t[]], ty::mk_nil(tcx)));
450450
}
451451

452452
// Writes the bottom type into the node type table.
453453
fn bot_ty(&ty::ctxt tcx, ast::node_id node_id) {
454-
ret ty(tcx, node_id, tup(none[vec[ty::t]], ty::mk_bot(tcx)));
454+
ret ty(tcx, node_id, tup(none[ty::t[]], ty::mk_bot(tcx)));
455455
}
456456
}
457457

@@ -912,24 +912,22 @@ fn resolve_type_vars_if_possible(&@fn_ctxt fcx, ty::t typ) -> ty::t {
912912

913913
// Demands - procedures that require that two types unify and emit an error
914914
// message if they don't.
915-
type ty_param_substs_and_ty = tup(vec[ty::t], ty::t);
915+
type ty_param_substs_and_ty = tup(ty::t[], ty::t);
916916

917917
mod demand {
918918
fn simple(&@fn_ctxt fcx, &span sp, &ty::t expected, &ty::t actual) ->
919919
ty::t {
920-
let vec[ty::t] tps = [];
921-
ret full(fcx, sp, expected, actual, tps, NO_AUTODEREF)._1;
920+
ret full(fcx, sp, expected, actual, ~[], NO_AUTODEREF)._1;
922921
}
923922
fn autoderef(&@fn_ctxt fcx, &span sp, &ty::t expected, &ty::t actual,
924923
autoderef_kind adk) -> ty::t {
925-
let vec[ty::t] tps = [];
926-
ret full(fcx, sp, expected, actual, tps, adk)._1;
924+
ret full(fcx, sp, expected, actual, ~[], adk)._1;
927925
}
928926

929927
// Requires that the two types unify, and prints an error message if they
930928
// don't. Returns the unified type and the type parameter substitutions.
931929
fn full(&@fn_ctxt fcx, &span sp, &ty::t expected, &ty::t actual,
932-
&vec[ty::t] ty_param_substs_0, autoderef_kind adk) ->
930+
&ty::t[] ty_param_substs_0, autoderef_kind adk) ->
933931
ty_param_substs_and_ty {
934932
auto expected_1 = expected;
935933
auto actual_1 = actual;
@@ -954,10 +952,10 @@ mod demand {
954952
fn mk_result(&@fn_ctxt fcx, &ty::t result_ty,
955953
&vec[int] ty_param_subst_var_ids,
956954
uint implicit_boxes) -> ty_param_substs_and_ty {
957-
let vec[ty::t] result_ty_param_substs = [];
955+
let ty::t[] result_ty_param_substs = ~[];
958956
for (int var_id in ty_param_subst_var_ids) {
959957
auto tp_subst = ty::mk_var(fcx.ccx.tcx, var_id);
960-
result_ty_param_substs += [tp_subst];
958+
result_ty_param_substs += ~[tp_subst];
961959
}
962960
ret tup(result_ty_param_substs,
963961
add_boxes(fcx.ccx, implicit_boxes, result_ty));
@@ -1047,13 +1045,14 @@ mod writeback {
10471045
auto new_ty = resolve_type_vars_in_type(fcx, sp, tpot._1);
10481046
auto new_substs_opt;
10491047
alt (tpot._0) {
1050-
case (none[vec[ty::t]]) { new_substs_opt = none[vec[ty::t]]; }
1051-
case (some[vec[ty::t]](?substs)) {
1052-
let vec[ty::t] new_substs = [];
1048+
case (none[ty::t[]]) { new_substs_opt = none[ty::t[]]; }
1049+
case (some[ty::t[]](?substs)) {
1050+
let ty::t[] new_substs = ~[];
10531051
for (ty::t subst in substs) {
1054-
new_substs += [resolve_type_vars_in_type(fcx, sp, subst)];
1052+
new_substs += ~[resolve_type_vars_in_type(fcx, sp,
1053+
subst)];
10551054
}
1056-
new_substs_opt = some[vec[ty::t]](new_substs);
1055+
new_substs_opt = some[ty::t[]](new_substs);
10571056
}
10581057
}
10591058
write::ty(fcx.ccx.tcx, id, tup(new_substs_opt, new_ty));
@@ -1234,11 +1233,11 @@ fn gather_locals(&@crate_ctxt ccx, &ast::fn_decl decl, &ast::block body,
12341233

12351234
// AST fragment utilities
12361235
fn replace_expr_type(&@fn_ctxt fcx, &@ast::expr expr,
1237-
&tup(vec[ty::t], ty::t) new_tyt) {
1236+
&tup(ty::t[], ty::t) new_tyt) {
12381237
auto new_tps;
12391238
if (ty::expr_has_ty_params(fcx.ccx.tcx, expr)) {
1240-
new_tps = some[vec[ty::t]](new_tyt._0);
1241-
} else { new_tps = none[vec[ty::t]]; }
1239+
new_tps = some[ty::t[]](new_tyt._0);
1240+
} else { new_tps = none[ty::t[]]; }
12421241
write::ty_fixup(fcx, expr.id, tup(new_tps, new_tyt._1));
12431242
}
12441243

@@ -1295,13 +1294,13 @@ fn check_pat(&@fn_ctxt fcx, &@ast::pat pat, ty::t expected) {
12951294
path_tpot);
12961295

12971296
// FIXME: Remove this ivec->vec conversion.
1298-
auto tps_vec = [];
1299-
for (ty::t tp in expected_tps) { tps_vec += [tp]; }
1297+
auto tps_vec = ~[];
1298+
for (ty::t tp in expected_tps) { tps_vec += ~[tp]; }
13001299

13011300
auto path_tpt =
13021301
demand::full(fcx, pat.span, expected, ctor_ty, tps_vec,
13031302
NO_AUTODEREF);
1304-
path_tpot = tup(some[vec[ty::t]](path_tpt._0), path_tpt._1);
1303+
path_tpot = tup(some[ty::t[]](path_tpt._0), path_tpt._1);
13051304
// Get the number of arguments in this tag variant.
13061305

13071306
auto arg_types =

0 commit comments

Comments
 (0)