summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2021-01-03 09:19:16 -0500
committerAaron Hill <aa1ronham@gmail.com>2021-01-16 17:53:02 -0500
commit7afb32557da945ec70fc926dbd91006089005fa4 (patch)
treed556d4da0e559d98a25e932835646fc942b70b52 /compiler/rustc_query_system
parent492b83c6971c390af7a42932869502224ef55ef7 (diff)
downloadrust-7afb32557da945ec70fc926dbd91006089005fa4.tar.gz
rust-7afb32557da945ec70fc926dbd91006089005fa4.zip
Enforce that query results implement Debug
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/query/caches.rs9
-rw-r--r--compiler/rustc_query_system/src/query/plumbing.rs5
2 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs
index 7bc6ae1d1c6..f17551c0e18 100644
--- a/compiler/rustc_query_system/src/query/caches.rs
+++ b/compiler/rustc_query_system/src/query/caches.rs
@@ -15,7 +15,7 @@ pub trait CacheSelector<K, V> {
 }
 
 pub trait QueryStorage: Default {
-    type Value;
+    type Value: Debug;
     type Stored: Clone;
 
     /// Store a value without putting it in the cache.
@@ -75,7 +75,7 @@ impl<K, V> Default for DefaultCache<K, V> {
     }
 }
 
-impl<K: Eq + Hash, V: Clone> QueryStorage for DefaultCache<K, V> {
+impl<K: Eq + Hash, V: Clone + Debug> QueryStorage for DefaultCache<K, V> {
     type Value = V;
     type Stored = V;
 
@@ -89,7 +89,7 @@ impl<K: Eq + Hash, V: Clone> QueryStorage for DefaultCache<K, V> {
 impl<K, V> QueryCache for DefaultCache<K, V>
 where
     K: Eq + Hash + Clone + Debug,
-    V: Clone,
+    V: Clone + Debug,
 {
     type Key = K;
     type Sharded = FxHashMap<K, (V, DepNodeIndex)>;
@@ -156,7 +156,7 @@ impl<'tcx, K, V> Default for ArenaCache<'tcx, K, V> {
     }
 }
 
-impl<'tcx, K: Eq + Hash, V: 'tcx> QueryStorage for ArenaCache<'tcx, K, V> {
+impl<'tcx, K: Eq + Hash, V: Debug + 'tcx> QueryStorage for ArenaCache<'tcx, K, V> {
     type Value = V;
     type Stored = &'tcx V;
 
@@ -171,6 +171,7 @@ impl<'tcx, K: Eq + Hash, V: 'tcx> QueryStorage for ArenaCache<'tcx, K, V> {
 impl<'tcx, K, V: 'tcx> QueryCache for ArenaCache<'tcx, K, V>
 where
     K: Eq + Hash + Clone + Debug,
+    V: Debug
 {
     type Key = K;
     type Sharded = FxHashMap<K, &'tcx (V, DepNodeIndex)>;
diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs
index d17af6120c7..5fab62dc82a 100644
--- a/compiler/rustc_query_system/src/query/plumbing.rs
+++ b/compiler/rustc_query_system/src/query/plumbing.rs
@@ -21,6 +21,7 @@ use rustc_span::source_map::DUMMY_SP;
 use rustc_span::Span;
 use std::collections::hash_map::Entry;
 use std::hash::{Hash, Hasher};
+use std::fmt::Debug;
 use std::mem;
 use std::num::NonZeroU32;
 use std::ptr;
@@ -478,7 +479,7 @@ where
     result
 }
 
-fn load_from_disk_and_cache_in_memory<CTX, K, V>(
+fn load_from_disk_and_cache_in_memory<CTX, K, V: Debug>(
     tcx: CTX,
     key: K,
     prev_dep_node_index: SerializedDepNodeIndex,
@@ -539,7 +540,7 @@ where
 
 #[inline(never)]
 #[cold]
-fn incremental_verify_ich<CTX, K, V>(
+fn incremental_verify_ich<CTX, K, V: Debug>(
     tcx: CTX,
     result: &V,
     dep_node: &DepNode<CTX::DepKind>,