Skip to content

Commit 47f71b0

Browse files
committed
Remove useless map.
1 parent 12b80a4 commit 47f71b0

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

compiler/rustc_middle/src/middle/stability.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_errors::{Applicability, Diagnostic};
1111
use rustc_feature::GateIssue;
1212
use rustc_hir as hir;
1313
use rustc_hir::def::DefKind;
14-
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX};
14+
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_INDEX};
1515
use rustc_hir::{self, HirId};
1616
use rustc_middle::ty::print::with_no_trimmed_paths;
1717
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
@@ -63,9 +63,6 @@ pub struct Index {
6363
pub stab_map: FxHashMap<LocalDefId, Stability>,
6464
pub const_stab_map: FxHashMap<LocalDefId, ConstStability>,
6565
pub depr_map: FxHashMap<LocalDefId, DeprecationEntry>,
66-
67-
/// Maps for each crate whether it is part of the staged API.
68-
pub staged_api: FxHashMap<CrateNum, bool>,
6966
}
7067

7168
impl Index {

compiler/rustc_passes/src/stability.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
77
use rustc_errors::struct_span_err;
88
use rustc_hir as hir;
99
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};
1111
use rustc_hir::hir_id::CRATE_HIR_ID;
1212
use rustc_hir::intravisit::{self, Visitor};
1313
use rustc_hir::{FieldDef, Generics, HirId, Item, TraitRef, Ty, TyKind, Variant};
@@ -654,12 +654,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
654654
}
655655

656656
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);
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.
875870
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(());
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

Comments
 (0)