Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 259c058

Browse files
committedJul 4, 2024
stabilize const_int_from_str
1 parent de4f5c2 commit 259c058

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
 

‎core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
#![feature(const_hash)]
129129
#![feature(const_heap)]
130130
#![feature(const_index_range_slice_index)]
131-
#![feature(const_int_from_str)]
132131
#![feature(const_intrinsic_copy)]
133132
#![feature(const_intrinsic_forget)]
134133
#![feature(const_ipv4)]

‎core/src/num/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub enum IntErrorKind {
113113
impl ParseIntError {
114114
/// Outputs the detailed cause of parsing an integer failing.
115115
#[must_use]
116-
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
116+
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
117117
#[stable(feature = "int_error_matching", since = "1.55.0")]
118118
pub const fn kind(&self) -> &IntErrorKind {
119119
&self.kind

‎core/src/num/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1387,6 +1387,7 @@ from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
13871387
#[doc(hidden)]
13881388
#[inline(always)]
13891389
#[unstable(issue = "none", feature = "std_internals")]
1390+
#[rustc_const_unstable(issue = "none", feature = "const_int_cannot_overflow")]
13901391
pub const fn can_not_overflow<T>(radix: u32, is_signed_ty: bool, digits: &[u8]) -> bool {
13911392
radix <= 16 && digits.len() <= mem::size_of::<T>() * 2 - is_signed_ty as usize
13921393
}
@@ -1410,6 +1411,7 @@ const fn from_str_radix_panic(radix: u32) {
14101411
intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
14111412
}
14121413

1414+
#[allow_internal_unstable(const_int_cannot_overflow)]
14131415
macro_rules! from_str_radix {
14141416
($($int_ty:ty)+) => {$(
14151417
impl $int_ty {
@@ -1436,7 +1438,7 @@ macro_rules! from_str_radix {
14361438
#[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str_radix(\"A\", 16), Ok(10));")]
14371439
/// ```
14381440
#[stable(feature = "rust1", since = "1.0.0")]
1439-
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
1441+
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
14401442
pub const fn from_str_radix(src: &str, radix: u32) -> Result<$int_ty, ParseIntError> {
14411443
use self::IntErrorKind::*;
14421444
use self::ParseIntError as PIE;
@@ -1566,7 +1568,7 @@ macro_rules! from_str_radix_size_impl {
15661568
#[doc = concat!("assert_eq!(", stringify!($size), "::from_str_radix(\"A\", 16), Ok(10));")]
15671569
/// ```
15681570
#[stable(feature = "rust1", since = "1.0.0")]
1569-
#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]
1571+
#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]
15701572
pub const fn from_str_radix(src: &str, radix: u32) -> Result<$size, ParseIntError> {
15711573
match <$t>::from_str_radix(src, radix) {
15721574
Ok(x) => Ok(x as $size),

‎core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#![feature(const_hash)]
1717
#![feature(const_heap)]
1818
#![feature(const_intrinsic_copy)]
19-
#![feature(const_int_from_str)]
2019
#![feature(const_maybe_uninit_as_mut_ptr)]
2120
#![feature(const_nonnull_new)]
2221
#![feature(const_pointer_is_aligned)]

0 commit comments

Comments
 (0)
Failed to load comments.