From 1dacf21a84d9d28ae6c0c7957ce671e66f5e32af Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Sun, 23 Aug 2020 18:28:55 +0800 Subject: [PATCH] Fix no_std builds by pulling in num-traits. --- Cargo.toml | 7 ++++++- src/fn_call.rs | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index aa50392c..83a2d021 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ internals = [] # expose internal data structures unicode-xid-ident = ["unicode-xid"] # allow Unicode Standard Annex #31 for identifiers. # compiling for no-std -no_std = [ "no_closure", "hashbrown", "core-error", "libm", "ahash" ] +no_std = [ "no_closure", "num-traits/libm", "hashbrown", "core-error", "libm", "ahash" ] [profile.release] lto = "fat" @@ -51,6 +51,11 @@ version = "0.2.1" default_features = false optional = true +[dependencies.num-traits] +version = "0.2.11" +default-features = false +optional = true + [dependencies.core-error] version = "0.0.0" default_features = false diff --git a/src/fn_call.rs b/src/fn_call.rs index f7836107..e7c5fdc7 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -52,6 +52,10 @@ use crate::stdlib::{ #[cfg(not(feature = "no_function"))] use crate::stdlib::{collections::HashSet, string::String}; +#[cfg(feature = "no_std")] +#[cfg(not(feature = "no_float"))] +use num_traits::float::Float; + /// Extract the property name from a getter function name. #[inline(always)] fn extract_prop_from_getter(_fn_name: &str) -> Option<&str> {