HashIndex entries outlive the container
bugenhancement
**Issue**
`scc::HashIndex` does not drop its entries when the index itself is dropped.
**Minimal Reproducer**
```rust
#[test]
fn entries_should_be_dropped_on_index_drop() {
let scc = scc::HashIndex::<u32, Arc<()>>::new();
let test_arc = Arc::new(());
scc.insert_sync(1, test_arc.clone()).unwrap();
drop(scc);
let res = Arc::strong_count(&test_arc);
assert_eq!(
res,
1,
"Arc strong count must be 1"
);
}
```
**Expected Behavior**
When `HashIndex` is dropped, all entries contained within it should also be dropped.
关闭于 2025-10-02 10 条评论