Skip to content

Commit 8961132

Browse files
committed
Auto merge of #52850 - SimonSapin:unstablize, r=alexcrichton
Revert "Stabilize to_bytes and from_bytes for integers." This reverts commit c8f9b84 / PR #51835, and reopens the tracking issue #49792. These methods were stabilized in Rust 1.29, which is still in Nightly as of this writing. So my understanding is that it is still time to change our minds. Given the ongoing discussion in #51919 about possibly renaming these APIs and since 1.29 goes to beta soon, I’d like to revert this stabilization for now until a decision is made in that PR. It’s possible that a decision will be made in time for 1.29, but there is no urgency. At most I expect this functionality to make it into 1.30.
2 parents d2652f6 + f162438 commit 8961132

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/libcore/num/mod.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -1903,10 +1903,12 @@ $EndFeature, "
19031903
/// # Examples
19041904
///
19051905
/// ```
1906+
/// #![feature(int_to_from_bytes)]
1907+
///
19061908
/// let bytes = i32::min_value().to_be().to_bytes();
19071909
/// assert_eq!(bytes, [0x80, 0, 0, 0]);
19081910
/// ```
1909-
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
1911+
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
19101912
#[inline]
19111913
pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] {
19121914
unsafe { mem::transmute(self) }
@@ -1923,10 +1925,12 @@ $EndFeature, "
19231925
/// # Examples
19241926
///
19251927
/// ```
1928+
/// #![feature(int_to_from_bytes)]
1929+
///
19261930
/// let int = i32::from_be(i32::from_bytes([0x80, 0, 0, 0]));
19271931
/// assert_eq!(int, i32::min_value());
19281932
/// ```
1929-
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
1933+
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
19301934
#[inline]
19311935
pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
19321936
unsafe { mem::transmute(bytes) }
@@ -3508,10 +3512,12 @@ $EndFeature, "
35083512
/// # Examples
35093513
///
35103514
/// ```
3515+
/// #![feature(int_to_from_bytes)]
3516+
///
35113517
/// let bytes = 0x1234_5678_u32.to_be().to_bytes();
35123518
/// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
35133519
/// ```
3514-
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
3520+
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
35153521
#[inline]
35163522
pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] {
35173523
unsafe { mem::transmute(self) }
@@ -3528,10 +3534,12 @@ $EndFeature, "
35283534
/// # Examples
35293535
///
35303536
/// ```
3537+
/// #![feature(int_to_from_bytes)]
3538+
///
35313539
/// let int = u32::from_be(u32::from_bytes([0x12, 0x34, 0x56, 0x78]));
35323540
/// assert_eq!(int, 0x1234_5678_u32);
35333541
/// ```
3534-
#[stable(feature = "int_to_from_bytes", since = "1.29.0")]
3542+
#[unstable(feature = "int_to_from_bytes", issue = "49792")]
35353543
#[inline]
35363544
pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
35373545
unsafe { mem::transmute(bytes) }

0 commit comments

Comments
 (0)