1
Fork 0

Rollup merge of #136484 - Zalathar:query-cache-notes, r=jieyouxu

Notes on types/traits used for in-memory query caching

When the word "cache" appears in the context of the query system, it often isn't obvious whether that is referring to the in-memory query cache or the on-disk incremental cache.

For these types, we can assure the reader that they are for in-memory caching.
This commit is contained in:
Matthias Krüger 2025-02-03 21:11:36 +01:00 committed by GitHub
commit d6f94a683c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 42 additions and 5 deletions

View file

@ -20,6 +20,12 @@ pub struct LocalCrate;
/// The `Key` trait controls what types can legally be used as the key
/// for a query.
pub trait Key: Sized {
/// The type of in-memory cache to use for queries with this key type.
///
/// In practice the cache type must implement [`QueryCache`], though that
/// constraint is not enforced here.
///
/// [`QueryCache`]: rustc_query_system::query::QueryCache
// N.B. Most of the keys down below have `type Cache<V> = DefaultCache<Self, V>;`,
// it would be reasonable to use associated type defaults, to remove the duplication...
//