Skip to content

Commit 703f176

Browse files
Rollup merge of #76829 - tspiteri:const-int-pow, r=oli-obk
stabilize const_int_pow This also requires stabilizing constctlz for const ctlz_nonzero.
2 parents 068320b + a6bcf7a commit 703f176

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

library/core/src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ extern "rust-intrinsic" {
14861486
/// let num_leading = unsafe { ctlz_nonzero(x) };
14871487
/// assert_eq!(num_leading, 3);
14881488
/// ```
1489-
#[rustc_const_unstable(feature = "constctlz", issue = "none")]
1489+
#[rustc_const_stable(feature = "constctlz", since = "1.50.0")]
14901490
pub fn ctlz_nonzero<T: Copy>(x: T) -> T;
14911491

14921492
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.

library/core/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
#![feature(const_overflowing_int_methods)]
7979
#![feature(const_int_unchecked_arith)]
8080
#![feature(const_mut_refs)]
81-
#![feature(const_int_pow)]
82-
#![feature(constctlz)]
8381
#![feature(const_cttz)]
8482
#![feature(const_panic)]
8583
#![feature(const_pin)]

library/core/src/num/int_macros.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ $EndFeature, "
791791
```"),
792792

793793
#[stable(feature = "no_panic_pow", since = "1.34.0")]
794-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
794+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
795795
#[must_use = "this returns the result of the operation, \
796796
without modifying the original"]
797797
#[inline]
@@ -974,7 +974,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.saturating_pow(3), ", stringify!($SelfT
974974
$EndFeature, "
975975
```"),
976976
#[stable(feature = "no_panic_pow", since = "1.34.0")]
977-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
977+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
978978
#[must_use = "this returns the result of the operation, \
979979
without modifying the original"]
980980
#[inline]
@@ -1340,7 +1340,7 @@ assert_eq!(3i8.wrapping_pow(6), -39);",
13401340
$EndFeature, "
13411341
```"),
13421342
#[stable(feature = "no_panic_pow", since = "1.34.0")]
1343-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1343+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
13441344
#[must_use = "this returns the result of the operation, \
13451345
without modifying the original"]
13461346
#[inline]
@@ -1707,7 +1707,7 @@ assert_eq!(3i8.overflowing_pow(5), (-13, true));",
17071707
$EndFeature, "
17081708
```"),
17091709
#[stable(feature = "no_panic_pow", since = "1.34.0")]
1710-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1710+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
17111711
#[must_use = "this returns the result of the operation, \
17121712
without modifying the original"]
17131713
#[inline]
@@ -1757,7 +1757,7 @@ assert_eq!(x.pow(5), 32);",
17571757
$EndFeature, "
17581758
```"),
17591759
#[stable(feature = "rust1", since = "1.0.0")]
1760-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1760+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
17611761
#[must_use = "this returns the result of the operation, \
17621762
without modifying the original"]
17631763
#[inline]

library/core/src/num/uint_macros.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ Basic usage:
749749
assert_eq!(", stringify!($SelfT), "::MAX.checked_pow(2), None);", $EndFeature, "
750750
```"),
751751
#[stable(feature = "no_panic_pow", since = "1.34.0")]
752-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
752+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
753753
#[must_use = "this returns the result of the operation, \
754754
without modifying the original"]
755755
#[inline]
@@ -865,7 +865,7 @@ assert_eq!(", stringify!($SelfT), "::MAX.saturating_pow(2), ", stringify!($SelfT
865865
$EndFeature, "
866866
```"),
867867
#[stable(feature = "no_panic_pow", since = "1.34.0")]
868-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
868+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
869869
#[must_use = "this returns the result of the operation, \
870870
without modifying the original"]
871871
#[inline]
@@ -1159,7 +1159,7 @@ Basic usage:
11591159
assert_eq!(3u8.wrapping_pow(6), 217);", $EndFeature, "
11601160
```"),
11611161
#[stable(feature = "no_panic_pow", since = "1.34.0")]
1162-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1162+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
11631163
#[must_use = "this returns the result of the operation, \
11641164
without modifying the original"]
11651165
#[inline]
@@ -1484,7 +1484,7 @@ Basic usage:
14841484
assert_eq!(3u8.overflowing_pow(6), (217, true));", $EndFeature, "
14851485
```"),
14861486
#[stable(feature = "no_panic_pow", since = "1.34.0")]
1487-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1487+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
14881488
#[must_use = "this returns the result of the operation, \
14891489
without modifying the original"]
14901490
#[inline]
@@ -1532,7 +1532,7 @@ Basic usage:
15321532
", $Feature, "assert_eq!(2", stringify!($SelfT), ".pow(5), 32);", $EndFeature, "
15331533
```"),
15341534
#[stable(feature = "rust1", since = "1.0.0")]
1535-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1535+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
15361536
#[must_use = "this returns the result of the operation, \
15371537
without modifying the original"]
15381538
#[inline]
@@ -1648,7 +1648,7 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
16481648
// overflow cases it instead ends up returning the maximum value
16491649
// of the type, and can return 0 for 0.
16501650
#[inline]
1651-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1651+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
16521652
const fn one_less_than_next_power_of_two(self) -> Self {
16531653
if self <= 1 { return 0; }
16541654

@@ -1677,7 +1677,7 @@ Basic usage:
16771677
assert_eq!(3", stringify!($SelfT), ".next_power_of_two(), 4);", $EndFeature, "
16781678
```"),
16791679
#[stable(feature = "rust1", since = "1.0.0")]
1680-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1680+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
16811681
#[inline]
16821682
#[rustc_inherit_overflow_checks]
16831683
pub const fn next_power_of_two(self) -> Self {
@@ -1703,7 +1703,7 @@ $EndFeature, "
17031703
```"),
17041704
#[inline]
17051705
#[stable(feature = "rust1", since = "1.0.0")]
1706-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1706+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
17071707
pub const fn checked_next_power_of_two(self) -> Option<Self> {
17081708
self.one_less_than_next_power_of_two().checked_add(1)
17091709
}
@@ -1728,7 +1728,7 @@ $EndFeature, "
17281728
```"),
17291729
#[unstable(feature = "wrapping_next_power_of_two", issue = "32463",
17301730
reason = "needs decision on wrapping behaviour")]
1731-
#[rustc_const_unstable(feature = "const_int_pow", issue = "53718")]
1731+
#[rustc_const_stable(feature = "const_int_pow", since = "1.50.0")]
17321732
pub const fn wrapping_next_power_of_two(self) -> Self {
17331733
self.one_less_than_next_power_of_two().wrapping_add(1)
17341734
}

src/test/ui/consts/const-int-pow-rpass.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22

3-
#![feature(const_int_pow)]
43
#![feature(wrapping_next_power_of_two)]
54

65
const IS_POWER_OF_TWO_A: bool = 0u32.is_power_of_two();

0 commit comments

Comments
 (0)