git.delta.rocks / jrsonnet / refs/commits / 1d4b842070e4

difftreelog

build stable rustc support

Lach2020-08-03parent: #bb6d643.patch.diff
in: master

7 files changed

modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
--- a/bindings/jsonnet/src/lib.rs
+++ b/bindings/jsonnet/src/lib.rs
@@ -1,5 +1,3 @@
-#![feature(custom_inner_attributes)]
-
 pub mod import;
 pub mod interop;
 pub mod val_extract;
modifiedcrates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth
before · crates/jrsonnet-evaluator/Cargo.toml
1[package]2name = "jrsonnet-evaluator"3description = "jsonnet interpreter"4version = "1.0.0"5authors = ["Лач <iam@lach.pw>"]6license = "MIT"7edition = "2018"89# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html1011[features]12default = ["serialized-stdlib", "faster", "explaining-traces"]13# Serializes standard library AST instead of parsing them every run14serialized-stdlib = ["serde", "bincode", "jrsonnet-parser/deserialize"]15# Same as above, but with generated code instead of serde. Reduces memory usage, but increases binary size and compilation time16codegenerated-stdlib = []17# Replace some standard library functions with faster implementations (I.e manifestJsonEx)18# Library works fine without this feature, but requires more memory and time for std function calls19faster = []20# Rustc-like trace visualization21explaining-traces = ["annotate-snippets"]2223[dependencies]24jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }25jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "1.0.0" }26pathdiff = "0.2.0"2728closure = "0.3.0"29indexmap = "1.4.0"3031md5 = "0.7.0"32base64 = "0.12.3"3334# Serialized stdlib35[dependencies.serde]36version = "1.0.114"37optional = true38[dependencies.bincode]39version = "1.3.1"40optional = true4142# Explaining traces43[dependencies.annotate-snippets]44version = "0.9.0"45optional = true4647[build-dependencies]48jrsonnet-parser = { path = "../jrsonnet-parser", features = ["dump", "serialize", "deserialize"], version = "1.0.0" }49jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "1.0.0" }50structdump = "0.1.2"51serde = "1.0.114"52bincode = "1.3.1"
after · crates/jrsonnet-evaluator/Cargo.toml
1[package]2name = "jrsonnet-evaluator"3description = "jsonnet interpreter"4version = "1.0.0"5authors = ["Лач <iam@lach.pw>"]6license = "MIT"7edition = "2018"89# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html1011[features]12default = ["serialized-stdlib", "faster", "explaining-traces"]13# Serializes standard library AST instead of parsing them every run14serialized-stdlib = ["serde", "bincode", "jrsonnet-parser/deserialize"]15# Same as above, but with generated code instead of serde. Reduces memory usage, but increases binary size and compilation time16codegenerated-stdlib = []17# Replace some standard library functions with faster implementations (I.e manifestJsonEx)18# Library works fine without this feature, but requires more memory and time for std function calls19faster = []20# Rustc-like trace visualization21explaining-traces = ["annotate-snippets"]2223# Unlocks extra features, but works only on unstable24unstable = []2526[dependencies]27jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }28jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "1.0.0" }29pathdiff = "0.2.0"3031closure = "0.3.0"32indexmap = "1.4.0"3334md5 = "0.7.0"35base64 = "0.12.3"3637# Serialized stdlib38[dependencies.serde]39version = "1.0.114"40optional = true41[dependencies.bincode]42version = "1.3.1"43optional = true4445# Explaining traces46[dependencies.annotate-snippets]47version = "0.9.0"48optional = true4950[build-dependencies]51jrsonnet-parser = { path = "../jrsonnet-parser", features = ["dump", "serialize", "deserialize"], version = "1.0.0" }52jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "1.0.0" }53structdump = "0.1.2"54serde = "1.0.114"55bincode = "1.3.1"
modifiedcrates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/ctx.rs
+++ b/crates/jrsonnet-evaluator/src/ctx.rs
@@ -2,12 +2,7 @@
 	error::Error::*, future_wrapper, map::LayeredHashMap, rc_fn_helper, resolved_lazy_val,
 	LazyBinding, LazyVal, ObjValue, Result, Val,
 };
