From 09d3f915a34f4fe553ba0907061f2d974dced345 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Thu, 11 Jul 2024 15:27:01 +0300 Subject: [PATCH 1/2] arena_tree: panic if iterator invalidation causes trouble. Fixes #104. --- src/arena_tree.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/arena_tree.rs b/src/arena_tree.rs index 72547460..2eb5c35d 100644 --- a/src/arena_tree.rs +++ b/src/arena_tree.rs @@ -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"), }, } } From a57a719a94f523040101f860f03a7b5f83542be8 Mon Sep 17 00:00:00 2001 From: Asherah Connor Date: Thu, 11 Jul 2024 15:29:09 +0300 Subject: [PATCH 2/2] arena_tree: remove unused allow(dead_code). --- src/arena_tree.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/arena_tree.rs b/src/arena_tree.rs index 2eb5c35d..4be00e6c 100644 --- a/src/arena_tree.rs +++ b/src/arena_tree.rs @@ -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;