-
Notifications
You must be signed in to change notification settings - Fork 12.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review and improve HashMap's handling of an empty table #53853
Comments
I'm going to close this issue since our hash maps are now a thin wrapper around hashbrown which hopefully doesn't suffer from these issues; if it does, this should be refiled upstream. A cursory examination didn't find any obvious problems for sentinel use of dangling or so. |
Yes none of this applies to the new hashbrown impl. cc @Amanieu in case they want to re-read the comments and any of that rings a bell, but I haven't see anything like that in hashbrown. |
I agree, I don't think any of this applies to hashbrown. |
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 use1
instead ofNonNull::dangling()
as value forEMPTY
, andptr()
even tests equality withEMPTY
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.
The text was updated successfully, but these errors were encountered: