@@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
7
7
use rustc_errors:: struct_span_err;
8
8
use rustc_hir as hir;
9
9
use rustc_hir:: def:: { DefKind , Res } ;
10
- use rustc_hir:: def_id:: { DefId , LocalDefId , CRATE_DEF_ID , CRATE_DEF_INDEX , LOCAL_CRATE } ;
10
+ use rustc_hir:: def_id:: { DefId , LocalDefId , CRATE_DEF_ID , CRATE_DEF_INDEX } ;
11
11
use rustc_hir:: hir_id:: CRATE_HIR_ID ;
12
12
use rustc_hir:: intravisit:: { self , Visitor } ;
13
13
use rustc_hir:: { FieldDef , Generics , HirId , Item , TraitRef , Ty , TyKind , Variant } ;
@@ -656,12 +656,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
656
656
}
657
657
658
658
fn stability_index < ' tcx > ( tcx : TyCtxt < ' tcx > , ( ) : ( ) ) -> Index < ' tcx > {
659
- let is_staged_api =
660
- tcx. sess . opts . debugging_opts . force_unstable_if_unmarked || tcx. features ( ) . staged_api ;
661
- let mut staged_api = FxHashMap :: default ( ) ;
662
- staged_api. insert ( LOCAL_CRATE , is_staged_api) ;
663
659
let mut index = Index {
664
- staged_api,
665
660
stab_map : Default :: default ( ) ,
666
661
const_stab_map : Default :: default ( ) ,
667
662
depr_map : Default :: default ( ) ,
@@ -879,9 +874,10 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
879
874
/// were expected to be library features), and the list of features used from
880
875
/// libraries, identify activated features that don't exist and error about them.
881
876
pub fn check_unused_or_stable_features ( tcx : TyCtxt < ' _ > ) {
882
- let access_levels = & tcx. privacy_access_levels ( ( ) ) ;
883
-
884
- if tcx. stability ( ) . staged_api [ & LOCAL_CRATE ] {
877
+ let is_staged_api =
878
+ tcx. sess . opts . debugging_opts . force_unstable_if_unmarked || tcx. features ( ) . staged_api ;
879
+ if is_staged_api {
880
+ let access_levels = & tcx. privacy_access_levels ( ( ) ) ;
885
881
let mut missing = MissingStabilityAnnotations { tcx, access_levels } ;
886
882
missing. check_missing_stability ( CRATE_DEF_ID , tcx. hir ( ) . span ( CRATE_HIR_ID ) ) ;
887
883
tcx. hir ( ) . walk_toplevel_module ( & mut missing) ;
0 commit comments