Skip to content

Commit

Permalink
Fix no_std compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
chxry committed Oct 2, 2024
1 parent 37011d2 commit b05f994
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ smallvec = { version = "1.7.0", default-features = false, features = ["union", "
thin-vec = { version = "0.2.13", default-features = false }
ahash = { version = "0.8.2", default-features = false, features = ["compile-time-rng"] }
num-traits = { version = "0.2.0", default-features = false }
once_cell = { version = "1.19.0", default-features = false, features = ["critical-section"] }
once_cell = { version = "1.20.1", default-features = false, features = ["race", "portable-atomic", "alloc"] }
bitflags = { version = "2.0.0", default-features = false }
smartstring = { version = "1.0.0", default-features = false }
rhai_codegen = { version = "2.1.0", path = "codegen" }
Expand Down
6 changes: 5 additions & 1 deletion src/config/hashing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ pub use crate::api::deprecated::config::hashing::{get_ahash_seed, set_ahash_seed
/// ```
#[inline(always)]
pub fn set_hashing_seed(new_seed: Option<[u64; 4]>) -> Result<(), Option<[u64; 4]>> {
HASHING_SEED.set(new_seed)
#[cfg(feature = "std")]
return HASHING_SEED.set(new_seed);

#[cfg(not(feature = "std"))]
return HASHING_SEED.set(new_seed.into()).map_err(|err| *err);
}

/// Get the current hashing Seed.
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,12 @@ type ExclusiveRange = std::ops::Range<INT>;
/// An inclusive integer range.
type InclusiveRange = std::ops::RangeInclusive<INT>;

#[cfg(feature = "std")]
use once_cell::sync::OnceCell;

#[cfg(not(feature = "std"))]
use once_cell::race::OnceBox as OnceCell;

pub use api::build_type::{CustomType, TypeBuilder};
#[cfg(not(feature = "no_custom_syntax"))]
pub use api::custom_syntax::Expression;
Expand Down

0 comments on commit b05f994

Please sign in to comment.