Unify key types in get_lookup.

This commit is contained in:
Camille GILLOT 2020-03-24 09:27:29 +01:00
parent 301ad11e9b
commit d305b2ccc6
2 changed files with 4 additions and 4 deletions
src/librustc_query_system/query

@ -8,12 +8,12 @@ use std::default::Default;
use std::hash::Hash;
use std::marker::PhantomData;
pub trait CacheSelector<CTX: QueryContext, K, V> {
pub trait CacheSelector<CTX: QueryContext, K: Hash, V> {
type Cache: QueryCache<CTX, Key = K, Value = V>;
}
pub trait QueryCache<CTX: QueryContext>: Default {
type Key;
type Key: Hash;
type Value;
type Sharded: Default;

@ -57,9 +57,9 @@ pub struct QueryState<CTX: QueryContext, C: QueryCache<CTX>> {
}
impl<CTX: QueryContext, C: QueryCache<CTX>> QueryState<CTX, C> {
pub(super) fn get_lookup<'tcx, K2: Hash>(
pub(super) fn get_lookup<'tcx>(
&'tcx self,
key: &K2,
key: &C::Key,
) -> QueryLookup<'tcx, CTX, C::Key, C::Sharded> {
// We compute the key's hash once and then use it for both the
// shard lookup and the hashmap lookup. This relies on the fact