@@ -1595,7 +1595,9 @@ $EndFeature, "
1595
1595
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1596
1596
#[ must_use = "this returns the result of the operation, \
1597
1597
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 ) {
1599
1601
if self == Self :: min_value( ) && rhs == -1 {
1600
1602
( self , true )
1601
1603
} else {
@@ -1604,6 +1606,20 @@ $EndFeature, "
1604
1606
}
1605
1607
}
1606
1608
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
+
1607
1623
doc_comment! {
1608
1624
concat!( "Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
1609
1625
@@ -1663,7 +1679,9 @@ $EndFeature, "
1663
1679
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
1664
1680
#[ must_use = "this returns the result of the operation, \
1665
1681
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 ) {
1667
1685
if self == Self :: min_value( ) && rhs == -1 {
1668
1686
( 0 , true )
1669
1687
} else {
@@ -1672,6 +1690,19 @@ $EndFeature, "
1672
1690
}
1673
1691
}
1674
1692
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
+ }
1675
1706
1676
1707
doc_comment! {
1677
1708
concat!( "Overflowing Euclidean remainder. Calculates `self.rem_euclid(rhs)`.
@@ -3517,11 +3548,23 @@ Basic usage
3517
3548
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
3518
3549
#[ must_use = "this returns the result of the operation, \
3519
3550
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 ) {
3521
3554
( self / rhs, false )
3522
3555
}
3523
3556
}
3524
3557
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
+
3525
3568
doc_comment! {
3526
3569
concat!( "Calculates the quotient of Euclidean division `self.div_euclid(rhs)`.
3527
3570
@@ -3576,11 +3619,23 @@ Basic usage
3576
3619
#[ stable( feature = "wrapping" , since = "1.7.0" ) ]
3577
3620
#[ must_use = "this returns the result of the operation, \
3578
3621
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 ) {
3580
3625
( self % rhs, false )
3581
3626
}
3582
3627
}
3583
3628
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
+
3584
3639
doc_comment! {
3585
3640
concat!( "Calculates the remainder `self.rem_euclid(rhs)` as if by Euclidean division.
3586
3641
0 commit comments