@@ -10,7 +10,7 @@ use rustc_attr::{
1010} ;
1111use rustc_data_structures:: fx:: FxIndexMap ;
1212use rustc_data_structures:: unord:: { ExtendUnord , UnordMap , UnordSet } ;
13- use rustc_feature:: ACCEPTED_LANG_FEATURES ;
13+ use rustc_feature:: { ACCEPTED_LANG_FEATURES , EnabledLangFeature , EnabledLibFeature } ;
1414use rustc_hir as hir;
1515use rustc_hir:: def:: { DefKind , Res } ;
1616use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
@@ -994,25 +994,25 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
994994
995995 let enabled_lang_features = tcx. features ( ) . enabled_lang_features ( ) ;
996996 let mut lang_features = UnordSet :: default ( ) ;
997- for & ( feature , span , since ) in enabled_lang_features {
998- if let Some ( since ) = since {
997+ for EnabledLangFeature { gate_name , attr_sp , stable_since } in enabled_lang_features {
998+ if let Some ( version ) = stable_since {
999999 // Warn if the user has enabled an already-stable lang feature.
1000- unnecessary_stable_feature_lint ( tcx, span , feature , since ) ;
1000+ unnecessary_stable_feature_lint ( tcx, * attr_sp , * gate_name , * version ) ;
10011001 }
1002- if !lang_features. insert ( feature ) {
1002+ if !lang_features. insert ( gate_name ) {
10031003 // Warn if the user enables a lang feature multiple times.
1004- tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span, feature } ) ;
1004+ tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * attr_sp , feature : * gate_name } ) ;
10051005 }
10061006 }
10071007
10081008 let enabled_lib_features = tcx. features ( ) . enabled_lib_features ( ) ;
10091009 let mut remaining_lib_features = FxIndexMap :: default ( ) ;
1010- for ( feature , span ) in enabled_lib_features {
1011- if remaining_lib_features. contains_key ( & feature ) {
1010+ for EnabledLibFeature { gate_name , attr_sp } in enabled_lib_features {
1011+ if remaining_lib_features. contains_key ( gate_name ) {
10121012 // Warn if the user enables a lib feature multiple times.
1013- tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * span , feature : * feature } ) ;
1013+ tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * attr_sp , feature : * gate_name } ) ;
10141014 }
1015- remaining_lib_features. insert ( feature , * span ) ;
1015+ remaining_lib_features. insert ( * gate_name , * attr_sp ) ;
10161016 }
10171017 // `stdbuild` has special handling for `libc`, so we need to
10181018 // recognise the feature when building std.
@@ -1044,7 +1044,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
10441044 /// time, less loading from metadata is performed and thus compiler performance is improved.
10451045 fn check_features < ' tcx > (
10461046 tcx : TyCtxt < ' tcx > ,
1047- remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
1047+ remaining_lib_features : & mut FxIndexMap < Symbol , Span > ,
10481048 remaining_implications : & mut UnordMap < Symbol , Symbol > ,
10491049 defined_features : & LibFeatures ,
10501050 all_implications : & UnordMap < Symbol , Symbol > ,
@@ -1114,7 +1114,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
11141114 }
11151115
11161116 for ( feature, span) in remaining_lib_features {
1117- tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature : * feature } ) ;
1117+ tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature } ) ;
11181118 }
11191119
11201120 for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
0 commit comments