about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-02-03 21:31:06 +1100
committerZalathar <Zalathar@users.noreply.github.com>2025-02-03 22:36:01 +1100
commit623d6e8ca423e37daf435136da32697e3cdd605b (patch)
treeb7a8e01c407c9d8475c0f912bd6f4b3b5b0b7d3d /compiler/rustc_middle/src/query
parent4a43094662727040d8522163f295b19d1aed0e49 (diff)
downloadrust-623d6e8ca423e37daf435136da32697e3cdd605b.tar.gz
rust-623d6e8ca423e37daf435136da32697e3cdd605b.zip
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.
Diffstat (limited to 'compiler/rustc_middle/src/query')
-rw-r--r--compiler/rustc_middle/src/query/keys.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/query/keys.rs b/compiler/rustc_middle/src/query/keys.rs
index 949d8303385..1489d57aba6 100644
--- a/compiler/rustc_middle/src/query/keys.rs
+++ b/compiler/rustc_middle/src/query/keys.rs
@@ -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...
     //