You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code causes a panic in set(i) ('assertion failed: probe.index() != idx_end'). The current belief is that clear() causes the underlying array to shrink below tested levels (being fixed independently), at which point a corner case may show up in insertion.
use std::collections::HashMap;
use std::collections::hash_map::Vacant;
fn main()
{
let mut m = HashMap::with_capacity(4);
m.clear();
for i in range(0u, 4)
{
match m.entry(i)
{
Vacant(x) => { x.set(i); },
_ => {},
}
}
}
The text was updated successfully, but these errors were encountered:
`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.
Fixesrust-lang#19485
The following code causes a panic in set(i) ('assertion failed: probe.index() != idx_end'). The current belief is that clear() causes the underlying array to shrink below tested levels (being fixed independently), at which point a corner case may show up in insertion.
The text was updated successfully, but these errors were encountered: