diff options
| author | bors <bors@rust-lang.org> | 2018-06-27 09:21:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-27 09:21:34 +0000 |
| commit | c20824323cf7ed6ad95cb8d7b780a7934927a753 (patch) | |
| tree | 28b97ee0c9f2f8ff3ebf6fb05830adb748acc8dd | |
| parent | 971f7d34d4e8afa663b3972b58528a069a25b436 (diff) | |
| parent | c8f9b84b393915a48253e3edc862c15a9b7152a7 (diff) | |
| download | rust-c20824323cf7ed6ad95cb8d7b780a7934927a753.tar.gz rust-c20824323cf7ed6ad95cb8d7b780a7934927a753.zip | |
Auto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett
Stabilize to_bytes and from_bytes for integers. Fixes #49792
| -rw-r--r-- | src/libcore/num/mod.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 1168126c47c..7e2dd304d7f 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1996,12 +1996,10 @@ $EndFeature, " /// # Examples /// /// ``` - /// #![feature(int_to_from_bytes)] - /// /// let bytes = i32::min_value().to_be().to_bytes(); /// assert_eq!(bytes, [0x80, 0, 0, 0]); /// ``` - #[unstable(feature = "int_to_from_bytes", issue = "49792")] + #[stable(feature = "int_to_from_bytes", since = "1.29.0")] #[inline] pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] { unsafe { mem::transmute(self) } @@ -2018,12 +2016,10 @@ $EndFeature, " /// # Examples /// /// ``` - /// #![feature(int_to_from_bytes)] - /// /// let int = i32::from_be(i32::from_bytes([0x80, 0, 0, 0])); /// assert_eq!(int, i32::min_value()); /// ``` - #[unstable(feature = "int_to_from_bytes", issue = "49792")] + #[stable(feature = "int_to_from_bytes", since = "1.29.0")] #[inline] pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { unsafe { mem::transmute(bytes) } @@ -3702,12 +3698,10 @@ $EndFeature, " /// # Examples /// /// ``` - /// #![feature(int_to_from_bytes)] - /// /// let bytes = 0x1234_5678_u32.to_be().to_bytes(); /// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]); /// ``` - #[unstable(feature = "int_to_from_bytes", issue = "49792")] + #[stable(feature = "int_to_from_bytes", since = "1.29.0")] #[inline] pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] { unsafe { mem::transmute(self) } @@ -3724,12 +3718,10 @@ $EndFeature, " /// # Examples /// /// ``` - /// #![feature(int_to_from_bytes)] - /// /// let int = u32::from_be(u32::from_bytes([0x12, 0x34, 0x56, 0x78])); /// assert_eq!(int, 0x1234_5678_u32); /// ``` - #[unstable(feature = "int_to_from_bytes", issue = "49792")] + #[stable(feature = "int_to_from_bytes", since = "1.29.0")] #[inline] pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self { unsafe { mem::transmute(bytes) } |
