Skip to content

Commit 9247e87

Browse files
committed
Use LocalDenseDefIdCache on more queries
1 parent 0b31698 commit 9247e87

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/librustc/query/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ rustc_queries! {
6464
/// Maps from the `DefId` of an item (trait/struct/enum/fn) to its
6565
/// associated generics.
6666
query generics_of(key: DefId) -> &'tcx ty::Generics {
67+
storage(caches::LocalDenseDefIdCacheSelector<&'tcx ty::Generics>)
6768
cache_on_disk_if { key.is_local() }
6869
load_cached(tcx, id) {
6970
let generics: Option<ty::Generics> = tcx.queries.on_disk_cache
@@ -88,6 +89,7 @@ rustc_queries! {
8889
/// to operate over only the actual where-clauses written by the
8990
/// user.)
9091
query predicates_of(key: DefId) -> ty::GenericPredicates<'tcx> {
92+
storage(caches::LocalDenseDefIdCacheSelector<ty::GenericPredicates<'tcx>>)
9193
cache_on_disk_if { key.is_local() }
9294
}
9395

@@ -586,23 +588,29 @@ rustc_queries! {
586588
cache_on_disk_if { true }
587589
}
588590

589-
query def_kind(_: DefId) -> Option<DefKind> {}
591+
query def_kind(_: DefId) -> Option<DefKind> {
592+
storage(caches::LocalDenseDefIdCacheSelector<Option<DefKind>>)
593+
}
590594
query def_span(_: DefId) -> Span {
595+
storage(caches::LocalDenseDefIdCacheSelector<Span>)
591596
// FIXME(mw): DefSpans are not really inputs since they are derived from
592597
// HIR. But at the moment HIR hashing still contains some hacks that allow
593598
// to make type debuginfo to be source location independent. Declaring
594599
// DefSpan an input makes sure that changes to these are always detected
595600
// regardless of HIR hashing.
596601
eval_always
597602
}
598-
query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {}
603+
query lookup_stability(_: DefId) -> Option<&'tcx attr::Stability> {
604+
storage(caches::LocalDenseDefIdCacheSelector<Option<&'tcx attr::Stability>>)
605+
}
599606
query lookup_const_stability(_: DefId) -> Option<&'tcx attr::ConstStability> {}
600607
query lookup_deprecation_entry(_: DefId) -> Option<DeprecationEntry> {}
601608
query item_attrs(_: DefId) -> Lrc<[ast::Attribute]> {}
602609
}
603610

604611
Codegen {
605612
query codegen_fn_attrs(_: DefId) -> CodegenFnAttrs {
613+
storage(caches::LocalDenseDefIdCacheSelector<CodegenFnAttrs>)
606614
cache_on_disk_if { true }
607615
}
608616
}
@@ -664,7 +672,9 @@ rustc_queries! {
664672
/// associated types. This is almost always what you want,
665673
/// unless you are doing MIR optimizations, in which case you
666674
/// might want to use `reveal_all()` method to change modes.
667-
query param_env(_: DefId) -> ty::ParamEnv<'tcx> {}
675+
query param_env(_: DefId) -> ty::ParamEnv<'tcx> {
676+
storage(caches::LocalDenseDefIdCacheSelector<ty::ParamEnv<'tcx>>)
677+
}
668678

669679
/// Trait selection queries. These are best used by invoking `ty.is_copy_modulo_regions()`,
670680
/// `ty.is_copy()`, etc, since that will prune the environment where possible.

0 commit comments

Comments
 (0)