Rollup merge of #124941 - Skgland:stabilize-const-int-from-str, r=dto… · model-checking/verify-rust-std@a2dbfd3 (original) (raw)

`@@ -1386,6 +1386,7 @@ from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 }

`

1386

1386

`#[doc(hidden)]

`

1387

1387

`#[inline(always)]

`

1388

1388

`#[unstable(issue = "none", feature = "std_internals")]

`

``

1389

`+

#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]

`

1389

1390

`pub const fn can_not_overflow(radix: u32, is_signed_ty: bool, digits: &[u8]) -> bool {

`

1390

1391

` radix <= 16 && digits.len() <= mem::size_of::() * 2 - is_signed_ty as usize

`

1391

1392

`}

`

`@@ -1435,7 +1436,7 @@ macro_rules! from_str_radix {

`

1435

1436

` #[doc = concat!("assert_eq!(", stringify!($int_ty), "::from_str_radix("A", 16), Ok(10));")]

`

1436

1437

```` /// ```


`1437`

`1438`

` #[stable(feature = "rust1", since = "1.0.0")]

`

`1438`

``

`-

#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]

`

``

`1439`

`+

#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]

`

`1439`

`1440`

`pub const fn from_str_radix(src: &str, radix: u32) -> Result<$int_ty, ParseIntError> {

`

`1440`

`1441`

`use self::IntErrorKind::*;

`

`1441`

`1442`

`use self::ParseIntError as PIE;

`

`@@ -1565,7 +1566,7 @@ macro_rules! from_str_radix_size_impl {

`

`1565`

`1566`

` #[doc = concat!("assert_eq!(", stringify!($size), "::from_str_radix(\"A\", 16), Ok(10));")]

`

`1566`

`1567`

```` /// ```

1567

1568

` #[stable(feature = "rust1", since = "1.0.0")]

`

1568

``

`-

#[rustc_const_unstable(feature = "const_int_from_str", issue = "59133")]

`

``

1569

`+

#[rustc_const_stable(feature = "const_int_from_str", since = "CURRENT_RUSTC_VERSION")]

`

1569

1570

`pub const fn from_str_radix(src: &str, radix: u32) -> Result<$size, ParseIntError> {

`

1570

1571

`match <$t>::from_str_radix(src, radix) {

`

1571

1572

`Ok(x) => Ok(x as $size),

`