about summary refs log tree commit diff
path: root/tvix/eval/src/builtins/mod.rs
diff options
context:
space:
mode:
authorRyan Lahfa <tvl@lahfa.xyz>2023-12-25T23·39+0100
committerclbot <clbot@tvl.fyi>2024-01-03T18·07+0000
commit375f7eaa59d5043be91ae0bbd47f3305628790d5 (patch)
tree96c595129187509ff59ddebf206bf27a2fd67f11 /tvix/eval/src/builtins/mod.rs
parent4a3aa05c8f3efd0f00493d3b625e30965df1a006 (diff)
feat(tvix/eval): context-aware `abort` r/7323
Change-Id: Id5a435961ce3a2a2240b3936ea48515650d445d6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10427
Autosubmit: raitobezarius <tvl@lahfa.xyz>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r--tvix/eval/src/builtins/mod.rs6
1 files changed, 5 insertions, 1 deletions
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<Value, ErrorKind> {
         // 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")]