Skip to content

Commit fa4d2ad

Browse files
committed
Clarify behavior of ShardedHashMap::insert_unique
1 parent 93d0186 commit fa4d2ad

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

compiler/rustc_data_structures/src/sharded.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ impl<K: Eq + Hash, V> ShardedHashMap<K, V> {
185185

186186
/// Insert value into the [`ShardedHashMap`] with unique key.
187187
///
188-
/// Checks uniqueness if debug_assertions enabled.
188+
/// This function panics if debug_assertions are enabled and uniqueness is violated.
189+
/// If uniqueness is violated but debug_assertions are disabled then lookups will arbitrarily
190+
/// return one of the inserted elements.
189191
#[inline]
190192
pub fn insert_unique(&self, key: K, value: V) {
191193
let hash = make_hash(&key);

0 commit comments

Comments
 (0)