@@ -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 } ;
@@ -937,25 +937,25 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
937
937
938
938
let enabled_lang_features = tcx. features ( ) . enabled_lang_features ( ) ;
939
939
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 {
942
942
// 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 ) ;
944
944
}
945
- if !lang_features. insert ( feature ) {
945
+ if !lang_features. insert ( gate_name ) {
946
946
// 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 } ) ;
948
948
}
949
949
}
950
950
951
951
let enabled_lib_features = tcx. features ( ) . enabled_lib_features ( ) ;
952
952
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 ) {
955
955
// 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 } ) ;
957
957
}
958
- remaining_lib_features. insert ( feature , * span ) ;
958
+ remaining_lib_features. insert ( * gate_name , * attr_sp ) ;
959
959
}
960
960
// `stdbuild` has special handling for `libc`, so we need to
961
961
// recognise the feature when building std.
@@ -987,7 +987,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
987
987
/// time, less loading from metadata is performed and thus compiler performance is improved.
988
988
fn check_features < ' tcx > (
989
989
tcx : TyCtxt < ' tcx > ,
990
- remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
990
+ remaining_lib_features : & mut FxIndexMap < Symbol , Span > ,
991
991
remaining_implications : & mut UnordMap < Symbol , Symbol > ,
992
992
defined_features : & LibFeatures ,
993
993
all_implications : & UnordMap < Symbol , Symbol > ,
@@ -1057,7 +1057,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
1057
1057
}
1058
1058
1059
1059
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 } ) ;
1061
1061
}
1062
1062
1063
1063
for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
0 commit comments