static_assert_const!
Convert a constant witness value back into a static, failing if it depends on the witness. Static evaluation
static_assert_const! expr
A static value assigned to a let variable, or passed to a function argument declared let, becomes a constant witness value: it has no witness entries but is no longer static. static_assert_const! recovers the static value so it can be used where statics are required, such as lengths and loop counts. It fails if any element actually depends on witness entries.
Arguments
expr- Any expression. Static values are returned as they are; witness values must be constant.
Returns
A static vector of the same length. static_assert_const! is an expression.
Constraints
None.
Example
(let x) # a static lifted into a witness variable let dims = [3 5] static height = static_assert_const! dims[0] let h = height h
(let x) static y = static_assert_const! x x
Notes
mat_poly_mul_vec uses it to read matrix dimensions passed in a vector alongside the data.
Used in the standard library
polynomial/mat_poly_compose_horizontal, polynomial/mat_poly_compose_vertical, polynomial/mat_poly_mul_vec, polynomial/ntt_negacyclic_mat