Skip to content

Commit dbfda2e

Browse files
committed
---
yaml --- r: 3615 b: refs/heads/master c: 5703bd1 h: refs/heads/master i: 3613: 389f889 3611: c2945ee 3607: 392b25a 3599: 50687b8 3583: c282e5e v: v3
1 parent 276f1bd commit dbfda2e

File tree

5 files changed

+36
-38
lines changed

5 files changed

+36
-38
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 52a7c2b78ebd3ee8ee98f0550e78db5fd6702368
2+
refs/heads/master: 5703bd1760366422019e1b6d3f432e46bae4dd1b

trunk/src/comp/metadata/decoder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -194,27 +194,27 @@ fn get_symbol(session::session sess, ast::def_id def) -> str {
194194
ret item_symbol(lookup_item(def._1, data));
195195
}
196196

197-
fn get_tag_variants(ty::ctxt tcx, ast::def_id def) -> vec[ty::variant_info] {
197+
fn get_tag_variants(ty::ctxt tcx, ast::def_id def) -> ty::variant_info[] {
198198
auto external_crate_id = def._0;
199199
auto data = tcx.sess.get_external_crate(external_crate_id).data;
200200
auto items = ebml::get_doc(ebml::new_doc(data), tag_items);
201201
auto item = find_item(def._1, items);
202-
let vec[ty::variant_info] infos = [];
202+
let ty::variant_info[] infos = ~[];
203203
auto variant_ids = tag_variant_ids(item, external_crate_id);
204204
for (ast::def_id did in variant_ids) {
205205
auto item = find_item(did._1, items);
206206
auto ctor_ty = item_type(item, external_crate_id, tcx);
207-
let vec[ty::t] arg_tys = [];
207+
let ty::t[] arg_tys = ~[];
208208
alt (ty::struct(tcx, ctor_ty)) {
209209
case (ty::ty_fn(_, ?args, _, _, _)) {
210-
for (ty::arg a in args) { arg_tys += [a.ty]; }
210+
for (ty::arg a in args) { arg_tys += ~[a.ty]; }
211211
}
212212
case (_) {
213213
// Nullary tag variant.
214214

215215
}
216216
}
217-
infos += [rec(args=arg_tys, ctor_ty=ctor_ty, id=did)];
217+
infos += ~[rec(args=arg_tys, ctor_ty=ctor_ty, id=did)];
218218
}
219219
ret infos;
220220
}

trunk/src/comp/middle/trans.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ fn type_of_inner(&@crate_ctxt cx, &span sp, &ty::t t) -> TypeRef {
903903

904904
fn type_of_tag(&@crate_ctxt cx, &span sp, &ast::def_id did, &ty::t t)
905905
-> TypeRef {
906-
auto degen = vec::len(ty::tag_variants(cx.tcx, did)) == 1u;
906+
auto degen = std::ivec::len(ty::tag_variants(cx.tcx, did)) == 1u;
907907
if (ty::type_has_dynamic_size(cx.tcx, t)) {
908908
if (degen) { ret T_i8(); }
909909
else { ret T_opaque_tag(cx.tn); }
@@ -1351,7 +1351,7 @@ fn dynamic_size_of(&@block_ctxt cx, ty::t t) -> result {
13511351
for (ty::variant_info variant in variants) {
13521352
// Perform type substitution on the raw argument types.
13531353

1354-
let vec[ty::t] raw_tys = variant.args;
1354+
let ty::t[] raw_tys = variant.args;
13551355
let vec[ty::t] tys = [];
13561356
for (ty::t raw_ty in raw_tys) {
13571357
auto t =
@@ -1366,7 +1366,7 @@ fn dynamic_size_of(&@block_ctxt cx, ty::t t) -> result {
13661366
bcx.build.Store(umax(bcx, this_size, old_max_size), max_size);
13671367
}
13681368
auto max_size_val = bcx.build.Load(max_size);
1369-
auto total_size = if (vec::len(variants) != 1u) {
1369+
auto total_size = if (std::ivec::len(variants) != 1u) {
13701370
bcx.build.Add(max_size_val, llsize_of(T_int()))
13711371
} else { max_size_val };
13721372
ret rslt(bcx, total_size);
@@ -2655,7 +2655,7 @@ fn iter_structural_ty_full(&@block_ctxt cx, ValueRef av, ValueRef bv,
26552655
fn iter_variant(@block_ctxt cx, ValueRef a_tup, ValueRef b_tup,
26562656
&ty::variant_info variant, &ty::t[] tps,
26572657
&ast::def_id tid, &val_pair_and_ty_fn f) -> result {
2658-
if (vec::len[ty::t](variant.args) == 0u) {
2658+
if (std::ivec::len[ty::t](variant.args) == 0u) {
26592659
ret rslt(cx, C_nil());
26602660
}
26612661
auto fn_ty = variant.ctor_ty;
@@ -2664,12 +2664,10 @@ fn iter_structural_ty_full(&@block_ctxt cx, ValueRef av, ValueRef bv,
26642664
case (ty::ty_fn(_, ?args, _, _, _)) {
26652665
auto j = 0;
26662666
for (ty::arg a in args) {
2667-
auto rslt = GEP_tag(cx, a_tup, tid,
2668-
variant.id, tps, j);
2667+
auto rslt = GEP_tag(cx, a_tup, tid, variant.id, tps, j);
26692668
auto llfldp_a = rslt.val;
26702669
cx = rslt.bcx;
2671-
rslt = GEP_tag(cx, b_tup, tid,
2672-
variant.id, tps, j);
2670+
rslt = GEP_tag(cx, b_tup, tid, variant.id, tps, j);
26732671
auto llfldp_b = rslt.val;
26742672
cx = rslt.bcx;
26752673
auto ty_subst =
@@ -2730,7 +2728,7 @@ fn iter_structural_ty_full(&@block_ctxt cx, ValueRef av, ValueRef bv,
27302728
}
27312729
case (ty::ty_tag(?tid, ?tps)) {
27322730
auto variants = ty::tag_variants(cx.fcx.lcx.ccx.tcx, tid);
2733-
auto n_variants = vec::len(variants);
2731+
auto n_variants = std::ivec::len(variants);
27342732

27352733
// Cast the tags to types we can GEP into.
27362734
if (n_variants == 1u) {
@@ -4159,8 +4157,8 @@ fn autoderef_lval(&@block_ctxt cx, ValueRef v, &ty::t t, bool is_lval)
41594157
}
41604158
case (ty::ty_tag(?did, ?tps)) {
41614159
auto variants = ty::tag_variants(ccx.tcx, did);
4162-
if (vec::len(variants) != 1u ||
4163-
vec::len(variants.(0).args) != 1u) {
4160+
if (std::ivec::len(variants) != 1u ||
4161+
std::ivec::len(variants.(0).args) != 1u) {
41644162
break;
41654163
}
41664164
if (is_lval) { v1 = cx.build.Load(v1); }
@@ -4700,7 +4698,7 @@ fn trans_pat_match(&@block_ctxt cx, &@ast::pat pat, ValueRef llval,
47004698
auto matched_cx = new_sub_block_ctxt(cx, "matched_cx");
47014699
auto llblobptr = llval;
47024700

4703-
if (vec::len(variants) == 1u) {
4701+
if (std::ivec::len(variants) == 1u) {
47044702
cx.build.Br(matched_cx.llbb);
47054703
} else {
47064704
auto lltagptr =
@@ -4789,7 +4787,8 @@ fn trans_pat_binding(&@block_ctxt cx, &@ast::pat pat, ValueRef llval,
47894787
"trans_pat_binding: internal error, unbound var"); }
47904788
}
47914789
auto llblobptr = llval;
4792-
if (vec::len(ty::tag_variants(cx.fcx.lcx.ccx.tcx, vdef._0))!=1u) {
4790+
if (std::ivec::len(ty::tag_variants(cx.fcx.lcx.ccx.tcx, vdef._0))
4791+
!= 1u) {
47934792
auto lltagptr = cx.build.PointerCast
47944793
(llval, T_opaque_tag_ptr(cx.fcx.lcx.ccx.tn));
47954794
llblobptr = cx.build.GEP(lltagptr, [C_int(0), C_int(1)]);
@@ -4987,7 +4986,8 @@ fn trans_path(&@block_ctxt cx, &ast::path p, ast::node_id id) -> lval_result {
49874986
auto bcx = alloc_result.bcx;
49884987
auto lltagptr = bcx.build.PointerCast
49894988
(lltagblob, T_ptr(lltagty));
4990-
if (vec::len(ty::tag_variants(ccx.tcx, tid)) != 1u) {
4989+
if (std::ivec::len(ty::tag_variants(ccx.tcx, tid))
4990+
!= 1u) {
49914991
auto lldiscrim_gv =
49924992
lookup_discriminant(bcx.fcx.lcx, tid, vid);
49934993
auto lldiscrim = bcx.build.Load(lldiscrim_gv);

trunk/src/comp/middle/ty.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,8 @@ fn type_autoderef(&ctxt cx, &ty::t t) -> ty::t {
12881288
}
12891289
case (ty::ty_tag(?did, ?tps)) {
12901290
auto variants = tag_variants(cx, did);
1291-
if (vec::len(variants) != 1u ||
1292-
vec::len(variants.(0).args) != 1u) {
1291+
if (ivec::len(variants) != 1u ||
1292+
ivec::len(variants.(0).args) != 1u) {
12931293
break;
12941294
}
12951295
t1 = substitute_type_params(cx, tps, variants.(0).args.(0));
@@ -2812,12 +2812,10 @@ fn def_has_ty_params(&ast::def def) -> bool {
28122812

28132813

28142814
// Tag information
2815-
type variant_info = rec(vec[ty::t] args, ty::t ctor_ty, ast::def_id id);
2815+
type variant_info = rec(ty::t[] args, ty::t ctor_ty, ast::def_id id);
28162816

2817-
fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
2818-
if (ast::local_crate != id._0) {
2819-
ret decoder::get_tag_variants(cx, id);
2820-
}
2817+
fn tag_variants(&ctxt cx, &ast::def_id id) -> variant_info[] {
2818+
if (ast::local_crate != id._0) { ret decoder::get_tag_variants(cx, id); }
28212819
auto item = alt (cx.items.find(id._1)) {
28222820
case (some(?i)) { i }
28232821
case (none) {
@@ -2828,22 +2826,22 @@ fn tag_variants(&ctxt cx, &ast::def_id id) -> vec[variant_info] {
28282826
case (ast_map::node_item(?item)) {
28292827
alt (item.node) {
28302828
case (ast::item_tag(?variants, _)) {
2831-
let vec[variant_info] result = [];
2829+
let variant_info[] result = ~[];
28322830
for (ast::variant variant in variants) {
28332831
auto ctor_ty = node_id_to_monotype
28342832
(cx, variant.node.id);
2835-
let vec[t] arg_tys = [];
2833+
let t[] arg_tys = ~[];
28362834
if (vec::len[ast::variant_arg](variant.node.args) >
28372835
0u) {
28382836
for (arg a in ty_fn_args(cx, ctor_ty)) {
2839-
arg_tys += [a.ty];
2837+
arg_tys += ~[a.ty];
28402838
}
28412839
}
28422840
auto did = variant.node.id;
28432841
result +=
2844-
[rec(args=arg_tys,
2845-
ctor_ty=ctor_ty,
2846-
id=ast::local_def(did))];
2842+
~[rec(args=arg_tys,
2843+
ctor_ty=ctor_ty,
2844+
id=ast::local_def(did))];
28472845
}
28482846
ret result;
28492847
}
@@ -2858,7 +2856,7 @@ fn tag_variant_with_id(&ctxt cx, &ast::def_id tag_id, &ast::def_id variant_id)
28582856
-> variant_info {
28592857
auto variants = tag_variants(cx, tag_id);
28602858
auto i = 0u;
2861-
while (i < vec::len[variant_info](variants)) {
2859+
while (i < ivec::len[variant_info](variants)) {
28622860
auto variant = variants.(i);
28632861
if (def_eq(variant.id, variant_id)) { ret variant; }
28642862
i += 1u;

trunk/src/comp/middle/typeck.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,8 @@ fn do_autoderef(&@fn_ctxt fcx, &span sp, &ty::t t) -> ty::t {
874874
}
875875
case (ty::ty_tag(?did, ?tps)) {
876876
auto variants = ty::tag_variants(fcx.ccx.tcx, did);
877-
if (vec::len(variants) != 1u ||
878-
vec::len(variants.(0).args) != 1u) {
877+
if (ivec::len(variants) != 1u ||
878+
ivec::len(variants.(0).args) != 1u) {
879879
ret t1;
880880
}
881881
t1 = ty::substitute_type_params(fcx.ccx.tcx, tps,
@@ -1620,8 +1620,8 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
16201620
case (ty::ty_res(_, ?inner, _)) { oper_t = inner; }
16211621
case (ty::ty_tag(?id, ?tps)) {
16221622
auto variants = ty::tag_variants(fcx.ccx.tcx, id);
1623-
if (vec::len(variants) != 1u ||
1624-
vec::len(variants.(0).args) != 1u) {
1623+
if (ivec::len(variants) != 1u ||
1624+
ivec::len(variants.(0).args) != 1u) {
16251625
fcx.ccx.tcx.sess.span_fatal
16261626
(expr.span, "can only dereference tags " +
16271627
"with a single variant which has a " +

0 commit comments

Comments
 (0)