From 22dc0fe6c74e29cc878025979896616ea70b9aec Mon Sep 17 00:00:00 2001 From: rvcas Date: Tue, 15 Jun 2021 19:20:15 -0400 Subject: [PATCH] feat: implement shallow clone for PExpected --- editor/src/lang/pool.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/editor/src/lang/pool.rs b/editor/src/lang/pool.rs index 975d2b2655..1d77814b46 100644 --- a/editor/src/lang/pool.rs +++ b/editor/src/lang/pool.rs @@ -12,6 +12,7 @@ /// This is important for performance. use libc::{c_void, MAP_ANONYMOUS, MAP_PRIVATE, PROT_READ, PROT_WRITE}; use roc_can::expected::Expected; +use roc_can::expected::PExpected; use std::cmp::Ordering; use std::marker::PhantomData; use std::mem::size_of; @@ -620,3 +621,14 @@ impl ShallowClone for Expected { } } } + +impl ShallowClone for PExpected { + fn shallow_clone(&self) -> Self { + use PExpected::*; + + match self { + NoExpectation(t) => NoExpectation(t.shallow_clone()), + ForReason(reason, t, region) => ForReason(reason.clone(), t.shallow_clone(), *region), + } + } +}