Merge remote-tracking branch 'remotes/origin/incoming' into incoming

This commit is contained in:
Erick Tryzelaar 2013-03-02 07:12:53 -08:00
commit 5515fd5c8c
58 changed files with 520 additions and 593 deletions

View file

@ -24,7 +24,7 @@ use ext::base::*;
use ext::base;
use ext::build;
use ext::build::*;
use private::extfmt::ct::*;
use unstable::extfmt::ct::*;
pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
-> base::MacResult {
@ -57,7 +57,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
-> @ast::expr {
fn make_path_vec(cx: ext_ctxt, ident: @~str) -> ~[ast::ident] {
let intr = cx.parse_sess().interner;
return ~[intr.intern(@~"private"), intr.intern(@~"extfmt"),
return ~[intr.intern(@~"unstable"), intr.intern(@~"extfmt"),
intr.intern(@~"rt"), intr.intern(ident)];
}
fn make_rt_path_expr(cx: ext_ctxt, sp: span, nm: @~str) -> @ast::expr {

View file

@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
@ -1130,15 +1130,10 @@ pub impl Parser {
self.mk_expr(lo, hi, expr_tup(es))
}
} else if *self.token == token::LBRACE {
if self.looking_at_record_literal() {
ex = self.parse_record_literal();
hi = self.span.hi;
} else {
self.bump();
let blk = self.parse_block_tail(lo, default_blk);
return self.mk_expr(blk.span.lo, blk.span.hi,
expr_block(blk));
}
self.bump();
let blk = self.parse_block_tail(lo, default_blk);
return self.mk_expr(blk.span.lo, blk.span.hi,
expr_block(blk));
} else if token::is_bar(&*self.token) {
return self.parse_lambda_expr();
} else if self.eat_keyword(&~"if") {
@ -1263,6 +1258,7 @@ pub impl Parser {
self.bump();
let mut fields = ~[];
let mut base = None;
fields.push(self.parse_field(token::COLON));
while *self.token != token::RBRACE {
if self.try_parse_obsolete_with() {

View file

@ -714,30 +714,26 @@ pub fn print_struct(s: @ps,
ident: ast::ident,
span: codemap::span) {
print_ident(s, ident);
nbsp(s);
print_generics(s, generics);
if ast_util::struct_def_is_tuple_like(struct_def) {
popen(s);
let mut first = true;
for struct_def.fields.each |field| {
if first {
first = false;
} else {
word_space(s, ~",");
}
match field.node.kind {
ast::named_field(*) => fail!(~"unexpected named field"),
ast::unnamed_field => {
maybe_print_comment(s, field.span.lo);
print_type(s, field.node.ty);
if !struct_def.fields.is_empty() {
popen(s);
do commasep(s, inconsistent, struct_def.fields) |s, field| {
match field.node.kind {
ast::named_field(*) => fail!(~"unexpected named field"),
ast::unnamed_field => {
maybe_print_comment(s, field.span.lo);
print_type(s, field.node.ty);
}
}
}
pclose(s);
}
pclose(s);
word(s.s, ~";");
end(s);
end(s); // close the outer-box
} else {
nbsp(s);
bopen(s);
hardbreak_if_not_bol(s);
do struct_def.dtor.iter |dtor| {
@ -1214,7 +1210,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
print_expr(s, expr);
end(s);
}
_ => word(s.s, ~",")
_ => (word(s.s, ~","))
}
word(s.s, ~"}");
}