Skip to content

Commit 768beb2

Browse files
committed
---
yaml --- r: 235391 b: refs/heads/stable c: 7824956 h: refs/heads/master i: 235389: d4c5d1a 235387: e5631ea 235383: a46a3f6 235375: 58905d4 235359: a72b274 235327: db73298 235263: e8a8b14 v: v3
1 parent 1e59f82 commit 768beb2

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 218eb1277d95090c7db5ba0242194b497784d04e
32+
refs/heads/stable: 7824956effbfaccea5f6ce0b973c26cb58d241f9
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libcore/ops.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

414426
macro_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

Comments
 (0)