diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/intern.rs | 7 |
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 | } |