Skip to content

Commit 5d46fa7

Browse files
committed
---
yaml --- r: 52316 b: refs/heads/dist-snap c: 4bcd19f h: refs/heads/master v: v3
1 parent 9426c66 commit 5d46fa7

File tree

14 files changed

+186
-131
lines changed

14 files changed

+186
-131
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 3ea3136e84659773fea9e6f89cb7ddf76cee2324
10+
refs/heads/dist-snap: 4bcd19f6be51d7fb26b0930c8a3354b9222143ff
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/front/config.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,19 @@ fn filter_stmt(cx: ctxt, &&stmt: @ast::stmt) ->
133133
}
134134
}
135135

136-
fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) ->
137-
ast::blk_ {
136+
fn fold_block(
137+
cx: ctxt,
138+
b: ast::blk_,
139+
fld: fold::ast_fold
140+
) -> ast::blk_ {
138141
let filtered_stmts = vec::filter_map(b.stmts, |a| filter_stmt(cx, *a));
139-
return {view_items: /*bad*/copy b.view_items,
140-
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
141-
expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
142-
id: b.id,
143-
rules: b.rules};
142+
ast::blk_ {
143+
view_items: /*bad*/copy b.view_items,
144+
stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)),
145+
expr: option::map(&b.expr, |x| fld.fold_expr(*x)),
146+
id: b.id,
147+
rules: b.rules,
148+
}
144149
}
145150

