difftreelog
build stable rustc support
in: master
7 files changed
bindings/jsonnet/src/lib.rsdiffbeforeafterboth1#![feature(custom_inner_attributes)]23pub mod import;1pub mod import;4pub mod interop;2pub mod interop;crates/jrsonnet-evaluator/Cargo.tomldiffbeforeafterboth20# Rustc-like trace visualization20# Rustc-like trace visualization21explaining-traces = ["annotate-snippets"]21explaining-traces = ["annotate-snippets"]2223# Unlocks extra features, but works only on unstable24unstable = []222523[dependencies]26[dependencies]24jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }27jrsonnet-parser = { path = "../jrsonnet-parser", version = "1.0.0" }crates/jrsonnet-evaluator/src/ctx.rsdiffbeforeafterboth6 cell::RefCell,7 collections::HashMap,8 fmt::Debug,9 rc::{Rc, Weak},10};11612rc_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}157153154#[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)crates/jrsonnet-evaluator/src/evaluate.rsdiffbeforeafterboth390390391/// Extracts code block and disables inlining for them391/// Extracts code block and disables inlining for them392/// Fixes WASM to java bytecode compilation failing because of very large method392/// Fixes WASM to java bytecode compilation failing because of very large method393#[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}399405400pub fn evaluate_apply(406pub fn evaluate_apply(401 context: Context,407 context: Context,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.rsdiffbeforeafterboth35 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}4148crates/jrsonnet-parser/src/lib.rsdiffbeforeafterboth1#![feature(box_syntax)]2#![feature(test)]34extern crate test;56use 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 }583584 use test::Bencher;585578586 // From source code579 // From source code587 #[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