summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Turner <jturner.usa@gmail.com>2025-11-25 06:48:20 +0000
committerJohn Turner <jturner.usa@gmail.com>2025-11-25 06:48:20 +0000
commit8be071ab980c6080732daec565c35de242eaccf7 (patch)
tree41b7caeb98121060f5cc5443079096aedda9c4fb
parent8fae8ec266f1eef3c52cbc9ad114abc4950d19d9 (diff)
downloadmon-8be071ab980c6080732daec565c35de242eaccf7.tar.gz
assert that iterator makes progress in Many combinator, in debug mode
-rw-r--r--src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index e0c7fa0..0d5a164 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -445,10 +445,16 @@ where
while !it.is_finished() {
it = match self.parser.next::<OM, EM>(it.clone(), &mut state) {
Some(Ok((rest, output))) => {
+ debug_assert!(
+ rest.position() > it.position(),
+ "iterator failed to make progress"
+ );
+
outputs = OM::combine(outputs, output, |mut acc, e| {
acc.push(e);
acc
});
+
rest
}
_ => break,