Skip to content

Commit 23606cf

Browse files
committed
---
yaml --- r: 220078 b: refs/heads/snap-stage3 c: 7824956 h: refs/heads/master v: v3
1 parent 59bc359 commit 23606cf

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
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 218eb1277d95090c7db5ba0242194b497784d04e
3+
refs/heads/snap-stage3: 7824956effbfaccea5f6ce0b973c26cb58d241f9
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/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)