From 4e7c19c62b486e8fa054e8de4f88893d0710b085 Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 11:35:03 -0700 Subject: [PATCH 1/8] Stabilize euclidean modulo methods --- src/libcore/num/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 1168126c47c93..1a423490a1f2f 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -824,7 +824,7 @@ assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); assert_eq!(", stringify!($SelfT), "::MIN.checked_mod_euc(-1), None); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] pub fn checked_mod_euc(self, rhs: Self) -> Option { if rhs == 0 || (self == Self::min_value() && rhs == -1) { @@ -1244,7 +1244,7 @@ Basic usage: assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); assert_eq!((-128i8).wrapping_mod_euc(-1), 0); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] pub fn wrapping_mod_euc(self, rhs: Self) -> Self { self.overflowing_mod_euc(rhs).0 @@ -1603,7 +1603,7 @@ use std::", stringify!($SelfT), "; assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); assert_eq!(", stringify!($SelfT), "::MIN.overflowing_mod_euc(-1), (0, true)); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { @@ -1870,7 +1870,7 @@ assert_eq!((-a).mod_euc(b), 1); assert_eq!(a.mod_euc(-b), 3); assert_eq!((-a).mod_euc(-b), 1); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] #[rustc_inherit_overflow_checks] pub fn mod_euc(self, rhs: Self) -> Self { @@ -2712,7 +2712,7 @@ Basic usage: assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] pub fn checked_mod_euc(self, rhs: Self) -> Option { if rhs == 0 { @@ -3062,7 +3062,7 @@ Basic usage: #![feature(euclidean_division)] assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] pub fn wrapping_mod_euc(self, rhs: Self) -> Self { self % rhs @@ -3376,7 +3376,7 @@ Basic usage assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); ```"), #[inline] - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { (self % rhs, false) } @@ -3574,7 +3574,7 @@ Basic usage: #![feature(euclidean_division)] assert_eq!(7", stringify!($SelfT), ".mod_euc(4), 3); // or any other integer type ```"), - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] #[inline] #[rustc_inherit_overflow_checks] pub fn mod_euc(self, rhs: Self) -> Self { From 24ce3b58943e60119da164b0ce0d01edfac92bdf Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 11:57:34 -0700 Subject: [PATCH 2/8] Stabilize Euclidean modulo for libstd f32 --- src/libstd/f32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index ae30321f46dfc..b99c00d5a2763 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -268,7 +268,7 @@ impl f32 { /// assert_eq!((-a).mod_euc(-b), 1.0); /// ``` #[inline] - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] pub fn mod_euc(self, rhs: f32) -> f32 { let r = self % rhs; if r < 0.0 { From 4e5d9b071008022ce950c4881ad594732087bb2c Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 11:58:38 -0700 Subject: [PATCH 3/8] Stabilize Euclidean modulo for libstd f64 --- src/libstd/f64.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 7950d434b77e6..a6ea9783d0f10 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -244,7 +244,7 @@ impl f64 { /// assert_eq!((-a).mod_euc(-b), 1.0); /// ``` #[inline] - #[unstable(feature = "euclidean_division", issue = "49048")] + #[stable(feature = "euclidean_division", since = "1.29.0")] pub fn mod_euc(self, rhs: f64) -> f64 { let r = self % rhs; if r < 0.0 { From 93819d9a054c4696d0be07df5b1043bf772691f9 Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 12:46:29 -0700 Subject: [PATCH 4/8] Change feature name of `mod_euc` to `euclidean_division` --- src/libcore/num/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 1a423490a1f2f..977d2fe9f59c9 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -824,7 +824,7 @@ assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); assert_eq!(", stringify!($SelfT), "::MIN.checked_mod_euc(-1), None); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] pub fn checked_mod_euc(self, rhs: Self) -> Option { if rhs == 0 || (self == Self::min_value() && rhs == -1) { @@ -1244,7 +1244,7 @@ Basic usage: assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); assert_eq!((-128i8).wrapping_mod_euc(-1), 0); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] pub fn wrapping_mod_euc(self, rhs: Self) -> Self { self.overflowing_mod_euc(rhs).0 @@ -1603,7 +1603,7 @@ use std::", stringify!($SelfT), "; assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); assert_eq!(", stringify!($SelfT), "::MIN.overflowing_mod_euc(-1), (0, true)); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { if self == Self::min_value() && rhs == -1 { @@ -1870,7 +1870,7 @@ assert_eq!((-a).mod_euc(b), 1); assert_eq!(a.mod_euc(-b), 3); assert_eq!((-a).mod_euc(-b), 1); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] #[rustc_inherit_overflow_checks] pub fn mod_euc(self, rhs: Self) -> Self { From e0320349367408e79cf9a0edebd52cebaab67577 Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 12:47:35 -0700 Subject: [PATCH 5/8] Change feature name of `mod_euc` (libstd f32) --- src/libstd/f32.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index b99c00d5a2763..1d0499f7826af 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -268,7 +268,7 @@ impl f32 { /// assert_eq!((-a).mod_euc(-b), 1.0); /// ``` #[inline] - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] pub fn mod_euc(self, rhs: f32) -> f32 { let r = self % rhs; if r < 0.0 { From bba8b27ef5262969cab02831b01860919ca4226a Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 12:48:12 -0700 Subject: [PATCH 6/8] Change feature name of `mod_euc` (libstd f64) --- src/libstd/f64.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index a6ea9783d0f10..e5efc4c7d7d59 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -244,7 +244,7 @@ impl f64 { /// assert_eq!((-a).mod_euc(-b), 1.0); /// ``` #[inline] - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] pub fn mod_euc(self, rhs: f64) -> f64 { let r = self % rhs; if r < 0.0 { From 2158aa3fb9b8cdcd07f777bbd679236cfc83e67b Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 13:09:52 -0700 Subject: [PATCH 7/8] Change feature name of `overflowing_mod_euc` --- src/libcore/num/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 977d2fe9f59c9..6d71cdfbb253d 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -3376,7 +3376,7 @@ Basic usage assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false)); ```"), #[inline] - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) { (self % rhs, false) } From 8924072ef0888dde718144e52d30b5a90a2dcf42 Mon Sep 17 00:00:00 2001 From: Anirudh Balaji Date: Thu, 19 Jul 2018 14:11:16 -0700 Subject: [PATCH 8/8] Change feature name of `mod_euc` to `euclidean_modulo` --- src/libcore/num/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6d71cdfbb253d..bb8be94adf02c 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -2712,7 +2712,7 @@ Basic usage: assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1)); assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] pub fn checked_mod_euc(self, rhs: Self) -> Option { if rhs == 0 { @@ -3062,7 +3062,7 @@ Basic usage: #![feature(euclidean_division)] assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0); ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] pub fn wrapping_mod_euc(self, rhs: Self) -> Self { self % rhs @@ -3574,7 +3574,7 @@ Basic usage: #![feature(euclidean_division)] assert_eq!(7", stringify!($SelfT), ".mod_euc(4), 3); // or any other integer type ```"), - #[stable(feature = "euclidean_division", since = "1.29.0")] + #[stable(feature = "euclidean_modulo", since = "1.29.0")] #[inline] #[rustc_inherit_overflow_checks] pub fn mod_euc(self, rhs: Self) -> Self {