about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-06 16:33:44 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-09 09:44:51 -0700
commitedf88416426d82d0099fc888e443bf21feeb1f04 (patch)
treed29a3013428dfe5654ef3c2276c85622044a6667 /src
parent8ccb61609238063b2f1b0cd038974426cdf81bc8 (diff)
downloadrust-edf88416426d82d0099fc888e443bf21feeb1f04.tar.gz
rust-edf88416426d82d0099fc888e443bf21feeb1f04.zip
syntax: Convert statics to constants
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/abi.rs4
-rw-r--r--src/libsyntax/ast.rs10
-rw-r--r--src/libsyntax/codemap.rs4
-rw-r--r--src/libsyntax/parse/parser.rs8
-rw-r--r--src/libsyntax/parse/token.rs16
-rw-r--r--src/libsyntax/print/pprust.rs4
6 files changed, 23 insertions, 23 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 3a02d74edff..03325ad4706 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -48,9 +48,9 @@ pub enum Architecture {
 }
 
 #[allow(non_uppercase_statics)]
-static IntelBits: u32 = (1 << (X86 as uint)) | (1 << (X86_64 as uint));
+const IntelBits: u32 = (1 << (X86 as uint)) | (1 << (X86_64 as uint));
 #[allow(non_uppercase_statics)]
-static ArmBits: u32 = (1 << (Arm as uint));
+const ArmBits: u32 = (1 << (Arm as uint));
 
 pub struct AbiData {
     abi: Abi,
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index c47d6b0fc9d..274bb2e39e0 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -104,8 +104,8 @@ impl PartialEq for Ident {
 // this uint is a reference to a table stored in thread-local
 // storage.
 pub type SyntaxContext = u32;
-pub static EMPTY_CTXT : SyntaxContext = 0;
-pub static ILLEGAL_CTXT : SyntaxContext = 1;
+pub const EMPTY_CTXT : SyntaxContext = 0;
+pub const ILLEGAL_CTXT : SyntaxContext = 1;
 
 /// A name is a part of an identifier, representing a string or gensym. It's
 /// the result of interning.
@@ -198,13 +198,13 @@ pub struct DefId {
 
 /// Item definitions in the currently-compiled crate would have the CrateNum
 /// LOCAL_CRATE in their DefId.
-pub static LOCAL_CRATE: CrateNum = 0;
-pub static CRATE_NODE_ID: NodeId = 0;
+pub const LOCAL_CRATE: CrateNum = 0;
+pub const CRATE_NODE_ID: NodeId = 0;
 
 /// When parsing and doing expansions, we initially give all AST nodes this AST
 /// node value. Then later, in the renumber pass, we renumber them to have
 /// small, positive ids.
-pub static DUMMY_NODE_ID: NodeId = -1;
+pub const DUMMY_NODE_ID: NodeId = -1;
 
 /// The AST represents all type param bounds as types.
 /// typeck::collect::compute_bounds matches these against
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index dda41070431..5d96cc359c2 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -96,7 +96,7 @@ pub struct Span {
     pub expn_id: ExpnId
 }
 
-pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION };
+pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION };
 
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Spanned<T> {
@@ -227,7 +227,7 @@ pub struct ExpnInfo {
 #[deriving(PartialEq, Eq, Clone, Show, Hash, Encodable, Decodable)]
 pub struct ExpnId(u32);
 
-pub static NO_EXPANSION: ExpnId = ExpnId(-1);
+pub const NO_EXPANSION: ExpnId = ExpnId(-1);
 
 impl ExpnId {
     pub fn from_llvm_cookie(cookie: c_uint) -> ExpnId {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e73ffd7e581..e7f40cf0722 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -91,10 +91,10 @@ use std::iter;
 
 bitflags! {
     flags Restrictions: u8 {
-        static UNRESTRICTED                  = 0b0000,
-        static RESTRICTION_STMT_EXPR         = 0b0001,
-        static RESTRICTION_NO_BAR_OP         = 0b0010,
-        static RESTRICTION_NO_STRUCT_LITERAL = 0b0100
+        const UNRESTRICTED                  = 0b0000,
+        const RESTRICTION_STMT_EXPR         = 0b0001,
+        const RESTRICTION_NO_BAR_OP         = 0b0010,
+        const RESTRICTION_NO_STRUCT_LITERAL = 0b0100
     }
 }
 
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 7cc78891d91..fa6b0c5ad4a 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -385,13 +385,13 @@ macro_rules! declare_special_idents_and_keywords {(
         use ast::{Ident, Name};
         $(
             #[allow(non_uppercase_statics)]
-            pub static $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 };
+            pub const $si_static: Ident = Ident { name: Name($si_name), ctxt: 0 };
          )*
     }
 
     pub mod special_names {
         use ast::Name;
-        $( #[allow(non_uppercase_statics)] pub static $si_static: Name =  Name($si_name); )*
+        $( #[allow(non_uppercase_statics)] pub const $si_static: Name =  Name($si_name); )*
     }
 
     /**
@@ -432,13 +432,13 @@ macro_rules! declare_special_idents_and_keywords {(
 }}
 
 // If the special idents get renumbered, remember to modify these two as appropriate
-pub static SELF_KEYWORD_NAME: Name = Name(SELF_KEYWORD_NAME_NUM);
-static STATIC_KEYWORD_NAME: Name = Name(STATIC_KEYWORD_NAME_NUM);
-static SUPER_KEYWORD_NAME: Name = Name(SUPER_KEYWORD_NAME_NUM);
+pub const SELF_KEYWORD_NAME: Name = Name(SELF_KEYWORD_NAME_NUM);
+const STATIC_KEYWORD_NAME: Name = Name(STATIC_KEYWORD_NAME_NUM);
+const SUPER_KEYWORD_NAME: Name = Name(SUPER_KEYWORD_NAME_NUM);
 
-pub static SELF_KEYWORD_NAME_NUM: u32 = 1;
-static STATIC_KEYWORD_NAME_NUM: u32 = 2;
-static SUPER_KEYWORD_NAME_NUM: u32 = 3;
+pub const SELF_KEYWORD_NAME_NUM: u32 = 1;
+const STATIC_KEYWORD_NAME_NUM: u32 = 2;
+const SUPER_KEYWORD_NAME_NUM: u32 = 3;
 
 // NB: leaving holes in the ident table is bad! a different ident will get
 // interned with the id from the hole, but it will be between the min and max
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 321b00db47e..e1a2b2aeefe 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -90,10 +90,10 @@ pub fn rust_printer_annotated<'a>(writer: Box<io::Writer+'static>,
 }
 
 #[allow(non_uppercase_statics)]
-pub static indent_unit: uint = 4u;
+pub const indent_unit: uint = 4u;
 
 #[allow(non_uppercase_statics)]
-pub static default_columns: uint = 78u;
+pub const default_columns: uint = 78u;
 
 /// Requires you to pass an input filename and reader so that
 /// it can scan the input text for comments and literals to