git.delta.rocks / jrsonnet / refs/commits / 58761866e4bc

difftreelog

style fix clippy warnings

Yaroslav Bolyukin2022-11-12parent: #9a50551.patch.diff
in: master

35 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -68,6 +68,15 @@
 checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 
 [[package]]
+name = "block-buffer"
+version = "0.10.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e"
+dependencies = [
+ "generic-array",
+]
+
+[[package]]
 name = "cc"
 version = "1.0.73"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -141,6 +150,45 @@
 ]
 
 [[package]]
+name = "cpufeatures"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "crypto-common"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
+dependencies = [
+ "generic-array",
+ "typenum",
+]
+
+[[package]]
+name = "digest"
+version = "0.10.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "adfbc57365a37acbd2ebf2b64d7e69bb766e2fea813521ed536f5d0520dcf86c"
+dependencies = [
+ "block-buffer",
+ "crypto-common",
+]
+
+[[package]]
+name = "generic-array"
+version = "0.14.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9"
+dependencies = [
+ "typenum",
+ "version_check",
+]
+
+[[package]]
 name = "getrandom"
 version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -304,6 +352,7 @@
  "serde",
  "serde_json",
  "serde_yaml_with_quirks",
+ "sha2",
  "structdump",
 ]
 
@@ -550,6 +599,17 @@
 ]
 
 [[package]]
+name = "sha2"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0"
+dependencies = [
+ "cfg-if 1.0.0",
+ "cpufeatures",
+ "digest",
+]
+
+[[package]]
 name = "smallvec"
 version = "1.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -640,6 +700,12 @@
 ]
 
 [[package]]
+name = "typenum"
+version = "1.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
+
+[[package]]
 name = "unicode-ident"
 version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
modifiedbindings/jsonnet/src/import.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/import.rs
+++ b/bindings/jsonnet/src/import.rs
@@ -12,7 +12,7 @@
 };
 
 use jrsonnet_evaluator::{
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	throw, FileImportResolver, ImportResolver,
 };
 use jrsonnet_gcmodule::Trace;
modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/lib.rs
+++ b/bindings/jsonnet/src/lib.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::box_default)]
+
 #[cfg(feature = "interop")]
 pub mod interop;
 
@@ -20,11 +22,11 @@
 	apply_tla,
 	function::TlaArg,
 	gc::GcHashMap,
+	manifest::{JsonFormat, ManifestFormat, ToStringFormat},
 	stack::set_stack_depth_limit,
-	stdlib::manifest::{JsonFormat, ToStringFormat},
 	tb, throw,
 	trace::{CompactFormat, PathResolver, TraceFormat},
-	FileImportResolver, IStr, ManifestFormat, Result, State, Val,
+	FileImportResolver, IStr, Result, State, Val,
 };
 
 /// WASM stub
@@ -193,7 +195,7 @@
 	let filename = parse_path(CStr::from_ptr(filename));
 	match vm
 		.state
