]> git.lizzy.rs Git - rust.git/commitdiff
Unify key types in get_lookup.
authorCamille GILLOT <gillot.camille@gmail.com>
Tue, 24 Mar 2020 08:27:29 +0000 (09:27 +0100)
committerCamille GILLOT <gillot.camille@gmail.com>
Thu, 26 Mar 2020 08:40:50 +0000 (09:40 +0100)
src/librustc_query_system/query/caches.rs
src/librustc_query_system/query/plumbing.rs

index efde51c4db6f0f7ef02ec2bd179fd58f918faf63..400e6fe84a8124b9660445d8d66b1e1baa9d7022 100644 (file)
@@ -8,12 +8,12 @@
 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;
 
index 6fd86d65c1d4a09a9e0a0f11710b7e7a1bc64ca6..dbe7b9c385daaa1657b6c4ecc48cff2c0077207e 100644 (file)
@@ -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