@@ -21,7 +21,7 @@ use hir::def::Def;
21
21
use hir:: def_id:: { CrateNum , CRATE_DEF_INDEX , DefId , DefIndex , LOCAL_CRATE } ;
22
22
use ty:: { self , TyCtxt , AdtKind } ;
23
23
use middle:: privacy:: AccessLevels ;
24
- use syntax:: symbol:: InternedString ;
24
+ use syntax:: symbol:: Symbol ;
25
25
use syntax_pos:: { Span , DUMMY_SP } ;
26
26
use syntax:: ast;
27
27
use syntax:: ast:: { NodeId , Attribute } ;
@@ -36,7 +36,6 @@ use hir::pat_util::EnumerateAndAdjustIterator;
36
36
37
37
use std:: mem:: replace;
38
38
use std:: cmp:: Ordering ;
39
- use std:: ops:: Deref ;
40
39
41
40
#[ derive( RustcEncodable , RustcDecodable , PartialEq , PartialOrd , Clone , Copy , Debug , Eq , Hash ) ]
42
41
pub enum StabilityLevel {
@@ -151,10 +150,11 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
151
150
152
151
// Check if deprecated_since < stable_since. If it is,
153
152
// 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 ) {
156
155
// 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 ( "." ) ) {
158
158
if let ( Ok ( dep_v) , Ok ( stab_v) ) = ( dep_v. parse :: < u64 > ( ) , stab_v. parse ( ) ) {
159
159
match dep_v. cmp ( & stab_v) {
160
160
Ordering :: Less => {
@@ -356,7 +356,7 @@ impl<'a, 'tcx> Index<'tcx> {
356
356
/// features and possibly prints errors. Returns a list of all
357
357
/// features used.
358
358
pub fn check_unstable_api_usage < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > )
359
- -> FxHashMap < InternedString , attr:: StabilityLevel > {
359
+ -> FxHashMap < Symbol , attr:: StabilityLevel > {
360
360
let _task = tcx. dep_graph . in_task ( DepNode :: StabilityCheck ) ;
361
361
let ref active_lib_features = tcx. sess . features . borrow ( ) . declared_lib_features ;
362
362
@@ -376,8 +376,8 @@ pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>)
376
376
377
377
struct Checker < ' a , ' tcx : ' a > {
378
378
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 > ,
381
381
// Within a block where feature gate checking can be skipped.
382
382
in_skip_block : u32 ,
383
383
}
@@ -407,10 +407,10 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
407
407
if !self . active_features . contains ( feature) {
408
408
let msg = match * reason {
409
409
Some ( ref r) => format ! ( "use of unstable library feature '{}': {}" ,
410
- & feature, & r) ,
410
+ & feature. as_str ( ) , & r) ,
411
411
None => format ! ( "use of unstable library feature '{}'" , & feature)
412
412
} ;
413
- emit_feature_err ( & self . tcx . sess . parse_sess , & feature, span,
413
+ emit_feature_err ( & self . tcx . sess . parse_sess , & feature. as_str ( ) , span,
414
414
GateIssue :: Library ( Some ( issue) ) , & msg) ;
415
415
}
416
416
}
@@ -735,18 +735,18 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
735
735
/// were expected to be library features), and the list of features used from
736
736
/// libraries, identify activated features that don't exist and error about them.
737
737
pub fn check_unused_or_stable_features ( sess : & Session ,
738
- lib_features_used : & FxHashMap < InternedString ,
738
+ lib_features_used : & FxHashMap < Symbol ,
739
739
attr:: StabilityLevel > ) {
740
740
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 >
742
742
= declared_lib_features. clone ( ) . into_iter ( ) . collect ( ) ;
743
743
744
744
fn format_stable_since_msg ( version : & str ) -> String {
745
745
format ! ( "this feature has been stable since {}. Attribute no longer needed" , version)
746
746
}
747
747
748
748
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 ( ) )
750
750
. expect ( "unexpectedly couldn't find version feature was stabilized" ) ;
751
751
sess. add_lint ( lint:: builtin:: STABLE_FEATURES ,
752
752
ast:: CRATE_NODE_ID ,
@@ -761,7 +761,7 @@ pub fn check_unused_or_stable_features(sess: &Session,
761
761
sess. add_lint ( lint:: builtin:: STABLE_FEATURES ,
762
762
ast:: CRATE_NODE_ID ,
763
763
span,
764
- format_stable_since_msg ( version. deref ( ) ) ) ;
764
+ format_stable_since_msg ( & version. as_str ( ) ) ) ;
765
765
}
766
766
}
767
767
None => ( /* used but undeclared, handled during the previous ast visit */ )
0 commit comments