]> git.lizzy.rs Git - rust.git/commitdiff
syntax: Make static/super/self/Self keywords + special ident cleanup
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sat, 16 Apr 2016 15:05:06 +0000 (18:05 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Sun, 24 Apr 2016 17:59:44 +0000 (20:59 +0300)
28 files changed:
src/librustc/hir/fold.rs
src/librustc/hir/print.rs
src/librustc/middle/liveness.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/ty/context.rs
src/librustc/ty/sty.rs
src/librustc_resolve/lib.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_trans/mir/mod.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/collect.rs
src/librustdoc/clean/mod.rs
src/libsyntax/ast.rs
src/libsyntax/ext/build.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/fold.rs
src/libsyntax/lib.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pprust.rs
src/libsyntax/std_inject.rs
src/libsyntax/test.rs
src/libsyntax_ext/deriving/generic/mod.rs
src/libsyntax_ext/deriving/generic/ty.rs
src/libsyntax_ext/format.rs

index a6ff716488526888a9b60ca08a2ec34a07f4bbce..ae8ef00eb6a506172ffdf9a2059cc1d36fa5e579 100644 (file)
@@ -867,7 +867,7 @@ pub fn noop_fold_crate<T: Folder>(Crate { module, attrs, config, span,
     let config = folder.fold_meta_items(config);
 
     let crate_mod = folder.fold_item(hir::Item {
-        name: token::special_idents::invalid.name,
+        name: token::special_idents::Invalid.name,
         attrs: attrs,
         id: DUMMY_NODE_ID,
         vis: hir::Public,
index e595c619e859bb895328d0cfaa98f3c5d209e194..04bd32732b6f68c827645f1db5e989aba07405de 100644 (file)
@@ -2211,7 +2211,7 @@ pub fn print_arg(&mut self, input: &hir::Arg, is_closure: bool) -> io::Result<()
                 match input.pat.node {
                     PatKind::Ident(_, ref path1, _) if
                         path1.node.name ==
-                            parse::token::special_idents::invalid.name => {
+                            parse::token::special_idents::Invalid.name => {
                         // Do nothing.
                     }
                     _ => {
index 35991ae56c8a1477097bd30f065c7aa99acf23d9..63eebd9d5ab7b5be9bd9df36988d01a133736e9a 100644 (file)
 use std::rc::Rc;
 use syntax::ast::{self, NodeId};
 use syntax::codemap::{BytePos, original_sp, Span};
-use syntax::parse::token::special_idents;
+use syntax::parse::token::keywords;
 use syntax::ptr::P;
 
 use hir::Expr;
@@ -1578,7 +1578,7 @@ fn warn_about_unused_args(&self, decl: &hir::FnDecl, entry_ln: LiveNode) {
                 let var = self.variable(p_id, sp);
                 // Ignore unused self.
                 let name = path1.node;
-                if name != special_idents::self_.name {
+                if name != keywords::SelfValue.ident.name {
                     if !self.warn_about_unused(sp, p_id, entry_ln, var) {
                         if self.live_on_entry(entry_ln, var).is_none() {
                             self.report_dead_assign(p_id, sp, var, true);
index 585b65b9f5e42e7613a1e5803213d9711bab5b13..54986a629f007297d093e74ecf87ea970859445b 100644 (file)
@@ -245,7 +245,7 @@ fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) {
     }
 
     fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) {
-        if lifetime_ref.name == special_idents::static_lifetime.name {
+        if lifetime_ref.name == special_idents::StaticLifetime.name {
             self.insert_lifetime(lifetime_ref, DefStaticRegion);
             return;
         }
@@ -672,9 +672,8 @@ fn check_lifetime_defs(&mut self, old_scope: Scope, lifetimes: &[hir::LifetimeDe
         for i in 0..lifetimes.len() {
             let lifetime_i = &lifetimes[i];
 
-            let special_idents = [special_idents::static_lifetime];
             for lifetime in lifetimes {
-                if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
+                if lifetime.lifetime.name == special_idents::StaticLifetime.name {
                     span_err!(self.sess, lifetime.lifetime.span, E0262,
                         "invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
                 }
index 10000607b540907a2a1a5bb434b4161f56b219b7..a5220cfbf8a91550bb121bb2a229f288e5d2975f 100644 (file)
@@ -44,7 +44,7 @@
 use std::rc::Rc;
 use syntax::ast::{self, Name, NodeId};
 use syntax::attr;
-use syntax::parse::token::{self, special_idents};
+use syntax::parse::token::{self, keywords};
 
 use hir;
 
@@ -1069,7 +1069,7 @@ pub fn mk_param(&self,
     }
 
     pub fn mk_self_type(&self) -> Ty<'tcx> {
-        self.mk_param(subst::SelfSpace, 0, special_idents::type_self.name)
+        self.mk_param(subst::SelfSpace, 0, keywords::SelfType.ident.name)
     }
 
     pub fn mk_param_from_def(&self, def: &ty::TypeParameterDef) -> Ty<'tcx> {
index c0fb60d4dd3dc59ab5c2694839d8d60b460a2f3d..623595b36cc381e85177d757d013d1584d88992a 100644 (file)
@@ -24,7 +24,7 @@
 use std::mem;
 use syntax::abi;
 use syntax::ast::{self, Name};
-use syntax::parse::token::special_idents;
+use syntax::parse::token::keywords;
 
 use serialize::{Decodable, Decoder};
 
@@ -533,7 +533,7 @@ pub fn new(space: subst::ParamSpace,
     }
 
     pub fn for_self() -> ParamTy {
-        ParamTy::new(subst::SelfSpace, 0, special_idents::type_self.name)
+        ParamTy::new(subst::SelfSpace, 0, keywords::SelfType.ident.name)
     }
 
     pub fn for_def(def: &ty::TypeParameterDef) -> ParamTy {
index 8326b8b95e9967bf06b589da3bafa67da1a858ed..bc09cfdb5837c09aa1ea85604c6b85cb0d88be66 100644 (file)
@@ -62,7 +62,7 @@
 use syntax::attr::AttrMetaMethods;
 use syntax::codemap::{self, Span, Pos};
 use syntax::errors::DiagnosticBuilder;
-use syntax::parse::token::{self, special_names, special_idents};
+use syntax::parse::token::{self, keywords, special_idents};
 use syntax::util::lev_distance::find_best_match_for_name;
 
 use rustc::hir::intravisit::{self, FnKind, Visitor};
@@ -1954,8 +1954,7 @@ fn with_self_rib<F>(&mut self, self_def: Def, f: F)
         let mut self_type_rib = Rib::new(NormalRibKind);
 
         // plain insert (no renaming, types are not currently hygienic....)
-        let name = special_names::type_self;
-        self_type_rib.bindings.insert(name, self_def);
+        self_type_rib.bindings.insert(keywords::SelfType.ident.name, self_def);
         self.type_ribs.push(self_type_rib);
         f(self);
         if !self.resolved {
@@ -2195,11 +2194,10 @@ fn resolve_type(&mut self, ty: &Ty) {
                             "type name"
                         };
 
-                        let self_type_name = special_idents::type_self.name;
                         let is_invalid_self_type_name = path.segments.len() > 0 &&
                                                         maybe_qself.is_none() &&
                                                         path.segments[0].identifier.name ==
-                                                        self_type_name;
+                                                        keywords::SelfType.ident.name;
                         if is_invalid_self_type_name {
                             resolve_error(self,
                                           ty.span,
@@ -2643,7 +2641,7 @@ fn resolve_identifier(&mut self,
                           namespace: Namespace,
                           record_used: bool)
                           -> Option<LocalDef> {
-        if identifier.name == special_idents::invalid.name {
+        if identifier.name == special_idents::Invalid.name {
             return Some(LocalDef::from_def(Def::Err));
         }
 
@@ -3074,7 +3072,8 @@ fn resolve_expr(&mut self, expr: &Expr) {
                                 false // Stop advancing
                             });
 
-                            if method_scope && special_names::self_.as_str() == &path_name[..] {
+                            if method_scope &&
+                                    &path_name[..] == keywords::SelfValue.ident.name.as_str() {
                                 resolve_error(self,
                                               expr.span,
                                               ResolutionError::SelfNotAvailableInStaticMethod);
@@ -3612,7 +3611,7 @@ fn collect_mod(names: &mut Vec<ast::Name>, module: Module) {
             }
             BlockParentLink(ref module, _) => {
                 // danger, shouldn't be ident?
-                names.push(special_idents::opaque.name);
+                names.push(token::intern("<opaque>"));
                 collect_mod(names, module);
             }
         }
index bf6ad7039636e97697c919b34de5f10f6bcd27f5..6118033e1fd6e2a4573fd5470bc00ea603aef891 100644 (file)
@@ -1011,7 +1011,7 @@ fn visit_item(&mut self, item: &ast::Item) {
                                 span: sub_span.expect("No span found for use"),
                                 id: item.id,
                                 mod_id: mod_id,
-                                name: ident.name.to_string(),
+                                name: ident.to_string(),
                                 scope: self.cur_scope
                             }.normalize(&self.tcx));
                         }
@@ -1075,7 +1075,7 @@ fn visit_item(&mut self, item: &ast::Item) {
                 if !self.span.filter_generated(alias_span, item.span) {
                     self.dumper.extern_crate(item.span, ExternCrateData {
                         id: item.id,
-                        name: item.ident.name.to_string(),
+                        name: item.ident.to_string(),
                         crate_num: cnum,
                         location: location,
                         span: alias_span.expect("No span found for extern crate"),
index 3874ebc91307bd8a0f0957b59dc030a83af28edc..d5d58c81b4f4e258ac5b7171b93d809a200b9e3c 100644 (file)
@@ -286,7 +286,7 @@ fn arg_value_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>,
                         alloca: lltemp,
                         address_operations: &ops
                     };
-                    declare_local(bcx, token::special_idents::invalid.name,
+                    declare_local(bcx, token::special_idents::Invalid.name,
                                   tupled_arg_ty, scope, variable_access,
                                   VariableKind::ArgumentVariable(arg_index + i + 1),
                                   bcx.fcx().span.unwrap_or(DUMMY_SP));
index 674c3d6f9a17a1d35b224a17d4100db78a7d19f1..d3baa349d76db9afdf245ae92d5fbaf02f318af5 100644 (file)
@@ -1313,7 +1313,7 @@ fn associated_path_def_to_ty<'tcx>(this: &AstConv<'tcx>,
             let trait_node_id = tcx.map.as_local_node_id(trait_did).unwrap();
             match find_bound_for_assoc_item(this,
                                             trait_node_id,
-                                            token::special_idents::type_self.name,
+                                            token::keywords::SelfType.ident.name,
                                             assoc_name,
                                             span) {
                 Ok(bound) => bound,
index 67b91f7838c6644616ab0de8f66c96f3b9bd8a5f..d63cabb1f93957a5b3b09dd2e2bc9745fbf3bd05 100644 (file)
@@ -2851,7 +2851,7 @@ fn check_method_call<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                 method_ty
             }
             Err(error) => {
-                if method_name.node != special_idents::invalid.name {
+                if method_name.node != special_idents::Invalid.name {
                     method::report_error(fcx, method_name.span, expr_t,
                                          method_name.node, Some(rcvr), error);
                 }
@@ -2990,7 +2990,7 @@ fn check_field<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
             let msg = format!("field `{}` of struct `{}` is private", field.node, struct_path);
             fcx.tcx().sess.span_err(expr.span, &msg);
             fcx.write_ty(expr.id, field_ty);
-        } else if field.node == special_idents::invalid.name {
+        } else if field.node == special_idents::Invalid.name {
             fcx.write_error(expr.id);
         } else if method::exists(fcx, field.span, field.node, expr_t, expr.id) {
             fcx.type_error_struct(field.span,
@@ -3780,7 +3780,7 @@ pub fn resolve_ty_and_def_ufcs<'a, 'b, 'tcx>(fcx: &FnCtxt<'b, 'tcx>,
                     method::MethodError::PrivateMatch(def) => Some(def),
                     _ => None,
                 };
-                if item_name != special_idents::invalid.name {
+                if item_name != special_idents::Invalid.name {
                     method::report_error(fcx, span, ty, item_name, None, error);
                 }
                 def
index 1b21e6ce9ebe3d1c548e2bc9df4d777395a7467a..ad411396be096bd3afd626887c2adab3f5ea882c 100644 (file)
@@ -24,7 +24,7 @@
 use syntax::ast;
 use syntax::codemap::{Span};
 use syntax::errors::DiagnosticBuilder;
-use syntax::parse::token::{special_idents};
+use syntax::parse::token::keywords;
 use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir;
 
@@ -472,7 +472,7 @@ fn param_ty(&self,
     {
         let name = match space {
             TypeSpace => ast_generics.ty_params[index].name,
-            SelfSpace => special_idents::type_self.name,
+            SelfSpace => keywords::SelfType.ident.name,
             FnSpace => bug!("Fn space occupied?"),
         };
 
index 6d95586bed01960fbf3d6e6fa4cd6f8d184d12a3..d2b50a0da119f2de2e69444a4c15f683ea4af6ba 100644 (file)
@@ -93,7 +93,7 @@
 use syntax::ast;
 use syntax::attr;
 use syntax::codemap::Span;
-use syntax::parse::token::special_idents;
+use syntax::parse::token::keywords;
 use syntax::ptr::P;
 use rustc::hir::{self, PatKind};
 use rustc::hir::intravisit;
@@ -1655,7 +1655,7 @@ fn ty_generics_for_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
     let def = ty::TypeParameterDef {
         space: SelfSpace,
         index: 0,
-        name: special_idents::type_self.name,
+        name: keywords::SelfType.ident.name,
         def_id: ccx.tcx.map.local_def_id(param_id),
         default_def_id: ccx.tcx.map.local_def_id(parent),
         default: None,
index c9f40a1adae3209fb1d4a909a13f3d76f004a641..d1c155fb97dea59920aa54db1fdf1b53d7de269d 100644 (file)
@@ -31,7 +31,7 @@
 use syntax::attr::{AttributeMethods, AttrMetaMethods};
 use syntax::codemap;
 use syntax::codemap::{DUMMY_SP, Pos, Spanned};
-use syntax::parse::token::{self, InternedString, special_idents};
+use syntax::parse::token::{self, InternedString, keywords};
 use syntax::ptr::P;
 
 use rustc_trans::back::link;
@@ -2666,7 +2666,7 @@ fn resolve_type(cx: &DocContext,
             hir::TyFloat(ast::FloatTy::F64) => return Primitive(F64),
         },
         Def::SelfTy(..) if path.segments.len() == 1 => {
-            return Generic(special_idents::type_self.name.to_string());
+            return Generic(keywords::SelfType.ident.to_string());
         }
         Def::SelfTy(..) | Def::TyParam(..) => true,
         _ => false,
index 0e825b8c2fe3c9f4c06e015778a938fb80975d51..6bcd8085315a279edbdd243b46fbb91d408f9a59 100644 (file)
@@ -93,7 +93,7 @@ impl Ident {
     pub fn new(name: Name, ctxt: SyntaxContext) -> Ident {
         Ident {name: name, ctxt: ctxt}
     }
-    pub fn with_empty_ctxt(name: Name) -> Ident {
+    pub const fn with_empty_ctxt(name: Name) -> Ident {
         Ident {name: name, ctxt: EMPTY_CTXT}
     }
 }
index a4e5b68277d698799d8be41122f0ac335947854a..c234ea3afebe49b949a61fc879a467b9cd1309c2 100644 (file)
@@ -13,7 +13,7 @@
 use attr;
 use codemap::{Span, respan, Spanned, DUMMY_SP, Pos};
 use ext::base::ExtCtxt;
-use parse::token::special_idents;
+use parse::token::{keywords, special_idents};
 use parse::token::InternedString;
 use parse::token;
 use ptr::P;
@@ -602,7 +602,7 @@ fn expr_ident(&self, span: Span, id: ast::Ident) -> P<ast::Expr> {
         self.expr_path(self.path_ident(span, id))
     }
     fn expr_self(&self, span: Span) -> P<ast::Expr> {
-        self.expr_ident(span, special_idents::self_)
+        self.expr_ident(span, keywords::SelfValue.ident)
     }
 
     fn expr_binary(&self, sp: Span, op: ast::BinOpKind,
@@ -1132,7 +1132,7 @@ fn item_use(&self, sp: Span,
                 vis: ast::Visibility, vp: P<ast::ViewPath>) -> P<ast::Item> {
         P(ast::Item {
             id: ast::DUMMY_NODE_ID,
-            ident: special_idents::invalid,
+            ident: special_idents::Invalid,
             attrs: vec![],
             node: ast::ItemKind::Use(vp),
             vis: vis,
index cd7b0fcfb004450cb04df6642fdddea5eebdf22e..3fe4913b5bba90d9c8b979f2c9ccf707ad760f7d 100644 (file)
@@ -380,7 +380,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
 
             Some(rc) => match *rc {
                 NormalTT(ref expander, tt_span, allow_internal_unstable) => {
-                    if ident.name != parse::token::special_idents::invalid.name {
+                    if ident.name != parse::token::special_idents::Invalid.name {
                         fld.cx
                             .span_err(path_span,
                                       &format!("macro {}! expects no ident argument, given '{}'",
@@ -401,7 +401,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
                     expander.expand(fld.cx, span, &marked_before[..])
                 }
                 IdentTT(ref expander, tt_span, allow_internal_unstable) => {
-                    if ident.name == parse::token::special_idents::invalid.name {
+                    if ident.name == parse::token::special_idents::Invalid.name {
                         fld.cx.span_err(path_span,
                                         &format!("macro {}! expects an ident argument",
                                                 extname));
@@ -420,7 +420,7 @@ pub fn expand_item_mac(it: P<ast::Item>,
                     expander.expand(fld.cx, span, ident, marked_tts)
                 }
                 MacroRulesTT => {
-                    if ident.name == parse::token::special_idents::invalid.name {
+                    if ident.name == parse::token::special_idents::Invalid.name {
                         fld.cx.span_err(path_span, "macro_rules! expects an ident argument");
                         return SmallVector::zero();
                     }
@@ -893,7 +893,7 @@ fn expand_annotatable(a: Annotatable,
             }
             ast::ItemKind::Mod(_) | ast::ItemKind::ForeignMod(_) => {
                 let valid_ident =
-                    it.ident.name != parse::token::special_idents::invalid.name;
+                    it.ident.name != parse::token::special_idents::Invalid.name;
 
                 if valid_ident {
                     fld.cx.mod_push(it.ident);
@@ -1807,7 +1807,7 @@ macro_rules! iterator_impl {
 
     // run one of the renaming tests
     fn run_renaming_test(t: &RenamingTest, test_idx: usize) {
-        let invalid_name = token::special_idents::invalid.name;
+        let invalid_name = token::special_idents::Invalid.name;
         let (teststr, bound_connections, bound_ident_check) = match *t {
             (ref str,ref conns, bic) => (str.to_string(), conns.clone(), bic)
         };
index abb17de47eae43c489b9c67982b721059de75869..41d3991aee809a4feddf47314a6f486544e41dbf 100644 (file)
@@ -17,7 +17,7 @@
 use ext::tt::macro_parser::parse;
 use parse::lexer::new_tt_reader;
 use parse::parser::{Parser, Restrictions};
-use parse::token::{self, special_idents, gensym_ident, NtTT, Token};
+use parse::token::{self, gensym_ident, NtTT, Token};
 use parse::token::Token::*;
 use print;
 use ptr::P;
@@ -244,8 +244,8 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt,
     // $( $lhs:tt => $rhs:tt );+
     // ...quasiquoting this would be nice.
     // These spans won't matter, anyways
-    let match_lhs_tok = MatchNt(lhs_nm, special_idents::tt);
-    let match_rhs_tok = MatchNt(rhs_nm, special_idents::tt);
+    let match_lhs_tok = MatchNt(lhs_nm, token::str_to_ident("tt"));
+    let match_rhs_tok = MatchNt(rhs_nm, token::str_to_ident("tt"));
     let argument_gram = vec!(
         TokenTree::Sequence(DUMMY_SP,
                    Rc::new(ast::SequenceRepetition {
index 69c420902c8a0724ad97ae1cd91edfa7e8f953ba..ad95b96363efe9abfde29dc267c5b5fb8c0ee95f 100644 (file)
@@ -1015,7 +1015,7 @@ pub fn noop_fold_crate<T: Folder>(Crate {module, attrs, config, mut exported_mac
     let config = folder.fold_meta_items(config);
 
     let mut items = folder.fold_item(P(ast::Item {
-        ident: token::special_idents::invalid,
+        ident: token::special_idents::Invalid,
         attrs: attrs,
         id: ast::DUMMY_NODE_ID,
         vis: ast::Visibility::Public,
index ca7e5729c0b7a176dd83ac415e85e2acf08dd07a..f38720c3e5006aa52a1a16d02878bd71b66c631c 100644 (file)
@@ -25,6 +25,7 @@
 #![cfg_attr(not(stage0), deny(warnings))]
 
 #![feature(associated_consts)]
+#![feature(const_fn)]
 #![feature(filling_drop)]
 #![feature(libc)]
 #![feature(rustc_private)]
index 71f059de0414557bf1d53f735c6e32453ecb1760..2c82cbcb6c66a656123a37e918315924e922b2f5 100644 (file)
@@ -292,7 +292,7 @@ fn to_string(&self) -> String {
         match *self {
             TokenType::Token(ref t) => format!("`{}`", Parser::token_to_string(t)),
             TokenType::Operator => "an operator".to_string(),
-            TokenType::Keyword(kw) => format!("`{}`", kw.to_name()),
+            TokenType::Keyword(kw) => format!("`{}`", kw.ident.name),
         }
     }
 }
@@ -562,9 +562,7 @@ fn interpolated_or_expr_span(&self,
     }
 
     pub fn parse_ident(&mut self) -> PResult<'a, ast::Ident> {
-        if !self.restrictions.contains(Restrictions::ALLOW_MODULE_PATHS) {
-            self.check_strict_keywords();
-        }
+        self.check_used_keywords();
         self.check_reserved_keywords();
         match self.token {
             token::Ident(i) => {
@@ -658,8 +656,8 @@ pub fn expect_keyword(&mut self, kw: keywords::Keyword) -> PResult<'a, ()> {
     }
 
     /// Signal an error if the given string is a strict keyword
-    pub fn check_strict_keywords(&mut self) {
-        if self.token.is_strict_keyword() {
+    pub fn check_used_keywords(&mut self) {
+        if self.token.is_used_keyword() {
             let token_str = self.this_token_to_string();
             let span = self.span;
             self.span_err(span,
@@ -1553,7 +1551,7 @@ pub fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> {
         } else {
             debug!("parse_arg_general ident_to_pat");
             let sp = self.last_span;
-            let spanned = Spanned { span: sp, node: special_idents::invalid };
+            let spanned = Spanned { span: sp, node: special_idents::Invalid };
             P(Pat {
                 id: ast::DUMMY_NODE_ID,
                 node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable),
@@ -2335,7 +2333,7 @@ fn parse_bottom_expr(&mut self) -> PResult<'a, P<Expr>> {
                     }
                     hi = self.last_span.hi;
                 } else if self.token.is_keyword(keywords::Let) {
-                    // Catch this syntax error here, instead of in `check_strict_keywords`, so
+                    // Catch this syntax error here, instead of in `check_used_keywords`, so
                     // that we can explicitly mention that let is not to be used as an expression
                     let mut db = self.fatal("expected expression, found statement (`let`)");
                     db.note("variable declaration using `let` is a statement");
@@ -2618,7 +2616,7 @@ fn parse_dot_or_call_expr_with_(&mut self, e0: P<Expr>, lo: BytePos) -> PResult<
                     self.span_err(self.span, &format!("unexpected token: `{}`", actual));
 
                     let dot_pos = self.last_span.hi;
-                    e = self.parse_dot_suffix(special_idents::invalid,
+                    e = self.parse_dot_suffix(special_idents::Invalid,
                                               mk_sp(dot_pos, dot_pos),
                                               e, lo)?;
                   }
@@ -2696,7 +2694,7 @@ fn parse_unquoted(&mut self) -> PResult<'a, TokenTree> {
         };
         // continue by trying to parse the `:ident` after `$name`
         if self.token == token::Colon && self.look_ahead(1, |t| t.is_ident() &&
-                                                                !t.is_strict_keyword() &&
+                                                                !t.is_used_keyword() &&
                                                                 !t.is_reserved_keyword()) {
             self.bump();
             sp = mk_sp(sp.lo, self.span.hi);
@@ -3942,7 +3940,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
             self.bump();
 
             let id = match self.token {
-                token::OpenDelim(_) => token::special_idents::invalid, // no special identifier
+                token::OpenDelim(_) => token::special_idents::Invalid, // no special identifier
                 _ => self.parse_ident()?,
             };
 
@@ -3954,7 +3952,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
                 _ => {
                     // we only expect an ident if we didn't parse one
                     // above.
-                    let ident_str = if id.name == token::special_idents::invalid.name {
+                    let ident_str = if id.name == token::special_idents::Invalid.name {
                         "identifier, "
                     } else {
                         ""
@@ -3980,7 +3978,7 @@ fn parse_stmt_without_recovery(&mut self) -> PResult<'a, Option<Stmt>> {
                 MacStmtStyle::NoBraces
             };
 
-            if id.name == token::special_idents::invalid.name {
+            if id.name == token::special_idents::Invalid.name {
                 let mac = P(spanned(lo, hi, Mac_ { path: pth, tts: tts, ctxt: EMPTY_CTXT }));
                 let stmt = StmtKind::Mac(mac, style, attrs.into_thin_attrs());
                 spanned(lo, hi, stmt)
@@ -4610,8 +4608,10 @@ pub fn parse_fn_decl(&mut self, allow_variadic: bool) -> PResult<'a, P<FnDecl>>
 
     fn expect_self_ident(&mut self) -> PResult<'a, ast::Ident> {
         match self.token {
-            token::Ident(id) if id.name == special_idents::self_.name => {
+            token::Ident(id) if id.name == keywords::SelfValue.ident.name => {
                 self.bump();
+                // The hygiene context of `id` needs to be preserved here,
+                // so we can't just return `SelfValue.ident`.
                 Ok(id)
             },
             _ => {
@@ -4696,7 +4696,7 @@ fn maybe_parse_borrowed_explicit_self<'b>(this: &mut Parser<'b>)
                     self.bump();
                 }
                 // error case, making bogus self ident:
-                SelfKind::Value(special_idents::self_)
+                SelfKind::Value(keywords::SelfValue.ident)
             }
             token::Ident(..) => {
                 if self.token.is_keyword(keywords::SelfValue) {
@@ -4971,7 +4971,7 @@ fn parse_impl_method(&mut self, vis: &Visibility)
             if delim != token::Brace {
                 self.expect(&token::Semi)?
             }
-            Ok((token::special_idents::invalid, vec![], ast::ImplItemKind::Macro(m)))
+            Ok((token::special_idents::Invalid, vec![], ast::ImplItemKind::Macro(m)))
         } else {
             let (constness, unsafety, abi) = self.parse_fn_front_matter()?;
             let ident = self.parse_ident()?;
@@ -5066,7 +5066,7 @@ fn parse_item_impl(&mut self, unsafety: ast::Unsafety) -> PResult<'a, ItemInfo>
 
             self.expect(&token::OpenDelim(token::Brace))?;
             self.expect(&token::CloseDelim(token::Brace))?;
-            Ok((special_idents::invalid,
+            Ok((special_idents::Invalid,
              ItemKind::DefaultImpl(unsafety, opt_trait.unwrap()), None))
         } else {
             if opt_trait.is_some() {
@@ -5082,7 +5082,7 @@ fn parse_item_impl(&mut self, unsafety: ast::Unsafety) -> PResult<'a, ItemInfo>
                 impl_items.push(self.parse_impl_item()?);
             }
 
-            Ok((special_idents::invalid,
+            Ok((special_idents::Invalid,
              ItemKind::Impl(unsafety, polarity, generics, opt_trait, ty, impl_items),
              Some(attrs)))
         }
@@ -5260,7 +5260,7 @@ fn parse_visibility(&mut self, allow_restricted: bool) -> PResult<'a, Visibility
 
     /// Parse defaultness: DEFAULT or nothing
     fn parse_defaultness(&mut self) -> PResult<'a, Defaultness> {
-        if self.eat_contextual_keyword(special_idents::DEFAULT) {
+        if self.eat_contextual_keyword(special_idents::Default) {
             Ok(Defaultness::Default)
         } else {
             Ok(Defaultness::Final)
@@ -5588,7 +5588,7 @@ fn parse_item_foreign_mod(&mut self,
         };
         Ok(self.mk_item(lo,
                      last_span.hi,
-                     special_idents::invalid,
+                     special_idents::Invalid,
                      ItemKind::ForeignMod(m),
                      visibility,
                      attrs))
@@ -5727,7 +5727,7 @@ fn parse_item_(&mut self, attrs: Vec<Attribute>,
             let last_span = self.last_span;
             let item = self.mk_item(lo,
                                     last_span.hi,
-                                    token::special_idents::invalid,
+                                    token::special_idents::Invalid,
                                     item_,
                                     visibility,
                                     attrs);
@@ -6018,7 +6018,7 @@ fn parse_macro_use_or_failure(
             let id = if self.token.is_ident() {
                 self.parse_ident()?
             } else {
-                token::special_idents::invalid // no special identifier
+                token::special_idents::Invalid // no special identifier
             };
             // eat a matched-delimiter token tree:
             let delim = self.expect_open_delim()?;
index 76bd0f66cd8f4390fda0b9950c85381233261450..449a226874030cad03f6cedb74f15f7a6247a6ec 100644 (file)
@@ -271,47 +271,39 @@ pub fn to_binop(&self) -> Option<BinOpKind> {
     /// Returns `true` if the token is a given keyword, `kw`.
     pub fn is_keyword(&self, kw: keywords::Keyword) -> bool {
         match *self {
-            Ident(id) => id.name == kw.to_name(),
+            Ident(id) => id.name == kw.ident.name,
             _ => false,
         }
     }
 
     pub fn is_path_segment_keyword(&self) -> bool {
         match *self {
-            Ident(id) => id.name == SUPER_KEYWORD_NAME ||
-                         id.name == SELF_KEYWORD_NAME ||
-                         id.name == SELF_TYPE_KEYWORD_NAME,
+            Ident(id) => id.name == keywords::Super.ident.name ||
+                         id.name == keywords::SelfValue.ident.name ||
+                         id.name == keywords::SelfType.ident.name,
             _ => false,
         }
     }
 
-    /// Returns `true` if the token is either a strict or reserved keyword.
+    /// Returns `true` if the token is either a used or reserved keyword.
     pub fn is_any_keyword(&self) -> bool {
         match *self {
-            Ident(id) => id.name == SELF_KEYWORD_NAME ||
-                         id.name == STATIC_KEYWORD_NAME ||
-                         id.name == SUPER_KEYWORD_NAME ||
-                         id.name == SELF_TYPE_KEYWORD_NAME ||
-                         id.name >= STRICT_KEYWORD_START &&
+            Ident(id) => id.name >= USED_KEYWORD_START &&
                          id.name <= RESERVED_KEYWORD_FINAL,
             _ => false
         }
     }
 
-    /// Returns `true` if the token is either a strict keyword.
-    pub fn is_strict_keyword(&self) -> bool {
+    /// Returns `true` if the token is a used keyword.
+    pub fn is_used_keyword(&self) -> bool {
         match *self {
-            Ident(id) => id.name == SELF_KEYWORD_NAME ||
-                         id.name == STATIC_KEYWORD_NAME ||
-                         id.name == SUPER_KEYWORD_NAME ||
-                         id.name == SELF_TYPE_KEYWORD_NAME ||
-                         id.name >= STRICT_KEYWORD_START &&
-                         id.name <= STRICT_KEYWORD_FINAL,
+            Ident(id) => id.name >= USED_KEYWORD_START &&
+                         id.name <= USED_KEYWORD_FINAL,
             _ => false,
         }
     }
 
-    /// Returns `true` if the token is either a keyword reserved for possible future use.
+    /// Returns `true` if the token is a keyword reserved for possible future use.
     pub fn is_reserved_keyword(&self) -> bool {
         match *self {
             Ident(id) => id.name >= RESERVED_KEYWORD_START &&
@@ -378,7 +370,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-
 // Get the first "argument"
 macro_rules! first {
     ( $first:expr, $( $remainder:expr, )* ) => ( $first )
@@ -392,122 +383,85 @@ macro_rules! last {
 
 // In this macro, there is the requirement that the name (the number) must be monotonically
 // increasing by one in the special identifiers, starting at 0; the same holds for the keywords,
-// except starting from the next number instead of zero, and with the additional exception that
-// special identifiers are *also* allowed (they are deduplicated in the important place, the
-// interner), an exception which is demonstrated by "static" and "self".
+// except starting from the next number instead of zero.
 macro_rules! declare_special_idents_and_keywords {(
     // So now, in these rules, why is each definition parenthesised?
     // Answer: otherwise we get a spurious local ambiguity bug on the "}"
     pub mod special_idents {
-        $( ($si_name:expr, $si_static:ident, $si_str:expr); )*
+        $( ($si_index: expr, $si_const: ident, $si_str: expr); )*
     }
 
     pub mod keywords {
-        'strict:
-        $( ($sk_name:expr, $sk_variant:ident, $sk_str:expr); )*
+        'used:
+        $( ($ukw_index: expr, $ukw_const: ident, $ukw_str: expr); )*
         'reserved:
-        $( ($rk_name:expr, $rk_variant:ident, $rk_str:expr); )*
+        $( ($rkw_index: expr, $rkw_const: ident, $rkw_str: expr); )*
     }
 ) => {
-    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), )*);
+    const USED_KEYWORD_START: ast::Name = first!($( ast::Name($ukw_index), )*);
+    const USED_KEYWORD_FINAL: ast::Name = last!($( ast::Name($ukw_index), )*);
+    const RESERVED_KEYWORD_START: ast::Name = first!($( ast::Name($rkw_index), )*);
+    const RESERVED_KEYWORD_FINAL: ast::Name = last!($( ast::Name($rkw_index), )*);
 
     pub mod special_idents {
         use ast;
         $(
             #[allow(non_upper_case_globals)]
-            pub const $si_static: ast::Ident = ast::Ident {
-                name: ast::Name($si_name),
-                ctxt: ast::EMPTY_CTXT,
-            };
-         )*
-    }
-
-    pub mod special_names {
-        use ast;
-        $(
-            #[allow(non_upper_case_globals)]
-            pub const $si_static: ast::Name = ast::Name($si_name);
+            pub const $si_const: ast::Ident = ast::Ident::with_empty_ctxt(ast::Name($si_index));
         )*
     }
 
-    /// All the valid words that have meaning in the Rust language.
-    ///
-    /// Rust keywords are either 'strict' or 'reserved'.  Strict keywords may not
-    /// appear as identifiers at all. Reserved keywords are not used anywhere in
-    /// the language and may not appear as identifiers.
+    /// Rust keywords are either 'used' in the language or 'reserved' for future use.
     pub mod keywords {
-        pub use self::Keyword::*;
         use ast;
-
-        #[derive(Copy, Clone, PartialEq, Eq)]
-        pub enum Keyword {
-            $( $sk_variant, )*
-            $( $rk_variant, )*
-        }
-
-        impl Keyword {
-            pub fn to_name(&self) -> ast::Name {
-                match *self {
-                    $( $sk_variant => ast::Name($sk_name), )*
-                    $( $rk_variant => ast::Name($rk_name), )*
-                }
-            }
+        #[derive(Clone, Copy, PartialEq, Eq)]
+        pub struct Keyword {
+            pub ident: ast::Ident,
         }
+        $(
+            #[allow(non_upper_case_globals)]
+            pub const $ukw_const: Keyword = Keyword {
+                ident: ast::Ident::with_empty_ctxt(ast::Name($ukw_index))
+            };
+        )*
+        $(
+            #[allow(non_upper_case_globals)]
+            pub const $rkw_const: Keyword = Keyword {
+                ident: ast::Ident::with_empty_ctxt(ast::Name($rkw_index))
+            };
+        )*
     }
 
     fn mk_fresh_ident_interner() -> IdentInterner {
-        let mut init_vec = Vec::new();
-        $(init_vec.push($si_str);)*
-        $(init_vec.push($sk_str);)*
-        $(init_vec.push($rk_str);)*
-        interner::StrInterner::prefill(&init_vec[..])
+        interner::StrInterner::prefill(&[$($si_str,)* $($ukw_str,)* $($rkw_str,)*])
     }
 }}
 
-// If the special idents get renumbered, remember to modify these two as appropriate
-pub const SELF_KEYWORD_NAME: ast::Name = ast::Name(SELF_KEYWORD_NAME_NUM);
-const STATIC_KEYWORD_NAME: ast::Name = ast::Name(STATIC_KEYWORD_NAME_NUM);
-pub const SUPER_KEYWORD_NAME: ast::Name = ast::Name(SUPER_KEYWORD_NAME_NUM);
-const SELF_TYPE_KEYWORD_NAME: ast::Name = ast::Name(SELF_TYPE_KEYWORD_NAME_NUM);
-
-pub const SELF_KEYWORD_NAME_NUM: u32 = 1;
-const STATIC_KEYWORD_NAME_NUM: u32 = 2;
-const SUPER_KEYWORD_NAME_NUM: u32 = 3;
-const SELF_TYPE_KEYWORD_NAME_NUM: u32 = 10;
-
 // 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
 // of the reserved words, and thus tagged as "reserved".
 
 declare_special_idents_and_keywords! {
     pub mod special_idents {
-        // These ones are statics
-        (0,                          invalid,                "");
-        (super::SELF_KEYWORD_NAME_NUM,   self_,              "self");
-        (super::STATIC_KEYWORD_NAME_NUM, statik,             "static");
-        (super::SUPER_KEYWORD_NAME_NUM, super_,              "super");
-        (4,                          static_lifetime,        "'static");
-
-        // for matcher NTs
-        (5,                          tt,                     "tt");
-        (6,                          matchers,               "matchers");
-
-        // outside of libsyntax
-        (7,                          clownshoe_abi,          "__rust_abi");
-        (8,                          opaque,                 "<opaque>");
-        (9,                          __unused1,              "<__unused1>");
-        (super::SELF_TYPE_KEYWORD_NAME_NUM, type_self,       "Self");
-        (11,                         prelude_import,         "prelude_import");
-        (12,                         DEFAULT,                "default");
+        // Special identifiers
+        (0,                          Invalid,        "");
+        (1,                          __Unused1,      "<__unused1>");
+        (2,                          __Unused2,      "<__unused2>");
+        (3,                          __Unused3,      "<__unused3>");
+        (4,                          __Unused4,      "<__unused4>");
+        (5,                          __Unused5,      "<__unused5>");
+        (6,                          Union,          "union");
+        (7,                          Default,        "default");
+        (8,                          StaticLifetime, "'static");
     }
 
     pub mod keywords {
-        // These ones are variants of the Keyword enum
-
-        'strict:
+        // Keywords
+        'used:
+        (9,                          Static,     "static");
+        (10,                         Super,      "super");
+        (11,                         SelfValue,  "self");
+        (12,                         SelfType,   "Self");
         (13,                         As,         "as");
         (14,                         Break,      "break");
         (15,                         Crate,      "crate");
@@ -529,12 +483,7 @@ pub mod keywords {
         (31,                         Pub,        "pub");
         (32,                         Ref,        "ref");
         (33,                         Return,     "return");
-        // Static and Self are also special idents (prefill de-dupes)
-        (super::STATIC_KEYWORD_NAME_NUM, Static, "static");
-        (super::SELF_KEYWORD_NAME_NUM, SelfValue, "self");
-        (super::SELF_TYPE_KEYWORD_NAME_NUM, SelfType, "Self");
         (34,                         Struct,     "struct");
-        (super::SUPER_KEYWORD_NAME_NUM, Super,   "super");
         (35,                         True,       "true");
         (36,                         Trait,      "trait");
         (37,                         Type,       "type");
index 4fe076b3a7b517ef8b6331a8b3bcda53d775a4b6..d5318e32aa8d18deadbf1122ea9b930570888f7a 100644 (file)
@@ -2959,7 +2959,7 @@ pub fn print_arg(&mut self, input: &ast::Arg, is_closure: bool) -> io::Result<()
                 match input.pat.node {
                     PatKind::Ident(_, ref path1, _) if
                         path1.node.name ==
-                            parse::token::special_idents::invalid.name => {
+                            parse::token::special_idents::Invalid.name => {
                         // Do nothing.
                     }
                     _ => {
index 9049b21d8b4bbc511cc4fb71772754dde6e70180..1d640d7435315a0214d339632ab6947fd70a9959 100644 (file)
@@ -148,7 +148,7 @@ fn fold_mod(&mut self, mut mod_: ast::Mod) -> ast::Mod {
         let vp = P(codemap::dummy_spanned(ast::ViewPathGlob(prelude_path)));
         mod_.items.insert(0, P(ast::Item {
             id: ast::DUMMY_NODE_ID,
-            ident: special_idents::invalid,
+            ident: special_idents::Invalid,
             node: ast::ItemKind::Use(vp),
             attrs: vec![ast::Attribute {
                 span: self.span,
@@ -157,7 +157,9 @@ fn fold_mod(&mut self, mut mod_: ast::Mod) -> ast::Mod {
                     style: ast::AttrStyle::Outer,
                     value: P(ast::MetaItem {
                         span: self.span,
-                        node: ast::MetaItemKind::Word(special_idents::prelude_import.name.as_str()),
+                        node: ast::MetaItemKind::Word(
+                            token::intern_and_get_ident("prelude_import")
+                        ),
                     }),
                     is_sugared_doc: false,
                 },
index 703b1611540c89272bc9c8b82d4aee63f1ef69f3..f464eb9bf972ae61aab555e1eb8899a4ed92c757 100644 (file)
@@ -116,7 +116,7 @@ fn fold_crate(&mut self, c: ast::Crate) -> ast::Crate {
 
     fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
         let ident = i.ident;
-        if ident.name != token::special_idents::invalid.name {
+        if ident.name != token::special_idents::Invalid.name {
             self.cx.path.push(ident);
         }
         debug!("current path: {}", path_name_i(&self.cx.path));
@@ -160,7 +160,7 @@ fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
             ast::ItemKind::Mod(..) => fold::noop_fold_item(i, self),
             _ => SmallVector::one(i),
         };
-        if ident.name != token::special_idents::invalid.name {
+        if ident.name != token::special_idents::Invalid.name {
             self.cx.path.pop();
         }
         res
@@ -453,7 +453,7 @@ fn mk_std(cx: &TestCtxt) -> P<ast::Item> {
         (ast::ItemKind::Use(
             P(nospan(ast::ViewPathSimple(id_test,
                                          path_node(vec!(id_test)))))),
-         ast::Visibility::Public, token::special_idents::invalid)
+         ast::Visibility::Public, token::special_idents::Invalid)
     } else {
         (ast::ItemKind::ExternCrate(None), ast::Visibility::Inherited, id_test)
     };
@@ -545,7 +545,7 @@ fn mk_test_module(cx: &mut TestCtxt) -> (P<ast::Item>, Option<P<ast::Item>>) {
 
         P(ast::Item {
             id: ast::DUMMY_NODE_ID,
-            ident: token::special_idents::invalid,
+            ident: token::special_idents::Invalid,
             attrs: vec![],
             node: ast::ItemKind::Use(P(use_path)),
             vis: ast::Visibility::Inherited,
@@ -590,7 +590,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
     let struct_type = ecx.ty_path(ecx.path(sp, vec![ecx.ident_of("self"),
                                                     ecx.ident_of("test"),
                                                     ecx.ident_of("TestDescAndFn")]));
-    let static_lt = ecx.lifetime(sp, token::special_idents::static_lifetime.name);
+    let static_lt = ecx.lifetime(sp, token::special_idents::StaticLifetime.name);
     // &'static [self::test::TestDescAndFn]
     let static_type = ecx.ty_rptr(sp,
                                   ecx.ty(sp, ast::TyKind::Vec(struct_type)),
index b8ba1a58f2163924fc95b5265abde5bb18f71a4f..b117b383120ab2fa02e47cf664e911f3baa46313 100644 (file)
 use syntax::errors::Handler;
 use syntax::util::move_map::MoveMap;
 use syntax::parse::token::{intern, InternedString};
-use syntax::parse::token::special_idents;
+use syntax::parse::token::{keywords, special_idents};
 use syntax::ptr::P;
 
 use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self_, Ty};
@@ -635,7 +635,7 @@ fn create_derived_impl(&self,
 
         cx.item(
             self.span,
-            special_idents::invalid,
+            special_idents::Invalid,
             a,
             ast::ItemKind::Impl(unsafety,
                                 ast::ImplPolarity::Positive,
@@ -866,7 +866,7 @@ fn create_method(&self,
             // creating fresh self id
             _ => Some(ast::Arg::new_self(trait_.span,
                                          ast::Mutability::Immutable,
-                                         special_idents::self_))
+                                         keywords::SelfValue.ident))
         };
         let args = {
             let args = arg_types.into_iter().map(|(name, ty)| {
index a924cc0695377f8bc02d9257c93a649926c48aea..972983c25386b2decf05e09a4c266448d86ae7aa 100644 (file)
@@ -19,7 +19,7 @@
 use syntax::ext::base::ExtCtxt;
 use syntax::ext::build::AstBuilder;
 use syntax::codemap::{Span,respan};
-use syntax::parse::token::special_idents;
+use syntax::parse::token::keywords;
 use syntax::ptr::P;
 
 /// The types of pointers
@@ -264,7 +264,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
     let self_path = cx.expr_self(span);
     match *self_ptr {
         None => {
-            (self_path, respan(span, ast::SelfKind::Value(special_idents::self_)))
+            (self_path, respan(span, ast::SelfKind::Value(keywords::SelfValue.ident)))
         }
         Some(ref ptr) => {
             let self_ty = respan(
@@ -272,7 +272,7 @@ pub fn get_explicit_self(cx: &ExtCtxt, span: Span, self_ptr: &Option<PtrTy>)
                 match *ptr {
                     Borrowed(ref lt, mutbl) => {
                         let lt = lt.map(|s| cx.lifetime(span, cx.ident_of(s).name));
-                        ast::SelfKind::Region(lt, mutbl, special_idents::self_)
+                        ast::SelfKind::Region(lt, mutbl, keywords::SelfValue.ident)
                     }
                     Raw(_) => cx.span_bug(span, "attempted to use *self in deriving definition")
                 });
index c8341a057a1c9a7c5890000e3c75f2665146ecfc..828f4a72e1fe9c01012fededbfa212c66e05f42f 100644 (file)
@@ -449,7 +449,7 @@ fn static_array(ecx: &mut ExtCtxt,
         let sp = piece_ty.span;
         let ty = ecx.ty_rptr(sp,
             ecx.ty(sp, ast::TyKind::Vec(piece_ty)),
-            Some(ecx.lifetime(sp, special_idents::static_lifetime.name)),
+            Some(ecx.lifetime(sp, special_idents::StaticLifetime.name)),
             ast::Mutability::Immutable);
         let slice = ecx.expr_vec_slice(sp, pieces);
         // static instead of const to speed up codegen by not requiring this to be inlined
@@ -475,7 +475,7 @@ fn into_expr(mut self) -> P<ast::Expr> {
 
         // First, build up the static array which will become our precompiled
         // format "string"
-        let static_lifetime = self.ecx.lifetime(self.fmtsp, special_idents::static_lifetime.name);
+        let static_lifetime = self.ecx.lifetime(self.fmtsp, special_idents::StaticLifetime.name);
         let piece_ty = self.ecx.ty_rptr(
                 self.fmtsp,
                 self.ecx.ty_ident(self.fmtsp, self.ecx.ident_of("str")),