Skip to content

Commit 0baf898

Browse files
committed
Remove num_as_ne_bytes feature
1 parent fbf1b1a commit 0baf898

File tree

4 files changed

+0
-118
lines changed

4 files changed

+0
-118
lines changed

library/core/src/num/f32.rs

-29
Original file line numberDiff line numberDiff line change
@@ -854,35 +854,6 @@ impl f32 {
854854
self.to_bits().to_ne_bytes()
855855
}
856856

857-
/// Return the memory representation of this floating point number as a byte array in
858-
/// native byte order.
859-
///
860-
/// [`to_ne_bytes`] should be preferred over this whenever possible.
861-
///
862-
/// [`to_ne_bytes`]: f32::to_ne_bytes
863-
///
864-
/// # Examples
865-
///
866-
/// ```
867-
/// #![feature(num_as_ne_bytes)]
868-
/// let num = 12.5f32;
869-
/// let bytes = num.as_ne_bytes();
870-
/// assert_eq!(
871-
/// bytes,
872-
/// if cfg!(target_endian = "big") {
873-
/// &[0x41, 0x48, 0x00, 0x00]
874-
/// } else {
875-
/// &[0x00, 0x00, 0x48, 0x41]
876-
/// }
877-
/// );
878-
/// ```
879-
#[unstable(feature = "num_as_ne_bytes", issue = "76976")]
880-
#[inline]
881-
pub fn as_ne_bytes(&self) -> &[u8; 4] {
882-
// SAFETY: `f32` is a plain old datatype so we can always transmute to it
883-
unsafe { &*(self as *const Self as *const _) }
884-
}
885-
886857
/// Create a floating point value from its representation as a byte array in big endian.
887858
///
888859
/// # Examples

library/core/src/num/f64.rs

-29
Original file line numberDiff line numberDiff line change
@@ -868,35 +868,6 @@ impl f64 {
868868
self.to_bits().to_ne_bytes()
869869
}
870870

871-
/// Return the memory representation of this floating point number as a byte array in
872-
/// native byte order.
873-
///
874-
/// [`to_ne_bytes`] should be preferred over this whenever possible.
875-
///
876-
/// [`to_ne_bytes`]: f64::to_ne_bytes
877-
///
878-
/// # Examples
879-
///
880-
/// ```
881-
/// #![feature(num_as_ne_bytes)]
882-
/// let num = 12.5f64;
883-
/// let bytes = num.as_ne_bytes();
884-
/// assert_eq!(
885-
/// bytes,
886-
/// if cfg!(target_endian = "big") {
887-
/// &[0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
888-
/// } else {
889-
/// &[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
890-
/// }
891-
/// );
892-
/// ```
893-
#[unstable(feature = "num_as_ne_bytes", issue = "76976")]
894-
#[inline]
895-
pub fn as_ne_bytes(&self) -> &[u8; 8] {
896-
// SAFETY: `f64` is a plain old datatype so we can always transmute to it
897-
unsafe { &*(self as *const Self as *const _) }
898-
}
899-
900871
/// Create a floating point value from its representation as a byte array in big endian.
901872
///
902873
/// # Examples

library/core/src/num/int_macros.rs

-30
Original file line numberDiff line numberDiff line change
@@ -1842,36 +1842,6 @@ macro_rules! int_impl {
18421842
unsafe { mem::transmute(self) }
18431843
}
18441844

1845-
/// Return the memory representation of this integer as a byte array in
1846-
/// native byte order.
1847-
///
1848-
/// [`to_ne_bytes`] should be preferred over this whenever possible.
1849-
///
1850-
/// [`to_ne_bytes`]: Self::to_ne_bytes
1851-
///
1852-
/// # Examples
1853-
///
1854-
/// ```
1855-
/// #![feature(num_as_ne_bytes)]
1856-
#[doc = concat!("let num = ", $swap_op, stringify!($SelfT), ";")]
1857-
/// let bytes = num.as_ne_bytes();
1858-
/// assert_eq!(
1859-
/// bytes,
1860-
/// if cfg!(target_endian = "big") {
1861-
#[doc = concat!(" &", $be_bytes)]
1862-
/// } else {
1863-
#[doc = concat!(" &", $le_bytes)]
1864-
/// }
1865-
/// );
1866-
/// ```
1867-
#[unstable(feature = "num_as_ne_bytes", issue = "76976")]
1868-
#[inline]
1869-
pub fn as_ne_bytes(&self) -> &[u8; mem::size_of::<Self>()] {
1870-
// SAFETY: integers are plain old datatypes so we can always transmute them to
1871-
// arrays of bytes
1872-
unsafe { &*(self as *const Self as *const _) }
1873-
}
1874-
18751845
/// Create an integer value from its representation as a byte array in
18761846
/// big endian.
18771847
///

library/core/src/num/uint_macros.rs

-30
Original file line numberDiff line numberDiff line change
@@ -1672,36 +1672,6 @@ macro_rules! uint_impl {
16721672
unsafe { mem::transmute(self) }
16731673
}
16741674

1675-
/// Return the memory representation of this integer as a byte array in
1676-
/// native byte order.
1677-
///
1678-
/// [`to_ne_bytes`] should be preferred over this whenever possible.
1679-
///
1680-
/// [`to_ne_bytes`]: Self::to_ne_bytes
1681-
///
1682-
/// # Examples
1683-
///
1684-
/// ```
1685-
/// #![feature(num_as_ne_bytes)]
1686-
#[doc = concat!("let num = ", $swap_op, stringify!($SelfT), ";")]
1687-
/// let bytes = num.as_ne_bytes();
1688-
/// assert_eq!(
1689-
/// bytes,
1690-
/// if cfg!(target_endian = "big") {
1691-
#[doc = concat!(" &", $be_bytes)]
1692-
/// } else {
1693-
#[doc = concat!(" &", $le_bytes)]
1694-
/// }
1695-
/// );
1696-
/// ```
1697-
#[unstable(feature = "num_as_ne_bytes", issue = "76976")]
1698-
#[inline]
1699-
pub fn as_ne_bytes(&self) -> &[u8; mem::size_of::<Self>()] {
1700-
// SAFETY: integers are plain old datatypes so we can always transmute them to
1701-
// arrays of bytes
1702-
unsafe { &*(self as *const Self as *const _) }
1703-
}
1704-
17051675
/// Create a native endian integer value from its representation
17061676
/// as a byte array in big endian.
17071677
///

0 commit comments

Comments
 (0)