const generics array length mismatch at compile time
Playing with const generics: fn pack<const N: usize>(data: [u8; N]) -> [u8; N+1]. Compiler on rustc 1.78 says:
error: generic parameters may not be used in const operations
--> src/pack.rs:6:48
|
6 | fn pack<const N: usize>(data: [u8; N]) -> [u8; N + 1] {
| ^^^ cannot perform const operation using N
|
help: use #![feature(generic_const_exprs)] to allow const operations
I'd rather not use nightly. Is there a stable way to express 'one bigger than N'?
4 replies