From 3089e46eb12b0648a8c564836a660b87c5200a65 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 27 Aug 2022 20:41:10 +0300 Subject: refactor(tvix/eval): encapsulate internal mutability within Closure This is required to efficiently construct the upvalue array at runtime, as there are situations where during Closure construction multiple things already have a reference to the closure (e.g. a self-reference). Change-Id: I35263b845fdc695dc873de489f5168d39b370f6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/6312 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/compiler/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tvix/eval/src/compiler') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 2fac7560a6f6..520eb3bd6404 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -87,8 +87,7 @@ impl Compiler { } fn chunk(&mut self) -> &mut Chunk { - Rc::::get_mut(self.context_mut().lambda.chunk()) - .expect("compiler flaw: long-lived chunk reference") + &mut self.context_mut().lambda.chunk } fn scope(&self) -> &Scope { -- cgit 1.4.1