From 20c894e232ab75b3ad79d1e8a8b3c47ba1394af2 Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Tue, 26 Dec 2023 01:30:05 +0100 Subject: feat(tvix/glue): context-aware `toFile` This removes the reference tracking and uses instead the context for references and returns some. Change-Id: Ic359ca6b903b63f1a9c679c566004c617b792442 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10435 Autosubmit: raitobezarius Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/src/errors.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs index 6ac29492dfc3..4ba93a0aaba3 100644 --- a/tvix/eval/src/errors.rs +++ b/tvix/eval/src/errors.rs @@ -202,6 +202,9 @@ pub enum ErrorKind { context: String, underlying: Box, }, + + /// Unexpected context string + UnexpectedContext, } impl error::Error for Error { @@ -484,6 +487,10 @@ to a missing value in the attribute set(s) included via `with`."#, ErrorKind::WithContext { .. } => { panic!("internal ErrorKind::WithContext variant leaked") } + + ErrorKind::UnexpectedContext => { + write!(f, "unexpected context string") + } } } } @@ -736,6 +743,7 @@ impl Error { ErrorKind::InvalidAttributeName(_) => "in this attribute set", ErrorKind::RelativePathResolution(_) => "in this path literal", ErrorKind::UnexpectedArgument { .. } => "in this function call", + ErrorKind::UnexpectedContext => "in this string", // The spans for some errors don't have any more descriptive stuff // in them, or we don't utilise it yet. @@ -810,6 +818,7 @@ impl Error { ErrorKind::Xml(_) => "E034", ErrorKind::FromTomlError(_) => "E035", ErrorKind::NotSerialisableToJson(_) => "E036", + ErrorKind::UnexpectedContext => "E037", // Special error code for errors from other Tvix // components. We may want to introduce a code namespacing -- cgit 1.4.1