Skip to content

Prevent hashtable shrinking past INITIAL_CAPACITY on clear.#19486

Closed
cgaebel wants to merge 1 commit into
rust-lang:masterfrom
cgaebel:hashmap-assert-failure
Closed

Prevent hashtable shrinking past INITIAL_CAPACITY on clear.#19486
cgaebel wants to merge 1 commit into
rust-lang:masterfrom
cgaebel:hashmap-assert-failure

Conversation

@cgaebel

@cgaebel cgaebel commented Dec 3, 2014

Copy link
Copy Markdown

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

cgaebel commented Dec 3, 2014

Copy link
Copy Markdown
Author

cc #19485

@Gankra

Gankra commented Dec 3, 2014

Copy link
Copy Markdown
Contributor

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

@cgaebel

cgaebel commented Dec 3, 2014

Copy link
Copy Markdown
Author

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

@Gankra

Gankra commented Dec 4, 2014

Copy link
Copy Markdown
Contributor

Landed. Might still be worth adding the test?

@cgaebel

cgaebel commented Dec 8, 2014

Copy link
Copy Markdown
Author

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