Skip to content

Commit

Permalink
Drop the lock guard
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Feb 12, 2020
1 parent 19c1012 commit 5de82b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
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)
Expand Down Expand Up @@ -183,7 +183,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
});
}
};
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.
Expand Down

0 comments on commit 5de82b9

Please sign in to comment.