about summary refs log tree commit diff
path: root/src/libcore/num/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/num/mod.rs')
-rw-r--r--src/libcore/num/mod.rs198
1 files changed, 105 insertions, 93 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index f1df1f2856e..97bf582df5a 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -1,13 +1,3 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 //! Numeric traits and functions for the built-in numeric types.
 
 #![stable(feature = "rust1", since = "1.0.0")]
@@ -16,7 +6,6 @@ use convert::TryFrom;
 use fmt;
 use intrinsics;
 use mem;
-use nonzero::NonZero;
 use ops;
 use str::FromStr;
 
@@ -58,7 +47,8 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
                 #[stable(feature = "nonzero", since = "1.28.0")]
                 #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
                 #[repr(transparent)]
-                pub struct $Ty(NonZero<$Int>);
+                #[rustc_layout_scalar_valid_range_start(1)]
+                pub struct $Ty($Int);
             }
 
             impl $Ty {
@@ -70,7 +60,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
                 #[stable(feature = "nonzero", since = "1.28.0")]
                 #[inline]
                 pub const unsafe fn new_unchecked(n: $Int) -> Self {
-                    $Ty(NonZero(n))
+                    $Ty(n)
                 }
 
                 /// Create a non-zero if the given value is not zero.
@@ -78,7 +68,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
                 #[inline]
                 pub fn new(n: $Int) -> Option<Self> {
                     if n != 0 {
-                        Some($Ty(unsafe { NonZero(n) }))
+                        Some(unsafe { $Ty(n) })
                     } else {
                         None
                     }
@@ -87,8 +77,8 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
                 /// Returns the value as a primitive type.
                 #[stable(feature = "nonzero", since = "1.28.0")]
                 #[inline]
-                pub fn get(self) -> $Int {
-                    self.0 .0
+                pub const fn get(self) -> $Int {
+                    self.0
                 }
 
             }
@@ -96,7 +86,7 @@ assert_eq!(size_of::<Option<std::num::", stringify!($Ty), ">>(), size_of::<", st
             #[stable(feature = "from_nonzero", since = "1.31.0")]
             impl From<$Ty> for $Int {
                 fn from(nonzero: $Ty) -> Self {
-                    nonzero.0 .0
+                    nonzero.0
                 }
             }
 
@@ -673,7 +663,7 @@ $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`,
+            concat!("Checked Euclidean division. Computes `self.div_euclid(rhs)`,
 returning `None` if `rhs == 0` or the division results in overflow.
 
 # Examples
@@ -683,17 +673,17 @@ Basic usage:
 ```
 #![feature(euclidean_division)]
 assert_eq!((", stringify!($SelfT),
-"::min_value() + 1).checked_div_euc(-1), Some(", stringify!($Max), "));
-assert_eq!(", stringify!($SelfT), "::min_value().checked_div_euc(-1), None);
-assert_eq!((1", stringify!($SelfT), ").checked_div_euc(0), None);
+"::min_value() + 1).checked_div_euclid(-1), Some(", stringify!($Max), "));
+assert_eq!(", stringify!($SelfT), "::min_value().checked_div_euclid(-1), None);
+assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn checked_div_euc(self, rhs: Self) -> Option<Self> {
+            pub fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
                 if rhs == 0 || (self == Self::min_value() && rhs == -1) {
                     None
                 } else {
-                    Some(self.div_euc(rhs))
+                    Some(self.div_euclid(rhs))
                 }
             }
         }
@@ -726,8 +716,8 @@ $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Checked Euclidean modulo. Computes `self.mod_euc(rhs)`, returning `None` if
-`rhs == 0` or the division results in overflow.
+            concat!("Checked Euclidean remainder. Computes `self.rem_euclid(rhs)`, returning `None`
+if `rhs == 0` or the division results in overflow.
 
 # Examples
 
@@ -737,17 +727,17 @@ Basic usage:
 #![feature(euclidean_division)]
 use std::", stringify!($SelfT), ";
 
-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);
+assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(2), Some(1));
+assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);
+assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn checked_mod_euc(self, rhs: Self) -> Option<Self> {
+            pub fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
                 if rhs == 0 || (self == Self::min_value() && rhs == -1) {
                     None
                 } else {
-                    Some(self.mod_euc(rhs))
+                    Some(self.rem_euclid(rhs))
                 }
             }
         }
@@ -1089,7 +1079,7 @@ $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`,
+            concat!("Wrapping Euclidean division. Computes `self.div_euclid(rhs)`,
 wrapping around at the boundary of the type.
 
 Wrapping will only occur in `MIN / -1` on a signed type (where `MIN` is the negative minimal value
@@ -1106,13 +1096,13 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(100", stringify!($SelfT), ".wrapping_div_euc(10), 10);
-assert_eq!((-128i8).wrapping_div_euc(-1), -128);
+assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);
+assert_eq!((-128i8).wrapping_div_euclid(-1), -128);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn wrapping_div_euc(self, rhs: Self) -> Self {
-                self.overflowing_div_euc(rhs).0
+            pub fn wrapping_div_euclid(self, rhs: Self) -> Self {
+                self.overflowing_div_euclid(rhs).0
             }
         }
 
@@ -1145,8 +1135,8 @@ $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Wrapping Euclidean modulo. Computes `self.mod_euc(rhs)`, wrapping around at the
-boundary of the type.
+            concat!("Wrapping Euclidean remainder. Computes `self.rem_euclid(rhs)`, wrapping around
+at the boundary of the type.
 
 Wrapping will only occur in `MIN % -1` on a signed type (where `MIN` is the negative minimal value
 for the type). In this case, this method returns 0.
@@ -1161,13 +1151,13 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0);
-assert_eq!((-128i8).wrapping_mod_euc(-1), 0);
+assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
+assert_eq!((-128i8).wrapping_rem_euclid(-1), 0);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn wrapping_mod_euc(self, rhs: Self) -> Self {
-                self.overflowing_mod_euc(rhs).0
+            pub fn wrapping_rem_euclid(self, rhs: Self) -> Self {
+                self.overflowing_rem_euclid(rhs).0
             }
         }
 
@@ -1442,7 +1432,7 @@ $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Calculates the quotient of Euclidean division `self.div_euc(rhs)`.
+            concat!("Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
 
 Returns a tuple of the divisor along with a boolean indicating whether an arithmetic overflow would
 occur. If an overflow would occur then `self` is returned.
@@ -1459,17 +1449,17 @@ Basic usage:
 #![feature(euclidean_division)]
 use std::", stringify!($SelfT), ";
 
-assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false));
-assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euc(-1), (", stringify!($SelfT),
+assert_eq!(5", stringify!($SelfT), ".overflowing_div_euclid(2), (2, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euclid(-1), (", stringify!($SelfT),
 "::MIN, true));
 ```"),
             #[inline]
             #[unstable(feature = "euclidean_division", issue = "49048")]
-            pub fn overflowing_div_euc(self, rhs: Self) -> (Self, bool) {
+            pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
                 if self == Self::min_value() && rhs == -1 {
                     (self, true)
                 } else {
-                    (self.div_euc(rhs), false)
+                    (self.div_euclid(rhs), false)
                 }
             }
         }
