From fe03f76794989508a92af17d2cf519249fae825d Mon Sep 17 00:00:00 2001 From: xizheyin Date: Thu, 3 Apr 2025 16:19:46 +0800 Subject: [PATCH] std: Add performance warnings to HashMap::get_disjoint_mut Signed-off-by: xizheyin --- library/std/src/collections/hash/map.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/collections/hash/map.rs b/library/std/src/collections/hash/map.rs index 2487f5a2a50..863d5a40997 100644 --- a/library/std/src/collections/hash/map.rs +++ b/library/std/src/collections/hash/map.rs @@ -973,6 +973,9 @@ where /// Returns an array of length `N` with the results of each query. For soundness, at most one /// mutable reference will be returned to any value. `None` will be used if the key is missing. /// + /// This method performs a check to ensure there are no duplicate keys, which has time-complexity O(n^2), + /// so be careful when passing many keys. + /// /// # Panics /// /// Panics if any keys are overlapping.