From 375f7eaa59d5043be91ae0bbd47f3305628790d5 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Tue, 26 Dec 2023 00:39:49 +0100 Subject: feat(tvix/eval): context-aware `abort` Change-Id: Id5a435961ce3a2a2240b3936ea48515650d445d6 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10427 Autosubmit: raitobezarius Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/builtins/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tvix') diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index 699dbf74c6f2..ee551bbaf5f6 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -83,7 +83,11 @@ mod pure_builtins { #[builtin("abort")] async fn builtin_abort(co: GenCo, message: Value) -> Result { // TODO(sterni): coerces to string - Err(ErrorKind::Abort(message.to_str()?.to_string())) + // Although `abort` does not make use of any context, + // we must still accept contextful strings as parameters. + // If `to_str` was used, this would err out with an unexpected type error. + // Therefore, we explicitly accept contextful strings and ignore their contexts. + Err(ErrorKind::Abort(message.to_contextful_str()?.to_string())) } #[builtin("add")] -- cgit 1.4.1