@@ -1508,7 +1498,7 @@ $EndFeature, "
 
 
         doc_comment! {
-            concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division.
+            concat!("Overflowing Euclidean remainder. Calculates `self.rem_euclid(rhs)`.
 
 Returns a tuple of the remainder after dividing along with a boolean indicating whether an
 arithmetic overflow would occur. If an overflow would occur then 0 is returned.
@@ -1525,16 +1515,16 @@ Basic usage:
 #![feature(euclidean_division)]
 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));
+assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false));
+assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) {
+            pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
                 if self == Self::min_value() && rhs == -1 {
                     (0, true)
                 } else {
-                    (self.mod_euc(rhs), false)
+                    (self.rem_euclid(rhs), false)
                 }
             }
         }
@@ -1739,9 +1729,13 @@ $EndFeature, "
         doc_comment! {
             concat!("Calculates the quotient of Euclidean division of `self` by `rhs`.
 
-This computes the integer `n` such that `self = n * rhs + self.mod_euc(rhs)`.
+This computes the integer `n` such that `self = n * rhs + self.rem_euclid(rhs)`,
+with `0 <= self.rem_euclid(rhs) < rhs`.
+
 In other words, the result is `self / rhs` rounded to the integer `n`
 such that `self >= n * rhs`.
+If `self > 0`, this is equal to round towards zero (the default in Rust);
+if `self < 0`, this is equal to round towards +/- infinity.
 
 # Panics
 
@@ -1756,15 +1750,15 @@ Basic usage:
 let a: ", stringify!($SelfT), " = 7; // or any other integer type
 let b = 4;
 
-assert_eq!(a.div_euc(b), 1); // 7 >= 4 * 1
-assert_eq!(a.div_euc(-b), -1); // 7 >= -4 * -1
-assert_eq!((-a).div_euc(b), -2); // -7 >= 4 * -2
-assert_eq!((-a).div_euc(-b), 2); // -7 >= -4 * 2
+assert_eq!(a.div_euclid(b), 1); // 7 >= 4 * 1
+assert_eq!(a.div_euclid(-b), -1); // 7 >= -4 * -1
+assert_eq!((-a).div_euclid(b), -2); // -7 >= 4 * -2
+assert_eq!((-a).div_euclid(-b), 2); // -7 >= -4 * 2
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
             #[rustc_inherit_overflow_checks]
-            pub fn div_euc(self, rhs: Self) -> Self {
+            pub fn div_euclid(self, rhs: Self) -> Self {
                 let q = self / rhs;
                 if self % rhs < 0 {
                     return if rhs > 0 { q - 1 } else { q + 1 }
@@ -1775,9 +1769,11 @@ assert_eq!((-a).div_euc(-b), 2); // -7 >= -4 * 2
 
 
         doc_comment! {
-            concat!("Calculates the remainder `self mod rhs` by Euclidean division.
+            concat!("Calculates the least nonnegative remainder of `self (mod rhs)`.
 
-In particular, the result `n` satisfies `0 <= n < rhs.abs()`.
+This is done as if by the Euclidean division algorithm -- given
+`r = self.rem_euclid(rhs)`, `self = rhs * self.div_euclid(rhs) + r`, and
+`0 <= r < abs(rhs)`.
 
 # Panics
 
@@ -1792,15 +1788,15 @@ Basic usage:
 let a: ", stringify!($SelfT), " = 7; // or any other integer type
 let b = 4;
 
-assert_eq!(a.mod_euc(b), 3);
-assert_eq!((-a).mod_euc(b), 1);
-assert_eq!(a.mod_euc(-b), 3);
-assert_eq!((-a).mod_euc(-b), 1);
+assert_eq!(a.rem_euclid(b), 3);
+assert_eq!((-a).rem_euclid(b), 1);
+assert_eq!(a.rem_euclid(-b), 3);
+assert_eq!((-a).rem_euclid(-b), 1);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
             #[rustc_inherit_overflow_checks]
-            pub fn mod_euc(self, rhs: Self) -> Self {
+            pub fn rem_euclid(self, rhs: Self) -> Self {
                 let r = self % rhs;
                 if r < 0 {
                     if rhs < 0 {
@@ -2611,7 +2607,7 @@ assert_eq!(1", stringify!($SelfT), ".checked_div(0), None);", $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Checked Euclidean division. Computes `self.div_euc(rhs)`, returning `None`
+            concat!("Checked Euclidean division. Computes `self.div_euclid(rhs)`, returning `None`
 if `rhs == 0`.
 
 # Examples
@@ -2620,16 +2616,16 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(128", stringify!($SelfT), ".checked_div(2), Some(64));
-assert_eq!(1", stringify!($SelfT), ".checked_div_euc(0), None);
+assert_eq!(128", stringify!($SelfT), ".checked_div_euclid(2), Some(64));
+assert_eq!(1", stringify!($SelfT), ".checked_div_euclid(0), None);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn checked_div_euc(self, rhs: Self) -> Option<Self> {
+            pub fn checked_div_euclid(self, rhs: Self) -> Option<Self> {
                 if rhs == 0 {
                     None
                 } else {
-                    Some(self.div_euc(rhs))
+                    Some(self.div_euclid(rhs))
                 }
             }
         }
@@ -2659,7 +2655,7 @@ assert_eq!(5", stringify!($SelfT), ".checked_rem(0), None);", $EndFeature, "
         }
 
         doc_comment! {
-            concat!("Checked Euclidean modulo. Computes `self.mod_euc(rhs)`, returning `None`
+            concat!("Checked Euclidean modulo. Computes `self.rem_euclid(rhs)`, returning `None`
 if `rhs == 0`.
 
 # Examples
@@ -2668,16 +2664,16 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(2), Some(1));
-assert_eq!(5", stringify!($SelfT), ".checked_mod_euc(0), None);
+assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(2), Some(1));
+assert_eq!(5", stringify!($SelfT), ".checked_rem_euclid(0), None);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn checked_mod_euc(self, rhs: Self) -> Option<Self> {
+            pub fn checked_rem_euclid(self, rhs: Self) -> Option<Self> {
                 if rhs == 0 {
                     None
                 } else {
-                    Some(self.mod_euc(rhs))
+                    Some(self.rem_euclid(rhs))
                 }
             }
         }
@@ -2965,11 +2961,14 @@ Basic usage:
         }
 
         doc_comment! {
-            concat!("Wrapping Euclidean division. Computes `self.div_euc(rhs)`.
+            concat!("Wrapping Euclidean division. Computes `self.div_euclid(rhs)`.
 Wrapped division on unsigned types is just normal division.
 There's no way wrapping could ever happen.
 This function exists, so that all operations
 are accounted for in the wrapping operations.
+Since, for the positive integers, all common
+definitions of division are equal, this
+is exactly equal to `self.wrapping_div(rhs)`.
 
 # Examples
 
@@ -2977,11 +2976,11 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(100", stringify!($SelfT), ".wrapping_div_euc(10), 10);
+assert_eq!(100", stringify!($SelfT), ".wrapping_div_euclid(10), 10);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn wrapping_div_euc(self, rhs: Self) -> Self {
+            pub fn wrapping_div_euclid(self, rhs: Self) -> Self {
                 self / rhs
             }
         }
@@ -3009,12 +3008,15 @@ Basic usage:
         }
 
         doc_comment! {
-            concat!("Wrapping Euclidean modulo. Computes `self.mod_euc(rhs)`.
+            concat!("Wrapping Euclidean modulo. Computes `self.rem_euclid(rhs)`.
 Wrapped modulo calculation on unsigned types is
 just the regular remainder calculation.
 There's no way wrapping could ever happen.
 This function exists, so that all operations
 are accounted for in the wrapping operations.
+Since, for the positive integers, all common
+definitions of division are equal, this
+is exactly equal to `self.wrapping_rem(rhs)`.
 
 # Examples
 
@@ -3022,11 +3024,11 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(100", stringify!($SelfT), ".wrapping_mod_euc(10), 0);
+assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0);
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
-            pub fn wrapping_mod_euc(self, rhs: Self) -> Self {
+            pub fn wrapping_rem_euclid(self, rhs: Self) -> Self {
                 self % rhs
             }
         }
@@ -3270,12 +3272,15 @@ Basic usage
         }
 
         doc_comment! {
-            concat!("Calculates the quotient of Euclidean division `self.div_euc(rhs)`.
+            concat!("Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
 
 Returns a tuple of the divisor along with a boolean indicating
 whether an arithmetic overflow would occur. Note that for unsigned
 integers overflow never occurs, so the second value is always
 `false`.
+Since, for the positive integers, all common
+definitions of division are equal, this
+is exactly equal to `self.overflowing_div(rhs)`.
 
 # Panics
 
@@ -3287,11 +3292,11 @@ Basic usage
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(5", stringify!($SelfT), ".overflowing_div_euc(2), (2, false));
+assert_eq!(5", stringify!($SelfT), ".overflowing_div_euclid(2), (2, false));
 ```"),
             #[inline]
             #[unstable(feature = "euclidean_division", issue = "49048")]
-            pub fn overflowing_div_euc(self, rhs: Self) -> (Self, bool) {
+            pub fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
                 (self / rhs, false)
             }
         }
@@ -3323,12 +3328,15 @@ Basic usage
         }
 
         doc_comment! {
-            concat!("Calculates the remainder `self.mod_euc(rhs)` by Euclidean division.
+            concat!("Calculates the remainder `self.rem_euclid(rhs)` as if by Euclidean division.
 
 Returns a tuple of the modulo after dividing along with a boolean
 indicating whether an arithmetic overflow would occur. Note that for
 unsigned integers overflow never occurs, so the second value is
 always `false`.
+Since, for the positive integers, all common
+definitions of division are equal, this operation
+is exactly equal to `self.overflowing_rem(rhs)`.
 
 # Panics
 
@@ -3340,11 +3348,11 @@ Basic usage
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(5", stringify!($SelfT), ".overflowing_mod_euc(2), (1, false));
+assert_eq!(5", stringify!($SelfT), ".overflowing_rem_euclid(2), (1, false));
 ```"),
             #[inline]
             #[unstable(feature = "euclidean_division", issue = "49048")]
-            pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) {
+            pub fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
                 (self % rhs, false)
             }
         }
@@ -3511,7 +3519,9 @@ Basic usage:
             doc_comment! {
             concat!("Performs Euclidean division.
 
-For unsigned types, this is just the same as `self / rhs`.
+Since, for the positive integers, all common
+definitions of division are equal, this
+is exactly equal to `self / rhs`.
 
 # Examples
 
@@ -3519,21 +3529,23 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(7", stringify!($SelfT), ".div_euc(4), 1); // or any other integer type
+assert_eq!(7", stringify!($SelfT), ".div_euclid(4), 1); // or any other integer type
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
             #[rustc_inherit_overflow_checks]
-            pub fn div_euc(self, rhs: Self) -> Self {
+            pub fn div_euclid(self, rhs: Self) -> Self {
                 self / rhs
             }
         }
 
 
         doc_comment! {
-            concat!("Calculates the remainder `self mod rhs` by Euclidean division.
+            concat!("Calculates the least remainder of `self (mod rhs)`.
 
-For unsigned types, this is just the same as `self % rhs`.
+Since, for the positive integers, all common
+definitions of division are equal, this
+is exactly equal to `self % rhs`.
 
 # Examples
 
@@ -3541,12 +3553,12 @@ Basic usage:
 
 ```
 #![feature(euclidean_division)]
-assert_eq!(7", stringify!($SelfT), ".mod_euc(4), 3); // or any other integer type
+assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer type
 ```"),
             #[unstable(feature = "euclidean_division", issue = "49048")]
             #[inline]
             #[rustc_inherit_overflow_checks]
-            pub fn mod_euc(self, rhs: Self) -> Self {
+            pub fn rem_euclid(self, rhs: Self) -> Self {
                 self % rhs
             }
         }