]> git.lizzy.rs Git - rust.git/commitdiff
Stabilize float_to_from_bytes feature
authorLzu Tao <taolzu@gmail.com>
Thu, 31 Oct 2019 16:13:28 +0000 (16:13 +0000)
committerLzu Tao <taolzu@gmail.com>
Thu, 31 Oct 2019 16:13:28 +0000 (16:13 +0000)
src/libcore/num/f32.rs
src/libcore/num/f64.rs

index 22e7573eca65b28c5693df365dc17af90fa5ed32..5730088c4d9a95a9f21f48609074c677138385f6 100644 (file)
@@ -466,11 +466,10 @@ pub fn from_bits(v: u32) -> Self {
     /// # 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 @@ pub fn from_bits(v: u32) -> Self {
     /// # 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 @@ pub fn from_bits(v: u32) -> Self {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_to_from_bytes)]
     /// let bytes = 12.5f32.to_ne_bytes();
     /// assert_eq!(
     ///     bytes,
@@ -515,7 +512,7 @@ pub fn from_bits(v: u32) -> Self {
     ///     }
     /// );
     /// ```
-    #[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 @@ pub fn from_bits(v: u32) -> Self {
     /// # 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 @@ pub fn from_bits(v: u32) -> Self {
     /// # 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 @@ pub fn from_bits(v: u32) -> Self {
     /// # 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 @@ pub fn from_bits(v: u32) -> Self {
     /// });
     /// 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))
index bbe1d040780602df44831bab76ff835a01da7898..2bdeda340dce01c19d7d60c2aaa08c1c5a6baaea 100644 (file)
@@ -479,11 +479,10 @@ pub fn from_bits(v: u64) -> Self {
     /// # 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 @@ pub fn from_bits(v: u64) -> Self {
     /// # 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 @@ pub fn from_bits(v: u64) -> Self {
     /// # Examples
     ///
     /// ```
-    /// #![feature(float_to_from_bytes)]
     /// let bytes = 12.5f64.to_ne_bytes();
     /// assert_eq!(
     ///     bytes,
@@ -528,7 +525,7 @@ pub fn from_bits(v: u64) -> Self {
     ///     }
     /// );
     /// ```
-    #[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 @@ pub fn from_bits(v: u64) -> Self {
     /// # 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 @@ pub fn from_bits(v: u64) -> Self {
     /// # 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 @@ pub fn from_bits(v: u64) -> Self {
     /// # 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 @@ pub fn from_bits(v: u64) -> Self {
     /// });
     /// 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))