From e73d26fa62c61602e0bceb7d9cf7c661badee57b Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Fri, 2 Apr 2021 20:46:37 +0200 Subject: Stop using an upgradeable read lock in interning 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. --- crates/hir_def/src/intern.rs | 7 ++----- 1 file 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 Interned { let storage = T::storage().get(); let shard_idx = storage.determine_map(&obj); let shard = &storage.shards()[shard_idx]; - let shard = shard.upgradeable_read(); + let mut shard = shard.write(); // Atomically, // - check if `obj` is already in the map @@ -43,10 +43,7 @@ impl Interned { let arc = Arc::new(obj); let arc2 = arc.clone(); - { - let mut shard = shard.upgrade(); - shard.insert(arc2, SharedValue::new(())); - } + shard.insert(arc2, SharedValue::new(())); Self { arc } } -- cgit v1.2.3