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
--- a/crates/jrsonnet-evaluator/Cargo.toml
+++ b/crates/jrsonnet-evaluator/Cargo.toml
@@ -20,6 +20,9 @@
 # Rustc-like trace visualization
 explaining-traces = ["annotate-snippets"]
 
+# Unlocks extra features, but works only on unstable
+unstable = []
+
 [dependencies]
 jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }
 jrsonnet-stdlib = { path = "../jrsonnet-stdlib", version = "1.0.0" }
modifiedcrates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth
6 cell::RefCell,
7 collections::HashMap,
8 fmt::Debug,
9 rc::{Rc, Weak},
10};
116
12rc_fn_helper!(7rc_fn_helper!(
138 }133 }
139 Ok(self.extend(new, new_dollar, this, super_obj))134 Ok(self.extend(new, new_dollar, this, super_obj))
140 }135 }
136 #[cfg(feature = "unstable")]
141 pub fn into_weak(self) -> WeakContext {137 pub fn into_weak(self) -> WeakContext {
142 WeakContext(Rc::downgrade(&self.0))138 WeakContext(Rc::downgrade(&self.0))
143 }139 }
155 }151 }
156}152}
157153
154#[cfg(feature = "unstable")]
158#[derive(Debug, Clone)]155#[derive(Debug, Clone)]
159pub struct WeakContext(Weak<ContextInternals>);156pub struct WeakContext(std::rc::Weak<ContextInternals>);
157#[cfg(feature = "unstable")]
160impl WeakContext {158impl WeakContext {
161 pub fn upgrade(&self) -> Context {159 pub fn upgrade(&self) -> Context {
162 Context(self.0.upgrade().expect("context is removed"))160 Context(self.0.upgrade().expect("context is removed"))
163 }161 }
164}162}
163#[cfg(feature = "unstable")]
165impl PartialEq for WeakContext {164impl PartialEq for WeakContext {
166 fn eq(&self, other: &Self) -> bool {165 fn eq(&self, other: &Self) -> bool {
167 self.0.ptr_eq(&other.0)166 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))
 	}
+	*/
 }