Skip to content

Commit 84dd79b

Browse files
authored
Rollup merge of rust-lang#57873 - milesand:master, r=Centril
Stabilize no_panic_pow This would close rust-lang#48320. I'm not sure if I've done this right, I've just changed attribute name to stable and set `since` to two minor versions above current stable since that seemed like what others were doing.
2 parents 11fef00 + b12aa4f commit 84dd79b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/libcore/num/mod.rs

+8-16
Original file line numberDiff line numberDiff line change
@@ -847,13 +847,12 @@ overflow occurred.
847847
Basic usage:
848848
849849
```
850-
#![feature(no_panic_pow)]
851850
", $Feature, "assert_eq!(8", stringify!($SelfT), ".checked_pow(2), Some(64));
852851
assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);",
853852
$EndFeature, "
854853
```"),
855854

856-
#[unstable(feature = "no_panic_pow", issue = "48320")]
855+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
857856
#[inline]
858857
pub fn checked_pow(self, mut exp: u32) -> Option<Self> {
859858
let mut base = self;
@@ -966,15 +965,14 @@ saturating at the numeric bounds instead of overflowing.
966965
Basic usage:
967966
968967
```
969-
#![feature(no_panic_pow)]
970968
", $Feature, "use std::", stringify!($SelfT), ";
971969
972970
assert_eq!((-4", stringify!($SelfT), ").saturating_pow(3), -64);
973971
assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(2), ", stringify!($SelfT), "::MAX);
974972
assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT), "::MIN);",
975973
$EndFeature, "
976974
```"),
977-
#[unstable(feature = "no_panic_pow", issue = "48320")]
975+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
978976
#[inline]
979977
pub fn saturating_pow(self, exp: u32) -> Self {
980978
match self.checked_pow(exp) {
@@ -1297,13 +1295,12 @@ wrapping around at the boundary of the type.
12971295
Basic usage:
12981296
12991297
```
1300-
#![feature(no_panic_pow)]
13011298
", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(4), 81);
13021299
assert_eq!(3i8.wrapping_pow(5), -13);
13031300
assert_eq!(3i8.wrapping_pow(6), -39);",
13041301
$EndFeature, "
13051302
```"),
1306-
#[unstable(feature = "no_panic_pow", issue = "48320")]
1303+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
13071304
#[inline]
13081305
pub fn wrapping_pow(self, mut exp: u32) -> Self {
13091306
let mut base = self;
@@ -1669,12 +1666,11 @@ whether an overflow happened.
16691666
Basic usage:
16701667
16711668
```
1672-
#![feature(no_panic_pow)]
16731669
", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(4), (81, false));
16741670
assert_eq!(3i8.overflowing_pow(5), (-13, true));",
16751671
$EndFeature, "
16761672
```"),
1677-
#[unstable(feature = "no_panic_pow", issue = "48320")]
1673+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
16781674
#[inline]
16791675
pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
16801676
let mut base = self;
@@ -2789,11 +2785,10 @@ overflow occurred.
27892785
Basic usage:
27902786
27912787
```
2792-
#![feature(no_panic_pow)]
27932788
", $Feature, "assert_eq!(2", stringify!($SelfT), ".checked_pow(5), Some(32));
27942789
assert_eq!(", stringify!($SelfT), "::max_value().checked_pow(2), None);", $EndFeature, "
27952790
```"),
2796-
#[unstable(feature = "no_panic_pow", issue = "48320")]
2791+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
27972792
#[inline]
27982793
pub fn checked_pow(self, mut exp: u32) -> Option<Self> {
27992794
let mut base = self;
@@ -2893,14 +2888,13 @@ saturating at the numeric bounds instead of overflowing.
28932888
Basic usage:
28942889
28952890
```
2896-
#![feature(no_panic_pow)]
28972891
", $Feature, "use std::", stringify!($SelfT), ";
28982892
28992893
assert_eq!(4", stringify!($SelfT), ".saturating_pow(3), 64);
29002894
assert_eq!(", stringify!($SelfT), "::MAX.saturating_pow(2), ", stringify!($SelfT), "::MAX);",
29012895
$EndFeature, "
29022896
```"),
2903-
#[unstable(feature = "no_panic_pow", issue = "48320")]
2897+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
29042898
#[inline]
29052899
pub fn saturating_pow(self, exp: u32) -> Self {
29062900
match self.checked_pow(exp) {
@@ -3178,11 +3172,10 @@ wrapping around at the boundary of the type.
31783172
Basic usage:
31793173
31803174
```
3181-
#![feature(no_panic_pow)]
31823175
", $Feature, "assert_eq!(3", stringify!($SelfT), ".wrapping_pow(5), 243);
31833176
assert_eq!(3u8.wrapping_pow(6), 217);", $EndFeature, "
31843177
```"),
3185-
#[unstable(feature = "no_panic_pow", issue = "48320")]
3178+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
31863179
#[inline]
31873180
pub fn wrapping_pow(self, mut exp: u32) -> Self {
31883181
let mut base = self;
@@ -3497,11 +3490,10 @@ whether an overflow happened.
34973490
Basic usage:
34983491
34993492
```
3500-
#![feature(no_panic_pow)]
35013493
", $Feature, "assert_eq!(3", stringify!($SelfT), ".overflowing_pow(5), (243, false));
35023494
assert_eq!(3u8.overflowing_pow(6), (217, true));", $EndFeature, "
35033495
```"),
3504-
#[unstable(feature = "no_panic_pow", issue = "48320")]
3496+
#[stable(feature = "no_panic_pow", since = "1.34.0")]
35053497
#[inline]
35063498
pub fn overflowing_pow(self, mut exp: u32) -> (Self, bool) {
35073499
let mut base = self;

0 commit comments

Comments
 (0)