difftreelog
fix StateBuilder leftovers
in: master
3 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -113,15 +113,6 @@
checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1"
[[package]]
-name = "bincode"
-version = "1.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
-dependencies = [
- "serde",
-]
-
-[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -483,7 +474,6 @@
dependencies = [
"annotate-snippets",
"anyhow",
- "bincode",
"derivative",
"hashbrown 0.14.5",
"hi-doc",
@@ -1304,6 +1294,7 @@
version = "0.1.0"
dependencies = [
"anyhow",
+ "clap",
"indexmap 2.2.6",
"itertools",
"proc-macro2",
Cargo.tomldiffbeforeafterboth1[workspace]2members = ["crates/*", "bindings/jsonnet", "cmds/*", "tests", "xtask"]3default-members = ["cmds/jrsonnet"]4resolver = "2"56[workspace.package]7authors = ["Yaroslav Bolyukin <iam@lach.pw>"]8edition = "2021"9license = "MIT"10repository = "https://github.com/CertainLach/jrsonnet"11version = "0.5.0-pre96"1213[workspace.dependencies]14jrsonnet-evaluator = { path = "./crates/jrsonnet-evaluator", version = "0.5.0-pre96" }15jrsonnet-macros = { path = "./crates/jrsonnet-macros", version = "0.5.0-pre96" }16jrsonnet-parser = { path = "./crates/jrsonnet-parser", version = "0.5.0-pre96" }17jrsonnet-rowan-parser = { path = "./crates/jrsonnet-rowan-parser", version = "0.5.0-pre96" }18jrsonnet-interner = { path = "./crates/jrsonnet-interner", version = "0.5.0-pre96" }19jrsonnet-stdlib = { path = "./crates/jrsonnet-stdlib", version = "0.5.0-pre96" }20jrsonnet-cli = { path = "./crates/jrsonnet-cli", version = "0.5.0-pre96" }21jrsonnet-types = { path = "./crates/jrsonnet-types", version = "0.5.0-pre96" }2223jrsonnet-gcmodule = "0.3.6"2425# Diagnostics.26# hi-doc is my library, which handles text formatting very well, but isn't polished enough yet27# Previous implementation was based on annotate-snippets, which I don't like for many reasons.28#29# I'm against using miette, because I want to reuse data between interpreter and annotations, yet miette30# and other libraries want to handle spans etc by itself, which is okay for compiler diagnostics, but is31# bad for interpreter, where interpreter and parser are paired much closer.32hi-doc = "0.1.1"33annotate-snippets = "0.10.1"3435# CLI36clap = "4.5"37clap_complete = "4.5"3839# Parsing, manifestification is implemented manually everywhere40# Note on serde_yaml_with_quirks: This is a fork of serde-yaml with legacy yaml 1.1 support:41# https://github.com/dtolnay/serde-yaml/pull/22542serde = "1.0.197"43serde_json = "1.0.114"44serde_yaml_with_quirks = "0.8.24"4546# Error handling47anyhow = "1.0.83"48thiserror = "1.0.60"4950# Code formatting51dprint-core = "0.65.0"5253# Stdlib hashing functions54md5 = "0.7.0"55sha1 = "0.10.6"56sha2 = "0.10.8"57sha3 = "0.10.8"5859# Pre-parsed stdlib serialization.60# TODO: Drop in favor of replacing std.jsonnet with full native implementation, version 2.0 of bincode is bad.61bincode = "1.3"6263# Source code parsing.64# Jrsonnet has two parsers for jsonnet - one is for execution, and another is for better parsing diagnostics/lints/LSP.65# First (and fast one) is based on peg, second is based on rowan.66peg = "0.8.3"67logos = "0.14.0"68ungrammar = "1.16.1"69rowan = "0.15.15"7071mimallocator = "0.1.3"72indoc = "2.0"73insta = "1.39"74tempfile = "3.10"75pathdiff = "0.2.1"76hashbrown = "0.14.5"77static_assertions = "1.1"78rustc-hash = "1.1"79num-bigint = "0.4.5"80derivative = "2.2.0"81strsim = "0.11.0"82proc-macro2 = "1.0"83quote = "1.0"84syn = "2.0"85drop_bomb = "0.1.5"86base64 = "0.22.1"87indexmap = "2.2.3"88itertools = "0.13.0"89xshell = "0.2.6"9091lsp-server = "0.7.6"92lsp-types = "0.96.0"9394regex = "1.10"95lru = "0.12.3"9697json-structural-diff = "0.1.0"9899[workspace.lints.rust]100unsafe_op_in_unsafe_fn = "deny"101102# TODO: add docs everywhere103# missing_doc = "warn"104105elided_lifetimes_in_paths = "allow"106explicit_outlives_requirements = "allow"107noop_method_call = "allow"108single_use_lifetimes = "allow"109variant_size_differences = "allow"110macro_expanded_macro_exports_accessed_by_absolute_paths = "allow"111112[workspace.lints.rustdoc]113all = "warn"114115[workspace.lints.clippy]116all = "warn"117nursery = "warn"118pedantic = "warn"119120ptr_arg = "allow"121# Too verbose122must_use_candidate = "allow"123# A lot of functions pass around errors thrown by code124missing_errors_doc = "allow"125# A lot of pointers have interior Rc126needless_pass_by_value = "allow"127# Its fine128wildcard_imports = "allow"129enum_glob_use = "allow"130module_name_repetitions = "allow"131# TODO: fix individual issues, however this works as intended almost everywhere132cast_precision_loss = "allow"133cast_possible_wrap = "allow"134cast_possible_truncation = "allow"135cast_sign_loss = "allow"136# False positives137# https://github.com/rust-lang/rust-clippy/issues/6902138use_self = "allow"139# https://github.com/rust-lang/rust-clippy/issues/8539140iter_with_drain = "allow"141type_repetition_in_bounds = "allow"142# ci is being run with nightly, but library should work on stable143missing_const_for_fn = "allow"144# too many false-positives with .expect() calls145missing_panics_doc = "allow"146# false positive for IStr type. There is an configuration option for147# such cases, but it doesn't work:148# https://github.com/rust-lang/rust-clippy/issues/9801149mutable_key_type = "allow"150# false positives151redundant_pub_crate = "allow"152# Sometimes code is fancier without that153manual_let_else = "allow"154# Something is broken about that lint, can't be allowed for155# codegenerated-stdlib block156similar_names = "allow"157158#[profile.test]159#opt-level = 1160161[profile.release]162opt-level = 3163lto = "fat"164codegen-units = 1165debug = 0166panic = "abort"167strip = true168169[profile.releasedebug]170inherits = "release"171debug = 2172panic = "unwind"173strip = falsecmds/jrsonnet/src/main.rsdiffbeforeafterboth--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -147,9 +147,8 @@
}
fn main_catch(opts: Opts) -> bool {
- let s = State::default();
let trace = opts.trace.trace_format();
- if let Err(e) = main_real(&s, opts) {
+ if let Err(e) = main_real(opts) {
if let Error::Evaluation(e) = e {
let mut out = String::new();
trace.write_trace(&mut out, &e).expect("format error");
@@ -162,18 +161,17 @@
true
}
-fn main_real(s: &State, opts: Opts) -> Result<(), Error> {
+fn main_real(opts: Opts) -> Result<(), Error> {
let _gc_leak_guard = opts.gc.leak_on_exit();
let _gc_print_stats = opts.gc.stats_printer();
let _stack_depth_override = opts.misc.stack_size_override();
let import_resolver = opts.misc.import_resolver();
- s.set_import_resolver(import_resolver);
+ let std = opts.std.context_initializer()?;
- let std = opts.std.context_initializer()?;
- if let Some(std) = std {
- s.set_context_initializer(std);
- }
+ let mut s = State::builder();
+ s.import_resolver(import_resolver).context_initializer(std);
+ let s = s.build();
let input = opts.input.input.ok_or(Error::MissingInputArgument)?;
let val = if opts.input.exec {
@@ -189,7 +187,7 @@
let tla = opts.tla.tla_opts()?;
#[allow(unused_mut)]
- let mut val = apply_tla(s.clone(), &tla, val)?;
+ let mut val = apply_tla(s, &tla, val)?;
#[cfg(feature = "exp-apply")]
for apply in opts.input.exp_apply {