Closed grovesNL closed 6 days ago
Something like this should reproduce it
#[test]
fn remove() {
let mut tree = SieveTree::<1, 2, Bounds<1>>::new();
let bounds = Bounds::point([0.]);
let id = tree.insert(bounds, bounds);
assert_eq!(tree.remove(bounds, id), bounds);
}
Fixed, thanks!
remove
starts off by removing it fromelements
https://github.com/Ralith/sieve-tree/blob/460fd6aa4a416a9de1614b7a0da625b29300cbb3/src/lib.rs#L223 but later callsunlink
.unlink
tries to load the successor of the deleted element (let successor = elements[element].next;
) but this is too late.It looks like moving
let elt = self.elements.remove(id);
afterunlink
should work fine.