I have code which looks roughly like this:
use typenum::{IsLess, Le, NonZero, Unsigned, U256};
pub trait Foo
where
Self::Size: IsLess<U256>,
Le<Self::Size, U256>: NonZero,
{
type Size: Unsigned;
}
pub trait Bar: Foo {}
But compiler refuses to accept this code and insists on duplicating the bounds on Size
in the Bar
trait. What is the reason for that? If a type implements Foo
(which is required for implementing Bar
), then the bound on Size
has to be satisfied.
Is it a deficiency of the current version of the Rust compiler? If yes, are there plans to fix it?