Closed
Description
When using an associated const in a where clause to describe a fixed size array, the error message does not state that fixed size arrays cannot be described by associated consts.
Alas, it says, that the trait bound is not satisfied and suggests adding the trait bound.
Example rust code: Playground
struct Seq([u8; 8]);
impl From<[u8; 8]> for Seq {
fn from(data: [u8; 8]) -> Seq {
Seq(data)
}
}
trait Sequence {
const LEN: usize;
}
impl Sequence for Seq {
const LEN: usize = 8;
}
trait ByteSequence {
fn check();
}
impl<S> ByteSequence for S
where
S: Sequence + From<[u8; <S as Sequence>::LEN]>,
{
fn check() {}
}
Resulting Error message:
error[E0277]: the trait bound `S: Sequence` is not satisfied
--> src/main.rs:23:29
|
23 | S: Sequence + From<[u8; <S as Sequence>::LEN]>,
| ^^^^^^^^^^^^^^^^^^^^ the trait `Sequence` is not implemented for `S`
|
= help: consider adding a `where S: Sequence` bound
= note: required by `Sequence::LEN`