Hi everyone,
I'm playing around with const generics on nightly and am running into a weird error that I don't really understand. A minimal example would be the following:
struct Vector<T, const N: usize>([T; 2 * N]);
When compiling, I get the following error:
error: unconstrained generic constant
--> src/lib.rs:23:34
|
23 | struct Vector<T, const N: usize>([T; 2 * N]);
| ^^^^^^^^^^
|
help: consider adding a `where` bound for this expression
--> src/lib.rs:23:38
|
23 | struct Vector<T, const N: usize>([T; 2 * N]);
| ^^^^^
I don't really know what to make of this Error. Could someone explain to me what the problem is and how to fix it?