@@ -992,10 +992,10 @@ macro_rules! int_impl {
992992 ///
993993 /// ```
994994 /// #![feature(exact_div)]
995- #[ doc = concat!( "assert_eq!((" , stringify!( $SelfT) , "::MIN + 1).checked_exact_div (-1), Some(" , stringify!( $Max) , "));" ) ]
996- #[ doc = concat!( "assert_eq!((-5" , stringify!( $SelfT) , ").checked_exact_div (2), None);" ) ]
997- #[ doc = concat!( "assert_eq!(" , stringify!( $SelfT) , "::MIN.checked_exact_div (-1), None);" ) ]
998- #[ doc = concat!( "assert_eq!((1" , stringify!( $SelfT) , ").checked_exact_div (0), None);" ) ]
995+ #[ doc = concat!( "assert_eq!((" , stringify!( $SelfT) , "::MIN + 1).checked_div_exact (-1), Some(" , stringify!( $Max) , "));" ) ]
996+ #[ doc = concat!( "assert_eq!((-5" , stringify!( $SelfT) , ").checked_div_exact (2), None);" ) ]
997+ #[ doc = concat!( "assert_eq!(" , stringify!( $SelfT) , "::MIN.checked_div_exact (-1), None);" ) ]
998+ #[ doc = concat!( "assert_eq!((1" , stringify!( $SelfT) , ").checked_div_exact (0), None);" ) ]
999999 /// ```
10001000 #[ unstable(
10011001 feature = "exact_div" ,
@@ -1004,7 +1004,7 @@ macro_rules! int_impl {
10041004 #[ must_use = "this returns the result of the operation, \
10051005 without modifying the original"]
10061006 #[ inline]
1007- pub const fn checked_exact_div ( self , rhs: Self ) -> Option <Self > {
1007+ pub const fn checked_div_exact ( self , rhs: Self ) -> Option <Self > {
10081008 if intrinsics:: unlikely( rhs == 0 || ( ( self == Self :: MIN ) && ( rhs == -1 ) ) ) {
10091009 None
10101010 } else {
@@ -1034,18 +1034,18 @@ macro_rules! int_impl {
10341034 ///
10351035 /// ```
10361036 /// #![feature(exact_div)]
1037- #[ doc = concat!( "assert_eq!(64" , stringify!( $SelfT) , ".exact_div (2), Some(32));" ) ]
1038- #[ doc = concat!( "assert_eq!(64" , stringify!( $SelfT) , ".exact_div (32), Some(2));" ) ]
1039- #[ doc = concat!( "assert_eq!((" , stringify!( $SelfT) , "::MIN + 1).exact_div (-1), Some(" , stringify!( $Max) , "));" ) ]
1040- #[ doc = concat!( "assert_eq!(65" , stringify!( $SelfT) , ".exact_div (2), None);" ) ]
1037+ #[ doc = concat!( "assert_eq!(64" , stringify!( $SelfT) , ".div_exact (2), Some(32));" ) ]
1038+ #[ doc = concat!( "assert_eq!(64" , stringify!( $SelfT) , ".div_exact (32), Some(2));" ) ]
1039+ #[ doc = concat!( "assert_eq!((" , stringify!( $SelfT) , "::MIN + 1).div_exact (-1), Some(" , stringify!( $Max) , "));" ) ]
1040+ #[ doc = concat!( "assert_eq!(65" , stringify!( $SelfT) , ".div_exact (2), None);" ) ]
10411041 /// ```
10421042 /// ```should_panic
10431043 /// #![feature(exact_div)]
1044- #[ doc = concat!( "let _ = 64" , stringify!( $SelfT) , ".exact_div (0);" ) ]
1044+ #[ doc = concat!( "let _ = 64" , stringify!( $SelfT) , ".div_exact (0);" ) ]
10451045 /// ```
10461046 /// ```should_panic
10471047 /// #![feature(exact_div)]
1048- #[ doc = concat!( "let _ = " , stringify!( $SelfT) , "::MIN.exact_div (-1);" ) ]
1048+ #[ doc = concat!( "let _ = " , stringify!( $SelfT) , "::MIN.div_exact (-1);" ) ]
10491049 /// ```
10501050 #[ unstable(
10511051 feature = "exact_div" ,
@@ -1055,7 +1055,7 @@ macro_rules! int_impl {
10551055 without modifying the original"]
10561056 #[ inline]
10571057 #[ rustc_inherit_overflow_checks]
1058- pub const fn exact_div ( self , rhs: Self ) -> Option <Self > {
1058+ pub const fn div_exact ( self , rhs: Self ) -> Option <Self > {
10591059 if self % rhs != 0 {
10601060 None
10611061 } else {
@@ -1069,18 +1069,18 @@ macro_rules! int_impl {
10691069 ///
10701070 /// This results in undefined behavior when `rhs == 0`, `self % rhs != 0`, or
10711071 #[ doc = concat!( "`self == " , stringify!( $SelfT) , "::MIN && rhs == -1`," ) ]
1072- /// i.e. when [`checked_exact_div `](Self::checked_exact_div ) would return `None`.
1072+ /// i.e. when [`checked_div_exact `](Self::checked_div_exact ) would return `None`.
10731073 #[ unstable(
10741074 feature = "exact_div" ,
10751075 issue = "139911" ,
10761076 ) ]
10771077 #[ must_use = "this returns the result of the operation, \
10781078 without modifying the original"]
10791079 #[ inline]
1080- pub const unsafe fn unchecked_exact_div ( self , rhs: Self ) -> Self {
1080+ pub const unsafe fn unchecked_div_exact ( self , rhs: Self ) -> Self {
10811081 assert_unsafe_precondition!(
10821082 check_language_ub,
1083- concat!( stringify!( $SelfT) , "::unchecked_exact_div cannot overflow, divide by zero, or leave a remainder" ) ,
1083+ concat!( stringify!( $SelfT) , "::unchecked_div_exact cannot overflow, divide by zero, or leave a remainder" ) ,
10841084 (
10851085 lhs: $SelfT = self ,
10861086 rhs: $SelfT = rhs,
@@ -1431,17 +1431,17 @@ macro_rules! int_impl {
14311431 /// ```
14321432 /// #![feature(exact_bitshifts)]
14331433 ///
1434- #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".exact_shl (4), Some(0x10));" ) ]
1435- #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".exact_shl (" , stringify!( $SelfT) , "::BITS - 2), Some(1 << " , stringify!( $SelfT) , "::BITS - 2));" ) ]
1436- #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".exact_shl (" , stringify!( $SelfT) , "::BITS - 1), None);" ) ]
1437- #[ doc = concat!( "assert_eq!((-0x2" , stringify!( $SelfT) , ").exact_shl (" , stringify!( $SelfT) , "::BITS - 2), Some(-0x2 << " , stringify!( $SelfT) , "::BITS - 2));" ) ]
1438- #[ doc = concat!( "assert_eq!((-0x2" , stringify!( $SelfT) , ").exact_shl (" , stringify!( $SelfT) , "::BITS - 1), None);" ) ]
1434+ #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".shl_exact (4), Some(0x10));" ) ]
1435+ #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".shl_exact (" , stringify!( $SelfT) , "::BITS - 2), Some(1 << " , stringify!( $SelfT) , "::BITS - 2));" ) ]
1436+ #[ doc = concat!( "assert_eq!(0x1" , stringify!( $SelfT) , ".shl_exact (" , stringify!( $SelfT) , "::BITS - 1), None);" ) ]
1437+ #[ doc = concat!( "assert_eq!((-0x2" , stringify!( $SelfT) , ").shl_exact (" , stringify!( $SelfT) , "::BITS - 2), Some(-0x2 << " , stringify!( $SelfT) , "::BITS - 2));" ) ]
1438+ #[ doc = concat!( "assert_eq!((-0x2" , stringify!( $SelfT) , ").shl_exact (" , stringify!( $SelfT) , "::BITS - 1), None);" ) ]
14391439 /// ```
14401440 #[ unstable( feature = "exact_bitshifts" , issue = "144336" ) ]
14411441 #[ must_use = "this returns the result of the operation, \
14421442 without modifying the original"]
14431443 #[ inline]
1444- pub const fn exact_shl ( self , rhs: u32 ) -> Option <$SelfT> {
1444+ pub const fn shl_exact ( self , rhs: u32 ) -> Option <$SelfT> {
14451445 if rhs < self . leading_zeros( ) || rhs < self . leading_ones( ) {
14461446 // SAFETY: rhs is checked above
14471447 Some ( unsafe { self . unchecked_shl( rhs) } )
@@ -1458,16 +1458,16 @@ macro_rules! int_impl {
14581458 ///
14591459 /// This results in undefined behavior when `rhs >= self.leading_zeros() && rhs >=
14601460 /// self.leading_ones()` i.e. when
1461- #[ doc = concat!( "[`" , stringify!( $SelfT) , "::exact_shl `]" ) ]
1461+ #[ doc = concat!( "[`" , stringify!( $SelfT) , "::shl_exact `]" ) ]
14621462 /// would return `None`.
14631463 #[ unstable( feature = "exact_bitshifts" , issue = "144336" ) ]
14641464 #[ must_use = "this returns the result of the operation, \
14651465 without modifying the original"]
14661466 #[ inline]
1467- pub const unsafe fn unchecked_exact_shl ( self , rhs: u32 ) -> $SelfT {
1467+ pub const unsafe fn unchecked_shl_exact ( self , rhs: u32 ) -> $SelfT {
14681468 assert_unsafe_precondition!(
14691469 check_library_ub,
1470- concat!( stringify!( $SelfT) , "::unchecked_exact_shl cannot shift out bits that would change the value of the first bit" ) ,
1470+ concat!( stringify!( $SelfT) , "::unchecked_shl_exact cannot shift out bits that would change the value of the first bit" ) ,
14711471 (
14721472 zeros: u32 = self . leading_zeros( ) ,
14731473 ones: u32 = self . leading_ones( ) ,
@@ -1611,14 +1611,14 @@ macro_rules! int_impl {
16111611 /// ```
16121612 /// #![feature(exact_bitshifts)]
16131613 ///
1614- #[ doc = concat!( "assert_eq!(0x10" , stringify!( $SelfT) , ".exact_shr (4), Some(0x1));" ) ]
1615- #[ doc = concat!( "assert_eq!(0x10" , stringify!( $SelfT) , ".exact_shr (5), None);" ) ]
1614+ #[ doc = concat!( "assert_eq!(0x10" , stringify!( $SelfT) , ".shr_exact (4), Some(0x1));" ) ]
1615+ #[ doc = concat!( "assert_eq!(0x10" , stringify!( $SelfT) , ".shr_exact (5), None);" ) ]
16161616 /// ```
16171617 #[ unstable( feature = "exact_bitshifts" , issue = "144336" ) ]
16181618 #[ must_use = "this returns the result of the operation, \
16191619 without modifying the original"]
16201620 #[ inline]
1621- pub const fn exact_shr ( self , rhs: u32 ) -> Option <$SelfT> {
1621+ pub const fn shr_exact ( self , rhs: u32 ) -> Option <$SelfT> {
16221622 if rhs <= self . trailing_zeros( ) && rhs < <$SelfT>:: BITS {
16231623 // SAFETY: rhs is checked above
16241624 Some ( unsafe { self . unchecked_shr( rhs) } )
@@ -1636,16 +1636,16 @@ macro_rules! int_impl {
16361636 /// This results in undefined behavior when `rhs > self.trailing_zeros() || rhs >=
16371637 #[ doc = concat!( stringify!( $SelfT) , "::BITS`" ) ]
16381638 /// i.e. when
1639- #[ doc = concat!( "[`" , stringify!( $SelfT) , "::exact_shr `]" ) ]
1639+ #[ doc = concat!( "[`" , stringify!( $SelfT) , "::shr_exact `]" ) ]
16401640 /// would return `None`.
16411641 #[ unstable( feature = "exact_bitshifts" , issue = "144336" ) ]
16421642 #[ must_use = "this returns the result of the operation, \
16431643 without modifying the original"]
16441644 #[ inline]
1645- pub const unsafe fn unchecked_exact_shr ( self , rhs: u32 ) -> $SelfT {
1645+ pub const unsafe fn unchecked_shr_exact ( self , rhs: u32 ) -> $SelfT {
16461646 assert_unsafe_precondition!(
16471647 check_library_ub,
1648- concat!( stringify!( $SelfT) , "::unchecked_exact_shr cannot shift out non-zero bits" ) ,
1648+ concat!( stringify!( $SelfT) , "::unchecked_shr_exact cannot shift out non-zero bits" ) ,
16491649 (
16501650 zeros: u32 = self . trailing_zeros( ) ,
16511651 bits: u32 = <$SelfT>:: BITS ,
0 commit comments