From e059ca009ccb58031dc993e0daccf99bb1433d8c Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Wed, 6 Jan 2021 18:22:45 +0800 Subject: [PATCH] Fix feature builds. --- codegen/ui_tests/rhai_mod_unknown_type.rs | 7 ++----- src/engine_settings.rs | 9 ++++----- src/lib.rs | 5 ++--- src/token.rs | 2 +- src/utils.rs | 1 + 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/codegen/ui_tests/rhai_mod_unknown_type.rs b/codegen/ui_tests/rhai_mod_unknown_type.rs index 7c19ab18..ae582726 100644 --- a/codegen/ui_tests/rhai_mod_unknown_type.rs +++ b/codegen/ui_tests/rhai_mod_unknown_type.rs @@ -9,16 +9,13 @@ pub struct Point { #[export_module] pub mod test_module { pub use super::Point; - pub fn test_fn(input: Pointer) -> bool { + pub fn test_fn(input: Point) -> bool { input.x < input.y } } fn main() { - let n = Point { - x: 0.0, - y: 10.0, - }; + let n = Point { x: 0.0, y: 10.0 }; if test_module::test_fn(n) { println!("yes"); } else { diff --git a/src/engine_settings.rs b/src/engine_settings.rs index e44d8d30..396c155e 100644 --- a/src/engine_settings.rs +++ b/src/engine_settings.rs @@ -1,13 +1,12 @@ //! Configuration settings for [`Engine`]. -use crate::stdlib::{ - format, - num::{NonZeroU64, NonZeroU8, NonZeroUsize}, - string::String, -}; +use crate::stdlib::{format, num::NonZeroU8, string::String}; use crate::token::Token; use crate::Engine; +#[cfg(not(feature = "unchecked"))] +use crate::stdlib::num::{NonZeroU64, NonZeroUsize}; + #[cfg(not(feature = "no_module"))] use crate::stdlib::boxed::Box; diff --git a/src/lib.rs b/src/lib.rs index 21a57ab1..14bc390d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,7 +136,7 @@ pub use utils::ImmutableString; use fn_native::Locked; #[cfg(feature = "internals")] -pub use utils::{calc_native_fn_hash, calc_script_fn_hash}; +pub use utils::{calc_native_fn_hash, calc_script_fn_hash, HashableHashMap}; #[cfg(not(feature = "internals"))] pub(crate) use utils::{calc_native_fn_hash, calc_script_fn_hash}; @@ -184,8 +184,7 @@ pub use token::{get_next_token, parse_string_literal, InputStream, Token, Tokeni #[cfg(feature = "internals")] #[deprecated = "this type is volatile and may change"] pub use ast::{ - BinaryExpr, CustomExpr, Expr, FloatWrapper, FnCallExpr, HashableHashMap, Ident, ReturnType, - ScriptFnDef, Stmt, + BinaryExpr, CustomExpr, Expr, FloatWrapper, FnCallExpr, Ident, ReturnType, ScriptFnDef, Stmt, }; #[cfg(feature = "internals")] diff --git a/src/token.rs b/src/token.rs index b08339d4..de291fbe 100644 --- a/src/token.rs +++ b/src/token.rs @@ -1806,7 +1806,7 @@ impl Engine { #[cfg(not(feature = "unchecked"))] max_string_size: self.limits.max_string_size, #[cfg(feature = "unchecked")] - max_string_size: 0, + max_string_size: None, non_unary: false, comment_level: 0, end_with_none: false, diff --git a/src/utils.rs b/src/utils.rs index 9d2a2417..6931476a 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -15,6 +15,7 @@ use crate::stdlib::{ ops::{Add, AddAssign, Deref, DerefMut}, str::FromStr, string::{String, ToString}, + vec::Vec, }; use crate::Shared;