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
1#![feature(custom_inner_attributes)]
2
3pub mod import;1pub mod import;
4pub mod interop;2pub mod interop;
modifiedcrates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth
20# Rustc-like trace visualization20# Rustc-like trace visualization
21explaining-traces = ["annotate-snippets"]21explaining-traces = ["annotate-snippets"]
22
23# Unlocks extra features, but works only on unstable
24unstable = []
2225
23[dependencies]26[dependencies]
24jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }27jrsonnet-parser = { path = "../jrsonnet-parser", 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
390390
391/// Extracts code block and disables inlining for them391/// Extracts code block and disables inlining for them
392/// Fixes WASM to java bytecode compilation failing because of very large method392/// Fixes WASM to java bytecode compilation failing because of very large method
393#[cfg(feature = "unstable")]
393macro_rules! noinline {394macro_rules! noinline {
394 ($e:expr) => {395 ($e:expr) => {
395 (#[inline(never)]396 (#![inline(never)] move || $e)()
396 move || $e)()
397 };397 };
398}398}
399#[cfg(not(feature = "unstable"))]
400macro_rules! noinline {
401 ($e:expr) => {
402 (move || $e)()
403 };
404}
399405
400pub fn evaluate_apply(406pub fn evaluate_apply(
401 context: Context,407 context: Context,
modifiedcrates/jrsonnet-evaluator/src/lib.rsdiffbeforeafterboth
1#![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)]
7
8extern crate test;
93
10mod builtin;4mod builtin;
11mod ctx;5mod ctx;
821 );815 );
822 }816 }
823
824 use test::Bencher;
825817
826 // This test is commented out by default, because of huge compilation slowdown818 // This test is commented out by default, because of huge compilation slowdown
827 // #[bench]819 // #[bench]
836 // })828 // })
837 // }829 // }
838830
839 #[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]842
851 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 */
862856
863 #[test]857 #[test]
864 fn equality() {858 fn equality() {
modifiedcrates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth
35 for (name, member) in self.0.this_entries.iter() {35 for (name, member) in self.0.this_entries.iter() {
36 debug.field(name, member);36 debug.field(name, member);
37 }37 }
38 #[cfg(feature = "unstable")]
39 {
38 debug.finish_non_exhaustive()40 debug.finish_non_exhaustive()
41 }
42 #[cfg(not(feature = "unstable"))]
43 {
44 debug.finish()
45 }
39 }46 }
40}47}
4148
modifiedcrates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth
1#![feature(box_syntax)]
2#![feature(test)]
3
4extern crate test;
5
6use peg::parser;1use peg::parser;
7use std::{path::PathBuf, rc::Rc};2use std::{path::PathBuf, rc::Rc};
581 parse!(jrsonnet_stdlib::STDLIB_STR);576 parse!(jrsonnet_stdlib::STDLIB_STR);
582 }577 }
583
584 use test::Bencher;
585578
586 // From source code579 // From source code
587 #[bench]580 /*
588 fn bench_parse_peg(b: &mut Bencher) {581 #[bench]
589 b.iter(|| parse!(jrsonnet_stdlib::STDLIB_STR))582 fn bench_parse_peg(b: &mut Bencher) {
590 }583 b.iter(|| parse!(jrsonnet_stdlib::STDLIB_STR))
584 }
585 */
591}586}
592587