Hi,
I found a potential API contract violation in the shrink_to method through Kani formal verification.
Location: src/basic.rs (shrink_to implementation)
Issue:
In some edge cases, shrink_to(min_capacity) may result in a capacity less than min_capacity.
Verification:
let mut sm: SlotMap<DefaultKey, u32> = SlotMap::with_capacity(100);
sm.shrink_to(50);
assert!(sm.capacity() >= 50); // May fail in some cases
Impact:
Violates API contract
May cause unexpected behavior
Could you please confirm if this is a valid issue? I can provide a more detailed reproduction case if needed.
Hi,
I found a potential API contract violation in the shrink_to method through Kani formal verification.
Location: src/basic.rs (shrink_to implementation)
Issue:
In some edge cases, shrink_to(min_capacity) may result in a capacity less than min_capacity.
Verification:
let mut sm: SlotMap<DefaultKey, u32> = SlotMap::with_capacity(100);
sm.shrink_to(50);
assert!(sm.capacity() >= 50); // May fail in some cases
Impact:
Violates API contract
May cause unexpected behavior
Could you please confirm if this is a valid issue? I can provide a more detailed reproduction case if needed.