Consider modifying the Mul<Self, Output = Self> bound on WrappingMul
Currently, the WrappingMul trait has a Mul<Self, Output = Self> bound on it. This is incompatible with compile-time large numeric types types that use const generics to increase their width upon multiplication rather than panicking or overflowing, but which may still want to provide a wrapping version of the operation. I propose removing the Output = Self associated type bound from it.
This is ~not~ a breaking change.
It is a breaking change, because users can no longer rely on that equivalence.
use num_traits::WrappingMul;
pub trait WrappingMul2: Sized + std::ops::Mul<Self> {
fn wrapping_mul(&self, v: &Self) -> Self;
}
fn mul<T: WrappingMul>(x: T, y: T) -> T {
// We know Mul::Output is T
x * y
}
fn mul2<T: WrappingMul2>(x: T, y: T) -> T {
x * y
// ^^^^^ expected type parameter `T`, found associated type
}
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ea08daf166ec856c0470515b7e9e51d5
for somebody it is breaking change, for others, hopefully, we can see next major version bump in optimistic roadmap?