Call a closure from an array or slice of closures:
fn main() {
// Also panics:
// let lambdas: [fn(()) -> ()] = &[];
// Also panics when there's a lambda in the array
// let example_lambda: fn(u8) -> u8 = |x| { x + 1 };
// let lambdas: [fn(u8) -> u8; 8] = [example_lambda; 8];
let lambdas: [fn(()) -> (); 0] = [];
lambdas[0](());
// Also panics
// for f in lambdas {
// f(());
// }
}
Expected Behavior
Either:
The closure to be successfully accessed from the array/slice and called
A user error explaining that this was unsupported
Bug
The application panicked (crashed).
Message: ICE: at least one variant should exist for a dynamic call Signature { params: [], returns: [] }
Location: compiler/noirc_evaluator/src/ssa/opt/defunctionalize.rs:253
To Reproduce
1.
2.
3.
4.
Project Impact
Nice-to-have
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
None
Nargo Version
nargo version = 0.31.0 noirc version = 0.31.0+0541568b4c209927a70778b895e8f1e50d9b6543 (git version hash: 0541568b4c209927a70778b895e8f1e50d9b6543, is dirty: false)
Aim
Call a closure from an array or slice of closures:
Expected Behavior
Either:
Bug
To Reproduce
1. 2. 3. 4.
Project Impact
Nice-to-have
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
None
Nargo Version
nargo version = 0.31.0 noirc version = 0.31.0+0541568b4c209927a70778b895e8f1e50d9b6543 (git version hash: 0541568b4c209927a70778b895e8f1e50d9b6543, is dirty: false)
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response