Skip to content

Commit f7bdb7a

Browse files
ezbrcopybara-github
authored andcommitted
Roll back: Add more debug capacity validation checks on moves.
PiperOrigin-RevId: 708329082 Change-Id: Ic4561c6f4786711166de3f4b53fe55b539366f1f
1 parent 50292b7 commit f7bdb7a

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

absl/container/internal/raw_hash_set.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,10 +2823,9 @@ class raw_hash_set {
28232823
// `that` must be left valid. If Hash is std::function<Key>, moving it
28242824
// would create a nullptr functor that cannot be called.
28252825
// Note: we avoid using exchange for better generated code.
2826-
settings_((that.AssertNotDebugCapacity(),
2827-
PolicyTraits::transfer_uses_memcpy() || !that.is_full_soo()
2828-
? std::move(that.common())
2829-
: CommonFields{full_soo_tag_t{}}),
2826+
settings_(PolicyTraits::transfer_uses_memcpy() || !that.is_full_soo()
2827+
? std::move(that.common())
2828+
: CommonFields{full_soo_tag_t{}},
28302829
that.hash_ref(), that.eq_ref(), that.alloc_ref()) {
28312830
if (!PolicyTraits::transfer_uses_memcpy() && that.is_full_soo()) {
28322831
transfer(soo_slot(), that.soo_slot());
@@ -2838,7 +2837,6 @@ class raw_hash_set {
28382837
raw_hash_set(raw_hash_set&& that, const allocator_type& a)
28392838
: settings_(CommonFields::CreateDefault<SooEnabled()>(), that.hash_ref(),
28402839
that.eq_ref(), a) {
2841-
that.AssertNotDebugCapacity();
28422840
if (a == that.alloc_ref()) {
28432841
swap_common(that);
28442842
annotate_for_bug_detection_on_move(that);
@@ -2865,7 +2863,8 @@ class raw_hash_set {
28652863
absl::allocator_traits<allocator_type>::is_always_equal::value &&
28662864
std::is_nothrow_move_assignable<hasher>::value &&
28672865
std::is_nothrow_move_assignable<key_equal>::value) {
2868-
that.AssertNotDebugCapacity();
2866+
// TODO(sbenza): We should only use the operations from the noexcept clause
2867+
// to make sure we actually adhere to that contract.
28692868
// NOLINTNEXTLINE: not returning *this for performance.
28702869
return move_assign(
28712870
std::move(that),

absl/container/internal/raw_hash_set_test.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,8 +3715,6 @@ TEST(Table, MovedFromCallsFail) {
37153715
EXPECT_DEATH_IF_SUPPORTED(t1.end(), "moved-from");
37163716
// NOLINTNEXTLINE(bugprone-use-after-move)
37173717
EXPECT_DEATH_IF_SUPPORTED(t1.size(), "moved-from");
3718-
// NOLINTNEXTLINE(bugprone-use-after-move)
3719-
EXPECT_DEATH_IF_SUPPORTED(IntTable{std::move(t1)}, "moved-from");
37203718
}
37213719
{
37223720
ABSL_ATTRIBUTE_UNUSED IntTable t1;

0 commit comments

Comments
 (0)