Skip to content

Commit

Permalink
Merge pull request #437 from kivikakk/iterator-invalidate-panics
Browse files Browse the repository at this point in the history
arena_tree: panic if iterator invalidation causes trouble.
  • Loading branch information
kivikakk authored Jul 11, 2024
2 parents 85443b1 + a57a719 commit bd16259
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/arena_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ make it a cell (`Cell` or `RefCell`) or use cells inside of it.
*/

#![allow(dead_code)]

use std::cell::Cell;
use std::fmt;

Expand Down Expand Up @@ -368,12 +366,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 bd16259

Please sign in to comment.