@@ -1595,7 +1595,9 @@ $EndFeature, "
15951595 #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
15961596 #[ must_use = "this returns the result of the operation, \
15971597 without modifying the original"]
1598- pub fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
1598+ #[ rustc_const_unstable( feature = "const_int_overflowing" ) ]
1599+ #[ cfg( not( bootstrap) ) ]
1600+ pub const fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
15991601 if self == Self :: min_value( ) && rhs == -1 {
16001602 ( self , true )
16011603 } else {
@@ -1604,6 +1606,20 @@ $EndFeature, "
16041606 }
16051607 }
16061608
1609+ /// No docs for bootstrap.
1610+ #[ inline]
1611+ #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1612+ #[ must_use = "this returns the result of the operation, \
1613+ without modifying the original"]
1614+ #[ cfg( bootstrap) ]
1615+ pub fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
1616+ if self == Self :: min_value( ) && rhs == -1 {
1617+ ( self , true )
1618+ } else {
1619+ ( self / rhs, false )
1620+ }
1621+ }
1622+
16071623 doc_comment! {
16081624 concat!( "Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
16091625
@@ -1663,7 +1679,9 @@ $EndFeature, "
16631679 #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
16641680 #[ must_use = "this returns the result of the operation, \
16651681 without modifying the original"]
1666- pub fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
1682+ #[ rustc_const_unstable( feature = "const_int_overflowing" ) ]
1683+ #[ cfg( not( bootstrap) ) ]
1684+ pub const fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
16671685 if self == Self :: min_value( ) && rhs == -1 {
16681686 ( 0 , true )
16691687 } else {
@@ -1672,6 +1690,19 @@ $EndFeature, "
16721690 }
16731691 }
16741692
1693+ /// No docs for bootstrap.
1694+ #[ inline]
1695+ #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1696+ #[ must_use = "this returns the result of the operation, \
1697+ without modifying the original"]
1698+ #[ cfg( bootstrap) ]
1699+ pub fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
1700+ if self == Self :: min_value( ) && rhs == -1 {
1701+ ( 0 , true )
1702+ } else {
1703+ ( self % rhs, false )
1704+ }
1705+ }
16751706
16761707 doc_comment! {
16771708 concat!( "Overflowing Euclidean remainder. Calculates `self.rem_euclid(rhs)`.
@@ -3517,11 +3548,23 @@ Basic usage
35173548 #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
35183549 #[ must_use = "this returns the result of the operation, \
35193550 without modifying the original"]
3520- pub fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
3551+ #[ rustc_const_unstable( feature = "const_int_overflowing" ) ]
3552+ #[ cfg( not( bootstrap) ) ]
3553+ pub const fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
35213554 ( self / rhs, false )
35223555 }
35233556 }
35243557
3558+ /// No docs for bootstrap.
3559+ #[ inline]
3560+ #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
3561+ #[ must_use = "this returns the result of the operation, \
3562+ without modifying the original"]
3563+ #[ cfg( bootstrap) ]
3564+ pub fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
3565+ ( self / rhs, false )
3566+ }
3567+
35253568 doc_comment! {
35263569 concat!( "Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
35273570
@@ -3576,11 +3619,23 @@ Basic usage
35763619 #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
35773620 #[ must_use = "this returns the result of the operation, \
35783621 without modifying the original"]
3579- pub fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
3622+ #[ rustc_const_unstable( feature = "const_int_overflowing" ) ]
3623+ #[ cfg( not( bootstrap) ) ]
3624+ pub const fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
35803625 ( self % rhs, false )
35813626 }
35823627 }
35833628
3629+ /// No docs for bootstrap.
3630+ #[ inline]
3631+ #[ stable( feature = "wrapping" , since = "1.7.0" ) ]
3632+ #[ must_use = "this returns the result of the operation, \
3633+ without modifying the original"]
3634+ #[ cfg( bootstrap) ]
3635+ pub fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
3636+ ( self % rhs, false )
3637+ }
3638+
35843639 doc_comment! {
35853640 concat!( "Calculates the remainder `self.rem_euclid(rhs)` as if by Euclidean division.
35863641
0 commit comments