]> git.lizzy.rs Git - rust.git/commitdiff
Drop the lock guard
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Wed, 12 Feb 2020 11:26:27 +0000 (12:26 +0100)
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>
Wed, 12 Feb 2020 11:33:31 +0000 (12:33 +0100)
src/librustc/ty/query/plumbing.rs

index 4fa82156c40c11a80cc32de66189a63371cc34a0..4e7a23be3837475d02c08518d003c58e772012d1 100644 (file)
@@ -112,8 +112,8 @@ pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<
             let key_hash = state.finish();
 
             let shard = cache.get_shard_index_by_hash(key_hash);
-            let mut lock = cache.get_shard_by_index(shard).lock();
-            let lock = &mut *lock;
+            let mut lock_guard = cache.get_shard_by_index(shard).lock();
+            let lock = &mut *lock_guard;
 
             if let Some((_, value)) =
                 lock.results.raw_entry().from_key_hashed_nocheck(key_hash, key)
@@ -183,7 +183,7 @@ pub(super) fn try_get(tcx: TyCtxt<'tcx>, span: Span, key: &Q::Key) -> TryGetJob<
                     });
                 }
             };
-            mem::drop(lock);
+            mem::drop(lock_guard);
 
             // If we are single-threaded we know that we have cycle error,
             // so we just return the error.