Skip to content

Commit ac6f445

Browse files
committed
---
yaml --- r: 3609 b: refs/heads/master c: 8bee69d h: refs/heads/master i: 3607: 392b25a v: v3
1 parent f05cd6b commit ac6f445

File tree

7 files changed

+48
-43
lines changed

7 files changed

+48
-43
lines changed

[refs]

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

trunk/src/comp/metadata/tydecode.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ fn parse_ty_or_bang(@pstate st, str_def sd) -> ty_or_bang {
6565
}
6666
}
6767

68-
fn parse_constrs(@pstate st, str_def sd) -> vec[@ty::constr_def] {
69-
let vec[@ty::constr_def] rslt = [];
68+
fn parse_constrs(@pstate st, str_def sd) -> (@ty::constr_def)[] {
69+
let (@ty::constr_def)[] rslt = ~[];
7070
alt (peek(st) as char) {
7171
case (':') {
7272
do {
7373
next(st);
74-
vec::push(rslt, parse_constr(st, sd));
74+
rslt += ~[parse_constr(st, sd)];
7575
} while (peek(st) as char == ';')
7676
}
7777
case (_) { }
@@ -333,7 +333,7 @@ fn parse_hex(@pstate st) -> uint {
333333
}
334334

335335
fn parse_ty_fn(@pstate st, str_def sd) ->
336-
tup(ty::arg[], ty::t, ast::controlflow, vec[@ty::constr_def]) {
336+
tup(ty::arg[], ty::t, ast::controlflow, (@ty::constr_def)[]) {
337337
assert (next(st) as char == '[');
338338
let ty::arg[] inputs = ~[];
339339
while (peek(st) as char != ']') {

trunk/src/comp/metadata/tyencode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ fn enc_sty(&io::writer w, &@ctxt cx, &ty::sty st) {
162162
case (native_abi_cdecl) { w.write_char('c'); }
163163
case (native_abi_llvm) { w.write_char('l'); }
164164
}
165-
enc_ty_fn(w, cx, args, out, return, []);
165+
enc_ty_fn(w, cx, args, out, return, ~[]);
166166
}
167167
case (ty::ty_obj(?methods)) {
168168
w.write_str("O[");
@@ -205,7 +205,7 @@ fn enc_proto(&io::writer w, proto proto) {
205205
}
206206
}
207207
fn enc_ty_fn(&io::writer w, &@ctxt cx, &ty::arg[] args, &ty::t out,
208-
&controlflow cf, &vec[@ty::constr_def] constrs) {
208+
&controlflow cf, &(@ty::constr_def)[] constrs) {
209209
w.write_char('[');
210210
for (ty::arg arg in args) {
211211
alt (arg.mode) {

trunk/src/comp/middle/tstate/auxiliary.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ fn controlflow_expr(&crate_ctxt ccx, @expr e) -> controlflow {
453453
}
454454
}
455455

456-
fn constraints_expr(&ty::ctxt cx, @expr e) -> vec[@ty::constr_def] {
456+
fn constraints_expr(&ty::ctxt cx, @expr e) -> (@ty::constr_def)[] {
457457
alt (ty::struct(cx, ty::node_id_to_type(cx, e.id))) {
458458
case (ty::ty_fn(_, _, _, _, ?cs)) { ret cs; }
459-
case (_) { ret []; }
459+
case (_) { ret ~[]; }
460460
}
461461
}
462462

trunk/src/comp/middle/ty.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ type method =
196196
arg[] inputs,
197197
t output,
198198
controlflow cf,
199-
vec[@constr_def] constrs);
199+
(@constr_def)[] constrs);
200200

201201
type constr_table = hashmap[ast::node_id, vec[constr_def]];
202202

@@ -267,9 +267,9 @@ tag sty {
267267
ty_task;
268268
ty_tup(mt[]);
269269
ty_rec(field[]);
270-
ty_fn(ast::proto, arg[], t, controlflow, vec[@constr_def]);
270+
ty_fn(ast::proto, arg[], t, controlflow, (@constr_def)[]);
271271
ty_native_fn(ast::native_abi, arg[], t);
272-
ty_obj(method[]);
272+
ty_obj(vec[method]);
273273
ty_res(def_id, t, t[]);
274274
ty_var(int); // type variable
275275
ty_param(uint); // fn/tag type param
@@ -596,7 +596,7 @@ fn mk_imm_tup(&ctxt cx, &t[] tys) -> t {
596596
fn mk_rec(&ctxt cx, &field[] fs) -> t { ret gen_ty(cx, ty_rec(fs)); }
597597

598598
fn mk_fn(&ctxt cx, &ast::proto proto, &arg[] args, &t ty, &controlflow cf,
599-
&vec[@constr_def] constrs) -> t {
599+
&(@constr_def)[] constrs) -> t {
600600
ret gen_ty(cx, ty_fn(proto, args, ty, cf, constrs));
601601
}
602602

@@ -1454,8 +1454,8 @@ fn constr_eq(&@constr_def c, &@constr_def d) -> bool {
14541454
args_eq(eq_int, c.node.args, d.node.args);
14551455
}
14561456

1457-
fn constrs_eq(&vec[@constr_def] cs, &vec[@constr_def] ds) -> bool {
1458-
if (vec::len(cs) != vec::len(ds)) { ret false; }
1457+
fn constrs_eq(&(@constr_def)[] cs, &(@constr_def)[] ds) -> bool {
1458+
if (ivec::len(cs) != ivec::len(ds)) { ret false; }
14591459
auto i = 0u;
14601460
for (@constr_def c in cs) {
14611461
if (!constr_eq(c, ds.(i))) { ret false; }
@@ -2139,8 +2139,8 @@ mod unify {
21392139
&t expected, &t actual, &arg[] expected_inputs,
21402140
&t expected_output, &arg[] actual_inputs, &t actual_output,
21412141
&controlflow expected_cf, &controlflow actual_cf,
2142-
&vec[@constr_def] expected_constrs,
2143-
&vec[@constr_def] actual_constrs) -> result {
2142+
&(@constr_def)[] expected_constrs,
2143+
&(@constr_def)[] actual_constrs) -> result {
21442144
if (e_proto != a_proto) { ret ures_err(terr_mismatch); }
21452145
alt (expected_cf) {
21462146
case (ast::return) { }

trunk/src/comp/middle/typeck.rs

+28-23
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,10 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
335335
}
336336
auto out_ty = ast_ty_to_ty(tcx, getter, output);
337337

338-
let fn(&@ast::constr) -> @ty::constr_def g =
339-
bind ast_constr_to_constr(tcx, _);
340-
let vec[@ty::constr_def] out_constrs = vec::map(g, constrs);
338+
auto out_constrs = ~[];
339+
for (@ast::constr constr in constrs) {
340+
out_constrs += ~[ast_constr_to_constr(tcx, constr)];
341+
}
341342
typ = ty::mk_fn(tcx, proto, i, out_ty, cf, out_constrs);
342343
}
343344
case (ast::ty_path(?path, ?id)) {
@@ -371,10 +372,10 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
371372
}
372373
auto out = ast_ty_to_ty(tcx, getter, m.node.output);
373374

374-
let fn(&@ast::constr) -> @ty::constr_def g =
375-
bind ast_constr_to_constr(tcx, _);
376-
let vec[@ty::constr_def] out_constrs =
377-
vec::map(g, m.node.constrs);
375+
auto out_constrs = ~[];
376+
for (@ast::constr constr in m.node.constrs) {
377+
out_constrs += ~[ast_constr_to_constr(tcx, constr)];
378+
}
378379
let ty::method new_m =
379380
rec(proto=m.node.proto,
380381
ident=m.node.ident,
@@ -490,9 +491,10 @@ mod collect {
490491
for (ast::arg a in decl.inputs) { input_tys += ~[ty_of_arg(a)]; }
491492
auto output_ty = convert(decl.output);
492493

493-
let fn(&@ast::constr) -> @ty::constr_def g =
494-
bind ast_constr_to_constr(cx.tcx, _);
495-
let vec[@ty::constr_def] out_constrs = vec::map(g, decl.constraints);
494+
auto out_constrs = ~[];
495+
for (@ast::constr constr in decl.constraints) {
496+
out_constrs += ~[ast_constr_to_constr(cx.tcx, constr)];
497+
}
496498
auto t_fn =
497499
ty::mk_fn(cx.tcx, proto, input_tys, output_ty, decl.cf,
498500
out_constrs);
@@ -568,10 +570,11 @@ mod collect {
568570
}
569571

570572
auto output = convert(m.node.meth.decl.output);
571-
let fn(&@ast::constr) -> @ty::constr_def g =
572-
bind ast_constr_to_constr(cx.tcx, _);
573-
let vec[@ty::constr_def] out_constrs =
574-
vec::map(g, m.node.meth.decl.constraints);
573+
574+
auto out_constrs = ~[];
575+
for (@ast::constr constr in m.node.meth.decl.constraints) {
576+
out_constrs += ~[ast_constr_to_constr(cx.tcx, constr)];
577+
}
575578
ret rec(proto=m.node.meth.proto, ident=m.node.ident,
576579
inputs=inputs, output=output, cf=m.node.meth.decl.cf,
577580
constrs=out_constrs);
@@ -596,7 +599,7 @@ mod collect {
596599
}
597600

598601
auto t_fn = ty::mk_fn(cx.tcx, ast::proto_fn, t_inputs, t_obj._1,
599-
ast::return, []);
602+
ast::return, ~[]);
600603
auto tpt = tup(t_obj._0, t_fn);
601604
cx.tcx.tcache.insert(local_def(ctor_id), tpt);
602605
ret tpt;
@@ -707,7 +710,7 @@ mod collect {
707710
auto tag_t = ty::mk_tag(cx.tcx, tag_id, ty_param_tys);
708711
// FIXME: this will be different for constrained types
709712
result_ty = ty::mk_fn(cx.tcx, ast::proto_fn, args, tag_t,
710-
ast::return, []);
713+
ast::return, ~[]);
711714
}
712715
auto tpt = tup(ty_param_count, result_ty);
713716
cx.tcx.tcache.insert(local_def(variant.node.id), tpt);
@@ -778,7 +781,7 @@ mod collect {
778781
case (none) {/* nothing to do */ }
779782
case (some(?m)) {
780783
auto t = ty::mk_fn(cx.tcx, ast::proto_fn, ~[],
781-
ty::mk_nil(cx.tcx), ast::return, []);
784+
ty::mk_nil(cx.tcx), ast::return, ~[]);
782785
write::ty_only(cx.tcx, m.node.id, t);
783786
}
784787
}
@@ -788,9 +791,9 @@ mod collect {
788791
auto t_res = ty::mk_res(cx.tcx, local_def(it.id), t_arg.ty,
789792
mk_ty_params(cx, vec::len(tps)));
790793
auto t_ctor = ty::mk_fn(cx.tcx, ast::proto_fn, ~[t_arg],
791-
t_res, ast::return, []);
794+
t_res, ast::return, ~[]);
792795
auto t_dtor = ty::mk_fn(cx.tcx, ast::proto_fn, ~[t_arg],
793-
ty::mk_nil(cx.tcx), ast::return, []);
796+
ty::mk_nil(cx.tcx), ast::return, ~[]);
794797
write::ty_only(cx.tcx, it.id, t_res);
795798
write::ty_only(cx.tcx, ctor_id, t_ctor);
796799
cx.tcx.tcache.insert(local_def(ctor_id),
@@ -2254,10 +2257,12 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) {
22542257
}
22552258

22562259
auto output = convert(m.node.meth.decl.output);
2257-
let fn(&@ast::constr) -> @ty::constr_def g =
2258-
bind ast_constr_to_constr(ccx.tcx, _);
2259-
let vec[@ty::constr_def] out_constrs =
2260-
vec::map(g, m.node.meth.decl.constraints);
2260+
2261+
auto out_constrs = ~[];
2262+
for (@ast::constr constr in m.node.meth.decl.constraints) {
2263+
out_constrs += ~[ast_constr_to_constr(ccx.tcx, constr)];
2264+
}
2265+
22612266
ret rec(proto=m.node.meth.proto, ident=m.node.ident,
22622267
inputs=inputs, output=output, cf=m.node.meth.decl.cf,
22632268
constrs=out_constrs);

trunk/src/comp/util/ppaux.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
4747
}
4848
fn fn_to_str(&ctxt cx, ast::proto proto, option::t[ast::ident] ident,
4949
&arg[] inputs, t output, ast::controlflow cf,
50-
&vec[@constr_def] constrs) -> str {
50+
&(@constr_def)[] constrs) -> str {
5151
auto s;
5252
alt (proto) {
5353
case (ast::proto_iter) { s = "iter"; }
@@ -130,7 +130,7 @@ fn ty_to_str(&ctxt cx, &t typ) -> str {
130130
}
131131
case (ty_native_fn(_, ?inputs, ?output)) {
132132
s += fn_to_str(cx, ast::proto_fn, none, inputs, output,
133-
ast::return, []);
133+
ast::return, ~[]);
134134
}
135135
case (ty_obj(?meths)) {
136136
auto f = bind method_to_str(cx, _);
@@ -162,7 +162,7 @@ fn constr_to_str(&@constr_def c) -> str {
162162
pprust::constr_args_to_str(pprust::uint_to_str, c.node.args);
163163
}
164164

165-
fn constrs_str(&vec[@constr_def] constrs) -> str {
165+
fn constrs_str(&(@constr_def)[] constrs) -> str {
166166
auto s = "";
167167
auto colon = true;
168168
for (@constr_def c in constrs) {

0 commit comments

Comments
 (0)