From 3412ae495661e8073075bbb8c24ee0098ca2bede Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 23 Oct 2022 13:50:07 -0400 Subject: feat(tvix/eval): Implement builtins.sort This is a bit tricky because the comparator can throw errors, so we need to propagate them out if they exist and try to avoid sorting forever by returning a reasonable ordering in this case (as short-circuiting is not available). Co-Authored-By: Vincent Ambo Change-Id: Icae1d30f43ec1ae64b2ba51e73ee467605686792 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7072 Tested-by: BuildkiteCI Reviewed-by: sterni --- tvix/eval/src/value/list.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tvix/eval/src/value/list.rs') diff --git a/tvix/eval/src/value/list.rs b/tvix/eval/src/value/list.rs index 236a654ad88d..da8f70caacaf 100644 --- a/tvix/eval/src/value/list.rs +++ b/tvix/eval/src/value/list.rs @@ -1,5 +1,5 @@ //! This module implements Nix lists. -use std::ops::Deref; +use std::ops::{Deref, DerefMut}; use crate::errors::ErrorKind; use crate::vm::VM; @@ -135,3 +135,9 @@ impl Deref for NixList { &self.0 } } + +impl DerefMut for NixList { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} -- cgit 1.4.1