diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-06 14:04:20 +0100 | 
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-13 21:14:58 +0100 | 
| commit | 280a2866d502747b51bd81390be760973c54e719 (patch) | |
| tree | ea3738702603defd4d9230d881dfa2b01c721d7f /compiler/rustc_query_system/src/query/caches.rs | |
| parent | 15b0bc6b8380942fb45f1839b9fd91e66fad8045 (diff) | |
| download | rust-280a2866d502747b51bd81390be760973c54e719.tar.gz rust-280a2866d502747b51bd81390be760973c54e719.zip | |
Drop the cache lock earlier.
Diffstat (limited to 'compiler/rustc_query_system/src/query/caches.rs')
| -rw-r--r-- | compiler/rustc_query_system/src/query/caches.rs | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/compiler/rustc_query_system/src/query/caches.rs b/compiler/rustc_query_system/src/query/caches.rs index d589c90fa7b..ec71c868580 100644 --- a/compiler/rustc_query_system/src/query/caches.rs +++ b/compiler/rustc_query_system/src/query/caches.rs @@ -37,7 +37,7 @@ pub trait QueryCache: QueryStorage { key: &Self::Key, // `on_hit` can be called while holding a lock to the query state shard. on_hit: OnHit, - ) -> Result<R, QueryLookup<'s, Self::Sharded>> + ) -> Result<R, QueryLookup> where OnHit: FnOnce(&Self::Stored, DepNodeIndex) -> R; @@ -98,12 +98,12 @@ where state: &'s QueryCacheStore<Self>, key: &K, on_hit: OnHit, - ) -> Result<R, QueryLookup<'s, Self::Sharded>> + ) -> Result<R, QueryLookup> where OnHit: FnOnce(&V, DepNodeIndex) -> R, { - let lookup = state.get_lookup(key); - let result = lookup.lock.raw_entry().from_key_hashed_nocheck(lookup.key_hash, key); + let (lookup, lock) = state.get_lookup(key); + let result = lock.raw_entry().from_key_hashed_nocheck(lookup.key_hash, key); if let Some((_, value)) = result { let hit_result = on_hit(&value.0, value.1); @@ -181,12 +181,12 @@ where state: &'s QueryCacheStore<Self>, key: &K, on_hit: OnHit, - ) -> Result<R, QueryLookup<'s, Self::Sharded>> + ) -> Result<R, QueryLookup> where OnHit: FnOnce(&&'tcx V, DepNodeIndex) -> R, { - let lookup = state.get_lookup(key); - let result = lookup.lock.raw_entry().from_key_hashed_nocheck(lookup.key_hash, key); + let (lookup, lock) = state.get_lookup(key); + let result = lock.raw_entry().from_key_hashed_nocheck(lookup.key_hash, key); if let Some((_, value)) = result { let hit_result = on_hit(&&value.0, value.1); | 
