@@ -315,9 +315,6 @@ mul_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
315315
316316/// The `Div` trait is used to specify the functionality of `/`.
317317///
318- /// For primitive integral types, this operation rounds towards zero,
319- /// truncating any fractional part of the exact result.
320- ///
321318/// # Examples
322319///
323320/// A trivial implementation of `Div`. When `Foo / Foo` happens, it ends up
@@ -354,7 +351,25 @@ pub trait Div<RHS=Self> {
354351 fn div ( self , rhs : RHS ) -> Self :: Output ;
355352}
356353
357- macro_rules! div_impl {
354+ macro_rules! div_impl_integer {
355+ ( $( $t: ty) * ) => ( $(
356+ /// This operation rounds towards zero, truncating any
357+ /// fractional part of the exact result.
358+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
359+ impl Div for $t {
360+ type Output = $t;
361+
362+ #[ inline]
363+ fn div( self , other: $t) -> $t { self / other }
364+ }
365+
366+ forward_ref_binop! { impl Div , div for $t, $t }
367+ ) * )
368+ }
369+
370+ div_impl_integer ! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
371+
372+ macro_rules! div_impl_float {
358373 ( $( $t: ty) * ) => ( $(
359374 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
360375 impl Div for $t {
@@ -368,13 +383,10 @@ macro_rules! div_impl {
368383 ) * )
369384}
370385
371- div_impl ! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
386+ div_impl_float ! { f32 f64 }
372387
373388/// The `Rem` trait is used to specify the functionality of `%`.
374389///
375- /// For primitive integral types, this operation satisfies `n % d == n
376- /// - (n / d) * d`. The result has the same sign as the left operand.
377- ///
378390/// # Examples
379391///
380392/// A trivial implementation of `Rem`. When `Foo % Foo` happens, it ends up
@@ -413,6 +425,8 @@ pub trait Rem<RHS=Self> {
413425
414426macro_rules! rem_impl {
415427 ( $( $t: ty) * ) => ( $(
428+ /// This operation satisfies `n % d == n - (n / d) * d`. The
429+ /// result has the same sign as the left operand.
416430 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
417431 impl Rem for $t {
418432 type Output = $t;
0 commit comments