@@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
77use rustc_errors:: struct_span_err;
88use rustc_hir as hir;
99use 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 } ;
1111use rustc_hir:: hir_id:: CRATE_HIR_ID ;
1212use rustc_hir:: intravisit:: { self , Visitor } ;
1313use rustc_hir:: { FieldDef , Generics , HirId , Item , TraitRef , Ty , TyKind , Variant } ;
@@ -654,12 +654,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
654654}
655655
656656fn 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) ;
661657 let mut index = Index {
662- staged_api,
663658 stab_map : Default :: default ( ) ,
664659 const_stab_map : Default :: default ( ) ,
665660 depr_map : Default :: default ( ) ,
@@ -873,9 +868,10 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
873868/// were expected to be library features), and the list of features used from
874869/// libraries, identify activated features that don't exist and error about them.
875870pub 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 ( ( ) ) ;
879875 let mut missing = MissingStabilityAnnotations { tcx, access_levels } ;
880876 missing. check_missing_stability ( CRATE_DEF_ID , tcx. hir ( ) . span ( CRATE_HIR_ID ) ) ;
881877 tcx. hir ( ) . walk_toplevel_module ( & mut missing) ;
0 commit comments