diff options
| author | Lzu Tao <taolzu@gmail.com> | 2019-10-31 16:13:28 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2019-10-31 16:13:28 +0000 |
| commit | 7b72c2831c6a50a9e07a3d94ebef5d9f29bfd51e (patch) | |
| tree | 4e04d8f2e512de5618c884b115e1b7a3e5886603 /src/libcore | |
| parent | 92df638162b7ccea6f97a8e1287ed05c5c0818b4 (diff) | |
| download | rust-7b72c2831c6a50a9e07a3d94ebef5d9f29bfd51e.tar.gz rust-7b72c2831c6a50a9e07a3d94ebef5d9f29bfd51e.zip | |
Stabilize float_to_from_bytes feature
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/num/f32.rs | 18 | ||||
| -rw-r--r-- | src/libcore/num/f64.rs | 18 |
2 files changed, 12 insertions, 24 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 22e7573eca6..5730088c4d9 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -466,11 +466,10 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f32.to_be_bytes(); /// assert_eq!(bytes, [0x41, 0x48, 0x00, 0x00]); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_be_bytes(self) -> [u8; 4] { self.to_bits().to_be_bytes() @@ -482,11 +481,10 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f32.to_le_bytes(); /// assert_eq!(bytes, [0x00, 0x00, 0x48, 0x41]); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_le_bytes(self) -> [u8; 4] { self.to_bits().to_le_bytes() @@ -504,7 +502,6 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f32.to_ne_bytes(); /// assert_eq!( /// bytes, @@ -515,7 +512,7 @@ impl f32 { /// } /// ); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_ne_bytes(self) -> [u8; 4] { self.to_bits().to_ne_bytes() @@ -526,11 +523,10 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f32::from_be_bytes([0x41, 0x48, 0x00, 0x00]); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_be_bytes(bytes: [u8; 4]) -> Self { Self::from_bits(u32::from_be_bytes(bytes)) @@ -541,11 +537,10 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f32::from_le_bytes([0x00, 0x00, 0x48, 0x41]); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_le_bytes(bytes: [u8; 4]) -> Self { Self::from_bits(u32::from_le_bytes(bytes)) @@ -563,7 +558,6 @@ impl f32 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f32::from_ne_bytes(if cfg!(target_endian = "big") { /// [0x41, 0x48, 0x00, 0x00] /// } else { @@ -571,7 +565,7 @@ impl f32 { /// }); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_ne_bytes(bytes: [u8; 4]) -> Self { Self::from_bits(u32::from_ne_bytes(bytes)) diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index bbe1d040780..2bdeda340dc 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -479,11 +479,10 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f64.to_be_bytes(); /// assert_eq!(bytes, [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_be_bytes(self) -> [u8; 8] { self.to_bits().to_be_bytes() @@ -495,11 +494,10 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f64.to_le_bytes(); /// assert_eq!(bytes, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_le_bytes(self) -> [u8; 8] { self.to_bits().to_le_bytes() @@ -517,7 +515,6 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let bytes = 12.5f64.to_ne_bytes(); /// assert_eq!( /// bytes, @@ -528,7 +525,7 @@ impl f64 { /// } /// ); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn to_ne_bytes(self) -> [u8; 8] { self.to_bits().to_ne_bytes() @@ -539,11 +536,10 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f64::from_be_bytes([0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_be_bytes(bytes: [u8; 8]) -> Self { Self::from_bits(u64::from_be_bytes(bytes)) @@ -554,11 +550,10 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f64::from_le_bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_le_bytes(bytes: [u8; 8]) -> Self { Self::from_bits(u64::from_le_bytes(bytes)) @@ -576,7 +571,6 @@ impl f64 { /// # Examples /// /// ``` - /// #![feature(float_to_from_bytes)] /// let value = f64::from_ne_bytes(if cfg!(target_endian = "big") { /// [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00] /// } else { @@ -584,7 +578,7 @@ impl f64 { /// }); /// assert_eq!(value, 12.5); /// ``` - #[unstable(feature = "float_to_from_bytes", issue = "60446")] + #[stable(feature = "float_to_from_bytes", since = "1.40.0")] #[inline] pub fn from_ne_bytes(bytes: [u8; 8]) -> Self { Self::from_bits(u64::from_ne_bytes(bytes)) |
