Stop interning stability.
This commit is contained in:
parent
cb4ee81ef5
commit
227d912489
7 changed files with 24 additions and 47 deletions
|
@ -57,11 +57,11 @@ impl DeprecationEntry {
|
|||
|
||||
/// A stability index, giving the stability level for items and methods.
|
||||
#[derive(HashStable, Debug)]
|
||||
pub struct Index<'tcx> {
|
||||
pub struct Index {
|
||||
/// This is mostly a cache, except the stabilities of local items
|
||||
/// are filled by the annotator.
|
||||
pub stab_map: FxHashMap<LocalDefId, &'tcx Stability>,
|
||||
pub const_stab_map: FxHashMap<LocalDefId, &'tcx ConstStability>,
|
||||
pub stab_map: FxHashMap<LocalDefId, Stability>,
|
||||
pub const_stab_map: FxHashMap<LocalDefId, ConstStability>,
|
||||
pub depr_map: FxHashMap<LocalDefId, DeprecationEntry>,
|
||||
|
||||
/// Maps for each crate whether it is part of the staged API.
|
||||
|
@ -71,12 +71,12 @@ pub struct Index<'tcx> {
|
|||
pub active_features: FxHashSet<Symbol>,
|
||||
}
|
||||
|
||||
impl<'tcx> Index<'tcx> {
|
||||
pub fn local_stability(&self, def_id: LocalDefId) -> Option<&'tcx Stability> {
|
||||
impl Index {
|
||||
pub fn local_stability(&self, def_id: LocalDefId) -> Option<Stability> {
|
||||
self.stab_map.get(&def_id).copied()
|
||||
}
|
||||
|
||||
pub fn local_const_stability(&self, def_id: LocalDefId) -> Option<&'tcx ConstStability> {
|
||||
pub fn local_const_stability(&self, def_id: LocalDefId) -> Option<ConstStability> {
|
||||
self.const_stab_map.get(&def_id).copied()
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
match stability {
|
||||
Some(&Stability {
|
||||
Some(Stability {
|
||||
level: attr::Unstable { reason, issue, is_soft }, feature, ..
|
||||
}) => {
|
||||
if span.allows_unstable(feature) {
|
||||
|
|
|
@ -1010,12 +1010,12 @@ rustc_queries! {
|
|||
separate_provide_extern
|
||||
}
|
||||
|
||||
query lookup_stability(def_id: DefId) -> Option<&'tcx attr::Stability> {
|
||||
query lookup_stability(def_id: DefId) -> Option<attr::Stability> {
|
||||
desc { |tcx| "looking up stability of `{}`", tcx.def_path_str(def_id) }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
||||
query lookup_const_stability(def_id: DefId) -> Option<&'tcx attr::ConstStability> {
|
||||
query lookup_const_stability(def_id: DefId) -> Option<attr::ConstStability> {
|
||||
desc { |tcx| "looking up const stability of `{}`", tcx.def_path_str(def_id) }
|
||||
separate_provide_extern
|
||||
}
|
||||
|
@ -1626,7 +1626,7 @@ rustc_queries! {
|
|||
desc { |tcx| "names_imported_by_glob_use for `{}`", tcx.def_path_str(def_id.to_def_id()) }
|
||||
}
|
||||
|
||||
query stability_index(_: ()) -> stability::Index<'tcx> {
|
||||
query stability_index(_: ()) -> stability::Index {
|
||||
storage(ArenaCacheSelector<'tcx>)
|
||||
eval_always
|
||||
desc { "calculating the stability index for the local crate" }
|
||||
|
|
|
@ -24,7 +24,6 @@ use crate::ty::{
|
|||
RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar, TyVid, TypeAndMut, UintTy,
|
||||
};
|
||||
use rustc_ast as ast;
|
||||
use rustc_attr as attr;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
|
@ -116,12 +115,6 @@ pub struct CtxtInterners<'tcx> {
|
|||
bound_variable_kinds: InternedSet<'tcx, List<ty::BoundVariableKind>>,
|
||||
layout: InternedSet<'tcx, Layout>,
|
||||
adt_def: InternedSet<'tcx, AdtDef>,
|
||||
|
||||
/// `#[stable]` and `#[unstable]` attributes
|
||||
stability: InternedSet<'tcx, attr::Stability>,
|
||||
|
||||
/// `#[rustc_const_stable]` and `#[rustc_const_unstable]` attributes
|
||||
const_stability: InternedSet<'tcx, attr::ConstStability>,
|
||||
}
|
||||
|
||||
impl<'tcx> CtxtInterners<'tcx> {
|
||||
|
@ -143,8 +136,6 @@ impl<'tcx> CtxtInterners<'tcx> {
|
|||
bound_variable_kinds: Default::default(),
|
||||
layout: Default::default(),
|
||||
adt_def: Default::default(),
|
||||
stability: Default::default(),
|
||||
const_stability: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1262,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
self.diagnostic_items(did.krate).name_to_id.get(&name) == Some(&did)
|
||||
}
|
||||
|
||||
pub fn stability(self) -> &'tcx stability::Index<'tcx> {
|
||||
pub fn stability(self) -> &'tcx stability::Index {
|
||||
self.stability_index(())
|
||||
}
|
||||
|
||||
|
@ -1981,12 +1972,6 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
writeln!(fmt, "InternalSubsts interner: #{}", self.0.interners.substs.len())?;
|
||||
writeln!(fmt, "Region interner: #{}", self.0.interners.region.len())?;
|
||||
writeln!(fmt, "Stability interner: #{}", self.0.interners.stability.len())?;
|
||||
writeln!(
|
||||
fmt,
|
||||
"Const Stability interner: #{}",
|
||||
self.0.interners.const_stability.len()
|
||||
)?;
|
||||
writeln!(
|
||||
fmt,
|
||||
"Const Allocation interner: #{}",
|
||||
|
@ -2174,8 +2159,6 @@ direct_interners_old! {
|
|||
const_allocation: intern_const_alloc(Allocation),
|
||||
layout: intern_layout(Layout),
|
||||
adt_def: intern_adt_def(AdtDef),
|
||||
stability: intern_stability(attr::Stability),
|
||||
const_stability: intern_const_stability(attr::ConstStability),
|
||||
}
|
||||
|
||||
macro_rules! slice_interners {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue