From ad60db5bae786d1217ddce364c85065f856418b3 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Wed, 21 Oct 2020 10:10:46 +0800 Subject: [PATCH] Reduce max fn call level. --- doc/src/safety/max-call-stack.md | 2 +- src/engine.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/safety/max-call-stack.md b/doc/src/safety/max-call-stack.md index 374dc2a6..7efb3c9d 100644 --- a/doc/src/safety/max-call-stack.md +++ b/doc/src/safety/max-call-stack.md @@ -6,7 +6,7 @@ Maximum Call Stack Depth Limit How Stack Usage by Scripts ------------------------------- -Rhai by default limits function calls to a maximum depth of 128 levels (12 levels in debug build). +Rhai by default limits function calls to a maximum depth of 128 levels (8 levels in debug build). This limit may be changed via the `Engine::set_max_call_levels` method. diff --git a/src/engine.rs b/src/engine.rs index 118f828c..406d54d1 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -75,7 +75,7 @@ pub type Imports = Vec<(ImmutableString, Module)>; #[cfg(not(feature = "unchecked"))] #[cfg(debug_assertions)] -pub const MAX_CALL_STACK_DEPTH: usize = 12; +pub const MAX_CALL_STACK_DEPTH: usize = 8; #[cfg(not(feature = "unchecked"))] #[cfg(debug_assertions)] pub const MAX_EXPR_DEPTH: usize = 32;