difftreelog
build stable rustc support
in: master
7 files changed
bindings/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;
crates/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" }
crates/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)
crates/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)()
};
}
crates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth1#![feature(box_syntax, box_patterns)]2#![feature(type_alias_impl_trait)]3#![feature(debug_non_exhaustive)]4#![feature(test)]5#![feature(stmt_expr_attributes)]1#![cfg_attr(feature = "unstable", feature(stmt_expr_attributes))]6#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]2#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]78extern crate test;9310mod builtin;4mod builtin;11mod ctx;5mod ctx;821 );815 );822 }816 }823824 use test::Bencher;825817826 // This test is commented out by default, because of huge compilation slowdown818 // This test is commented out by default, because of huge compilation slowdown827 // #[bench]819 // #[bench]836 // })828 // })837 // }829 // }838830839 #[bench]831 /*840 fn bench_serialize(b: &mut Bencher) {832 #[bench]841 b.iter(|| {833 fn bench_serialize(b: &mut Bencher) {842 bincode::deserialize::<jrsonnet_parser::LocExpr>(include_bytes!(concat!(834 b.iter(|| {843 env!("OUT_DIR"),835 bincode::deserialize::<jrsonnet_parser::LocExpr>(include_bytes!(concat!(844 "/stdlib.bincode"836 env!("OUT_DIR"),845 )))837 "/stdlib.bincode"846 .expect("deserialize stdlib")838 )))847 })839 .expect("deserialize stdlib")848 }840 })849841 }850 #[bench]842851 fn bench_parse(b: &mut Bencher) {843 #[bench]852 b.iter(|| {844 fn bench_parse(b: &mut Bencher) {853 jrsonnet_parser::parse(845 b.iter(|| {854 jrsonnet_stdlib::STDLIB_STR,846 jrsonnet_parser::parse(855 &jrsonnet_parser::ParserSettings {847 jrsonnet_stdlib::STDLIB_STR,856 loc_data: true,848 &jrsonnet_parser::ParserSettings {857 file_name: Rc::new(PathBuf::from("std.jsonnet")),849 loc_data: true,858 },850 file_name: Rc::new(PathBuf::from("std.jsonnet")),859 )851 },860 })852 )861 }853 })854 }855 */862856863 #[test]857 #[test]864 fn equality() {858 fn equality() {crates/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()
+ }
}
}
crates/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))
}
+ */
}