diff options
| author | bors <bors@rust-lang.org> | 2022-02-24 10:02:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-24 10:02:26 +0000 |
| commit | 7ccfe2ff1d59666dc0188dfd5847304fec257565 (patch) | |
| tree | 48ab85a723d1398aa894f6fe89e88d01986b8f57 /compiler/rustc_middle/src | |
| parent | 1204400ab8da9830f6f77a5e40e7ad3ea459676a (diff) | |
| parent | 7afcf9fcd14af52e53e38ffe60b1eac9b3232b21 (diff) | |
| download | rust-7ccfe2ff1d59666dc0188dfd5847304fec257565.tar.gz rust-7ccfe2ff1d59666dc0188dfd5847304fec257565.zip | |
Auto merge of #94129 - cjgillot:rmeta-table, r=petrochenkov
Back more metadata using per-query tables r? `@ghost`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/middle/stability.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/query/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 19 |
3 files changed, 11 insertions, 28 deletions
diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index ac4a5985c2f..7a7d2470444 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -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) { diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 069dac969c6..c299dacfc92 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1016,12 +1016,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 } @@ -1636,7 +1636,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" } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 4b4fcaa9c18..7a6a6a00cc7 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -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; @@ -115,12 +114,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> { @@ -141,8 +134,6 @@ impl<'tcx> CtxtInterners<'tcx> { bound_variable_kinds: Default::default(), layout: Default::default(), adt_def: Default::default(), - stability: Default::default(), - const_stability: Default::default(), } } @@ -1268,7 +1259,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(()) } @@ -1997,12 +1988,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: #{}", @@ -2190,8 +2175,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 { |
