Skip to content

Commit 3e79063

Browse files
committed
---
yaml --- r: 14802 b: refs/heads/try c: 59a56ad h: refs/heads/master v: v3
1 parent a30caa6 commit 3e79063

File tree

7 files changed

+35
-76
lines changed

7 files changed

+35
-76
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 96e1bbd4a0abd2c8e76e7e02b396c5319dea7a8d
5+
refs/heads/try: 59a56ad043d30d69f7c14dea1abeda2899fd1f28
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/front/test.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,11 @@ fn mk_test_desc_vec_ty(cx: test_ctxt) -> @ast::ty {
254254
types: []});
255255

256256
let test_desc_ty: ast::ty =
257-
{id: cx.sess.next_node_id(),
258-
node: ast::ty_path(test_desc_ty_path, cx.sess.next_node_id()),
259-
span: dummy_sp()};
257+
nospan(ast::ty_path(test_desc_ty_path, cx.sess.next_node_id()));
260258

261259
let vec_mt: ast::mt = {ty: @test_desc_ty, mutbl: ast::m_imm};
262260

263-
ret @{id: cx.sess.next_node_id(),
264-
node: ast::ty_vec(vec_mt),
265-
span: dummy_sp()};
261+
ret @nospan(ast::ty_vec(vec_mt));
266262
}
267263

268264
fn mk_test_desc_vec(cx: test_ctxt) -> @ast::expr {
@@ -350,7 +346,7 @@ fn mk_test_wrapper(cx: test_ctxt,
350346

351347
let wrapper_decl: ast::fn_decl = {
352348
inputs: [],
353-
output: @{id: cx.sess.next_node_id(), node: ast::ty_nil, span: span},
349+
output: @nospan(ast::ty_nil),
354350
purity: ast::impure_fn,
355351
cf: ast::return_val,
356352
constraints: []
@@ -381,23 +377,17 @@ fn mk_test_wrapper(cx: test_ctxt,
381377

382378
fn mk_main(cx: test_ctxt) -> @ast::item {
383379
let str_pt = @nospan({global: false, idents: ["str"], types: []});
384-
let str_ty = @{id: cx.sess.next_node_id(),
385-
node: ast::ty_path(str_pt, cx.sess.next_node_id()),
386-
span: dummy_sp()};
380+
let str_ty = @nospan(ast::ty_path(str_pt, cx.sess.next_node_id()));
387381
let args_mt: ast::mt = {ty: str_ty, mutbl: ast::m_imm};
388-
let args_ty: ast::ty = {id: cx.sess.next_node_id(),
389-
node: ast::ty_vec(args_mt),
390-
span: dummy_sp()};
382+
let args_ty: ast::ty = nospan(ast::ty_vec(args_mt));
391383

392384
let args_arg: ast::arg =
393385
{mode: ast::expl(ast::by_val),
394386
ty: @args_ty,
395387
ident: "args",
396388
id: cx.sess.next_node_id()};
397389

398-
let ret_ty = {id: cx.sess.next_node_id(),
399-
node: ast::ty_nil,
400-
span: dummy_sp()};
390+
let ret_ty = nospan(ast::ty_nil);
401391

402392
let decl: ast::fn_decl =
403393
{inputs: [args_arg],

branches/try/src/rustc/metadata/astencode_gen.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3463,15 +3463,12 @@ fn serialize_31<S: std::serialization::serializer>(s: S,
34633463
/*syntax::ast::ty*/
34643464
fn serialize_30<S: std::serialization::serializer>(s: S, v: syntax::ast::ty) {
34653465

3466-
s.emit_rec(/*syntax::ast::node_id*//*syntax::ast::ty_*/
3467-
/*syntax::codemap::span*/
3466+
s.emit_rec(/*syntax::ast::ty_*//*syntax::codemap::span*/
34683467
{||
34693468
{
3470-
s.emit_rec_field("id", 0u,
3471-
{|| serialize_27(s, v.id) });
3472-
s.emit_rec_field("node", 1u,
3469+
s.emit_rec_field("node", 0u,
34733470
{|| serialize_31(s, v.node) });
3474-
s.emit_rec_field("span", 2u,
3471+
s.emit_rec_field("span", 1u,
34753472
{|| serialize_19(s, v.span) })
34763473
}
34773474
});
@@ -7328,18 +7325,15 @@ fn deserialize_30<S: std::serialization::deserializer>(s: S) ->
73287325
s.read_rec(
73297326

73307327

7331-
/*syntax::ast::node_id*/
7332-
73337328
/*syntax::ast::ty_*/
73347329

73357330
/*syntax::codemap::span*/
73367331

73377332
{||
7338-
{id: s.read_rec_field("id", 0u, {|| deserialize_27(s) }),
7339-
node:
7340-
s.read_rec_field("node", 1u, {|| deserialize_31(s) }),
7333+
{node:
7334+
s.read_rec_field("node", 0u, {|| deserialize_31(s) }),
73417335
span:
7342-
s.read_rec_field("span", 2u,
7336+
s.read_rec_field("span", 1u,
73437337
{|| deserialize_19(s) }),}
73447338
})
73457339

branches/try/src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4419,8 +4419,7 @@ fn trans_item(ccx: crate_ctxt, item: ast::item) {
44194419
node: ast::pat_ident(rslt_path, none),
44204420
span: ctor.node.body.span};
44214421
// Set up obj's type
4422-
let rslt_ast_ty : @ast::ty = @{id: ccx.sess.next_node_id(),
4423-
node: ast::ty_infer,
4422+
let rslt_ast_ty : @ast::ty = @{node: ast::ty_infer,
44244423
span: ctor.node.body.span};
44254424
// kludgy
44264425
let ty_args = [], i = 0u;

branches/try/src/rustc/syntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ enum uint_ty { ty_u, ty_u8, ty_u16, ty_u32, ty_u64, }
334334

335335
enum float_ty { ty_f, ty_f32, ty_f64, }
336336

337-
type ty = {id: node_id, node: ty_, span: span};
337+
type ty = spanned<ty_>;
338338

339339
// Not represented directly in the AST, referred to by name through a ty_path.
340340
enum prim_ty {

branches/try/src/rustc/syntax/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ fn make_fold(afp: ast_fold_precursor) -> ast_fold {
699699
}
700700
fn f_ty(afp: ast_fold_precursor, f: ast_fold, &&x: @ty) -> @ty {
701701
let (n, s) = afp.fold_ty(x.node, x.span, f);
702-
ret @{id: x.id, node: n, span: afp.new_span(s)};
702+
ret @{node: n, span: afp.new_span(s)};
703703
}
704704
fn f_constr(afp: ast_fold_precursor, f: ast_fold, &&x: @ast::constr) ->
705705
@ast::constr {

branches/try/src/rustc/syntax/parse/parser.rs

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -385,24 +385,19 @@ fn parse_ty_postfix(orig_t: ast::ty_, p: parser, colons_before_params: bool,
385385
expect(p, token::LT);
386386
} else if !colons_before_params && p.token == token::LT {
387387
p.bump();
388-
} else {
389-
ret @{id: p.get_id(),
390-
node: orig_t,
391-
span: ast_util::mk_sp(lo, p.last_span.hi)};
392-
}
388+
} else { ret @spanned(lo, p.last_span.hi, orig_t); }
393389

394390
// If we're here, we have explicit type parameter instantiation.
395391
let seq = parse_seq_to_gt(some(token::COMMA), {|p| parse_ty(p, false)},
396392
p);
397393

398394
alt orig_t {
399395
ast::ty_path(pth, ann) {
400-
ret @{id: p.get_id(),
401-
node: ast::ty_path(@spanned(lo, p.last_span.hi,
402-
{global: pth.node.global,
403-
idents: pth.node.idents,
404-
types: seq}), ann),
405-
span: ast_util::mk_sp(lo, p.last_span.hi)};
396+
ret @spanned(lo, p.last_span.hi,
397+
ast::ty_path(@spanned(lo, p.last_span.hi,
398+
{global: pth.node.global,
399+
idents: pth.node.idents,
400+
types: seq}), ann));
406401
}
407402
_ { p.fatal("type parameter instantiation only allowed for paths"); }
408403
}
@@ -412,17 +407,11 @@ fn parse_ret_ty(p: parser) -> (ast::ret_style, @ast::ty) {
412407
ret if eat(p, token::RARROW) {
413408
let lo = p.span.lo;
414409
if eat(p, token::NOT) {
415-
(ast::noreturn, @{id: p.get_id(),
416-
node: ast::ty_bot,
417-
span: ast_util::mk_sp(lo, p.last_span.hi)})
418-
} else {
419-
(ast::return_val, parse_ty(p, false))
420-
}
410+
(ast::noreturn, @spanned(lo, p.last_span.hi, ast::ty_bot))
411+
} else { (ast::return_val, parse_ty(p, false)) }
421412
} else {
422413
let pos = p.span.lo;
423-
(ast::return_val, @{id: p.get_id(),
424-
node: ast::ty_nil,
425-
span: ast_util::mk_sp(pos, pos)})
414+
(ast::return_val, @spanned(pos, pos, ast::ty_nil))
426415
}
427416
}
428417

@@ -446,11 +435,8 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
446435
let lo = p.span.lo;
447436

448437
alt have_dollar(p) {
449-
some(e) {
450-
ret @{id: p.get_id(),
451-
node: ast::ty_mac(spanned(lo, p.span.hi, e)),
452-
span: ast_util::mk_sp(lo, p.span.hi)};
453-
}
438+
some(e) {ret @spanned(lo, p.span.hi,
439+
ast::ty_mac(spanned(lo, p.span.hi, e)))}
454440
none {}
455441
}
456442

@@ -489,10 +475,7 @@ fn parse_ty(p: parser, colons_before_params: bool) -> @ast::ty {
489475
let t = ast::ty_rec(elems.node);
490476
if p.token == token::COLON {
491477
p.bump();
492-
ast::ty_constr(@{id: p.get_id(),
493-
node: t,
494-
span: ast_util::mk_sp(lo, hi)},
495-
parse_type_constraints(p))
478+
ast::ty_constr(@spanned(lo, hi, t), parse_type_constraints(p))
496479
} else { t }
497480
} else if p.token == token::LBRACKET {
498481
expect(p, token::LBRACKET);
@@ -551,9 +534,7 @@ fn parse_fn_block_arg(p: parser) -> ast::arg {
551534
let t = if eat(p, token::COLON) {
552535
parse_ty(p, false)
553536
} else {
554-
@{id: p.get_id(),
555-
node: ast::ty_infer,
556-
span: ast_util::mk_sp(p.span.lo, p.span.hi)}
537+
@spanned(p.span.lo, p.span.hi, ast::ty_infer)
557538
};
558539
ret {mode: m, ty: t, ident: i, id: p.get_id()};
559540
}
@@ -1625,9 +1606,7 @@ fn parse_local(p: parser, is_mutbl: bool,
16251606
allow_init: bool) -> @ast::local {
16261607
let lo = p.span.lo;
16271608
let pat = parse_pat(p);
1628-
let ty = @{id: p.get_id(),
1629-
node: ast::ty_infer,
1630-
span: ast_util::mk_sp(lo, lo)};
1609+
let ty = @spanned(lo, lo, ast::ty_infer);
16311610
if eat(p, token::COLON) { ty = parse_ty(p, false); }
16321611
let init = if allow_init { parse_initializer(p) } else { none };
16331612
ret @spanned(lo, p.last_span.hi,
@@ -1903,7 +1882,7 @@ fn parse_fn_block_decl(p: parser) -> ast::fn_decl {
19031882
let output = if eat(p, token::RARROW) {
19041883
parse_ty(p, false)
19051884
} else {
1906-
@{id: p.get_id(), node: ast::ty_infer, span: p.span}
1885+
@spanned(p.span.lo, p.span.hi, ast::ty_infer)
19071886
};
19081887
ret {inputs: inputs,
19091888
output: output,
@@ -1978,7 +1957,7 @@ fn parse_item_iface(p: parser, attrs: [ast::attribute]) -> @ast::item {
19781957
fn parse_item_impl(p: parser, attrs: [ast::attribute]) -> @ast::item {
19791958
let lo = p.last_span.lo;
19801959
fn wrap_path(p: parser, pt: @ast::path) -> @ast::ty {
1981-
@{id: p.get_id(), node: ast::ty_path(pt, p.get_id()), span: pt.span}
1960+
@{node: ast::ty_path(pt, p.get_id()), span: pt.span}
19821961
}
19831962
let (ident, tps) = if !is_word(p, "of") {
19841963
if p.token == token::LT { (none, parse_ty_params(p)) }
@@ -2017,9 +1996,7 @@ fn parse_item_res(p: parser, attrs: [ast::attribute]) -> @ast::item {
20171996
{inputs:
20181997
[{mode: ast::expl(ast::by_ref), ty: t,
20191998
ident: arg_ident, id: p.get_id()}],
2020-
output: @{id: p.get_id(),
2021-
node: ast::ty_nil,
2022-
span: ast_util::mk_sp(lo, lo)},
1999+
output: @spanned(lo, lo, ast::ty_nil),
20232000
purity: ast::impure_fn,
20242001
cf: ast::return_val,
20252002
constraints: []};
@@ -2089,9 +2066,8 @@ enum class_contents { ctor_decl(ast::fn_decl, ast::blk, codemap::span),
20892066
// Can ctors have attrs?
20902067
// result type is always the type of the class
20912068
let decl_ = parse_fn_decl(p, ast::impure_fn);
2092-
let decl = {output: @{id: p.get_id(),
2093-
node: ast::ty_path(class_name, p.get_id()),
2094-
span: decl_.output.span}
2069+
let decl = {output: @{node: ast::ty_path(class_name, p.get_id()),
2070+
span: decl_.output.span}
20952071
with decl_};
20962072
let body = parse_block(p);
20972073
ret ctor_decl(decl, body, ast_util::mk_sp(lo, p.last_span.hi));

0 commit comments

Comments
 (0)