Skip to content

Review and improve HashMap's handling of an empty table #53853

Description

@RalfJung

In #53804, I fixed the most immediate problem arising from how HashMap handles the empty table, but @gnzlbg still (rightly) sees more problems. We still use 1 instead of NonNull::dangling() as value for EMPTY, and ptr() even tests equality with EMPTY to return NULL instead. We can't really use non-NULL pointers as sentinel values like that, and NULL is often a worse choice than an aligned dangling pointer because the latter are at least valid for zero-sized operations.

See here for @gnzlbg's suggestions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`T-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions