aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-04-02 19:47:25 +0100
committerGitHub <[email protected]>2021-04-02 19:47:25 +0100
commit8e3e13f3a41b311c82fa5859c5bfebbbcd82cad4 (patch)
tree8541571011ca81bcb2536374f43873fdc049295e /crates
parent0129628a0f497834a544fa981078b43321c9020a (diff)
parente73d26fa62c61602e0bceb7d9cf7c661badee57b (diff)
Merge #8298
8298: Stop using an upgradeable read lock in interning r=jonas-schievink a=jonas-schievink Only one upgradeable read lock can be handed out at the same time, and we never acquire a non-upgradeable read lock, so this has no benefit over just using a write lock in the first place. bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_def/src/intern.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/crates/hir_def/src/intern.rs b/crates/hir_def/src/intern.rs
index cc0b5d350..bc0307dbc 100644
--- a/crates/hir_def/src/intern.rs
+++ b/crates/hir_def/src/intern.rs
@@ -25,7 +25,7 @@ impl<T: Internable> Interned<T> {
25 let storage = T::storage().get(); 25 let storage = T::storage().get();
26 let shard_idx = storage.determine_map(&obj); 26 let shard_idx = storage.determine_map(&obj);
27 let shard = &storage.shards()[shard_idx]; 27 let shard = &storage.shards()[shard_idx];
28 let shard = shard.upgradeable_read(); 28 let mut shard = shard.write();
29 29
30 // Atomically, 30 // Atomically,
31 // - check if `obj` is already in the map 31 // - check if `obj` is already in the map
@@ -43,10 +43,7 @@ impl<T: Internable> Interned<T> {
43 let arc = Arc::new(obj); 43 let arc = Arc::new(obj);
44 let arc2 = arc.clone(); 44 let arc2 = arc.clone();
45 45
46 { 46 shard.insert(arc2, SharedValue::new(()));
47 let mut shard = shard.upgrade();
48 shard.insert(arc2, SharedValue::new(()));
49 }
50 47
51 Self { arc } 48 Self { arc }
52 } 49 }