Skip to content

Commit c8f9b84

Browse files
committed
Stabilize to_bytes and from_bytes for integers.
Fixes #49792
1 parent d6e2239 commit c8f9b84

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/libcore/num/mod.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -1996,12 +1996,10 @@ $EndFeature, "
19961996
/// # Examples
19971997
///
19981998
/// ```
1999-
/// #![feature(int_to_from_bytes)]
2000-
///
20011999
/// let bytes = i32::min_value().to_be().to_bytes();
20022000
/// assert_eq!(bytes, [0x80, 0, 0, 0]);
20032001
/// ```
2004-
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
2002+
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
20052003
#[inline]
20062004
pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] {
20072005
unsafe { mem::transmute(self) }
@@ -2018,12 +2016,10 @@ $EndFeature, "
20182016
/// # Examples
20192017
///
20202018
/// ```
2021-
/// #![feature(int_to_from_bytes)]
2022-
///
20232019
/// let int = i32::from_be(i32::from_bytes([0x80, 0, 0, 0]));
20242020
/// assert_eq!(int, i32::min_value());
20252021
/// ```
2026-
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
2022+
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
20272023
#[inline]
20282024
pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
20292025
unsafe { mem::transmute(bytes) }
@@ -3702,12 +3698,10 @@ $EndFeature, "
37023698
/// # Examples
37033699
///
37043700
/// ```
3705-
/// #![feature(int_to_from_bytes)]
3706-
///
37073701
/// let bytes = 0x1234_5678_u32.to_be().to_bytes();
37083702
/// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
37093703
/// ```
3710-
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
3704+
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
37113705
#[inline]
37123706
pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] {
37133707
unsafe { mem::transmute(self) }
@@ -3724,12 +3718,10 @@ $EndFeature, "
37243718
/// # Examples
37253719
///
37263720
/// ```
3727-
/// #![feature(int_to_from_bytes)]
3728-
///
37293721
/// let int = u32::from_be(u32::from_bytes([0x12, 0x34, 0x56, 0x78]));
37303722
/// assert_eq!(int, 0x1234_5678_u32);
37313723
/// ```
3732-
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
3724+
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
37333725
#[inline]
37343726
pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
37353727
unsafe { mem::transmute(bytes) }

0 commit comments

Comments
 (0)