Skip to content

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

Closed
@RalfJung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-collectionsArea: `std::collections`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions