stabilize const_int_from_str
· model-checking/verify-rust-std@259c058 (original) (raw)
`@@ -1387,6 +1387,7 @@ from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }
`
1387
1387
`#[doc(hidden)]
`
1388
1388
`#[inline(always)]
`
1389
1389
`#[unstable(issue = "none", feature = "std_internals")]
`
``
1390
`+
#[rustc_const_unstable(issue = "none", feature = "const_int_cannot_overflow")]
`
1390
1391
`pub const fn can_not_overflow(radix: u32, is_signed_ty: bool, digits: &[u8]) -> bool {
`
1391
1392
` radix <= 16 && digits.len() <= mem::size_of::() * 2 - is_signed_ty as usize
`
1392
1393
`}
`
`@@ -1410,6 +1411,7 @@ const fn from_str_radix_panic(radix: u32) {
`
1410
1411
` intrinsics::const_eval_select((radix,), from_str_radix_panic_ct, from_str_radix_panic_rt);
`
1411
1412
`}
`
1412
1413
``
``
1414
`+
#[allow_internal_unstable(const_int_cannot_overflow)]
`
1413
1415
`macro_rules! from_str_radix {
`
1414
1416
`($($int_ty:ty)+) => {$(
`
1415
1417
`impl $int_ty {
`
`@@ -1436,7 +1438,7 @@ macro_rules! from_str_radix {
`
1436
1438
` #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str_radix("A", 16), Ok(10));")]
`
1437
1439
```` /// ```
`1438`
`1440`
` #[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")]
`
`1440`
`1442`
`pub const fn from_str_radix(src: &str, radix: u32) -> Result<$int_ty, ParseIntError> {
`
`1441`
`1443`
`use self::IntErrorKind::*;
`
`1442`
`1444`
`use self::ParseIntError as PIE;
`
`@@ -1566,7 +1568,7 @@ macro_rules! from_str_radix_size_impl {
`
`1566`
`1568`
` #[doc = concat!("assert_eq!(", stringify!($size), "::from_str_radix(\"A\", 16), Ok(10));")]
`
`1567`
`1569`
```` /// ```
1568
1570
` #[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")]
`
1570
1572
`pub const fn from_str_radix(src: &str, radix: u32) -> Result<$size, ParseIntError> {
`
1571
1573
`match <$t>::from_str_radix(src, radix) {
`
1572
1574
`Ok(x) => Ok(x as $size),
`