Remove unnecessary boxing of Stack::recursion_count (#11238)

This commit is contained in:
Ian Manske
2023-12-06 08:48:56 +00:00
committed by GitHub
parent 858c93d2e5
commit 51bf8d9f6a
2 changed files with 7 additions and 7 deletions

View File

@ -611,14 +611,14 @@ pub fn eval_block(
// picked 50 arbitrarily, should work on all architectures
const RECURSION_LIMIT: u64 = 50;
if recursive {
if *stack.recursion_count >= RECURSION_LIMIT {
stack.recursion_count = Box::new(0);
if stack.recursion_count >= RECURSION_LIMIT {
stack.recursion_count = 0;
return Err(ShellError::RecursionLimitReached {
recursion_limit: RECURSION_LIMIT,
span: block.span,
});
}
*stack.recursion_count += 1;
stack.recursion_count += 1;
}
}