Skip to content

Commit

Permalink
arena_tree: panic if iterator invalidation causes trouble.
Browse files Browse the repository at this point in the history
Fixes #104.
  • Loading branch information
kivikakk committed Jul 11, 2024
1 parent 85443b1 commit 09d3f91
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/arena_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,7 @@ macro_rules! traverse_iterator {
Some(sibling) => Some(NodeEdge::Start(sibling)),
None => match node.parent.get() {
Some(parent) => Some(NodeEdge::End(parent)),

// `node.parent()` here can only be `None`
// if the tree has been modified during iteration,
// but silently stoping iteration
// seems a more sensible behavior than panicking.
None => None,
None => panic!("tree modified during iteration"),
},
}
}
Expand Down

0 comments on commit 09d3f91

Please sign in to comment.