From f35f973cb700c444d8c029ee13b37dc16d560225 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Fri, 27 Feb 2015 15:36:53 +0100 Subject: 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] --- src/libsyntax/parse/lexer/comments.rs | 4 ++-- src/libsyntax/parse/token.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/parse') 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; -- cgit 1.4.1-3-g733a5