@@ -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 } ;
@@ -937,25 +937,25 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
937937
938938 let enabled_lang_features = tcx. features ( ) . enabled_lang_features ( ) ;
939939 let mut lang_features = UnordSet :: default ( ) ;
940- for & ( feature , span , since ) in enabled_lang_features {
941- if let Some ( since ) = since {
940+ for EnabledLangFeature { gate_name , attr_sp , stable_since } in enabled_lang_features {
941+ if let Some ( version ) = stable_since {
942942 // Warn if the user has enabled an already-stable lang feature.
943- unnecessary_stable_feature_lint ( tcx, span , feature , since ) ;
943+ unnecessary_stable_feature_lint ( tcx, * attr_sp , * gate_name , * version ) ;
944944 }
945- if !lang_features. insert ( feature ) {
945+ if !lang_features. insert ( gate_name ) {
946946 // Warn if the user enables a lang feature multiple times.
947- tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span, feature } ) ;
947+ tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * attr_sp , feature : * gate_name } ) ;
948948 }
949949 }
950950
951951 let enabled_lib_features = tcx. features ( ) . enabled_lib_features ( ) ;
952952 let mut remaining_lib_features = FxIndexMap :: default ( ) ;
953- for ( feature , span ) in enabled_lib_features {
954- if remaining_lib_features. contains_key ( & feature ) {
953+ for EnabledLibFeature { gate_name , attr_sp } in enabled_lib_features {
954+ if remaining_lib_features. contains_key ( gate_name ) {
955955 // Warn if the user enables a lib feature multiple times.
956- tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * span , feature : * feature } ) ;
956+ tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * attr_sp , feature : * gate_name } ) ;
957957 }
958- remaining_lib_features. insert ( feature , * span ) ;
958+ remaining_lib_features. insert ( * gate_name , * attr_sp ) ;
959959 }
960960 // `stdbuild` has special handling for `libc`, so we need to
961961 // recognise the feature when building std.
@@ -987,7 +987,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
987987 /// time, less loading from metadata is performed and thus compiler performance is improved.
988988 fn check_features < ' tcx > (
989989 tcx : TyCtxt < ' tcx > ,
990- remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
990+ remaining_lib_features : & mut FxIndexMap < Symbol , Span > ,
991991 remaining_implications : & mut UnordMap < Symbol , Symbol > ,
992992 defined_features : & LibFeatures ,
993993 all_implications : & UnordMap < Symbol , Symbol > ,
@@ -1057,7 +1057,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
10571057 }
10581058
10591059 for ( feature, span) in remaining_lib_features {
1060- tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature : * feature } ) ;
1060+ tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature } ) ;
10611061 }
10621062
10631063 for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
0 commit comments