Remove unneeded Lrc in query results.
This commit is contained in:
parent
5e1ad0d1e4
commit
81f0e90c62
7 changed files with 21 additions and 19 deletions
|
@ -1197,7 +1197,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_item_attrs(&self, node_id: DefIndex, sess: &Session) -> Lrc<[ast::Attribute]> {
|
||||
fn get_item_attrs(&self, node_id: DefIndex, sess: &Session) -> Vec<ast::Attribute> {
|
||||
// The attributes for a tuple struct/variant are attached to the definition, not the ctor;
|
||||
// we assume that someone passing in a tuple struct ctor is actually wanting to
|
||||
// look at the definition
|
||||
|
@ -1208,15 +1208,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
node_id
|
||||
};
|
||||
|
||||
Lrc::from(
|
||||
self.root
|
||||
.tables
|
||||
.attributes
|
||||
.get(self, item_id)
|
||||
.unwrap_or(Lazy::empty())
|
||||
.decode((self, sess))
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
self.root
|
||||
.tables
|
||||
.attributes
|
||||
.get(self, item_id)
|
||||
.unwrap_or(Lazy::empty())
|
||||
.decode((self, sess))
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
fn get_struct_field_names(&self, id: DefIndex, sess: &Session) -> Vec<Spanned<ast::Name>> {
|
||||
|
|
|
@ -138,7 +138,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
lookup_deprecation_entry => {
|
||||
cdata.get_deprecation(def_id.index).map(DeprecationEntry::external)
|
||||
}
|
||||
item_attrs => { cdata.get_item_attrs(def_id.index, tcx.sess) }
|
||||
item_attrs => { tcx.arena.alloc_from_iter(
|
||||
cdata.get_item_attrs(def_id.index, tcx.sess).into_iter()
|
||||
) }
|
||||
// FIXME(#38501) We've skipped a `read` on the `hir_owner_nodes` of
|
||||
// a `fn` when encoding, so the dep-tracking wouldn't work.
|
||||
// This is only used by rustdoc anyway, which shouldn't have
|
||||
|
|
|
@ -118,6 +118,9 @@ macro_rules! arena_types {
|
|||
[] upvars: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
|
||||
[] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
|
||||
[] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
|
||||
[] attribute: rustc_ast::ast::Attribute,
|
||||
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_ast::ast::Name>,
|
||||
[] hir_id_set: rustc_hir::HirIdSet,
|
||||
|
||||
// Interned types
|
||||
[] tys: rustc_middle::ty::TyS<$tcx>,
|
||||
|
|
|
@ -610,7 +610,7 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
Other {
|
||||
query reachable_set(_: CrateNum) -> Lrc<HirIdSet> {
|
||||
query reachable_set(_: CrateNum) -> &'tcx HirIdSet {
|
||||
desc { "reachability" }
|
||||
}
|
||||
|
||||
|
@ -642,7 +642,7 @@ rustc_queries! {
|
|||
query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {}
|
||||
query lookup_const_stability(_: DefId) -> Option<&'tcx attr::ConstStability> {}
|
||||
query lookup_deprecation_entry(_: DefId) -> Option<DeprecationEntry> {}
|
||||
query item_attrs(_: DefId) -> Lrc<[ast::Attribute]> {}
|
||||
query item_attrs(_: DefId) -> &'tcx [ast::Attribute] {}
|
||||
}
|
||||
|
||||
Codegen {
|
||||
|
@ -1047,7 +1047,7 @@ rustc_queries! {
|
|||
desc { "looking up all possibly unused extern crates" }
|
||||
}
|
||||
query names_imported_by_glob_use(_: DefId)
|
||||
-> Lrc<FxHashSet<ast::Name>> {
|
||||
-> &'tcx FxHashSet<ast::Name> {
|
||||
eval_always
|
||||
}
|
||||
|
||||
|
|
|
@ -2721,7 +2721,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
|||
};
|
||||
providers.names_imported_by_glob_use = |tcx, id| {
|
||||
assert_eq!(id.krate, LOCAL_CRATE);
|
||||
Lrc::new(tcx.glob_map.get(&id).cloned().unwrap_or_default())
|
||||
tcx.arena.alloc(tcx.glob_map.get(&id).cloned().unwrap_or_default())
|
||||
};
|
||||
|
||||
providers.lookup_stability = |tcx, id| {
|
||||
|
|
|
@ -3013,7 +3013,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
if let Some(id) = self.hir().as_local_hir_id(did) {
|
||||
Attributes::Borrowed(self.hir().attrs(id))
|
||||
} else {
|
||||
Attributes::Owned(self.item_attrs(did))
|
||||
Attributes::Borrowed(self.item_attrs(did))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// reachable as well.
|
||||
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
|
@ -375,7 +374,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx
|
|||
}
|
||||
}
|
||||
|
||||
fn reachable_set(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Lrc<HirIdSet> {
|
||||
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> &'tcx HirIdSet {
|
||||
debug_assert!(crate_num == LOCAL_CRATE);
|
||||
|
||||
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
|
||||
|
@ -421,7 +420,7 @@ fn reachable_set(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Lrc<HirIdSet> {
|
|||
debug!("Inline reachability shows: {:?}", reachable_context.reachable_symbols);
|
||||
|
||||
// Return the set of reachable symbols.
|
||||
Lrc::new(reachable_context.reachable_symbols)
|
||||
tcx.arena.alloc(reachable_context.reachable_symbols)
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers<'_>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue