@@ -62,7 +62,7 @@ use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, IntTy, UintTy};
6262use syntax:: attr:: AttrMetaMethods ;
6363use syntax:: codemap:: { self , Span , Pos } ;
6464use syntax:: errors:: DiagnosticBuilder ;
65- use syntax:: parse:: token:: { self , special_names , special_idents} ;
65+ use syntax:: parse:: token:: { self , keywords , special_idents} ;
6666use syntax:: util:: lev_distance:: find_best_match_for_name;
6767
6868use rustc:: hir:: intravisit:: { self , FnKind , Visitor } ;
@@ -1954,8 +1954,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
19541954 let mut self_type_rib = Rib :: new ( NormalRibKind ) ;
19551955
19561956 // plain insert (no renaming, types are not currently hygienic....)
1957- let name = special_names:: type_self;
1958- self_type_rib. bindings . insert ( name, self_def) ;
1957+ self_type_rib. bindings . insert ( keywords:: SelfType . ident . name , self_def) ;
19591958 self . type_ribs . push ( self_type_rib) ;
19601959 f ( self ) ;
19611960 if !self . resolved {
@@ -2195,11 +2194,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
21952194 "type name"
21962195 } ;
21972196
2198- let self_type_name = special_idents:: type_self. name ;
21992197 let is_invalid_self_type_name = path. segments . len ( ) > 0 &&
22002198 maybe_qself. is_none ( ) &&
22012199 path. segments [ 0 ] . identifier . name ==
2202- self_type_name ;
2200+ keywords :: SelfType . ident . name ;
22032201 if is_invalid_self_type_name {
22042202 resolve_error ( self ,
22052203 ty. span ,
@@ -2643,7 +2641,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
26432641 namespace : Namespace ,
26442642 record_used : bool )
26452643 -> Option < LocalDef > {
2646- if identifier. name == special_idents:: invalid . name {
2644+ if identifier. name == special_idents:: Invalid . name {
26472645 return Some ( LocalDef :: from_def ( Def :: Err ) ) ;
26482646 }
26492647
@@ -3074,7 +3072,8 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
30743072 false // Stop advancing
30753073 } ) ;
30763074
3077- if method_scope && special_names:: self_. as_str ( ) == & path_name[ ..] {
3075+ if method_scope &&
3076+ & path_name[ ..] == keywords:: SelfValue . ident . name . as_str ( ) {
30783077 resolve_error ( self ,
30793078 expr. span ,
30803079 ResolutionError :: SelfNotAvailableInStaticMethod ) ;
@@ -3612,7 +3611,7 @@ fn module_to_string(module: Module) -> String {
36123611 }
36133612 BlockParentLink ( ref module, _) => {
36143613 // danger, shouldn't be ident?
3615- names. push ( special_idents :: opaque. name ) ;
3614+ names. push ( token :: intern ( "< opaque>" ) ) ;
36163615 collect_mod ( names, module) ;
36173616 }
36183617 }
0 commit comments