Inline the IsValid() check in AssertNotDebugCapacity() to avoid unduly slowing down tests. PiperOrigin-RevId: 998131097 Change-Id: I9cbaa70c89537151b84beee91b5176f439e77679
diff --git a/absl/container/internal/raw_hash_set.cc b/absl/container/internal/raw_hash_set.cc index 15a80cb..f31db0e 100644 --- a/absl/container/internal/raw_hash_set.cc +++ b/absl/container/internal/raw_hash_set.cc
@@ -292,9 +292,6 @@ void CommonFields::AssertNotDebugCapacityImpl() const { const HashtableCapacity cap = maybe_invalid_capacity(); - if (ABSL_PREDICT_TRUE(cap.IsValid())) { - return; - } assert(!cap.IsReentrance() && "Reentrant container access during element construction/destruction " "is not allowed.");
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 5f57b10..2bd7378 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h
@@ -1546,7 +1546,9 @@ // Asserts that the capacity is not a sentinel invalid value. void AssertNotDebugCapacity() const { if constexpr (SwisstableGenerationsOrDebugEnabled()) { - AssertNotDebugCapacityImpl(); + if (ABSL_PREDICT_FALSE(!maybe_invalid_capacity().IsValid())) { + AssertNotDebugCapacityImpl(); + } } }