@@ -10,7 +10,9 @@ 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 , EnabledLangFeature , LangFeatureStability } ;
13
+ use rustc_feature:: {
14
+ ACCEPTED_LANG_FEATURES , EnabledLangFeature , EnabledLibFeature , LangFeatureStability ,
15
+ } ;
14
16
use rustc_hir as hir;
15
17
use rustc_hir:: def:: { DefKind , Res } ;
16
18
use rustc_hir:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
@@ -950,12 +952,12 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
950
952
951
953
let enabled_lib_features = tcx. features ( ) . enabled_lib_features ( ) ;
952
954
let mut remaining_lib_features = FxIndexMap :: default ( ) ;
953
- for ( feature , span ) in enabled_lib_features {
954
- if remaining_lib_features. contains_key ( & feature ) {
955
+ for EnabledLibFeature { gate_name , attr_sp } in enabled_lib_features {
956
+ if remaining_lib_features. contains_key ( gate_name ) {
955
957
// Warn if the user enables a lib feature multiple times.
956
- tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * span , feature : * feature } ) ;
958
+ tcx. dcx ( ) . emit_err ( errors:: DuplicateFeatureErr { span : * attr_sp , feature : * gate_name } ) ;
957
959
}
958
- remaining_lib_features. insert ( feature , * span ) ;
960
+ remaining_lib_features. insert ( * gate_name , * attr_sp ) ;
959
961
}
960
962
// `stdbuild` has special handling for `libc`, so we need to
961
963
// recognise the feature when building std.
@@ -987,7 +989,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
987
989
/// time, less loading from metadata is performed and thus compiler performance is improved.
988
990
fn check_features < ' tcx > (
989
991
tcx : TyCtxt < ' tcx > ,
990
- remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
992
+ remaining_lib_features : & mut FxIndexMap < Symbol , Span > ,
991
993
remaining_implications : & mut UnordMap < Symbol , Symbol > ,
992
994
defined_features : & LibFeatures ,
993
995
all_implications : & UnordMap < Symbol , Symbol > ,
@@ -1057,7 +1059,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
1057
1059
}
1058
1060
1059
1061
for ( feature, span) in remaining_lib_features {
1060
- tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature : * feature } ) ;
1062
+ tcx. dcx ( ) . emit_err ( errors:: UnknownFeature { span, feature } ) ;
1061
1063
}
1062
1064
1063
1065
for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
0 commit comments