1
Fork 0

Make Int inherit from Ord.

Previously Int inherited from PartialOrd (via Primitive)
but not Ord.  But integers have a total order, so
inheriting from Ord is appropriate. Fixes #18776.
This commit is contained in:
Josh Haberman 2014-11-08 22:34:19 -05:00
parent 34af03681f
commit a7533b8a6b

View file

@ -19,7 +19,7 @@ use {int, i8, i16, i32, i64};
use {uint, u8, u16, u32, u64}; use {uint, u8, u16, u32, u64};
use {f32, f64}; use {f32, f64};
use clone::Clone; use clone::Clone;
use cmp::{PartialEq, PartialOrd}; use cmp::{Ord, PartialEq, PartialOrd};
use kinds::Copy; use kinds::Copy;
use mem::size_of; use mem::size_of;
use ops::{Add, Sub, Mul, Div, Rem, Neg}; use ops::{Add, Sub, Mul, Div, Rem, Neg};
@ -386,6 +386,7 @@ trait_impl!(Primitive for uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64)
/// A primitive signed or unsigned integer equipped with various bitwise /// A primitive signed or unsigned integer equipped with various bitwise
/// operators, bit counting methods, and endian conversion functions. /// operators, bit counting methods, and endian conversion functions.
pub trait Int: Primitive pub trait Int: Primitive
+ Ord
+ CheckedAdd + CheckedAdd
+ CheckedSub + CheckedSub
+ CheckedMul + CheckedMul