Skip to content

Prevent hashtable shrinking past INITIAL_CAPACITY on clear. #19486

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

Closed
wants to merge 1 commit into from

Conversation

cgaebel
Copy link
Contributor

@cgaebel cgaebel commented Dec 3, 2014

No description provided.

`HashMap::clear()` was failing to set the capacity to a power of 2,
and could even go under INITIAL_CAPACITY! This broke invariants,
and at times (see unit test) led to failure of sanity-checking
asserts.

This patch fixes that.

Fixes rust-lang#19485
@cgaebel
Copy link
Contributor Author

cgaebel commented Dec 3, 2014

cc #19485

@Gankra
Copy link
Contributor

Gankra commented Dec 3, 2014

This change might be redundant with #18770 which is approved but bors' panic attacks are blocking.

@cgaebel
Copy link
Contributor Author

cgaebel commented Dec 3, 2014

Should be. I'll keep this open till that lands.

@Gankra
Copy link
Contributor

Gankra commented Dec 4, 2014

Landed. Might still be worth adding the test?

@cgaebel
Copy link
Contributor Author

cgaebel commented Dec 8, 2014

Probably not. It was a bug triggered by complexity in hashtable growing and shrinking which is much simpler now. Testing this now would probably be overkill. @frankmcsherry can you confirm this is fixed, and close #19485 if it is?

@cgaebel cgaebel closed this Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants