diff --git a/src/run_program.rs b/src/run_program.rs index 0a3fad2b..44552835 100644 --- a/src/run_program.rs +++ b/src/run_program.rs @@ -24,7 +24,7 @@ pub type PreEval = Box Result>, EvalErr>>; #[cfg(feature = "pre-eval")] -pub type PostEval = dyn Fn(Option); +pub type PostEval = dyn Fn(&mut Allocator, Option); #[repr(u8)] enum Operation { @@ -495,7 +495,7 @@ impl<'a, D: Dialect> RunProgramContext<'a, D> { Operation::PostEval => { let f = self.posteval_stack.pop().unwrap(); let peek: Option = self.val_stack.last().copied(); - f(peek); + f(&mut self.allocator, peek); 0 } }; diff --git a/src/test_ops.rs b/src/test_ops.rs index f4ee7dd1..e5f21435 100644 --- a/src/test_ops.rs +++ b/src/test_ops.rs @@ -413,7 +413,7 @@ fn test_pre_eval_and_post_eval() { &mut Allocator, NodePtr, NodePtr, - ) -> Result))>>, EvalErr>, + ) -> Result))>>, EvalErr>, > = Box::new(move |_allocator, prog, args| { let tracking_key = pre_eval_tracking.borrow().len(); // Ensure lifetime of mutable borrow is contained. @@ -430,17 +430,18 @@ fn test_pre_eval_and_post_eval() { ); } let post_eval_tracking = pre_eval_tracking.clone(); - let post_eval_f: Box)> = Box::new(move |outcome| { - let mut tracking_mutable = post_eval_tracking.borrow_mut(); - tracking_mutable.insert( - tracking_key, - EvalFTracker { - prog, - args, - outcome, - }, - ); - }); + let post_eval_f: Box)> = + Box::new(move |_a, outcome| { + let mut tracking_mutable = post_eval_tracking.borrow_mut(); + tracking_mutable.insert( + tracking_key, + EvalFTracker { + prog, + args, + outcome, + }, + ); + }); Ok(Some(post_eval_f)) });