noir
noir copied to clipboard
`[T]::pop_front()` errors during execution inside a dynamic non-executed `if`
Aim
Similar to 5462, but the if
's predicate isn't known at compile time.
Attempted to nargo execute
the following program:
fn main(x: bool) {
println("x's value:");
println(x);
println("");
if x {
let empty_slice: [u8] = &[];
let _ = empty_slice.pop_front();
}
}
NOTE: re-enable the array_regex
tests once this is resolved
Expected Behavior
Expected the program to print the following and execute successfully:
x's value:
false
Bug
Program fails at execution time with the following error:
x's value:
false
error: Index out of bounds, array has size 0, but index was 0
┌─ /Users/michaelklein/Coding/rust/noir/test_programs/execution_success/regression_test_5462/src/main.nr:8:17
│
8 │ let _ = empty_slice.pop_front();
│ ---------------------
│
= Call stack:
1. /Users/michaelklein/Coding/rust/noir/test_programs/execution_success/regression_test_5462/src/main.nr:8:17
Failed to solve program: 'Index out of bounds, array has size 0, but index was 0'
To Reproduce
Workaround
None
Workaround Description
No response
Additional Context
No response
Project Impact
None
Blocker Context
No response
Nargo Version
No response
NoirJS Version
No response
Proving Backend Tooling & Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response