diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-03-24 09:27:29 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-03-26 09:40:50 +0100 |
| commit | d305b2ccc61c6faf6c10271122fcf3a76a94a5bf (patch) | |
| tree | 562ac1fb5836a4c7742768cfef5805f99ecb935e | |
| parent | 301ad11e9b6d33594a08aade7332af3b40f2d7b2 (diff) | |
| download | rust-d305b2ccc61c6faf6c10271122fcf3a76a94a5bf.tar.gz rust-d305b2ccc61c6faf6c10271122fcf3a76a94a5bf.zip | |
Unify key types in get_lookup.
| -rw-r--r-- | src/librustc_query_system/query/caches.rs | 4 | ||||
| -rw-r--r-- | src/librustc_query_system/query/plumbing.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_query_system/query/caches.rs b/src/librustc_query_system/query/caches.rs index efde51c4db6..400e6fe84a8 100644 --- a/src/librustc_query_system/query/caches.rs +++ b/src/librustc_query_system/query/caches.rs @@ -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; diff --git a/src/librustc_query_system/query/plumbing.rs b/src/librustc_query_system/query/plumbing.rs index 6fd86d65c1d..dbe7b9c385d 100644 --- a/src/librustc_query_system/query/plumbing.rs +++ b/src/librustc_query_system/query/plumbing.rs @@ -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 |
