about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-10-03 18:47:13 +0000
committerbors <bors@rust-lang.org>2014-10-03 18:47:13 +0000
commitae81c89f34f1ac2cdb596cf216612e94822a8466 (patch)
tree5a3cd9b50266167ad0abdc56567dcdfdf882b4b2 /src/libsyntax
parent9a2286d3a13c4a97340c99c86c718654f6cb2ed6 (diff)
parent39f4bf7b1c9991cfd02f68d45ca59d6c525c4184 (diff)
downloadrust-ae81c89f34f1ac2cdb596cf216612e94822a8466.tar.gz
rust-ae81c89f34f1ac2cdb596cf216612e94822a8466.zip
auto merge of #17742 : alexcrichton/rust/rollup, r=alexcrichton
Trying to get a couple of these into the next snapshot.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/abi.rs3
-rw-r--r--src/libsyntax/ast_util.rs1
-rw-r--r--src/libsyntax/parse/parser.rs31
-rw-r--r--src/libsyntax/parse/token.rs7
-rw-r--r--src/libsyntax/print/pprust.rs2
5 files changed, 36 insertions, 8 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 6d9b8821bd8..3a02d74edff 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -47,7 +47,9 @@ pub enum Architecture {
     Mipsel
 }
 
+#[allow(non_uppercase_statics)]
 static IntelBits: u32 = (1 << (X86 as uint)) | (1 << (X86_64 as uint));
+#[allow(non_uppercase_statics)]
 static ArmBits: u32 = (1 << (Arm as uint));
 
 pub struct AbiData {
@@ -70,6 +72,7 @@ pub enum AbiArchitecture {
     Archs(u32)
 }
 
+#[allow(non_uppercase_statics)]
 static AbiDatas: &'static [AbiData] = &[
     // Platform-specific ABIs
     AbiData {abi: Cdecl, name: "cdecl", abi_arch: Archs(IntelBits)},
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 31860062580..f746e1f1482 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -293,6 +293,7 @@ pub fn operator_prec(op: ast::BinOp) -> uint {
 
 /// Precedence of the `as` operator, which is a binary operator
 /// not appearing in the prior table.
+#[allow(non_uppercase_statics)]
 pub static as_prec: uint = 12u;
 
 pub fn empty_generics() -> Generics {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7cce9c2dc3a..4c877c0b101 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3402,9 +3402,10 @@ impl<'a> Parser<'a> {
                        binding_mode: ast::BindingMode)
                        -> ast::Pat_ {
         if !is_plain_ident(&self.token) {
-            let last_span = self.last_span;
-            self.span_fatal(last_span,
-                            "expected identifier, found path");
+            let span = self.span;
+            let tok_str = self.this_token_to_string();
+            self.span_fatal(span,
+                            format!("expected identifier, found `{}`", tok_str).as_slice());
         }
         let ident = self.parse_ident();
         let last_span = self.last_span;
@@ -4731,8 +4732,7 @@ impl<'a> Parser<'a> {
         }
     }
 
-    fn parse_item_const(&mut self) -> ItemInfo {
-        let m = if self.eat_keyword(keywords::Mut) {MutMutable} else {MutImmutable};
+    fn parse_item_const(&mut self, m: Mutability) -> ItemInfo {
         let id = self.parse_ident();
         self.expect(&token::COLON);
         let ty = self.parse_ty(true);
@@ -5288,7 +5288,26 @@ impl<'a> Parser<'a> {
         if self.is_keyword(keywords::Static) {
             // STATIC ITEM
             self.bump();
-            let (ident, item_, extra_attrs) = self.parse_item_const();
+            let m = if self.eat_keyword(keywords::Mut) {MutMutable} else {MutImmutable};
+            let (ident, item_, extra_attrs) = self.parse_item_const(m);
+            let last_span = self.last_span;
+            let item = self.mk_item(lo,
+                                    last_span.hi,
+                                    ident,
+                                    item_,
+                                    visibility,
+                                    maybe_append(attrs, extra_attrs));
+            return IoviItem(item);
+        }
+        if self.is_keyword(keywords::Const) {
+            // CONST ITEM
+            self.bump();
+            if self.eat_keyword(keywords::Mut) {
+                let last_span = self.last_span;
+                self.span_err(last_span, "const globals cannot be mutable, \
+                                          did you mean to declare a static?");
+            }
+            let (ident, item_, extra_attrs) = self.parse_item_const(MutImmutable);
             let last_span = self.last_span;
             let item = self.mk_item(lo,
                                     last_span.hi,
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index a486ac40a97..a8c827439cc 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -383,12 +383,15 @@ macro_rules! declare_special_idents_and_keywords {(
 
     pub mod special_idents {
         use ast::{Ident, Name};
-        $( pub static $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 }; )*
+        $(
+            #[allow(non_uppercase_statics)]
+            pub static $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 };
+         )*
     }
 
     pub mod special_names {
         use ast::Name;
-        $( pub static $si_static: Name =  Name($si_name); )*
+        $( #[allow(non_uppercase_statics)] pub static $si_static: Name =  Name($si_name); )*
     }
 
     /**
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 8400d9aea3b..c3a3848019a 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -89,8 +89,10 @@ pub fn rust_printer_annotated<'a>(writer: Box<io::Writer+'static>,
     }
 }
 
+#[allow(non_uppercase_statics)]
 pub static indent_unit: uint = 4u;
 
+#[allow(non_uppercase_statics)]
 pub static default_columns: uint = 78u;
 
 /// Requires you to pass an input filename and reader so that