blob: 4ce485a97efeae01793981face46fe9bf44fec52 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
commit 7ece455c2527fa7f001a5f734a7efa42df4e767a
Author: Evan Brown <[email protected]>
Date: Thu Jul 24 15:24:05 2025 -0700
Disallow using a hash function whose return type is smaller than size_t.
Swisstable relies on the hash having good entropy in both the high and low bits.
PiperOrigin-RevId: 786854836
Change-Id: I6fc7041534984a0e937a11f50a2b478390a1a509
diff --git b/absl/container/internal/raw_hash_set.h a/absl/container/internal/raw_hash_set.h
index 679d68c4..5fe33674 100644
--- b/absl/container/internal/raw_hash_set.h
+++ a/absl/container/internal/raw_hash_set.h
@@ -1915,13 +1915,6 @@ class raw_hash_set {
auto KeyTypeCanBeHashed(const Hash& h, const key_type& k) -> decltype(h(k));
auto KeyTypeCanBeEq(const Eq& eq, const key_type& k) -> decltype(eq(k, k));
- // Try to be helpful when the hasher returns an unreasonable type.
- using key_hash_result =
- absl::remove_cvref_t<decltype(std::declval<const Hash&>()(
- std::declval<const key_type&>()))>;
- static_assert(sizeof(key_hash_result) >= sizeof(size_t),
- "`Hash::operator()` should return a `size_t`");
-
using AllocTraits = absl::allocator_traits<allocator_type>;
using SlotAlloc = typename absl::allocator_traits<
allocator_type>::template rebind_alloc<slot_type>;
|