diff options
| author | Florian Zeitz <florob@babelmonkeys.de> | 2015-02-27 15:36:53 +0100 |
|---|---|---|
| committer | Florian Zeitz <florob@babelmonkeys.de> | 2015-03-02 17:11:51 +0100 |
| commit | f35f973cb700c444d8c029ee13b37dc16d560225 (patch) | |
| tree | 7d87e40045e89a5d75001ef4b241840870b6aed7 /src/libsyntax/parse | |
| parent | 1cc8b6ec664f30b43f75551e95299d943c8a4e6a (diff) | |
| download | rust-f35f973cb700c444d8c029ee13b37dc16d560225.tar.gz rust-f35f973cb700c444d8c029ee13b37dc16d560225.zip | |
Use `const`s instead of `static`s where appropriate
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer/comments.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 7a5d75581a5..3ad1d96a45d 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -124,8 +124,8 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String { } // one-line comments lose their prefix - static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"]; - for prefix in ONLINERS { + const ONELINERS: &'static [&'static str] = &["///!", "///", "//!", "//"]; + for prefix in ONELINERS { if comment.starts_with(*prefix) { return (&comment[prefix.len()..]).to_string(); } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2797ef084d9..61a3a5ca82a 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -425,10 +425,10 @@ macro_rules! declare_special_idents_and_keywords {( $( ($rk_name:expr, $rk_variant:ident, $rk_str:expr); )* } ) => { - static STRICT_KEYWORD_START: ast::Name = first!($( ast::Name($sk_name), )*); - static STRICT_KEYWORD_FINAL: ast::Name = last!($( ast::Name($sk_name), )*); - static RESERVED_KEYWORD_START: ast::Name = first!($( ast::Name($rk_name), )*); - static RESERVED_KEYWORD_FINAL: ast::Name = last!($( ast::Name($rk_name), )*); + const STRICT_KEYWORD_START: ast::Name = first!($( ast::Name($sk_name), )*); + const STRICT_KEYWORD_FINAL: ast::Name = last!($( ast::Name($sk_name), )*); + const RESERVED_KEYWORD_START: ast::Name = first!($( ast::Name($rk_name), )*); + const RESERVED_KEYWORD_FINAL: ast::Name = last!($( ast::Name($rk_name), )*); pub mod special_idents { use ast; |
