@@ -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 } ;
@@ -654,12 +654,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
654
654
}
655
655
656
656
fn stability_index ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> Index {
657
- let is_staged_api =
658
- tcx. sess . opts . debugging_opts . force_unstable_if_unmarked || tcx. features ( ) . staged_api ;
659
- let mut staged_api = FxHashMap :: default ( ) ;
660
- staged_api. insert ( LOCAL_CRATE , is_staged_api) ;
661
657
let mut index = Index {
662
- staged_api,
663
658
stab_map : Default :: default ( ) ,
664
659
const_stab_map : Default :: default ( ) ,
665
660
depr_map : Default :: default ( ) ,
@@ -873,9 +868,10 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
873
868
/// were expected to be library features), and the list of features used from
874
869
/// libraries, identify activated features that don't exist and error about them.
875
870
pub fn check_unused_or_stable_features ( tcx : TyCtxt < ' _ > ) {
876
- let access_levels = & tcx. privacy_access_levels ( ( ) ) ;
877
-
878
- if tcx. stability ( ) . staged_api [ & LOCAL_CRATE ] {
871
+ let is_staged_api =
872
+ tcx. sess . opts . debugging_opts . force_unstable_if_unmarked || tcx. features ( ) . staged_api ;
873
+ if is_staged_api {
874
+ let access_levels = & tcx. privacy_access_levels ( ( ) ) ;
879
875
let mut missing = MissingStabilityAnnotations { tcx, access_levels } ;
880
876
missing. check_missing_stability ( CRATE_DEF_ID , tcx. hir ( ) . span ( CRATE_HIR_ID ) ) ;
881
877
tcx. hir ( ) . walk_toplevel_module ( & mut missing) ;
0 commit comments