Skip to content

Commit a54f6dc

Browse files
committed
Remove useless map.
1 parent 4870ee6 commit a54f6dc

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, DiagnosticBuilder};
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<'tcx> {
6363
pub stab_map: FxHashMap<LocalDefId, &'tcx Stability>,
6464
pub const_stab_map: FxHashMap<LocalDefId, &'tcx 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<'tcx> Index<'tcx> {

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};
@@ -656,12 +656,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'tcx> {
656656
}
657657

658658
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);
663659
let mut index = Index {
664-
staged_api,
665660
stab_map: Default::default(),
666661
const_stab_map: Default::default(),
667662
depr_map: Default::default(),
@@ -879,9 +874,10 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
879874
/// were expected to be library features), and the list of features used from
880875
/// libraries, identify activated features that don't exist and error about them.
881876
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(());
885881
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
886882
missing.check_missing_stability(CRATE_DEF_ID, tcx.hir().span(CRATE_HIR_ID));
887883
tcx.hir().walk_toplevel_module(&mut missing);

0 commit comments

Comments
 (0)