1
Fork 0

Enforce that query results implement Debug

This commit is contained in:
Aaron Hill 2021-01-03 09:19:16 -05:00
parent 492b83c697
commit 7afb32557d
No known key found for this signature in database
GPG key ID: B4087E510E98B164
22 changed files with 45 additions and 33 deletions

View file

@ -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)>;

View file

@ -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>,