Attempt at fixing E0411 on older rust versions
This commit is contained in:
parent
b024e1c326
commit
9b06d4a0bb
|
@ -51,7 +51,7 @@ zero_impl!(i64, 0i64);
|
||||||
zero_impl!(f32, 0.0f32);
|
zero_impl!(f32, 0.0f32);
|
||||||
zero_impl!(f64, 0.0f64);
|
zero_impl!(f64, 0.0f64);
|
||||||
|
|
||||||
impl<T: Zero + PartialEq> Zero for Wrapping<T> where Self: Add<Output=Self> {
|
impl<T: Zero + PartialEq> Zero for Wrapping<T> where Wrapping<T>: Add<Output=Wrapping<T>> {
|
||||||
fn is_zero(&self) -> bool {
|
fn is_zero(&self) -> bool {
|
||||||
self.0 == T::zero()
|
self.0 == T::zero()
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ one_impl!(i64, 1i64);
|
||||||
one_impl!(f32, 1.0f32);
|
one_impl!(f32, 1.0f32);
|
||||||
one_impl!(f64, 1.0f64);
|
one_impl!(f64, 1.0f64);
|
||||||
|
|
||||||
impl<T: One> One for Wrapping<T> where Self: Add<Output=Self> + Mul<Output=Self> {
|
impl<T: One> One for Wrapping<T> where Wrapping<T>: Add<Output=Wrapping<T>> + Mul<Output=Wrapping<T>> {
|
||||||
fn one() -> Self {
|
fn one() -> Self {
|
||||||
Wrapping(T::one())
|
Wrapping(T::one())
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,9 +76,9 @@ macro_rules! int_trait_impl {
|
||||||
int_trait_impl!(Num for usize u8 u16 u32 u64 isize i8 i16 i32 i64);
|
int_trait_impl!(Num for usize u8 u16 u32 u64 isize i8 i16 i32 i64);
|
||||||
|
|
||||||
impl<T: Num> Num for Wrapping<T>
|
impl<T: Num> Num for Wrapping<T>
|
||||||
where Self: Zero + One
|
where Wrapping<T>: Zero + One
|
||||||
+ Add<Output = Self> + Sub<Output = Self>
|
+ Add<Output = Wrapping<T>> + Sub<Output = Wrapping<T>>
|
||||||
+ Mul<Output = Self> + Div<Output = Self> + Rem<Output = Self>
|
+ Mul<Output = Wrapping<T>> + Div<Output = Wrapping<T>> + Rem<Output = Wrapping<T>>
|
||||||
{
|
{
|
||||||
type FromStrRadixErr = T::FromStrRadixErr;
|
type FromStrRadixErr = T::FromStrRadixErr;
|
||||||
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr> {
|
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr> {
|
||||||
|
|
Loading…
Reference in New Issue