Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow AbslHashValue() to take a C-style array parameter. The
current behavior of decaying the array to a pointer and hashing the pointer can lead to subtle bugs. The most common potential error is passing a C-string literal. Hashing the char pointer in those cases is correct only if the string literals are guaranteed to be deduplicated, which is dangerous to rely on even if true (and the call sites in header files require deduplication across translation units). After this change, these call-sites requires wrapping the literal in absl::string_view. This is a breaking change for code doing something like absl::HashOf("string"); Instead, this should be changed to absl::HashOf(absl::string_view("string")); PiperOrigin-RevId: 582393585 Change-Id: I3810c07b5b74bf153cb62a7beedce243be5a69ee
- Loading branch information