@@ -10,7 +10,7 @@ use rustc_attr::{
10
10
} ;
11
11
use rustc_data_structures:: fx:: FxIndexMap ;
12
12
use rustc_data_structures:: unord:: { ExtendUnord , UnordMap , UnordSet } ;
13
- use rustc_feature:: ACCEPTED_LANG_FEATURES ;
13
+ use rustc_feature:: { ACCEPTED_LANG_FEATURES , EnabledLangFeature , EnabledLibFeature } ;
14
14
use rustc_hir as hir;
15
15
use rustc_hir:: def:: { DefKind , Res } ;
16
16
use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
@@ -994,25 +994,25 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
994
994
995
995
let enabled_lang_features = tcx. features ( ) . enabled_lang_features ( ) ;
996
996
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 {
999
999
// 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 ) ;
1001
1001
}
1002
- if !lang_features. insert ( feature ) {
1002
+ if !lang_features. insert ( gate_name ) {
1003
1003
// 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 } ) ;
1005
1005
}
1006
1006
}
1007
1007
1008
1008
let enabled_lib_features = tcx. features ( ) . enabled_lib_features ( ) ;
1009
1009
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 ) {
1012
1012
// 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 } ) ;
1014
1014
}
1015
- remaining_lib_features. insert ( feature , * span ) ;
1015
+ remaining_lib_features. insert ( * gate_name , * attr_sp ) ;
1016
1016
}
1017
1017
// `stdbuild` has special handling for `libc`, so we need to
1018
1018
// recognise the feature when building std.
@@ -1044,7 +1044,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
1044
1044
/// time, less loading from metadata is performed and thus compiler performance is improved.
1045
1045
fn check_features < ' tcx > (
1046
1046
tcx : TyCtxt < ' tcx > ,
1047
- remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
1047
+ remaining_lib_features : & mut FxIndexMap < Symbol , Span > ,
1048
1048
remaining_implications : & mut UnordMap < Symbol , Symbol > ,
1049
1049
defined_features : & LibFeatures ,
1050
1050
all_implications : & UnordMap < Symbol , Symbol > ,
@@ -1114,7 +1114,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
1114
1114
}
1115
1115
1116
1116
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 } ) ;
1118
1118
}
1119
1119
1120
1120
for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
0 commit comments