about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-02 07:12:53 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-03-02 07:12:53 -0800
commit5515fd5c8cf65a8eebd43ddb0de6ff920a509ece (patch)
tree4e3d85a43f684fd9d3b2e80a6a9178f90e63d7ce /src/libsyntax
parentaa3505d8ff043f0c1da62de4f517eed6defb6187 (diff)
parent2304fe6208404ce952aaa37e7634db570ff71f6c (diff)
downloadrust-5515fd5c8cf65a8eebd43ddb0de6ff920a509ece.tar.gz
rust-5515fd5c8cf65a8eebd43ddb0de6ff920a509ece.zip
Merge remote-tracking branch 'remotes/origin/incoming' into incoming
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/fmt.rs4
-rw-r--r--src/libsyntax/parse/parser.rs16
-rw-r--r--src/libsyntax/print/pprust.rs30
3 files changed, 21 insertions, 29 deletions
diff --git a/src/libsyntax/ext/fmt.rs b/src/libsyntax/ext/fmt.rs
index 35b11962524..e06e43f6287 100644
--- a/src/libsyntax/ext/fmt.rs
+++ b/src/libsyntax/ext/fmt.rs
@@ -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 {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 127af5b73ac..4c48b49b5d6 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -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() {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index f08b042ad6a..282980f0faa 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -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, ~"}");
       }