Closed
Description
Given the following code: (see play.rust-lang.org link).
trait Foo<const N: usize> {
fn do_x(&self) -> [u8; N];
}
struct Bar;
impl Foo<N = const 3> for Bar {
fn do_x(&self) -> [u8; N] {
[0u8; N]
}
}
The current output is:
Compiling playground v0.0.1 (/playground)
error: missing type to the right of `=`
--> src/lib.rs:7:13
|
7 | impl Foo<N = const 3> for Bar {
| ^
|
help: to constrain the associated type, add a type after `=`
|
7 | impl Foo<N = TheTypeconst 3> for Bar {
| +++++++
help: remove the `=` if `N` is a type
|
7 - impl Foo<N = const 3> for Bar {
7 + impl Foo<N const 3> for Bar {
|
error: expected one of `,`, `>`, a const expression, lifetime, or type, found keyword `const`
--> src/lib.rs:7:14
|
7 | impl Foo<N = const 3> for Bar {
| ^^^^^ expected one of `,`, `>`, a const expression, lifetime, or type
error: could not compile `playground` due to 2 previous errors
Notice the TheTypeconst
in the above error message.
I've checked if this is the case on nightly, and at the time of this filing, this
is also an issue on nightly.