-		.import(&filename)
+		.import(filename)
 		.and_then(|val| apply_tla(vm.state.clone(), &vm.tla_args, val))
 		.and_then(|val| val.manifest(&vm.manifest_format))
 	{
@@ -286,7 +288,7 @@
 	let filename = parse_path(CStr::from_ptr(filename));
 	match vm
 		.state
-		.import(&filename)
+		.import(filename)
 		.and_then(|val| apply_tla(vm.state.clone(), &vm.tla_args, val))
 		.and_then(|val| val_to_multi(val, &vm.manifest_format))
 	{
modifiedbindings/jsonnet/src/native.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/native.rs
+++ b/bindings/jsonnet/src/native.rs
@@ -5,7 +5,7 @@
 };
 
 use jrsonnet_evaluator::{
-	error::{Error, LocError},
+	error::{Error, ErrorKind},
 	function::builtin::{NativeCallback, NativeCallbackHandler},
 	tb,
 	typed::Typed,
@@ -38,7 +38,7 @@
 	cb: JsonnetNativeCallback,
 }
 impl NativeCallbackHandler for JsonnetNativeCallbackHandler {
-	fn call(&self, args: &[Val]) -> Result<Val, LocError> {
+	fn call(&self, args: &[Val]) -> Result<Val, Error> {
 		let mut n_args = Vec::new();
 		for a in args {
 			n_args.push(Some(Box::new(a.clone())));
@@ -57,7 +57,7 @@
 			Ok(v)
 		} else {
 			let e = IStr::from_untyped(v).expect("error msg should be a string");
-			Err(Error::RuntimeError(e).into())
+			Err(ErrorKind::RuntimeError(e).into())
 		}
 	}
 }
modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -6,7 +6,11 @@
 use clap::{CommandFactory, Parser};
 use clap_complete::Shell;
 use jrsonnet_cli::{ConfigureState, GeneralOpts, ManifestOpts, OutputOpts, TraceOpts};
-use jrsonnet_evaluator::{apply_tla, error::LocError, throw, ResultExt, State, Val};
+use jrsonnet_evaluator::{
+	apply_tla,
+	error::{Error as JrError, ErrorKind},
+	throw, ResultExt, State, Val,
+};
 
 #[cfg(feature = "mimalloc")]
 #[global_allocator]
@@ -96,7 +100,7 @@
 enum Error {
 	// Handled differently
 	#[error("evaluation error")]
-	Evaluation(LocError),
+	Evaluation(JrError),
 	#[error("io error")]
 	Io(#[from] std::io::Error),
 	#[error("input is not utf8 encoded")]
@@ -104,14 +108,14 @@
 	#[error("missing input argument")]
 	MissingInputArgument,
 }
-impl From<LocError> for Error {
-	fn from(e: LocError) -> Self {
+impl From<JrError> for Error {
+	fn from(e: JrError) -> Self {
 		Self::Evaluation(e)
 	}
 }
-impl From<jrsonnet_evaluator::error::Error> for Error {
-	fn from(e: jrsonnet_evaluator::error::Error) -> Self {
-		Self::from(LocError::from(e))
+impl From<ErrorKind> for Error {
+	fn from(e: ErrorKind) -> Self {
+		Self::from(JrError::from(e))
 	}
 }
 
modifiedcrates/jrsonnet-cli/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/manifest.rs
+++ b/crates/jrsonnet-cli/src/manifest.rs
@@ -3,9 +3,10 @@
 use clap::{Parser, ValueEnum};
 use jrsonnet_evaluator::{
 	error::Result,
-	stdlib::manifest::{JsonFormat, StringFormat, ToStringFormat, YamlFormat, YamlStreamFormat},
-	ManifestFormat, State,
+	manifest::{JsonFormat, ManifestFormat, StringFormat, ToStringFormat, YamlStreamFormat},
+	State,
 };
+use jrsonnet_stdlib::YamlFormat;
 
 use crate::ConfigureState;
 
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -1,6 +1,6 @@
 use clap::Parser;
 use jrsonnet_evaluator::{
-	error::{Error, Result},
+	error::{ErrorKind, Result},
 	function::TlaArg,
 	gc::GcHashMap,
 	IStr, State,
@@ -51,15 +51,15 @@
 		{
 			let source = Source::new_virtual(format!("<top-level-arg:{name}>").into(), code.into());
 			out.insert(
-				(&name as &str).into(),
+				(name as &str).into(),
 				TlaArg::Code(
 					jrsonnet_parser::parse(
-						&code,
+						code,
 						&ParserSettings {
 							source: source.clone(),
 						},
 					)
-					.map_err(|e| Error::ImportSyntaxError {
+					.map_err(|e| ErrorKind::ImportSyntaxError {
 						path: source,
 						error: Box::new(e),
 					})?,
modifiedcrates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/ctx.rs
+++ b/crates/jrsonnet-evaluator/src/ctx.rs
@@ -4,8 +4,8 @@
 use jrsonnet_interner::IStr;
 
 use crate::{
-	error::Error::*, gc::GcHashMap, map::LayeredHashMap, ObjValue, Pending, Result, State, Thunk,
-	Val,
+	error::ErrorKind::*, gc::GcHashMap, map::LayeredHashMap, ObjValue, Pending, Result, State,
+	Thunk, Val,
 };
 
 #[derive(Trace)]
modifiedcrates/jrsonnet-evaluator/src/error.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/error.rs
+++ b/crates/jrsonnet-evaluator/src/error.rs
@@ -74,7 +74,7 @@
 #[allow(missing_docs)]
 #[derive(Error, Debug, Clone, Trace)]
 #[non_exhaustive]
-pub enum Error {
+pub enum ErrorKind {
 	#[error("intrinsic not found: {0}")]
 	IntrinsicNotFound(IStr),
 
@@ -211,14 +211,14 @@
 }
 
 #[cfg(feature = "anyhow-error")]
-impl From<anyhow::Error> for LocError {
+impl From<anyhow::Error> for Error {
 	fn from(e: anyhow::Error) -> Self {
-		Self::new(Error::Other(Rc::new(e)))
+		Self::new(ErrorKind::Other(Rc::new(e)))
 	}
 }
 
-impl From<Error> for LocError {
-	fn from(e: Error) -> Self {
+impl From<ErrorKind> for Error {
+	fn from(e: ErrorKind) -> Self {
 		Self::new(e)
 	}
 }
@@ -236,16 +236,16 @@
 pub struct StackTrace(pub Vec<StackTraceElement>);
 
 #[derive(Clone, Trace)]
-pub struct LocError(Box<(Error, StackTrace)>);
-impl LocError {
-	pub fn new(e: Error) -> Self {
+pub struct Error(Box<(ErrorKind, StackTrace)>);
+impl Error {
+	pub fn new(e: ErrorKind) -> Self {
 		Self(Box::new((e, StackTrace(vec![]))))
 	}
 
-	pub const fn error(&self) -> &Error {
+	pub const fn error(&self) -> &ErrorKind {
 		&(self.0).0
 	}
-	pub fn error_mut(&mut self) -> &mut Error {
+	pub fn error_mut(&mut self) -> &mut ErrorKind {
 		&mut (self.0).0
 	}
 	pub const fn trace(&self) -> &StackTrace {
@@ -255,7 +255,7 @@
 		&mut (self.0).1
 	}
 }
-impl Display for LocError {
+impl Display for Error {
 	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 		writeln!(f, "{}", self.0 .0)?;
 		for el in &self.0 .1 .0 {
@@ -269,7 +269,7 @@
 		Ok(())
 	}
 }
-impl Debug for LocError {
+impl Debug for Error {
 	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 		f.debug_tuple("LocError").field(&self.0).finish()
 	}
@@ -294,7 +294,7 @@
 	}
 }
 
-pub type Result<V, E = LocError> = std::result::Result<V, E>;
+pub type Result<V, E = Error> = std::result::Result<V, E>;
 pub trait ResultExt: Sized {
 	#[must_use]
 	fn with_description<O: Into<String>>(self, msg: impl FnOnce() -> O) -> Self;
@@ -314,7 +314,7 @@
 		self.with_description_src(src, || msg)
 	}
 }
-impl<T> ResultExt for Result<T, LocError> {
+impl<T> ResultExt for Result<T, Error> {
 	fn with_description<O: Into<String>>(mut self, msg: impl FnOnce() -> O) -> Self {
 		if let Err(e) = &mut self {
 			let trace = e.trace_mut();
@@ -348,9 +348,9 @@
 		return Err($w$(::$i)*$(($($tt)*))?.into())
 	};
 	($l:literal) => {
-		return Err($crate::error::Error::RuntimeError($l.into()).into())
+		return Err($crate::error::ErrorKind::RuntimeError($l.into()).into())
 	};
 	($l:literal, $($tt:tt)*) => {
-		return Err($crate::error::Error::RuntimeError(format!($l, $($tt)*).into()).into())
+		return Err($crate::error::ErrorKind::RuntimeError(format!($l, $($tt)*).into()).into())
 	};
 }
modifiedcrates/jrsonnet-evaluator/src/evaluate/destructure.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/destructure.rs
@@ -3,7 +3,7 @@
 use jrsonnet_parser::{BindSpec, Destruct, LocExpr, ParamsDesc};
 
 use crate::{
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	evaluate, evaluate_method, evaluate_named,
 	gc::GcHashMap,
 	tb, throw,
modifiedcrates/jrsonnet-evaluator/src/evaluate/mod.rsdiffbeforeafterboth
before · crates/jrsonnet-evaluator/src/evaluate/mod.rs
1use std::{cmp::Ordering, rc::Rc};23use jrsonnet_gcmodule::{Cc, Trace};4use jrsonnet_interner::IStr;5use jrsonnet_parser::{6	ArgsDesc, AssertStmt, BindSpec, CompSpec, Expr, FieldMember, FieldName, ForSpecData,7	IfSpecData, LiteralType, LocExpr, Member, ObjBody, ParamsDesc,8};9use jrsonnet_types::ValType;1011use self::destructure::destruct;12use crate::{13	destructure::evaluate_dest,14	error::Error::*,15	evaluate::operator::{evaluate_add_op, evaluate_binary_op_special, evaluate_unary_op},16	function::{CallLocation, FuncDesc, FuncVal},17	tb, throw,18	typed::Typed,19	val::{ArrValue, CachedUnbound, IndexableVal, Thunk, ThunkValue},20	Context, GcHashMap, LocError, ObjValue, ObjValueBuilder, ObjectAssertion, Pending, Result,21	ResultExt, State, Unbound, Val,22};23pub mod destructure;24pub mod operator;2526pub fn evaluate_method(ctx: Context, name: IStr, params: ParamsDesc, body: LocExpr) -> Val {27	Val::Func(FuncVal::Normal(Cc::new(FuncDesc {28		name,29		ctx,30		params,31		body,32	})))33}3435pub fn evaluate_field_name(ctx: Context, field_name: &FieldName) -> Result<Option<IStr>> {36	Ok(match field_name {37		FieldName::Fixed(n) => Some(n.clone()),38		FieldName::Dyn(expr) => State::push(39			CallLocation::new(&expr.1),40			|| "evaluating field name".to_string(),41			|| {42				let value = evaluate(ctx, expr)?;43				if matches!(value, Val::Null) {44					Ok(None)45				} else {46					Ok(Some(IStr::from_untyped(value)?))47				}48			},49		)?,50	})51}5253pub fn evaluate_comp(54	ctx: Context,55	specs: &[CompSpec],56	callback: &mut impl FnMut(Context) -> Result<()>,57) -> Result<()> {58	match specs.get(0) {59		None => callback(ctx)?,60		Some(CompSpec::IfSpec(IfSpecData(cond))) => {61			if bool::from_untyped(evaluate(ctx.clone(), cond)?)? {62				evaluate_comp(ctx, &specs[1..], callback)?;63			}64		}65		Some(CompSpec::ForSpec(ForSpecData(var, expr))) => match evaluate(ctx.clone(), expr)? {66			Val::Arr(list) => {67				for item in list.iter_lazy() {68					let fctx = Pending::new();69					let mut new_bindings = GcHashMap::with_capacity(var.capacity_hint());70					destruct(var, item, fctx.clone(), &mut new_bindings)?;71					let ctx = ctx72						.clone()73						.extend(new_bindings, None, None, None)74						.into_future(fctx);7576					evaluate_comp(ctx, &specs[1..], callback)?;77				}78			}79			#[cfg(feature = "exp-object-iteration")]80			Val::Obj(obj) => {81				for field in obj.fields(82					// TODO: Should there be ability to preserve iteration order?83					#[cfg(feature = "exp-preserve-order")]84					false,85				) {86					#[derive(Trace)]87					struct ObjectFieldThunk {88						obj: ObjValue,89						field: IStr,90					}91					impl ThunkValue for ObjectFieldThunk {92						type Output = Val;9394						fn get(self: Box<Self>) -> Result<Self::Output> {95							self.obj.get(self.field).transpose().expect(96								"field exists, as field name was obtained from object.fields()",97							)98						}99					}100101					let fctx = Pending::new();102					let mut new_bindings = GcHashMap::with_capacity(var.capacity_hint());103					let value = Thunk::evaluated(Val::Arr(ArrValue::Lazy(Cc::new(vec![104						Thunk::evaluated(Val::Str(field.clone())),105						Thunk::new(tb!(ObjectFieldThunk {106							field: field.clone(),107							obj: obj.clone(),108						})),109					]))));110					destruct(var, value, fctx.clone(), &mut new_bindings)?;111					let ctx = ctx112						.clone()113						.extend(new_bindings, None, None, None)114						.into_future(fctx);115116					evaluate_comp(ctx, &specs[1..], callback)?;117				}118			}119			_ => throw!(InComprehensionCanOnlyIterateOverArray),120		},121	}122	Ok(())123}124125trait CloneableUnbound<T>: Unbound<Bound = T> + Clone {}126impl<V, T> CloneableUnbound<T> for V where V: Unbound<Bound = T> + Clone {}127128fn evaluate_object_locals(129	fctx: Pending<Context>,130	locals: Rc<Vec<BindSpec>>,131) -> impl CloneableUnbound<Context> {132	#[derive(Trace, Clone)]133	struct UnboundLocals {134		fctx: Pending<Context>,135		locals: Rc<Vec<BindSpec>>,136	}137	impl Unbound for UnboundLocals {138		type Bound = Context;139140		fn bind(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Context> {141			let fctx = Context::new_future();142			let mut new_bindings =143				GcHashMap::with_capacity(self.locals.iter().map(BindSpec::capacity_hint).sum());144			for b in self.locals.iter() {145				evaluate_dest(b, fctx.clone(), &mut new_bindings)?;146			}147148			let ctx = self.fctx.unwrap();149			let new_dollar = ctx.dollar().clone().or_else(|| this.clone());150151			let ctx = ctx152				.extend(new_bindings, new_dollar, sup, this)153				.into_future(fctx);154155			Ok(ctx)156		}157	}158159	UnboundLocals { fctx, locals }160}161162pub fn evaluate_field_member<B: Unbound<Bound = Context> + Clone>(163	builder: &mut ObjValueBuilder,164	ctx: Context,165	uctx: B,166	field: &FieldMember,167) -> Result<()> {168	let name = evaluate_field_name(ctx.clone(), &field.name)?;169	let Some(name) = name else {170		return Ok(());171	};172173	match field {174		FieldMember {175			plus,176			params: None,177			visibility,178			value,179			..180		} => {181			#[derive(Trace)]182			struct UnboundValue<B: Trace> {183				uctx: B,184				value: LocExpr,185				name: IStr,186			}187			impl<B: Unbound<Bound = Context>> Unbound for UnboundValue<B> {188				type Bound = Val;189				fn bind(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Val> {190					Ok(evaluate_named(191						self.uctx.bind(sup, this)?,192						&self.value,193						self.name.clone(),194					)?)195				}196			}197198			builder199				.member(name.clone())200				.with_add(*plus)201				.with_visibility(*visibility)202				.with_location(value.1.clone())203				.bindable(tb!(UnboundValue {204					uctx: uctx.clone(),205					value: value.clone(),206					name: name.clone()207				}))?;208		}209		FieldMember {210			params: Some(params),211			visibility,212			value,213			..214		} => {215			#[derive(Trace)]216			struct UnboundMethod<B: Trace> {217				uctx: B,218				value: LocExpr,219				params: ParamsDesc,220				name: IStr,221			}222			impl<B: Unbound<Bound = Context>> Unbound for UnboundMethod<B> {223				type Bound = Val;224				fn bind(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<Val> {225					Ok(evaluate_method(226						self.uctx.bind(sup, this)?,227						self.name.clone(),228						self.params.clone(),229						self.value.clone(),230					))231				}232			}233234			builder235				.member(name.clone())236				.with_visibility(*visibility)237				.with_location(value.1.clone())238				.bindable(tb!(UnboundMethod {239					uctx: uctx.clone(),240					value: value.clone(),241					params: params.clone(),242					name: name.clone()243				}))?;244		}245	}246	Ok(())247}248249#[allow(clippy::too_many_lines)]250pub fn evaluate_member_list_object(ctx: Context, members: &[Member]) -> Result<ObjValue> {251	let mut builder = ObjValueBuilder::new();252	let locals = Rc::new(253		members254			.iter()255			.filter_map(|m| match m {256				Member::BindStmt(bind) => Some(bind.clone()),257				_ => None,258			})259			.collect::<Vec<_>>(),260	);261262	let fctx = Context::new_future();263264	// We have single context for all fields, so we can cache binds265	let uctx = CachedUnbound::new(evaluate_object_locals(fctx.clone(), locals));266267	for member in members.iter() {268		match member {269			Member::Field(field) => {270				evaluate_field_member(&mut builder, ctx.clone(), uctx.clone(), &field)?271			}272			Member::AssertStmt(stmt) => {273				#[derive(Trace)]274				struct ObjectAssert<B: Trace> {275					uctx: B,276					assert: AssertStmt,277				}278				impl<B: Unbound<Bound = Context>> ObjectAssertion for ObjectAssert<B> {279					fn run(&self, sup: Option<ObjValue>, this: Option<ObjValue>) -> Result<()> {280						let ctx = self.uctx.bind(sup, this)?;281						evaluate_assert(ctx, &self.assert)282					}283				}284				builder.assert(tb!(ObjectAssert {285					uctx: uctx.clone(),286					assert: stmt.clone(),287				}));288			}289			Member::BindStmt(_) => {290				// Already handled291			}292		}293	}294	let this = builder.build();295	fctx.fill(ctx.extend(GcHashMap::new(), None, None, Some(this.clone())));296	Ok(this)297}298299pub fn evaluate_object(ctx: Context, object: &ObjBody) -> Result<ObjValue> {300	Ok(match object {301		ObjBody::MemberList(members) => evaluate_member_list_object(ctx, members)?,302		ObjBody::ObjComp(obj) => {303			let mut builder = ObjValueBuilder::new();304			let locals = Rc::new(305				obj.pre_locals306					.iter()307					.chain(obj.post_locals.iter())308					.cloned()309					.collect::<Vec<_>>(),310			);311			let mut ctxs = vec![];312			evaluate_comp(ctx, &obj.compspecs, &mut |ctx| {313				let fctx = Context::new_future();314				ctxs.push((ctx.clone(), fctx.clone()));315				let uctx = evaluate_object_locals(fctx, locals.clone());316317				evaluate_field_member(&mut builder, ctx, uctx, &obj.field)318			})?;319320			let this = builder.build();321			for (ctx, fctx) in ctxs {322				let _ctx = ctx323					.extend(GcHashMap::new(), None, None, Some(this.clone()))324					.into_future(fctx);325			}326			this327		}328	})329}330331pub fn evaluate_apply(332	ctx: Context,333	value: &LocExpr,334	args: &ArgsDesc,335	loc: CallLocation<'_>,336	tailstrict: bool,337) -> Result<Val> {338	let value = evaluate(ctx.clone(), value)?;339	Ok(match value {340		Val::Func(f) => {341			let body = || f.evaluate(ctx, loc, args, tailstrict);342			if tailstrict {343				body()?344			} else {345				State::push(loc, || format!("function <{}> call", f.name()), body)?346			}347		}348		v => throw!(OnlyFunctionsCanBeCalledGot(v.value_type())),349	})350}351352pub fn evaluate_assert(ctx: Context, assertion: &AssertStmt) -> Result<()> {353	let value = &assertion.0;354	let msg = &assertion.1;355	let assertion_result = State::push(356		CallLocation::new(&value.1),357		|| "assertion condition".to_owned(),358		|| bool::from_untyped(evaluate(ctx.clone(), value)?),359	)?;360	if !assertion_result {361		State::push(362			CallLocation::new(&value.1),363			|| "assertion failure".to_owned(),364			|| {365				if let Some(msg) = msg {366					throw!(AssertionFailed(evaluate(ctx, msg)?.to_string()?));367				}368				throw!(AssertionFailed(Val::Null.to_string()?));369			},370		)?;371	}372	Ok(())373}374375pub fn evaluate_named(ctx: Context, expr: &LocExpr, name: IStr) -> Result<Val> {376	use Expr::*;377	let LocExpr(raw_expr, _loc) = expr;378	Ok(match &**raw_expr {379		Function(params, body) => evaluate_method(ctx, name, params.clone(), body.clone()),380		_ => evaluate(ctx, expr)?,381	})382}383384#[allow(clippy::too_many_lines)]385pub fn evaluate(ctx: Context, expr: &LocExpr) -> Result<Val> {386	use Expr::*;387	let LocExpr(expr, loc) = expr;388	Ok(match &**expr {389		Literal(LiteralType::This) => {390			Val::Obj(ctx.this().clone().ok_or(CantUseSelfOutsideOfObject)?)391		}392		Literal(LiteralType::Super) => Val::Obj(393			ctx.super_obj().clone().ok_or(NoSuperFound)?.with_this(394				ctx.this()395					.clone()396					.expect("if super exists - then this should to"),397			),398		),399		Literal(LiteralType::Dollar) => {400			Val::Obj(ctx.dollar().clone().ok_or(NoTopLevelObjectFound)?)401		}402		Literal(LiteralType::True) => Val::Bool(true),403		Literal(LiteralType::False) => Val::Bool(false),404		Literal(LiteralType::Null) => Val::Null,405		Parened(e) => evaluate(ctx, e)?,406		Str(v) => Val::Str(v.clone()),407		Num(v) => Val::new_checked_num(*v)?,408		BinaryOp(v1, o, v2) => evaluate_binary_op_special(ctx, v1, *o, v2)?,409		UnaryOp(o, v) => evaluate_unary_op(*o, &evaluate(ctx, v)?)?,410		Var(name) => State::push(411			CallLocation::new(loc),412			|| format!("variable <{name}> access"),413			|| ctx.binding(name.clone())?.evaluate(),414		)?,415		Index(value, index) => match (evaluate(ctx.clone(), value)?, evaluate(ctx, index)?) {416			(Val::Obj(v), Val::Str(key)) => State::push(417				CallLocation::new(loc),418				|| format!("field <{key}> access"),419				|| match v.get(key.clone()) {420					Ok(Some(v)) => Ok(v),421					#[cfg(not(feature = "friendly-errors"))]422					Ok(None) => throw!(NoSuchField(key.clone(), vec![])),423					#[cfg(feature = "friendly-errors")]424					Ok(None) => {425						let mut heap = Vec::new();426						for field in v.fields_ex(427							true,428							#[cfg(feature = "exp-preserve-order")]429							false,430						) {431							let conf = strsim::jaro_winkler(&field as &str, &key as &str);432							if conf < 0.8 {433								continue;434							}435							heap.push((conf, field));436						}437						heap.sort_by(|a, b| b.0.partial_cmp(&a.0).unwrap_or(Ordering::Equal));438439						throw!(NoSuchField(440							key.clone(),441							heap.into_iter().map(|(_, v)| v).collect()442						))443					}444					Err(e) => Err(e),445				},446			)?,447			(Val::Obj(_), n) => throw!(ValueIndexMustBeTypeGot(448				ValType::Obj,449				ValType::Str,450				n.value_type(),451			)),452453			(Val::Arr(v), Val::Num(n)) => {454				if n.fract() > f64::EPSILON {455					throw!(FractionalIndex)456				}457				v.get(n as usize)?458					.ok_or_else(|| ArrayBoundsError(n as usize, v.len()))?459			}460			(Val::Arr(_), Val::Str(n)) => throw!(AttemptedIndexAnArrayWithString(n)),461			(Val::Arr(_), n) => throw!(ValueIndexMustBeTypeGot(462				ValType::Arr,463				ValType::Num,464				n.value_type(),465			)),466467			(Val::Str(s), Val::Num(n)) => Val::Str({468				let v: IStr = s469					.chars()470					.skip(n as usize)471					.take(1)472					.collect::<String>()473					.into();474				if v.is_empty() {475					let size = s.chars().count();476					throw!(StringBoundsError(n as usize, size))477				}478				v479			}),480			(Val::Str(_), n) => throw!(ValueIndexMustBeTypeGot(481				ValType::Str,482				ValType::Num,483				n.value_type(),484			)),485486			(v, _) => throw!(CantIndexInto(v.value_type())),487		},488		LocalExpr(bindings, returned) => {489			let mut new_bindings: GcHashMap<IStr, Thunk<Val>> =490				GcHashMap::with_capacity(bindings.iter().map(BindSpec::capacity_hint).sum());491			let fctx = Context::new_future();492			for b in bindings {493				evaluate_dest(b, fctx.clone(), &mut new_bindings)?;494			}495			let ctx = ctx.extend(new_bindings, None, None, None).into_future(fctx);496			evaluate(ctx, &returned.clone())?497		}498		Arr(items) => {499			let mut out = Vec::with_capacity(items.len());500			for item in items {501				// TODO: Implement ArrValue::Lazy with same context for every element?502				#[derive(Trace)]503				struct ArrayElement {504					ctx: Context,505					item: LocExpr,506				}507				impl ThunkValue for ArrayElement {508					type Output = Val;509					fn get(self: Box<Self>) -> Result<Val> {510						evaluate(self.ctx, &self.item)511					}512				}513				out.push(Thunk::new(tb!(ArrayElement {514					ctx: ctx.clone(),515					item: item.clone(),516				})));517			}518			Val::Arr(out.into())519		}520		ArrComp(expr, comp_specs) => {521			let mut out = Vec::new();522			evaluate_comp(ctx, comp_specs, &mut |ctx| {523				out.push(evaluate(ctx, expr)?);524				Ok(())525			})?;526			Val::Arr(ArrValue::Eager(Cc::new(out)))527		}528		Obj(body) => Val::Obj(evaluate_object(ctx, body)?),529		ObjExtend(a, b) => evaluate_add_op(530			&evaluate(ctx.clone(), a)?,531			&Val::Obj(evaluate_object(ctx, b)?),532		)?,533		Apply(value, args, tailstrict) => {534			evaluate_apply(ctx, value, args, CallLocation::new(loc), *tailstrict)?535		}536		Function(params, body) => {537			evaluate_method(ctx, "anonymous".into(), params.clone(), body.clone())538		}539		AssertExpr(assert, returned) => {540			evaluate_assert(ctx.clone(), assert)?;541			evaluate(ctx, returned)?542		}543		ErrorStmt(e) => State::push(544			CallLocation::new(loc),545			|| "error statement".to_owned(),546			|| throw!(RuntimeError(evaluate(ctx, e)?.to_string()?,)),547		)?,548		IfElse {549			cond,550			cond_then,551			cond_else,552		} => {553			if State::push(554				CallLocation::new(loc),555				|| "if condition".to_owned(),556				|| bool::from_untyped(evaluate(ctx.clone(), &cond.0)?),557			)? {558				evaluate(ctx, cond_then)?559			} else {560				match cond_else {561					Some(v) => evaluate(ctx, v)?,562					None => Val::Null,563				}564			}565		}566		Slice(value, desc) => {567			fn parse_idx<T: Typed>(568				loc: CallLocation<'_>,569				ctx: &Context,570				expr: &Option<LocExpr>,571				desc: &'static str,572			) -> Result<Option<T>> {573				if let Some(value) = expr {574					Ok(Some(State::push(575						loc,576						|| format!("slice {desc}"),577						|| T::from_untyped(evaluate(ctx.clone(), value)?),578					)?))579				} else {580					Ok(None)581				}582			}583584			let indexable = evaluate(ctx.clone(), value)?;585			let loc = CallLocation::new(loc);586587			let start = parse_idx(loc, &ctx, &desc.start, "start")?;588			let end = parse_idx(loc, &ctx, &desc.end, "end")?;589			let step = parse_idx(loc, &ctx, &desc.step, "step")?;590591			IndexableVal::into_untyped(indexable.into_indexable()?.slice(start, end, step)?)?592		}593		i @ (Import(path) | ImportStr(path) | ImportBin(path)) => {594			let Expr::Str(path) = &*path.0 else {595				throw!("computed imports are not supported")596			};597			let tmp = loc.clone().0;598			let s = ctx.state();599			let resolved_path = s.resolve_from(tmp.source_path(), path as &str)?;600			match i {601				Import(_) => State::push(602					CallLocation::new(loc),603					|| format!("import {:?}", path.clone()),604					|| s.import_resolved(resolved_path),605				)?,606				ImportStr(_) => Val::Str(s.import_resolved_str(resolved_path)?),607				ImportBin(_) => Val::Arr(ArrValue::Bytes(s.import_resolved_bin(resolved_path)?)),608				_ => unreachable!(),609			}610		}611	})612}
modifiedcrates/jrsonnet-evaluator/src/evaluate/operator.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate/operator.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate/operator.rs
@@ -3,7 +3,7 @@
 use jrsonnet_parser::{BinaryOpType, LocExpr, UnaryOpType};
 
 use crate::{
-	error::Error::*, evaluate, stdlib::std_format, throw, typed::Typed, val::equals, Context,
+	error::ErrorKind::*, evaluate, stdlib::std_format, throw, typed::Typed, val::equals, Context,
 	Result, Val,
 };
 
modifiedcrates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/arglike.rs
+++ b/crates/jrsonnet-evaluator/src/function/arglike.rs
@@ -180,8 +180,8 @@
 	}
 }
 
-impl<A: ArgLike, S> sealed::Named for HashMap<IStr, A, S> {}
-impl<A: ArgLike, S> ArgsLike for HashMap<IStr, A, S> {
+impl<V: ArgLike, S> sealed::Named for HashMap<IStr, V, S> {}
+impl<V: ArgLike, S> ArgsLike for HashMap<IStr, V, S> {
 	fn unnamed_len(&self) -> usize {
 		0
 	}
@@ -213,7 +213,7 @@
 		}
 	}
 }
-impl<A, S> OptionalContext for HashMap<IStr, A, S> where A: ArgLike + OptionalContext {}
+impl<V, S> OptionalContext for HashMap<IStr, V, S> where V: ArgLike + OptionalContext {}
 
 impl<A: ArgLike> ArgsLike for GcHashMap<IStr, A> {
 	fn unnamed_len(&self) -> usize {
@@ -239,7 +239,7 @@
 	}
 
 	fn named_names(&self, handler: &mut dyn FnMut(&IStr)) {
-		self.0.named_names(handler)
+		self.0.named_names(handler);
 	}
 }
 
modifiedcrates/jrsonnet-evaluator/src/function/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/parse.rs
+++ b/crates/jrsonnet-evaluator/src/function/parse.rs
@@ -7,7 +7,7 @@
 use super::{arglike::ArgsLike, builtin::BuiltinParam};
 use crate::{
 	destructure::destruct,
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	evaluate_named,
 	gc::GcHashMap,
 	tb, throw,
modifiedcrates/jrsonnet-evaluator/src/import.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/import.rs
+++ b/crates/jrsonnet-evaluator/src/import.rs
@@ -12,10 +12,7 @@
 use jrsonnet_parser::{SourceDirectory, SourceFile, SourcePath};
 
 use crate::{
-	error::{
-		Error::{self, *},
-		Result,
-	},
+	error::{ErrorKind::*, Result},
 	throw,
 };
 
@@ -94,7 +91,7 @@
 		} else if let Some(d) = from.downcast_ref::<SourceDirectory>() {
 			d.path().to_owned()
 		} else if from.is_default() {
-			current_dir().map_err(|e| Error::ImportIo(e.to_string()))?
+			current_dir().map_err(|e| ImportIo(e.to_string()))?
 		} else {
 			unreachable!("resolver can't return this path")
 		};
@@ -122,7 +119,7 @@
 			Err(e) if e.kind() == ErrorKind::NotFound => {
 				throw!(AbsoluteImportFileNotFound(path.to_owned()))
 			}
-			Err(e) => throw!(Error::ImportIo(e.to_string())),
+			Err(e) => throw!(ImportIo(e.to_string())),
 		};
 		if meta.is_file() {
 			Ok(SourcePath::new(SourceFile::new(
@@ -141,7 +138,7 @@
 		let path = if let Some(f) = id.downcast_ref::<SourceFile>() {
 			f.path()
 		} else if id.downcast_ref::<SourceDirectory>().is_some() || id.is_default() {
-			throw!(Error::ImportIsADirectory(id.clone()))
+			throw!(ImportIsADirectory(id.clone()))
 		} else {
 			unreachable!("other types are not supported in resolve");
 		};
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -51,6 +51,7 @@
 pub mod gc;
 mod import;
 mod integrations;
+pub mod manifest;
 mod map;
 mod obj;
 pub mod stack;
@@ -69,7 +70,7 @@
 
 pub use ctx::*;
 pub use dynamic::*;
-pub use error::{Error::*, LocError, Result, ResultExt};
+pub use error::{Error, ErrorKind::*, Result, ResultExt};
 pub use evaluate::*;
 use function::CallLocation;
 use gc::{GcHashMap, TraceBox};
@@ -82,7 +83,7 @@
 pub use obj::*;
 use stack::check_depth;
 pub use tla::apply_tla;
-pub use val::{ManifestFormat, Thunk, Val};
+pub use val::{Thunk, Val};
 
 /// Thunk without bound `super`/`this`
 /// object inheritance may be overriden multiple times, and will be fixed only on field read
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -11,7 +11,7 @@
 use rustc_hash::FxHashMap;
 
 use crate::{
-	error::{Error::*, LocError},
+	error::{Error, ErrorKind::*},
 	function::CallLocation,
 	gc::{GcHashMap, GcHashSet, TraceBox},
 	operator::evaluate_add_op,
@@ -115,7 +115,7 @@
 	Cached(Val),
 	NotFound,
 	Pending,
-	Errored(LocError),
+	Errored(Error),
 }
 
 #[allow(clippy::module_name_repetitions)]
modifiedcrates/jrsonnet-evaluator/src/stack.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stack.rs
+++ b/crates/jrsonnet-evaluator/src/stack.rs
@@ -1,6 +1,6 @@
 use std::{cell::Cell, marker::PhantomData};
 
-use crate::error::{Error, LocError};
+use crate::error::{Error, ErrorKind};
 
 struct StackLimit {
 	max_stack_size: Cell<usize>,
@@ -22,14 +22,14 @@
 }
 
 pub struct StackOverflowError;
-impl From<StackOverflowError> for Error {
+impl From<StackOverflowError> for ErrorKind {
 	fn from(_: StackOverflowError) -> Self {
-		Error::StackOverflow
+		ErrorKind::StackOverflow
 	}
 }
-impl From<StackOverflowError> for LocError {
+impl From<StackOverflowError> for Error {
 	fn from(_: StackOverflowError) -> Self {
-		Error::StackOverflow.into()
+		ErrorKind::StackOverflow.into()
 	}
 }
 
modifiedcrates/jrsonnet-evaluator/src/stdlib/format.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stdlib/format.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/format.rs
@@ -6,7 +6,7 @@
 use jrsonnet_types::ValType;
 use thiserror::Error;
 
-use crate::{error::Error::*, throw, typed::Typed, LocError, ObjValue, Result, Val};
+use crate::{error::ErrorKind::*, throw, typed::Typed, Error, ObjValue, Result, Val};
 
 #[derive(Debug, Clone, Error, Trace)]
 pub enum FormatError {
@@ -26,7 +26,7 @@
 	NoSuchFormatField(IStr),
 }
 
-impl From<FormatError> for LocError {
+impl From<FormatError> for Error {
 	fn from(e: FormatError) -> Self {
 		Self::new(Format(e))
 	}
modifiedcrates/jrsonnet-evaluator/src/stdlib/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stdlib/mod.rs
+++ b/crates/jrsonnet-evaluator/src/stdlib/mod.rs
@@ -7,7 +7,6 @@
 use crate::{error::Result, function::CallLocation, State, Val};
 
 pub mod format;
-pub mod manifest;
 
 pub fn std_format(str: IStr, vals: Val) -> Result<String> {
 	State::push(
modifiedcrates/jrsonnet-evaluator/src/trace/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/trace/mod.rs
+++ b/crates/jrsonnet-evaluator/src/trace/mod.rs
@@ -6,7 +6,7 @@
 use jrsonnet_gcmodule::Trace;
 use jrsonnet_parser::{CodeLocation, Source};
 
-use crate::{error::Error, LocError};
+use crate::{error::ErrorKind, Error};
 
 /// The way paths should be displayed
 #[derive(Clone, Trace)]
@@ -51,9 +51,9 @@
 	fn write_trace(
 		&self,
 		out: &mut dyn std::fmt::Write,
-		error: &LocError,
+		error: &Error,
 	) -> Result<(), std::fmt::Error>;
-	fn format(&self, error: &LocError) -> Result<String, std::fmt::Error> {
+	fn format(&self, error: &Error) -> Result<String, std::fmt::Error> {
 		let mut out = String::new();
 		self.write_trace(&mut out, error)?;
 		Ok(out)
@@ -107,10 +107,10 @@
 	fn write_trace(
 		&self,
 		out: &mut dyn std::fmt::Write,
-		error: &LocError,
+		error: &Error,
 	) -> Result<(), std::fmt::Error> {
 		write!(out, "{}", error.error())?;
-		if let Error::ImportSyntaxError { path, error } = error.error() {
+		if let ErrorKind::ImportSyntaxError { path, error } = error.error() {
 			use std::fmt::Write;
 
 			writeln!(out)?;
@@ -204,7 +204,7 @@
 	fn write_trace(
 		&self,
 		out: &mut dyn std::fmt::Write,
-		error: &LocError,
+		error: &Error,
 	) -> Result<(), std::fmt::Error> {
 		write!(out, "{}", error.error())?;
 		for item in &error.trace().0 {
@@ -250,10 +250,10 @@
 	fn write_trace(
 		&self,
 		out: &mut dyn std::fmt::Write,
-		error: &LocError,
+		error: &Error,
 	) -> Result<(), std::fmt::Error> {
 		write!(out, "{}", error.error())?;
-		if let Error::ImportSyntaxError { path, error } = error.error() {
+		if let ErrorKind::ImportSyntaxError { path, error } = error.error() {
 			writeln!(out)?;
 			let offset = error.location.offset;
 			let location = path
modifiedcrates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/mod.rs
+++ b/crates/jrsonnet-evaluator/src/typed/mod.rs
@@ -7,7 +7,7 @@
 use thiserror::Error;
 
 use crate::{
-	error::{Error, LocError, Result},
+	error::{Error, ErrorKind, Result},
 	State, Val,
 };
 
@@ -26,9 +26,9 @@
 	)]
 	BoundsFailed(f64, Option<f64>, Option<f64>),
 }
-impl From<TypeError> for LocError {
+impl From<TypeError> for Error {
 	fn from(e: TypeError) -> Self {
-		Error::TypeError(e.into()).into()
+		ErrorKind::TypeError(e.into()).into()
 	}
 }
 
@@ -39,9 +39,9 @@
 		Self(Box::new(e), ValuePathStack(Vec::new()))
 	}
 }
-impl From<TypeLocError> for LocError {
+impl From<TypeLocError> for Error {
 	fn from(e: TypeLocError) -> Self {
-		Error::TypeError(e).into()
+		ErrorKind::TypeError(e).into()
 	}
 }
 impl Display for TypeLocError {
@@ -92,7 +92,7 @@
 	State::push_description(error_reason, || match item() {
 		Ok(_) => Ok(()),
 		Err(mut e) => {
-			if let Error::TypeError(e) = &mut e.error_mut() {
+			if let ErrorKind::TypeError(e) = &mut e.error_mut() {
 				(e.1).0.push(path());
 			}
 			Err(e)
@@ -218,7 +218,7 @@
 							return Ok(());
 						}
 						Err(e) => match e.error() {
-							Error::TypeError(e) => errors.push(e.clone()),
+							ErrorKind::TypeError(e) => errors.push(e.clone()),
 							_ => return Err(e),
 						},
 					}
@@ -233,7 +233,7 @@
 							return Ok(());
 						}
 						Err(e) => match e.error() {
-							Error::TypeError(e) => errors.push(e.clone()),
+							ErrorKind::TypeError(e) => errors.push(e.clone()),
 							_ => return Err(e),
 						},
 					}
modifiedcrates/jrsonnet-evaluator/src/val.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/val.rs
+++ b/crates/jrsonnet-evaluator/src/val.rs
@@ -5,9 +5,10 @@
 use jrsonnet_types::ValType;
 
 use crate::{
-	error::{Error::*, LocError},
+	error::{Error, ErrorKind::*},
 	function::FuncVal,
 	gc::{GcHashMap, TraceBox},
+	manifest::{ManifestFormat, ToStringFormat},
 	throw,
 	typed::BoundedUsize,
 	ObjValue, Result, Unbound, WeakObjValue,
@@ -21,7 +22,7 @@
 #[derive(Trace)]
 enum ThunkInner<T: Trace> {
 	Computed(T),
-	Errored(LocError),
+	Errored(Error),
 	Waiting(TraceBox<dyn ThunkValue<Output = T>>),
 	Pending,
 }
@@ -116,33 +117,6 @@
 impl<T: Trace> PartialEq for Thunk<T> {
 	fn eq(&self, other: &Self) -> bool {
 		Cc::ptr_eq(&self.0, &other.0)
-	}
-}
-
-pub trait ManifestFormat {
-	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()>;
-	fn manifest(&self, val: Val) -> Result<String> {
-		let mut out = String::new();
-		self.manifest_buf(val, &mut out)?;
-		Ok(out)
-	}
-}
-impl<T> ManifestFormat for Box<T>
-where
-	T: ManifestFormat + ?Sized,
-{
-	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {
-		let inner = &**self;
-		inner.manifest_buf(val, buf)
-	}
-}
-impl<T> ManifestFormat for &'_ T
-where
-	T: ManifestFormat + ?Sized,
-{
-	fn manifest_buf(&self, val: Val, buf: &mut String) -> Result<()> {
-		let inner = &**self;
-		inner.manifest_buf(val, buf)
 	}
 }
 
@@ -649,9 +623,7 @@
 			Self::Bool(false) => "false".into(),
 			Self::Null => "null".into(),
 			Self::Str(s) => s.clone(),
-			_ => self
-				.manifest(crate::stdlib::manifest::ToStringFormat)
-				.map(IStr::from)?,
+			_ => self.manifest(ToStringFormat).map(IStr::from)?,
 		})
 	}
 
modifiedcrates/jrsonnet-macros/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-macros/src/lib.rs
+++ b/crates/jrsonnet-macros/src/lib.rs
@@ -540,7 +540,7 @@
 			}
 		} else {
 			quote! {
-				<#ty>::from_untyped(obj.get(#name.into())?.ok_or_else(|| Error::NoSuchField(#name.into(), vec![]))?)?
+				<#ty>::from_untyped(obj.get(#name.into())?.ok_or_else(|| ErrorKind::NoSuchField(#name.into(), vec![]))?)?
 			}
 		};
 
@@ -638,19 +638,19 @@
 			use ::jrsonnet_evaluator::{
 				typed::{ComplexValType, Typed, TypedObj, CheckType},
 				Val, State,
-				error::{LocError, Error, Result},
+				error::{ErrorKind, Result as JrResult},
 				ObjValueBuilder, ObjValue,
 			};
 
 			#typed
 
 			impl TypedObj for #ident {
-				fn serialize(self, out: &mut ObjValueBuilder) -> Result<(), LocError> {
+				fn serialize(self, out: &mut ObjValueBuilder) -> JrResult<()> {
 					#(#fields_serialize)*
 
 					Ok(())
 				}
-				fn parse(obj: &ObjValue) -> Result<Self, LocError> {
+				fn parse(obj: &ObjValue) -> JrResult<Self> {
 					Ok(Self {
 						#(#fields_parse)*
 					})
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/lib.rs
+++ b/crates/jrsonnet-parser/src/lib.rs
@@ -450,15 +450,23 @@
 	fn imports() {
 		assert_eq!(
 			parse!("import \"hello\""),
-			el!(Expr::Import("hello".into()), 0, 14),
+			el!(Expr::Import(el!(Expr::Str("hello".into()), 7, 14)), 0, 14),
 		);
 		assert_eq!(
 			parse!("importstr \"garnish.txt\""),
-			el!(Expr::ImportStr("garnish.txt".into()), 0, 23)
+			el!(
+				Expr::ImportStr(el!(Expr::Str("garnish.txt".into()), 10, 23)),
+				0,
+				23
+			)
 		);
 		assert_eq!(
 			parse!("importbin \"garnish.bin\""),
-			el!(Expr::ImportBin("garnish.bin".into()), 0, 23)
+			el!(
+				Expr::ImportBin(el!(Expr::Str("garnish.bin".into()), 10, 23)),
+				0,
+				23
+			)
 		);
 	}
 
modifiedcrates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -7,7 +7,7 @@
 edition = "2021"
 
 [features]
-default = ["codegenerated-stdlib"]
+default = ["codegenerated-stdlib", "exp-more-hashes"]
 # Speed-up initialization by generating code for parsed stdlib, instead
 # of invoking parser for it
 codegenerated-stdlib = ["jrsonnet-parser/structdump"]
@@ -15,6 +15,7 @@
 legacy-this-file = []
 # Add order preservation flag to some functions
 exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order"]
+exp-more-hashes = ["sha2"]
 
 [dependencies]
 jrsonnet-evaluator.workspace = true
@@ -36,6 +37,8 @@
 # std.parseYaml, custom library fork is used for C++/golang compatibility
 serde_yaml_with_quirks = "0.8.24"
 
+sha2 = { version = "0.10.6", optional = true }
+
 [build-dependencies]
 jrsonnet-parser.workspace = true
 structdump = { version = "0.2.0", features = ["derive"] }
modifiedcrates/jrsonnet-stdlib/build.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/build.rs
+++ b/crates/jrsonnet-stdlib/build.rs
@@ -19,7 +19,7 @@
 	{
 		let out_dir = env::var("OUT_DIR").unwrap();
 		let dest_path = Path::new(&out_dir).join("stdlib.rs");
-		let mut f = File::create(&dest_path).unwrap();
+		let mut f = File::create(dest_path).unwrap();
 		f.write_all(
 			("#[allow(clippy::redundant_clone)]".to_owned() + &v.to_string())
 				.replace(';', ";\n")
modifiedcrates/jrsonnet-stdlib/src/encoding.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/encoding.rs
+++ b/crates/jrsonnet-stdlib/src/encoding.rs
@@ -1,5 +1,5 @@
 use jrsonnet_evaluator::{
-	error::{Error::RuntimeError, Result},
+	error::{ErrorKind::RuntimeError, Result},
 	function::builtin,
 	typed::{Either, Either2},
 	IBytes, IStr,
modifiedcrates/jrsonnet-stdlib/src/hash.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/hash.rs
+++ b/crates/jrsonnet-stdlib/src/hash.rs
@@ -4,3 +4,10 @@
 pub fn builtin_md5(str: IStr) -> Result<String> {
 	Ok(format!("{:x}", md5::compute(str.as_bytes())))
 }
+
+#[cfg(feature = "exp-more-hashes")]
+#[builtin]
+pub fn builtin_sha256(str: IStr) -> Result<String> {
+	use sha2::digest::Digest;
+	Ok(format!("{:?}", sha2::Sha256::digest(str.as_bytes())))
+}
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -5,7 +5,7 @@
 };
 
 use jrsonnet_evaluator::{
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	function::{builtin::Builtin, CallLocation, FuncVal, TlaArg},
 	gc::{GcHashMap, TraceBox},
 	tb,
@@ -101,6 +101,8 @@
 		("sort", builtin_sort::INST),
 		// Hash
 		("md5", builtin_md5::INST),
+		#[cfg(feature = "exp-more-hashes")]
+		("sha256", builtin_sha256::INST),
 		// Encoding
 		("encodeUTF8", builtin_encode_utf8::INST),
 		("decodeUTF8", builtin_decode_utf8::INST),
modifiedcrates/jrsonnet-stdlib/src/misc.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/misc.rs
+++ b/crates/jrsonnet-stdlib/src/misc.rs
@@ -1,7 +1,7 @@
 use std::{cell::RefCell, rc::Rc};
 
 use jrsonnet_evaluator::{
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	function::{builtin, ArgLike, CallLocation, FuncVal},
 	throw,
 	typed::{Any, Either2, Either4},
modifiedcrates/jrsonnet-stdlib/src/parse.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/parse.rs
+++ b/crates/jrsonnet-stdlib/src/parse.rs
@@ -1,5 +1,5 @@
 use jrsonnet_evaluator::{
-	error::{Error::RuntimeError, Result},
+	error::{ErrorKind::RuntimeError, Result},
 	function::builtin,
 	typed::Any,
 	IStr, Val,
modifiedcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/strings.rs
+++ b/crates/jrsonnet-stdlib/src/strings.rs
@@ -1,5 +1,5 @@
 use jrsonnet_evaluator::{
-	error::{Error::*, Result},
+	error::{ErrorKind::*, Result},
 	function::builtin,
 	typed::{Either2, VecVal, M1},
 	val::ArrValue,
modifiedtests/tests/common.rsdiffbeforeafterboth
--- a/tests/tests/common.rs
+++ b/tests/tests/common.rs
@@ -29,7 +29,7 @@
 macro_rules! ensure_val_eq {
 	($a:expr, $b:expr) => {{
 		if !::jrsonnet_evaluator::val::equals(&$a.clone(), &$b.clone())? {
-			use ::jrsonnet_evaluator::stdlib::manifest::JsonFormat;
+			use ::jrsonnet_evaluator::manifest::JsonFormat;
 			::jrsonnet_evaluator::throw!(
 				"assertion failed: a != b\na={:#?}\nb={:#?}",
 				$a.manifest(JsonFormat::default())?,
modifiedtests/tests/golden.rsdiffbeforeafterboth
--- a/tests/tests/golden.rs
+++ b/tests/tests/golden.rs
@@ -4,7 +4,7 @@
 };
 
 use jrsonnet_evaluator::{
-	stdlib::manifest::JsonFormat,
+	manifest::JsonFormat,
 	trace::{CompactFormat, PathResolver, TraceFormat},
 	FileImportResolver, State,
 };