diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-06 16:33:44 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-09 09:44:51 -0700 |
| commit | edf88416426d82d0099fc888e443bf21feeb1f04 (patch) | |
| tree | d29a3013428dfe5654ef3c2276c85622044a6667 /src/libsyntax/parse | |
| parent | 8ccb61609238063b2f1b0cd038974426cdf81bc8 (diff) | |
| download | rust-edf88416426d82d0099fc888e443bf21feeb1f04.tar.gz rust-edf88416426d82d0099fc888e443bf21feeb1f04.zip | |
syntax: Convert statics to constants
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 16 |
2 files changed, 12 insertions, 12 deletions
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 |
