Skip to content

Commit aad0bcc

Browse files
committed
rustc: Make AST tuple types use interior vectors
1 parent 401b636 commit aad0bcc

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

src/comp/middle/typeck.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,7 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
315315
typ = ty::mk_chan(tcx, ast_ty_to_ty(tcx, getter, t));
316316
}
317317
case (ast::ty_tup(?fields)) {
318-
let ty::mt[] flds = ~[];
319-
ivec::reserve(flds, vec::len(fields));
320-
for (ast::mt field in fields) {
321-
flds += ~[ast_mt_to_mt(tcx, getter, field)];
322-
}
318+
auto flds = ivec::map(bind ast_mt_to_mt(tcx, getter, _), fields);
323319
typ = ty::mk_tup(tcx, flds);
324320
}
325321
case (ast::ty_rec(?fields)) {

src/comp/syntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ tag ty_ {
401401
ty_task;
402402
ty_port(@ty);
403403
ty_chan(@ty);
404-
ty_tup(vec[mt]);
404+
ty_tup(mt[]);
405405
ty_rec(vec[ty_field]);
406406
ty_fn(proto, vec[ty_arg], @ty, controlflow, vec[@constr]);
407407
ty_obj(vec[ty_method]);

src/comp/syntax/parse/parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,8 @@ fn parse_ty(&parser p) -> @ast::ty {
520520
expect(p, token::RBRACKET);
521521
} else if (eat_word(p, "tup")) {
522522
auto elems =
523-
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA),
524-
parse_mt, p);
523+
parse_seq_ivec(token::LPAREN, token::RPAREN, some(token::COMMA),
524+
parse_mt, p);
525525
hi = elems.span.hi;
526526
t = ast::ty_tup(elems.node);
527527
} else if (eat_word(p, "rec")) {

src/comp/syntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ fn print_type(&ps s, &ast::ty ty) {
301301
case (ast::ty_tup(?elts)) {
302302
word(s.s, "tup");
303303
popen(s);
304-
commasep(s, inconsistent, elts, print_mt);
304+
commasep_ivec(s, inconsistent, elts, print_mt);
305305
pclose(s);
306306
}
307307
case (ast::ty_rec(?fields)) {

0 commit comments

Comments
 (0)