Closed
Description
Given the following code (playground):
struct NInts<const N: usize>([u8; N]);
impl NInts<const N: usize> {}
The current output is fairly uninformative:
error: expected one of `>`, a const expression, lifetime, or type, found keyword `const`
--> src/lib.rs:2:11
|
2 | impl NInts<const N: usize> {}
| ^^^^^ expected one of `>`, a const expression, lifetime, or type
Ideally the output should look something like this (perhaps with slightly clearer wording 😅):
error: generic parameter declarations on `impl` blocks must be attached to `impl`
--> src/lib.rs:2:11
|
2 | impl NInts<const N: usize> {}
| ^^^^^^^^^^^^^^ cannot declare a const parameter here
help: move the generic parameter declaration
|
2 | impl<const N: usize> NInts<N> {}
| ---------------- -