146151
fn item_in_cfg(cx: ctxt, item: @ast::item) -> bool {

branches/dist-snap/src/librustc/front/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ fn mk_test_wrapper(cx: test_ctxt,
469469
cf: ast::return_val
470470
};
471471

472-
let wrapper_body: ast::blk = nospan({
472+
let wrapper_body = nospan(ast::blk_ {
473473
view_items: ~[],
474474
stmts: ~[@call_stmt],
475475
expr: option::None,

branches/dist-snap/src/librustc/middle/astencode.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,10 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
267267
}
268268
};
269269
// XXX: Bad copy.
270-
let blk_sans_items = { stmts: stmts_sans_items,.. copy blk };
270+
let blk_sans_items = ast::blk_ {
271+
stmts: stmts_sans_items,
272+
.. copy blk
273+
};
271274
fold::noop_fold_block(blk_sans_items, fld)
272275
}
273276

branches/dist-snap/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ fn ctor_arity(cx: @MatchCheckCtxt, ctor: ctor, ty: ty::t) -> uint {
478478
}
479479

480480
fn wild() -> @pat {
481-
@{id: 0, node: pat_wild, span: ast_util::dummy_sp()}
481+
@pat {id: 0, node: pat_wild, span: ast_util::dummy_sp()}
482482
}
483483

484484
fn specialize(cx: @MatchCheckCtxt, r: ~[@pat], ctor_id: ctor, arity: uint,

branches/dist-snap/src/librustc/middle/trans/_match.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ fn enter_opt(bcx: block, m: &[@Match/&r], opt: &Opt, col: uint,
499499
let _indenter = indenter();
500500

501501
let tcx = bcx.tcx();
502-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
502+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
503503
do enter_match(bcx, tcx.def_map, m, col, val) |p| {
504504
match /*bad*/copy p.node {
505505
ast::pat_enum(_, subpats) => {
@@ -600,7 +600,7 @@ fn enter_rec_or_struct(bcx: block, dm: DefMap, m: &[@Match/&r], col: uint,
600600
bcx.val_str(val));
601601
let _indenter = indenter();
602602

603-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
603+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
604604
do enter_match(bcx, dm, m, col, val) |p| {
605605
match /*bad*/copy p.node {
606606
ast::pat_rec(fpats, _) | ast::pat_struct(_, fpats, _) => {
@@ -632,7 +632,7 @@ fn enter_tup(bcx: block, dm: DefMap, m: &[@Match/&r],
632632
bcx.val_str(val));
633633
let _indenter = indenter();
634634

635-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
635+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
636636
do enter_match(bcx, dm, m, col, val) |p| {
637637
match /*bad*/copy p.node {
638638
ast::pat_tup(elts) => {
@@ -657,7 +657,7 @@ fn enter_tuple_struct(bcx: block, dm: DefMap, m: &[@Match/&r], col: uint,
657657
bcx.val_str(val));
658658
let _indenter = indenter();
659659

660-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
660+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
661661
do enter_match(bcx, dm, m, col, val) |p| {
662662
match /*bad*/copy p.node {
663663
ast::pat_enum(_, Some(elts)) => Some(elts),
@@ -680,7 +680,7 @@ fn enter_box(bcx: block, dm: DefMap, m: &[@Match/&r],
680680
bcx.val_str(val));
681681
let _indenter = indenter();
682682

683-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
683+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
684684
do enter_match(bcx, dm, m, col, val) |p| {
685685
match p.node {
686686
ast::pat_box(sub) => {
@@ -705,7 +705,7 @@ fn enter_uniq(bcx: block, dm: DefMap, m: &[@Match/&r],
705705
bcx.val_str(val));
706706
let _indenter = indenter();
707707

708-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
708+
let dummy = @ast::pat {id: 0, node: ast::pat_wild, span: dummy_sp()};
709709
do enter_match(bcx, dm, m, col, val) |p| {
710710
match p.node {
711711
ast::pat_uniq(sub) => {
@@ -730,7 +730,7 @@ fn enter_region(bcx: block, dm: DefMap, m: &[@Match/&r],
730730
bcx.val_str(val));
731731
let _indenter = indenter();
732732

733-
let dummy = @{id: 0, node: ast::pat_wild, span: dummy_sp()};
733+
let dummy = @ast::pat { id: 0, node: ast::pat_wild, span: dummy_sp() };
734734
do enter_match(bcx, dm, m, col, val) |p| {
735735
match p.node {
736736
ast::pat_region(sub) => {

branches/dist-snap/src/libsyntax/ast.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,18 @@ struct blk_ {
323323

324324
#[auto_encode]
325325
#[auto_decode]
326-
type pat = {id: node_id, node: pat_, span: span};
326+
struct pat {
327+
id: node_id,
328+
node: pat_,
329+
span: span,
330+
}
327331

328332
#[auto_encode]
329333
#[auto_decode]
330-
type field_pat = {ident: ident, pat: @pat};
334+
struct field_pat {
335+
ident: ident,
336+
pat: @pat,
337+
}
331338

332339
#[auto_encode]
333340
#[auto_decode]
@@ -637,8 +644,13 @@ enum stmt_ {
637644
// a refinement on pat.
638645
#[auto_encode]
639646
#[auto_decode]
640-
type local_ = {is_mutbl: bool, ty: @Ty, pat: @pat,
641-
init: Option<@expr>, id: node_id};
647+
struct local_ {
648+
is_mutbl: bool,
649+
ty: @Ty,
650+
pat: @pat,
651+
init: Option<@expr>,
652+
id: node_id,
653+
}
642654

643655
type local = spanned<local_>;
644656

@@ -650,7 +662,11 @@ enum decl_ { decl_local(~[@local]), decl_item(@item), }
650662

651663
#[auto_encode]
652664
#[auto_decode]
653-
type arm = {pats: ~[@pat], guard: Option<@expr>, body: blk};
665+
struct arm {
666+
pats: ~[@pat],
667+
guard: Option<@expr>,
668+
body: blk,
669+
}
654670

655671
#[auto_encode]
656672
#[auto_decode]

branches/dist-snap/src/libsyntax/ast_util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,9 @@ fn ident_to_path(s: span, +i: ident) -> @path {
312312
}
313313

314314
fn ident_to_pat(id: node_id, s: span, +i: ident) -> @pat {
315-
@{id: id,
316-
node: pat_ident(bind_by_value, ident_to_path(s, i), None),
317-
span: s}
315+
@ast::pat { id: id,
316+
node: pat_ident(bind_by_value, ident_to_path(s, i), None),
317+
span: s }
318318
}
319319

320320
pure fn is_unguarded(a: &arm) -> bool {

branches/dist-snap/src/libsyntax/ext/auto_encode.rs

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,14 @@ priv impl ext_ctxt {
317317
}
318318

319319
fn binder_pat(span: span, nm: ast::ident) -> @ast::pat {
320-
@{id: self.next_id(),
321-
node: ast::pat_ident(ast::bind_by_ref(ast::m_imm),
322-
self.path(span, ~[nm]),
323-
None),
324-
span: span}
320+
@ast::pat {
321+
id: self.next_id(),
322+
node: ast::pat_ident(
323+
ast::bind_by_ref(ast::m_imm),
324+
self.path(span, ~[nm]),
325+
None),
326+
span: span,
327+
}
325328
}
326329

327330
fn stmt(expr: @ast::expr) -> @ast::stmt {
@@ -579,12 +582,14 @@ fn mk_ser_method(
579582
let ser_inputs = ~[{
580583
mode: ast::infer(cx.next_id()),
581584
ty: ty_s,
582-
pat: @{id: cx.next_id(),
583-
node: ast::pat_ident(
584-
ast::bind_by_value,
585-
ast_util::ident_to_path(span, cx.ident_of(~"__s")),
586-
None),
587-
span: span},
585+
pat: @ast::pat {
586+
id: cx.next_id(),
587+
node: ast::pat_ident(
588+
ast::bind_by_value,
589+
ast_util::ident_to_path(span, cx.ident_of(~"__s")),
590+
None),
591+
span: span,
592+
},
588593
id: cx.next_id(),
589594
}];
590595

@@ -640,12 +645,14 @@ fn mk_deser_method(
640645
let deser_inputs = ~[{
641646
mode: ast::infer(cx.next_id()),
642647
ty: ty_d,
643-
pat: @{id: cx.next_id(),
644-
node: ast::pat_ident(
645-
ast::bind_by_value,
646-
ast_util::ident_to_path(span, cx.ident_of(~"__d")),
647-
None),
648-
span: span},
648+
pat: @ast::pat {
649+
id: cx.next_id(),
650+
node: ast::pat_ident(
651+
ast::bind_by_value,
652+
ast_util::ident_to_path(span, cx.ident_of(~"__d")),
653+
None),
654+
span: span,
655+
},
649656
id: cx.next_id(),
650657
}];
651658

@@ -967,7 +974,7 @@ fn ser_variant(
967974
)
968975
};
969976

970-
let pat = @{
977+
let pat = @ast::pat {
971978
id: cx.next_id(),
972979
node: pat_node,
973980
span: span,
@@ -1020,7 +1027,7 @@ fn ser_variant(
10201027
]
10211028
);
10221029

1023-
{ pats: ~[pat], guard: None, body: cx.expr_blk(body) }
1030+
ast::arm { pats: ~[pat], guard: None, body: cx.expr_blk(body) }
10241031
}
10251032

10261033
fn mk_enum_ser_body(
@@ -1132,21 +1139,25 @@ fn mk_enum_deser_body(
11321139
fail ~"enum variants unimplemented",
11331140
};
11341141

1135-
let pat = @{
1142+
let pat = @ast::pat {
11361143
id: cx.next_id(),
11371144
node: ast::pat_lit(cx.lit_uint(span, v_idx)),
11381145
span: span,
11391146
};
11401147

1141-
{
1148+
ast::arm {
11421149
pats: ~[pat],
11431150
guard: None,
11441151
body: cx.expr_blk(body),
11451152
}
11461153
};
11471154

1148-
let impossible_case = {
1149-
pats: ~[@{ id: cx.next_id(), node: ast::pat_wild, span: span}],
1155+
let impossible_case = ast::arm {
1156+
pats: ~[@ast::pat {
1157+
id: cx.next_id(),
1158+
node: ast::pat_wild,
1159+
span: span,
1160+
}],
11501161
guard: None,
11511162

11521163
// FIXME(#3198): proper error message
@@ -1167,13 +1178,14 @@ fn mk_enum_deser_body(
11671178
node: ast::ty_infer,
11681179
span: span
11691180
},
1170-
pat: @{id: cx.next_id(),
1171-
node: ast::pat_ident(
1172-
ast::bind_by_value,
1173-
ast_util::ident_to_path(span,
1174-
cx.ident_of(~"i")),
1175-
None),
1176-
span: span},
1181+
pat: @ast::pat {
1182+
id: cx.next_id(),
1183+
node: ast::pat_ident(
1184+
ast::bind_by_value,
1185+
ast_util::ident_to_path(span, cx.ident_of(~"i")),
1186+
None),
1187+
span: span,
1188+
},
11771189
id: cx.next_id(),
11781190
}],
11791191
output: @{

branches/dist-snap/src/libsyntax/ext/build.rs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -181,18 +181,25 @@ fn mk_glob_use(cx: ext_ctxt, sp: span,
181181
fn mk_local(cx: ext_ctxt, sp: span, mutbl: bool,
182182
ident: ast::ident, ex: @ast::expr) -> @ast::stmt {
183183

184-
let pat : @ast::pat = @{id: cx.next_id(),
185-
node: ast::pat_ident(ast::bind_by_value,
186-
mk_raw_path(sp, ~[ident]),
187-
None),
188-
span: sp};
184+
let pat = @ast::pat {
185+
id: cx.next_id(),
186+
node: ast::pat_ident(
187+
ast::bind_by_value,
188+
mk_raw_path(sp, ~[ident]),
189+
None),
190+
span: sp,
191+
};
189192
let ty : @ast::Ty = @{ id: cx.next_id(), node: ast::ty_infer, span: sp };
190-
let local : @ast::local = @ast::spanned { node: { is_mutbl: mutbl,
191-
ty: ty,
192-
pat: pat,
193-
init: Some(ex),
194-
id: cx.next_id()},
195-
span: sp};
193+
let local = @ast::spanned {
194+
node: ast::local_ {
195+
is_mutbl: mutbl,
196+
ty: ty,
197+
pat: pat,
198+
init: Some(ex),
199+
id: cx.next_id(),
200+
},
201+
span: sp,
202+
};
196203
let decl = ast::spanned {node: ast::decl_local(~[local]), span: sp};
197204
@ast::spanned { node: ast::stmt_decl(@decl, cx.next_id()), span: sp }
198205
}
@@ -243,7 +250,7 @@ fn mk_managed(cx: ext_ctxt, sp: span, e: @ast::expr) -> @ast::expr {
243250
mk_expr(cx, sp, ast::expr_unary(ast::box(ast::m_imm), e))
244251
}
245252
fn mk_pat(cx: ext_ctxt, span: span, +pat: ast::pat_) -> @ast::pat {
246-
@{ id: cx.next_id(), node: move pat, span: span }
253+
@ast::pat { id: cx.next_id(), node: pat, span: span }
247254
}
248255
fn mk_pat_ident(cx: ext_ctxt, span: span, ident: ast::ident) -> @ast::pat {
249256
let path = mk_raw_path(span, ~[ ident ]);

0 commit comments

Comments
 (0)