@@ -21,7 +21,7 @@ use hir::def::Def;
2121use hir:: def_id:: { CrateNum , CRATE_DEF_INDEX , DefId , DefIndex , LOCAL_CRATE } ;
2222use ty:: { self , TyCtxt , AdtKind } ;
2323use middle:: privacy:: AccessLevels ;
24- use syntax:: symbol:: InternedString ;
24+ use syntax:: symbol:: Symbol ;
2525use syntax_pos:: { Span , DUMMY_SP } ;
2626use syntax:: ast;
2727use syntax:: ast:: { NodeId , Attribute } ;
@@ -36,7 +36,6 @@ use hir::pat_util::EnumerateAndAdjustIterator;
3636
3737use std:: mem:: replace;
3838use std:: cmp:: Ordering ;
39- use std:: ops:: Deref ;
4039
4140#[ derive( RustcEncodable , RustcDecodable , PartialEq , PartialOrd , Clone , Copy , Debug , Eq , Hash ) ]
4241pub enum StabilityLevel {
@@ -151,10 +150,11 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
151150
152151 // Check if deprecated_since < stable_since. If it is,
153152 // this is *almost surely* an accident.
154- if let ( & Some ( attr:: RustcDeprecation { since : ref dep_since, ..} ) ,
155- & attr:: Stable { since : ref stab_since} ) = ( & stab. rustc_depr , & stab. level ) {
153+ if let ( & Some ( attr:: RustcDeprecation { since : dep_since, ..} ) ,
154+ & attr:: Stable { since : stab_since} ) = ( & stab. rustc_depr , & stab. level ) {
156155 // Explicit version of iter::order::lt to handle parse errors properly
157- for ( dep_v, stab_v) in dep_since. split ( "." ) . zip ( stab_since. split ( "." ) ) {
156+ for ( dep_v, stab_v) in
157+ dep_since. as_str ( ) . split ( "." ) . zip ( stab_since. as_str ( ) . split ( "." ) ) {
158158 if let ( Ok ( dep_v) , Ok ( stab_v) ) = ( dep_v. parse :: < u64 > ( ) , stab_v. parse ( ) ) {
159159 match dep_v. cmp ( & stab_v) {
160160 Ordering :: Less => {
@@ -356,7 +356,7 @@ impl<'a, 'tcx> Index<'tcx> {
356356/// features and possibly prints errors. Returns a list of all
357357/// features used.
358358pub fn check_unstable_api_usage < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > )
359- -> FxHashMap < InternedString , attr:: StabilityLevel > {
359+ -> FxHashMap < Symbol , attr:: StabilityLevel > {
360360 let _task = tcx. dep_graph . in_task ( DepNode :: StabilityCheck ) ;
361361 let ref active_lib_features = tcx. sess . features . borrow ( ) . declared_lib_features ;
362362
@@ -376,8 +376,8 @@ pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
376376
377377struct Checker < ' a , ' tcx : ' a > {
378378 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
379- active_features : FxHashSet < InternedString > ,
380- used_features : FxHashMap < InternedString , attr:: StabilityLevel > ,
379+ active_features : FxHashSet < Symbol > ,
380+ used_features : FxHashMap < Symbol , attr:: StabilityLevel > ,
381381 // Within a block where feature gate checking can be skipped.
382382 in_skip_block : u32 ,
383383}
@@ -407,10 +407,10 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
407407 if !self . active_features . contains ( feature) {
408408 let msg = match * reason {
409409 Some ( ref r) => format ! ( "use of unstable library feature '{}': {}" ,
410- & feature, & r) ,
410+ & feature. as_str ( ) , & r) ,
411411 None => format ! ( "use of unstable library feature '{}'" , & feature)
412412 } ;
413- emit_feature_err ( & self . tcx . sess . parse_sess , & feature, span,
413+ emit_feature_err ( & self . tcx . sess . parse_sess , & feature. as_str ( ) , span,
414414 GateIssue :: Library ( Some ( issue) ) , & msg) ;
415415 }
416416 }
@@ -735,18 +735,18 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
735735/// were expected to be library features), and the list of features used from
736736/// libraries, identify activated features that don't exist and error about them.
737737pub fn check_unused_or_stable_features ( sess : & Session ,
738- lib_features_used : & FxHashMap < InternedString ,
738+ lib_features_used : & FxHashMap < Symbol ,
739739 attr:: StabilityLevel > ) {
740740 let ref declared_lib_features = sess. features . borrow ( ) . declared_lib_features ;
741- let mut remaining_lib_features: FxHashMap < InternedString , Span >
741+ let mut remaining_lib_features: FxHashMap < Symbol , Span >
742742 = declared_lib_features. clone ( ) . into_iter ( ) . collect ( ) ;
743743
744744 fn format_stable_since_msg ( version : & str ) -> String {
745745 format ! ( "this feature has been stable since {}. Attribute no longer needed" , version)
746746 }
747747
748748 for & ( ref stable_lang_feature, span) in & sess. features . borrow ( ) . declared_stable_lang_features {
749- let version = find_lang_feature_accepted_version ( stable_lang_feature. deref ( ) )
749+ let version = find_lang_feature_accepted_version ( & stable_lang_feature. as_str ( ) )
750750 . expect ( "unexpectedly couldn't find version feature was stabilized" ) ;
751751 sess. add_lint ( lint:: builtin:: STABLE_FEATURES ,
752752 ast:: CRATE_NODE_ID ,
@@ -761,7 +761,7 @@ pub fn check_unused_or_stable_features(sess: &Session,
761761 sess. add_lint ( lint:: builtin:: STABLE_FEATURES ,
762762 ast:: CRATE_NODE_ID ,
763763 span,
764- format_stable_since_msg ( version. deref ( ) ) ) ;
764+ format_stable_since_msg ( & version. as_str ( ) ) ) ;
765765 }
766766 }
767767 None => ( /* used but undeclared, handled during the previous ast visit */ )
0 commit comments