-use std::{
-	cell::RefCell,
-	collections::HashMap,
-	fmt::Debug,
-	rc::{Rc, Weak},
-};
+use std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc};
 
 rc_fn_helper!(
 	ContextCreator,
@@ -138,6 +133,7 @@
 		}
 		Ok(self.extend(new, new_dollar, this, super_obj))
 	}
+	#[cfg(feature = "unstable")]
 	pub fn into_weak(self) -> WeakContext {
 		WeakContext(Rc::downgrade(&self.0))
 	}
@@ -155,13 +151,16 @@
 	}
 }
 
+#[cfg(feature = "unstable")]
 #[derive(Debug, Clone)]
-pub struct WeakContext(Weak<ContextInternals>);
+pub struct WeakContext(std::rc::Weak<ContextInternals>);
+#[cfg(feature = "unstable")]
 impl WeakContext {
 	pub fn upgrade(&self) -> Context {
 		Context(self.0.upgrade().expect("context is removed"))
 	}
 }
+#[cfg(feature = "unstable")]
 impl PartialEq for WeakContext {
 	fn eq(&self, other: &Self) -> bool {
 		self.0.ptr_eq(&other.0)
modifiedcrates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/evaluate.rs
+++ b/crates/jrsonnet-evaluator/src/evaluate.rs
@@ -390,10 +390,16 @@
 
 /// Extracts code block and disables inlining for them
 /// Fixes WASM to java bytecode compilation failing because of very large method
+#[cfg(feature = "unstable")]
+macro_rules! noinline {
+	($e:expr) => {
+		(#![inline(never)] move || $e)()
+	};
+}
+#[cfg(not(feature = "unstable"))]
 macro_rules! noinline {
 	($e:expr) => {
-		(#[inline(never)]
-		move || $e)()
+		(move || $e)()
 	};
 }
 
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/lib.rs
+++ b/crates/jrsonnet-evaluator/src/lib.rs
@@ -1,12 +1,6 @@
-#![feature(box_syntax, box_patterns)]
-#![feature(type_alias_impl_trait)]
-#![feature(debug_non_exhaustive)]
-#![feature(test)]
-#![feature(stmt_expr_attributes)]
+#![cfg_attr(feature = "unstable", feature(stmt_expr_attributes))]
 #![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
 
-extern crate test;
-
 mod builtin;
 mod ctx;
 mod dynamic;
@@ -820,8 +814,6 @@
 		"#
 		);
 	}
-
-	use test::Bencher;
 
 	// This test is commented out by default, because of huge compilation slowdown
 	// #[bench]
@@ -836,6 +828,7 @@
 	// 	})
 	// }
 
+	/*
 	#[bench]
 	fn bench_serialize(b: &mut Bencher) {
 		b.iter(|| {
@@ -859,6 +852,7 @@
 			)
 		})
 	}
+	*/
 
 	#[test]
 	fn equality() {
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/obj.rs
+++ b/crates/jrsonnet-evaluator/src/obj.rs
@@ -35,7 +35,14 @@
 		for (name, member) in self.0.this_entries.iter() {
 			debug.field(name, member);
 		}
-		debug.finish_non_exhaustive()
+		#[cfg(feature = "unstable")]
+		{
+			debug.finish_non_exhaustive()
+		}
+		#[cfg(not(feature = "unstable"))]
+		{
+			debug.finish()
+		}
 	}
 }
 
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-parser/src/lib.rs
+++ b/crates/jrsonnet-parser/src/lib.rs
@@ -1,8 +1,3 @@
-#![feature(box_syntax)]
-#![feature(test)]
-
-extern crate test;
-
 use peg::parser;
 use std::{path::PathBuf, rc::Rc};
 mod expr;
@@ -581,11 +576,11 @@
 		parse!(jrsonnet_stdlib::STDLIB_STR);
 	}
 
-	use test::Bencher;
-
 	// From source code
+	/*
 	#[bench]
 	fn bench_parse_peg(b: &mut Bencher) {
 		b.iter(|| parse!(jrsonnet_stdlib::STDLIB_STR))
 	}
+	*/
 }