#[test]
fn stack_overflow_siblings() {
let mut prev_sibling = Node::new(1);
for _ in 0..200_000 {
let node = Node::new(1);
prev_sibling.insert_before(node.clone());
prev_sibling = node;
}
}
This is very similar to stack_overflow() test, but this ends up in stack overflow.
Current Drop impl of NodeData<T> detaches descendants before they are dropped, but do nothing special to following siblings.
If they have parent, they would be detached by parent's NodeData<T>::drop(), so this does not matter.
However, rctree allows root node to have siblings, and in this case siblings are not detached beforehand and dropped recursively.
This is very similar to
stack_overflow()
test, but this ends up in stack overflow.Current
Drop
impl ofNodeData<T>
detaches descendants before they are dropped, but do nothing special to following siblings. If they have parent, they would be detached by parent'sNodeData<T>::drop()
, so this does not matter. However,rctree
allows root node to have siblings, and in this case siblings are not detached beforehand and dropped recursively.