Closed
Description
Hi!
I was trying to make the following extension to heapless
in my project:
use heapless::spsc::Consumer;
use heapless::spsc::MultiCore;
use generic_array::ArrayLength;
pub trait ConsumerExt {
fn flush(&mut self);
}
impl<T, N> ConsumerExt for Consumer<'_, T, N, usize, MultiCore>
where
N: ArrayLength<T>,
{
fn flush(&mut self) {
while self.dequeue().is_some() {}
}
}
In this case, the compatible type is reexported as heapless::ArrayLength;
I now understand that my generic_array::ArrayLength
was from a mismatching version of generic_array
. Regardless, the error message is extremely confusing:
error[E0277]: the trait bound `N: generic_array::ArrayLength<T>` is not satisfied
--> src\utils\mod.rs:58:14
|
58 | fn flush(&mut self) {
| ^^^^^^^^^ the trait `generic_array::ArrayLength<T>` is not implemented for `N`
|
::: C:\Users\bugad\.cargo\registry\src\github.com-1285ae84e5963aae\heapless-0.5.5\src\spsc\split.rs:35:8
|
35 | N: ArrayLength<T>,
| -------------- required by this bound in `heapless::spsc::split::Consumer`
|
help: consider further restricting this bound
|
56 | N: ArrayLength<T> + generic_array::ArrayLength<T>,
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint that should be reworked.Diagnostics: Errors or lints caused be the use of two different crate versions.Relevant to the compiler team, which will review and decide on the PR/issue.