From ec2d09b72a81841ee9fe91698a4ba3a3e61965cb Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 30 Oct 2022 04:57:06 -0400 Subject: [PATCH] Switch to Rc to fix the multiple references issue. --- src/parser/nom_context.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parser/nom_context.rs b/src/parser/nom_context.rs index 67e55a48..40486f37 100644 --- a/src/parser/nom_context.rs +++ b/src/parser/nom_context.rs @@ -11,7 +11,7 @@ pub struct TestContext { head: ContextReference, } -type ContextReference = Option>>; +type ContextReference = Option>>; struct ContextLayer { data: T, @@ -32,11 +32,11 @@ impl TestContext { new_matcher: MatcherRef, ) -> TestContext { TestContext { - head: Some(Box::new(ContextLayer { + head: Some(Rc::new(ContextLayer { data: ContextData { fail_matcher: ChainBehavior::AndParent(Some(new_matcher)), }, - parent: self.head, // TODO FIX THIS + parent: self.head.clone(), })), } }