git.delta.rocks / jrsonnet / refs/commits / c5b983e11d4d

difftreelog

ci bump Rust version and resolve clippy issues (#160)

Petr Portnov | PROgrm_JARvis2024-05-10parent: #ad68a24.patch.diff
in: master
* build: bump Rust version and update dependencies

* chore: resolve all reported Clippy issues

* build: use the correct Toolchain version

* ci: update GitHub Workflows to use valid actions

* ci: add permissions to `clippy_check`

* chore(GH-160): bump dependencies and disable `thread_local_initializer_can_be_made_const` lint

* chore(GH-160): try fixing `thread_local_initializer_can_be_made_const`

* fix(GH-160): `serialized-stdlib` feature

* ci(GH-160): fix `Test Suite`

* fix(GH-160): resolve `insta` deprecation

* ci(GH-160): add formatting check job

* ci(GH-160): reorganize jobs

* style(GH-160): fix formatting

* build(GH-160): fix `#[cfg(never)]`

* build(GH-160): `#[allow(dead_code)]` on `FinishedRanger::end_token`

* build(GH-160): allow more dead code

* test(GH-160): fix `golden.rs`

26 files changed

added.github/workflows/checks.yamldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/checks.yaml
@@ -0,0 +1,25 @@
+name: Checks
+on: [ pull_request ]
+jobs:
+  tests:
+    name: Tests
+    uses: ./.github/workflows/test.yaml
+  lints:
+    name: Lints
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4.1.4
+      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+      - uses: auguwu/clippy-action@1.3.0
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+    permissions:
+      checks: write
+  formatting:
+    name: Formatting
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4.1.4
+      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+      - uses: actions-rust-lang/rustfmt@v1.1.0
+
deleted.github/workflows/clippy_check.ymldiffbeforeafterboth
--- a/.github/workflows/clippy_check.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-on: [push, pull_request]
-name: Clippy check
-jobs:
-  clippy_check:
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-            toolchain: nightly-2023-10-28
-            components: clippy
-            override: true
-      - uses: actions-rs/clippy-check@v1
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
added.github/workflows/release.yamldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,140 @@
+name: Release
+on:
+  push:
+    tags: [ 'v*' ]
+jobs:
+  tests:
+    uses: ./.github/workflows/test.yaml
+
+  cargo-release:
+    if: !endsWith(github.ref, '-test')
+    needs: [ tests ]
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4.1.4
+      - name: Install stable toolchain
+        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+        with:
+          toolchain: stable
+      - run: cargo install cargo-release
+      - run: cargo login ${{ secrets.CARGO_TOKEN }}
+      - run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm
+
+  github-release:
+    needs: [ tests ]
+    strategy:
+      matrix:
+        target:
+          # Linux build notes:
+          # While musl targets are not as supported as gnu, those are most relevant to users,
+          # which want to download binaries from github, as glibc has compatibility issues
+          # with older distros
+
+          # Tier 1
+          - i686-pc-windows-msvc
+          - x86_64-apple-darwin
+          - x86_64-pc-windows-msvc
+
+          # Tier 2
+          - aarch64-apple-darwin
+          - aarch64-unknown-linux-musl
+          - i686-unknown-linux-musl
+          - x86_64-unknown-linux-musl
+        include:
+          # Linux
+          - target: aarch64-unknown-linux-musl
+            os: ubuntu-latest
+            bin: jrsonnet
+            name: jrsonnet-linux-aarch64
+          - target: i686-unknown-linux-musl
+            os: ubuntu-latest
+            bin: jrsonnet
+            name: jrsonnet-linux-i686
+          - target: x86_64-unknown-linux-musl
+            os: ubuntu-latest
+            bin: jrsonnet
+            name: jrsonnet-linux-amd64
+
+          # Windows
+          - target: i686-pc-windows-msvc
+            os: windows-latest
+            bin: jrsonnet.exe
+            name: jrsonnet-windows-i686.exe
+          - target: x86_64-pc-windows-msvc
+            os: windows-latest
+            bin: jrsonnet.exe
+            name: jrsonnet-windows-amd64.exe
+
+          # Apple
+          - target: aarch64-apple-darwin
+            os: macOS-latest
+            bin: jrsonnet
+            name: jrsonnet-darwin-aarch64
+          - target: x86_64-apple-darwin
+            os: macOS-latest
+            bin: jrsonnet
+            name: jrsonnet-darwin-amd64
+    runs-on: ${{ matrix.os }}
+    steps:
+      - name: Fetch apt repo updates
+        if: ${{ startsWith(matrix.os, 'ubuntu-') }}
+        run: sudo apt update
+
+      - name: Install stable toolchain
+        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+        with:
+          toolchain: stable
+          target: ${{ matrix.target }}
+
+      - uses: actions/checkout@v4.1.4
+
+      - name: Add experimental flags
+        if: ${{ endsWith(github.ref, '-test' )}}
+        run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV
+
+      - name: Linux x86 cross compiler
+        if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }}
+        run: sudo apt install gcc-multilib
+
+      - name: ARM cross compiler
+        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
+        uses: actions-rs/cargo@v1
+        with:
+          command: install
+          args: cross
+
+      - name: ARM gcc
+        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
+        run: sudo apt install gcc-aarch64-linux-gnu
+
+      - name: Musl gcc
+        if: ${{ endsWith(matrix.target, '-musl') }}
+        run: sudo apt install musl musl-tools
+
+      - name: Run cross build
+        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
+        shell: bash
+        run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
+
+      - name: Run build
+        if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
+        run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
+
+      - name: Package
+        shell: bash
+        run: |
+          cd target/${{ matrix.target }}/release
+
+          cp ${{ matrix.bin }} ../../../${{ matrix.name }}
+          cd -
+
+      - name: Generate SHA-256
+        run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
+
+      - name: Publish
+        uses: softprops/action-gh-release@v2.0.4
+        with:
+          draft: true
+          files: "jrsonnet*"
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deleted.github/workflows/release.ymldiffbeforeafterboth
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,172 +0,0 @@
-name: CI
-on: [push]
-jobs:
-  test:
-    name: Test Suite
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout sources
-        uses: actions/checkout@v2
-      - name: Install stable toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          override: true
-      - name: Run tests
-        uses: actions-rs/cargo@v1
-        with:
-          command: test
-          args: --all
-
-  cargo-release:
-    if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test')
-    needs: [test]
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout sources
-        uses: actions/checkout@v2
-      - name: Install stable toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          override: true
-      - name: Install cargo release command
-        uses: actions-rs/cargo@v1
-        with:
-          command: install
-          args: cargo-release
-      - name: Run cargo login
-        uses: actions-rs/cargo@v1
-        with:
-          command: login
-          args: ${{ secrets.CARGO_TOKEN }}
-      - name: Publish crates
-        uses: actions-rs/cargo@v1
-        with:
-          command: release
-          args: --no-dev-version --skip-push --skip-tag --no-confirm
-
-  github-release:
-    if: startsWith(github.ref, 'refs/tags/')
-    needs: [test]
-    strategy:
-      matrix:
-        target:
-          # Linux build notes:
-          # While musl targets are not as supported as gnu, those are most relevant to users,
-          # which want to download binaries from github, as glibc has compatibility issues
-          # with older distros
-
-          # Tier 1
-          - i686-pc-windows-msvc
-          - x86_64-apple-darwin
-          - x86_64-pc-windows-msvc
-
-          # Tier 2
-          - aarch64-apple-darwin
-          - aarch64-unknown-linux-musl
-          - i686-unknown-linux-musl
-          - x86_64-unknown-linux-musl
-        include:
-          # Linux
-          - target: aarch64-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-aarch64
-          - target: i686-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-i686
-          - target: x86_64-unknown-linux-musl
-            os: ubuntu-latest
-            bin: jrsonnet
-            name: jrsonnet-linux-amd64
-
-          # Windows
-          - target: i686-pc-windows-msvc
-            os: windows-latest
-            bin: jrsonnet.exe
-            name: jrsonnet-windows-i686.exe
-          - target: x86_64-pc-windows-msvc
-            os: windows-latest
-            bin: jrsonnet.exe
-            name: jrsonnet-windows-amd64.exe
-
-          # Apple
-          - target: aarch64-apple-darwin
-            os: macOS-latest
-            bin: jrsonnet
-            name: jrsonnet-darwin-aarch64
-          - target: x86_64-apple-darwin
-            os: macOS-latest
-            bin: jrsonnet
-            name: jrsonnet-darwin-amd64
-    runs-on: ${{ matrix.os }}
-    steps:
-      - name: Fetch apt repo updates
-        if: ${{ startsWith(matrix.os, 'ubuntu-') }}
-        run: sudo apt update
-
-      - name: Install stable toolchain
-        uses: actions-rs/toolchain@v1
-        with:
-          toolchain: stable
-          override: true
-          target: ${{ matrix.target }}
-
-      - name: Checkout
-        uses: actions/checkout@v2
-
-      - name: Add experimental flags
-        if: ${{ endsWith(github.ref, '-test' )}}
-        run: echo 'EXPERIMENTAL_FLAGS=--features=experimental' >> $GITHUB_ENV
-
-      - name: Linux x86 cross compiler
-        if: ${{ startsWith(matrix.target, 'i686-unknown-linux-') }}
-        run: sudo apt install gcc-multilib
-
-      - name: ARM cross compiler
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        uses: actions-rs/cargo@v1
-        with:
-          command: install
-          args: cross
-
-      - name: ARM gcc
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        run: sudo apt install gcc-aarch64-linux-gnu
-
-      - name: Musl gcc
-        if: ${{ endsWith(matrix.target, '-musl') }}
-        run: sudo apt install musl musl-tools
-
-      - name: Run cross build
-        if: ${{ startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        shell: bash
-        run: cross build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
-
-      - name: Run build
-        if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
-        uses: actions-rs/cargo@v1
-        with:
-          command: build
-          args: --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
-
-      - name: Package
-        shell: bash
-        run: |
-          cd target/${{ matrix.target }}/release
-
-          cp ${{ matrix.bin }} ../../../${{ matrix.name }}
-          cd -
-
-      - name: Generate SHA-256
-        run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256
-
-      - name: Publish
-        uses: softprops/action-gh-release@v1
-        with:
-          draft: true
-          files: "jrsonnet*"
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
added.github/workflows/test.yamldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,21 @@
+name: Test
+on: [ workflow_call ]
+jobs:
+  test:
+    name: Test
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4.1.4
+      - uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+      - run: cargo test --all
+  test-stable:
+    name: Test on stable
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4.1.4
+      - name: Install the latest stable toolchain
+        uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
+        with:
+          toolchain: stable
+      - run: cargo test --all
+
modifiedCargo.lockdiffbeforeafterboth
before · Cargo.lock
157 packageslockfile v3
after · Cargo.lock
150 packageslockfile v3
modifiedcmds/jrsonnet-fmt/src/tests.rsdiffbeforeafterboth
--- a/cmds/jrsonnet-fmt/src/tests.rs
+++ b/cmds/jrsonnet-fmt/src/tests.rs
@@ -23,7 +23,7 @@
 
 #[test]
 fn complex_comments_snapshot() {
-	insta::assert_display_snapshot!(reformat(indoc!(
+	insta::assert_snapshot!(reformat(indoc!(
 		"{
 		  comments: {
 			_: '',
modifiedcrates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth
--- a/crates/jrsonnet-cli/src/tla.rs
+++ b/crates/jrsonnet-cli/src/tla.rs
@@ -14,7 +14,7 @@
 pub struct TlaOpts {
 	/// Add top level string argument.
 	/// Top level arguments will be passed to function before manifestification stage.
-	/// This is preferred to ExtVars method.
+	/// This is preferred to [`ExtVars`] method.
 	/// If [=data] is not set then it will be read from `name` env variable.
 	#[clap(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]
 	tla_str: Vec<ExtStr>,
modifiedcrates/jrsonnet-evaluator/src/arr/mod.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/arr/mod.rs
+++ b/crates/jrsonnet-evaluator/src/arr/mod.rs
@@ -7,8 +7,7 @@
 use crate::{function::FuncVal, gc::TraceBox, tb, Context, Result, Thunk, Val};
 
 mod spec;
-pub use spec::ArrayLike;
-pub(crate) use spec::*;
+pub use spec::{ArrayLike, *};
 
 /// Represents a Jsonnet array value.
 #[derive(Debug, Clone, Trace)]
modifiedcrates/jrsonnet-evaluator/src/function/arglike.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/function/arglike.rs
+++ b/crates/jrsonnet-evaluator/src/function/arglike.rs
@@ -76,13 +76,6 @@
 	}
 }
 
-mod sealed {
-	/// Implemented for `ArgsLike`, where only unnamed arguments present
-	pub trait Unnamed {}
-	/// Implemented for `ArgsLike`, where only named arguments present
-	pub trait Named {}
-}
-
 pub trait ArgsLike {
 	fn unnamed_len(&self) -> usize;
 	fn unnamed_iter(
@@ -182,7 +175,6 @@
 	}
 }
 
-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
@@ -247,7 +239,6 @@
 
 macro_rules! impl_args_like {
 	($count:expr; $($gen:ident)*) => {
-		impl<$($gen: ArgLike,)*> sealed::Unnamed for ($($gen,)*) {}
 		impl<$($gen: ArgLike,)*> ArgsLike for ($($gen,)*) {
 			fn unnamed_len(&self) -> usize {
 				$count
@@ -279,7 +270,6 @@
 		}
 		impl<$($gen: ArgLike,)*> OptionalContext for ($($gen,)*) where $($gen: OptionalContext),* {}
 
-		impl<$($gen: ArgLike,)*> sealed::Named for ($((IStr, $gen),)*) {}
 		impl<$($gen: ArgLike,)*> ArgsLike for ($((IStr, $gen),)*) {
 			fn unnamed_len(&self) -> usize {
 				0
modifiedcrates/jrsonnet-evaluator/src/integrations/serde.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/integrations/serde.rs
+++ b/crates/jrsonnet-evaluator/src/integrations/serde.rs
@@ -346,9 +346,9 @@
 	type Ok = Val;
 	type Error = JrError;
 
-	fn serialize_key<T: ?Sized>(&mut self, key: &T) -> Result<()>
+	fn serialize_key<T>(&mut self, key: &T) -> Result<()>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		let key = key.serialize(IntoValSerializer)?;
 		let key = key.to_string()?;
@@ -356,9 +356,9 @@
 		Ok(())
 	}
 
-	fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<()>
+	fn serialize_value<T>(&mut self, value: &T) -> Result<()>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		let key = self.key.take().expect("no serialize_key called");
 		let value = value.serialize(IntoValSerializer)?;
@@ -367,10 +367,10 @@
 	}
 
 	// TODO: serialize_key/serialize_value
-	fn serialize_entry<K: ?Sized, V: ?Sized>(&mut self, key: &K, value: &V) -> Result<()>
+	fn serialize_entry<K, V>(&mut self, key: &K, value: &V) -> Result<()>
 	where
-		K: Serialize,
-		V: Serialize,
+		K: ?Sized + Serialize,
+		V: ?Sized + Serialize,
 	{
 		let key = key.serialize(IntoValSerializer)?;
 		let key = key.to_string()?;
@@ -394,9 +394,9 @@
 	type Ok = Val;
 	type Error = JrError;
 
-	fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<()>
+	fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		SerializeMap::serialize_entry(self, key, value)?;
 		Ok(())
@@ -411,9 +411,9 @@
 
 	type Error = JrError;
 
-	fn serialize_field<T: ?Sized>(&mut self, key: &'static str, value: &T) -> Result<()>
+	fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<()>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		SerializeMap::serialize_entry(self, key, value)?;
 		Ok(())
@@ -504,9 +504,9 @@
 		Ok(Val::Null)
 	}
 
-	fn serialize_some<T: ?Sized>(self, value: &T) -> Result<Val>
+	fn serialize_some<T>(self, value: &T) -> Result<Val>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		value.serialize(self)
 	}
@@ -528,14 +528,14 @@
 		Ok(Val::Str(variant.into()))
 	}
 
-	fn serialize_newtype_struct<T: ?Sized>(self, _name: &'static str, value: &T) -> Result<Val>
+	fn serialize_newtype_struct<T>(self, _name: &'static str, value: &T) -> Result<Val>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		value.serialize(self)
 	}
 
-	fn serialize_newtype_variant<T: ?Sized>(
+	fn serialize_newtype_variant<T>(
 		self,
 		_name: &'static str,
 		_variant_index: u32,
@@ -543,7 +543,7 @@
 		value: &T,
 	) -> Result<Val>
 	where
-		T: Serialize,
+		T: ?Sized + Serialize,
 	{
 		let mut out = ObjValue::builder_with_capacity(1);
 		let value = value.serialize(self)?;
modifiedcrates/jrsonnet-evaluator/src/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/manifest.rs
@@ -1,4 +1,4 @@
-use std::{borrow::Cow, fmt::Write};
+use std::{borrow::Cow, fmt::Write, ptr};
 
 use crate::{bail, Result, ResultExt, State, Val};
 
@@ -404,7 +404,7 @@
 
 pub fn escape_string_json_buf(value: &str, buf: &mut String) {
 	// Safety: we only write correct utf-8 in this function
-	let buf: &mut Vec<u8> = unsafe { &mut *(buf as *mut String).cast::<Vec<u8>>() };
+	let buf: &mut Vec<u8> = unsafe { &mut *ptr::from_mut(buf).cast::<Vec<u8>>() };
 	let bytes = value.as_bytes();
 
 	// Perfect for ascii strings, removes any reallocations
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -88,7 +88,7 @@
 	}
 }
 
-use ordering::*;
+use ordering::{FieldIndex, FieldSortKey, SuperDepth};
 
 // 0 - add
 //  12 - visibility
modifiedcrates/jrsonnet-evaluator/src/stack.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/stack.rs
+++ b/crates/jrsonnet-evaluator/src/stack.rs
@@ -8,6 +8,7 @@
 }
 
 #[cfg(feature = "nightly")]
+#[allow(clippy::thread_local_initializer_can_be_made_const)]
 #[thread_local]
 static STACK_LIMIT: StackLimit = StackLimit {
 	max_stack_size: Cell::new(200),
@@ -15,9 +16,11 @@
 };
 #[cfg(not(feature = "nightly"))]
 thread_local! {
-	static STACK_LIMIT: StackLimit = StackLimit {
-		max_stack_size: Cell::new(200),
-		current_depth: Cell::new(0),
+	static STACK_LIMIT: StackLimit = const {
+		StackLimit {
+			max_stack_size: Cell::new(200),
+			current_depth: Cell::new(0),
+		}
 	};
 }
 
@@ -40,7 +43,7 @@
 	fn drop(&mut self) {
 		STACK_LIMIT
 			.current_depth
-			.set(STACK_LIMIT.current_depth.get() - 1)
+			.set(STACK_LIMIT.current_depth.get() - 1);
 	}
 	#[cfg(not(feature = "nightly"))]
 	fn drop(&mut self) {
@@ -75,7 +78,7 @@
 impl Drop for StackDepthLimitOverrideGuard {
 	#[cfg(feature = "nightly")]
 	fn drop(&mut self) {
-		STACK_LIMIT.max_stack_size.set(self.old_limit)
+		STACK_LIMIT.max_stack_size.set(self.old_limit);
 	}
 	#[cfg(not(feature = "nightly"))]
 	fn drop(&mut self) {
modifiedcrates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/typed/conversions.rs
+++ b/crates/jrsonnet-evaluator/src/typed/conversions.rs
@@ -143,6 +143,7 @@
 					_ => unreachable!(),
 				}
 			}
+			#[allow(clippy::cast_lossless)]
 			fn into_untyped(value: Self) -> Result<Val> {
 				Ok(Val::Num(value as f64))
 			}
@@ -199,6 +200,7 @@
 				}
 			}
 
+			#[allow(clippy::cast_lossless)]
 			fn into_untyped(value: Self) -> Result<Val> {
 				Ok(Val::Num(value.0 as f64))
 			}
modifiedcrates/jrsonnet-rowan-parser/src/marker.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/marker.rs
+++ b/crates/jrsonnet-rowan-parser/src/marker.rs
@@ -22,6 +22,7 @@
 
 pub struct FinishedRanger {
 	pub start_token: usize,
+	#[allow(dead_code)]
 	pub end_token: usize,
 }
 impl FinishedRanger {
modifiedcrates/jrsonnet-rowan-parser/src/tests.rsdiffbeforeafterboth
--- a/crates/jrsonnet-rowan-parser/src/tests.rs
+++ b/crates/jrsonnet-rowan-parser/src/tests.rs
@@ -1,4 +1,5 @@
-#![cfg(never)]
+// `never`
+#![cfg(any())]
 
 use miette::{
 	Diagnostic, GraphicalReportHandler, GraphicalTheme, LabeledSpan, ThemeCharacters, ThemeStyles,
modifiedcrates/jrsonnet-stdlib/Cargo.tomldiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/Cargo.toml
+++ b/crates/jrsonnet-stdlib/Cargo.toml
@@ -12,19 +12,23 @@
 
 [features]
 default = ["codegenerated-stdlib"]
-# Speed-up initialization by generating code for parsed stdlib, instead
-# of invoking parser for it
+# Speed-up initialization by generating code for parsed stdlib,
+# instead of invoking parser for it.
+# This is mutually exclusive with `serialized-stdlib`.
 codegenerated-stdlib = ["jrsonnet-parser/structdump"]
+# Use the embedded serialized stdlib.
+# This is mutually exclusive with `codegenerated-stdlib`.
+serialized-stdlib = []
 # Enables legacy `std.thisFile` support, at the cost of worse caching
 legacy-this-file = []
 # Add order preservation flag to some functions
 exp-preserve-order = ["jrsonnet-evaluator/exp-preserve-order"]
 # Bigint type
-exp-bigint = ["num-bigint", "jrsonnet-evaluator/exp-bigint"]
+exp-bigint = ["dep:num-bigint", "jrsonnet-evaluator/exp-bigint"]
 
 exp-null-coaelse = ["jrsonnet-parser/exp-null-coaelse", "jrsonnet-evaluator/exp-null-coaelse"]
 # std.regexMatch and other helpers
-exp-regex = ["regex", "lru", "rustc-hash"]
+exp-regex = ["dep:regex", "dep:lru", "dep:rustc-hash"]
 
 [dependencies]
 jrsonnet-evaluator.workspace = true
modifiedcrates/jrsonnet-stdlib/src/expr.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/expr.rs
+++ b/crates/jrsonnet-stdlib/src/expr.rs
@@ -1,7 +1,11 @@
 use jrsonnet_parser::LocExpr;
 
 pub fn stdlib_expr() -> LocExpr {
-	#[cfg(feature = "serialized-stdlib")]
+	#[cfg(all(feature = "serialized-stdlib", feature = "codegenerated-stdlib"))]
+	compile_error!(
+		"features `serialized-stdlib` and `codegenerated-stdlib` are mutually exclusive"
+	);
+	#[cfg(all(feature = "serialized-stdlib", not(feature = "codegenerated-stdlib")))]
 	{
 		use bincode::{BincodeRead, DefaultOptions, Options};
 		use serde::{Deserialize, Deserializer};
@@ -77,7 +81,7 @@
 		LocExpr::deserialize(&mut deserializer).unwrap()
 	}
 
-	#[cfg(feature = "codegenerated-stdlib")]
+	#[cfg(all(feature = "codegenerated-stdlib", not(feature = "serialized-stdlib")))]
 	{
 		mod structdump_import {
 			pub(super) use std::{option::Option, rc::Rc, vec};
@@ -88,7 +92,7 @@
 		include!(concat!(env!("OUT_DIR"), "/stdlib.rs"))
 	}
 
-	#[cfg(not(feature = "codegenerated-stdlib"))]
+	#[cfg(not(any(feature = "serialized-stdlib", feature = "codegenerated-stdlib")))]
 	{
 		use jrsonnet_parser::Source;
 
modifiedcrates/jrsonnet-stdlib/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/lib.rs
+++ b/crates/jrsonnet-stdlib/src/lib.rs
@@ -1,9 +1,15 @@
+#![allow(clippy::similar_names)]
+
 use std::{
 	cell::{Ref, RefCell, RefMut},
 	collections::HashMap,
 	rc::Rc,
 };
 
+pub use arrays::*;
+pub use compat::*;
+pub use encoding::*;
+pub use hash::*;
 use jrsonnet_evaluator::{
 	error::{ErrorKind::*, Result},
 	function::{CallLocation, FuncVal, TlaArg},
@@ -13,40 +19,37 @@
 };
 use jrsonnet_gcmodule::Trace;
 use jrsonnet_parser::Source;
-
-mod expr;
-mod types;
-pub use types::*;
-mod arrays;
-pub use arrays::*;
-mod math;
+pub use manifest::*;
 pub use math::*;
-mod operator;
+pub use misc::*;
+pub use objects::*;
 pub use operator::*;
-mod sort;
+pub use parse::*;
+pub use sets::*;
 pub use sort::*;
-mod hash;
-pub use hash::*;
+pub use strings::*;
+pub use types::*;
+
+#[cfg(feature = "exp-regex")]
+pub use crate::regex::*;
+
+mod arrays;
+mod compat;
 mod encoding;
-pub use encoding::*;
+mod expr;
+mod hash;
+mod manifest;
+mod math;
+mod misc;
 mod objects;
-pub use objects::*;
-mod manifest;
-pub use manifest::*;
+mod operator;
 mod parse;
-pub use parse::*;
-mod strings;
-pub use strings::*;
-mod misc;
-pub use misc::*;
-mod sets;
-pub use sets::*;
-mod compat;
-pub use compat::*;
 #[cfg(feature = "exp-regex")]
 mod regex;
-#[cfg(feature = "exp-regex")]
-pub use crate::regex::*;
+mod sets;
+mod sort;
+mod strings;
+mod types;
 
 #[allow(clippy::too_many_lines)]
 pub fn stdlib_uncached(settings: Rc<RefCell<Settings>>) -> ObjValue {
@@ -244,9 +247,7 @@
 		);
 		builder.method(
 			"regexGlobalReplace",
-			builtin_regex_global_replace {
-				cache: regex_cache.clone(),
-			},
+			builtin_regex_global_replace { cache: regex_cache },
 		);
 	};
 
@@ -395,16 +396,15 @@
 	}
 	#[cfg(feature = "legacy-this-file")]
 	fn populate(&self, source: Source, builder: &mut ContextBuilder) {
-		use jrsonnet_evaluator::val::StrValue;
-
 		let mut std = ObjValueBuilder::new();
 		std.with_super(self.stdlib_obj.clone());
-		std.field("thisFile")
-			.hide()
-			.value(match source.source_path().path() {
-				Some(p) => self.settings().path_resolver.resolve(p),
-				None => source.source_path().to_string(),
-			});
+		std.field("thisFile").hide().value({
+			let source_path = source.source_path();
+			source_path.path().map_or_else(
+				|| source_path.to_string(),
+				|p| self.settings().path_resolver.resolve(p),
+			)
+		});
 		let stdlib_with_this_file = std.build();
 
 		builder.bind("std", Thunk::evaluated(Val::Obj(stdlib_with_this_file)));
modifiedcrates/jrsonnet-stdlib/src/regex.rsdiffbeforeafterboth
--- a/crates/jrsonnet-stdlib/src/regex.rs
+++ b/crates/jrsonnet-stdlib/src/regex.rs
@@ -50,16 +50,16 @@
 
 	for ele in captured.iter().skip(1) {
 		if let Some(ele) = ele {
-			captures.push(Val::Str(StrValue::Flat(ele.as_str().into())))
+			captures.push(Val::Str(StrValue::Flat(ele.as_str().into())));
 		} else {
-			captures.push(Val::Str(StrValue::Flat(IStr::empty())))
+			captures.push(Val::Str(StrValue::Flat(IStr::empty())));
 		}
 	}
 	for (i, name) in regex
 		.capture_names()
 		.skip(1)
 		.enumerate()
-		.flat_map(|(i, v)| Some((i, v?)))
+		.filter_map(|(i, v)| Some((i, v?)))
 	{
 		let capture = captures[i].clone();
 		named_captures.field(name).try_value(capture)?;
modifiedflake.lockdiffbeforeafterboth
--- a/flake.lock
+++ b/flake.lock
@@ -7,11 +7,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1711299236,
-        "narHash": "sha256-6/JsyozOMKN8LUGqWMopKTSiK8N79T8Q+hcxu2KkTXg=",
+        "lastModified": 1714536327,
+        "narHash": "sha256-zu4+LcygJwdyFHunTMeDFltBZ9+hoWvR/1A7IEy7ChA=",
         "owner": "ipetkov",
         "repo": "crane",
-        "rev": "880573f80d09e18a11713f402b9e6172a085449f",
+        "rev": "3124551aebd8db15d4560716d4f903bd44c64e4a",
         "type": "github"
       },
       "original": {
@@ -25,11 +25,11 @@
         "systems": "systems"
       },
       "locked": {
-        "lastModified": 1705309234,
-        "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
+        "lastModified": 1710146030,
+        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
         "owner": "numtide",
         "repo": "flake-utils",
-        "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
+        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
         "type": "github"
       },
       "original": {
@@ -40,11 +40,11 @@
     },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1705391267,
-        "narHash": "sha256-gGVm9QudiRtYTX8PN9cTTy7uuJcL4I2lRMoPx496kXk=",
+        "lastModified": 1714595735,
+        "narHash": "sha256-8MDOiHrg2mOylcC7wpx1U1mk9V5VranG7wKyenhHnic=",
         "owner": "nixos",
         "repo": "nixpkgs",
-        "rev": "41a9a7f170c740acb24f3390323877d11c69d5ee",
+        "rev": "9d7a1659bc5c6be24ac46407b91807c6e3e0227d",
         "type": "github"
       },
       "original": {
@@ -71,11 +71,11 @@
         ]
       },
       "locked": {
-        "lastModified": 1705371439,
-        "narHash": "sha256-P1kulUXpYWkcrjiX3sV4j8ACJZh9XXSaaD+jDLBDLKo=",
+        "lastModified": 1714529851,
+        "narHash": "sha256-YMKJW880f7LHXVRzu93xa6Ek+QLECIu0IRQbXbzZe38=",
         "owner": "oxalica",
         "repo": "rust-overlay",
-        "rev": "b21f3c0d5bf0f0179f5f0140e8e0cd099618bd04",
+        "rev": "9ca720fdcf7865385ae3b93ecdf65f1a64cb475e",
         "type": "github"
       },
       "original": {
modifiedrust-toolchain.tomldiffbeforeafterboth
--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,3 @@
 [toolchain]
-channel = "nightly-2024-01-10"
+channel = "nightly-2024-05-10"
 components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]
modifiedtests/tests/golden.rsdiffbeforeafterboth
--- a/tests/tests/golden.rs
+++ b/tests/tests/golden.rs
@@ -27,11 +27,7 @@
 		Ok(v) => v,
 		Err(e) => return trace_format.format(&e).unwrap(),
 	};
-	match v.manifest(
-		JsonFormat::default(),
-		#[cfg(feature = "exp-preserve-order")]
-		false,
-	) {
+	match v.manifest(JsonFormat::default()) {
 		Ok(v) => v.to_string(),
 		Err(e) => trace_format.format(&e).unwrap(),
 	}
modifiedxtask/src/sourcegen/ast.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/ast.rs
+++ b/xtask/src/sourcegen/ast.rs
@@ -62,6 +62,7 @@
 
 #[derive(Debug, Clone)]
 pub struct AstTokenEnumSrc {
+	#[allow(dead_code)]
 	pub doc: Vec<String>,
 	pub name: String,
 	pub variants: Vec<String>,
modifiedxtask/src/sourcegen/kinds.rsdiffbeforeafterboth
--- a/xtask/src/sourcegen/kinds.rs
+++ b/xtask/src/sourcegen/kinds.rs
@@ -14,6 +14,7 @@
 	Error {
 		grammar_name: String,
 		name: String,
+		#[allow(dead_code)]
 		/// Is this error returned by lexer directly, or from lex.rs
 		is_lexer_error: bool,
 		regex: Option<String>,