Skip to content

Commit 68a26ec

Browse files
committed
Stabilize the int_to_from_bytes feature
Fixes rust-lang#52963
1 parent 37961db commit 68a26ec

File tree

3 files changed

+14
-38
lines changed

3 files changed

+14
-38
lines changed

src/libcore/num/mod.rs

+12-36
Original file line numberDiff line numberDiff line change
@@ -1921,12 +1921,10 @@ big-endian (network) byte order.
19211921
# Examples
19221922
19231923
```
1924-
#![feature(int_to_from_bytes)]
1925-
19261924
let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes();
19271925
assert_eq!(bytes, ", $be_bytes, ");
19281926
```"),
1929-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
1927+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
19301928
#[rustc_const_unstable(feature = "const_int_conversion")]
19311929
#[inline]
19321930
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -1941,12 +1939,10 @@ little-endian byte order.
19411939
# Examples
19421940
19431941
```
1944-
#![feature(int_to_from_bytes)]
1945-
19461942
let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
19471943
assert_eq!(bytes, ", $le_bytes, ");
19481944
```"),
1949-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
1945+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
19501946
#[rustc_const_unstable(feature = "const_int_conversion")]
19511947
#[inline]
19521948
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -1969,16 +1965,14 @@ instead.
19691965
# Examples
19701966
19711967
```
1972-
#![feature(int_to_from_bytes)]
1973-
19741968
let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes();
19751969
assert_eq!(bytes, if cfg!(target_endian = \"big\") {
19761970
", $be_bytes, "
19771971
} else {
19781972
", $le_bytes, "
19791973
});
19801974
```"),
1981-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
1975+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
19821976
#[rustc_const_unstable(feature = "const_int_conversion")]
19831977
#[inline]
19841978
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -1993,12 +1987,10 @@ big endian.
19931987
# Examples
19941988
19951989
```
1996-
#![feature(int_to_from_bytes)]
1997-
19981990
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
19991991
assert_eq!(value, ", $swap_op, ");
20001992
```"),
2001-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
1993+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
20021994
#[rustc_const_unstable(feature = "const_int_conversion")]
20031995
#[inline]
20041996
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
@@ -2014,12 +2006,10 @@ little endian.
20142006
# Examples
20152007
20162008
```
2017-
#![feature(int_to_from_bytes)]
2018-
20192009
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
20202010
assert_eq!(value, ", $swap_op, ");
20212011
```"),
2022-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
2012+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
20232013
#[rustc_const_unstable(feature = "const_int_conversion")]
20242014
#[inline]
20252015
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
@@ -2041,16 +2031,14 @@ appropriate instead.
20412031
# Examples
20422032
20432033
```
2044-
#![feature(int_to_from_bytes)]
2045-
20462034
let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") {
20472035
", $be_bytes, "
20482036
} else {
20492037
", $le_bytes, "
20502038
});
20512039
assert_eq!(value, ", $swap_op, ");
20522040
```"),
2053-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
2041+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
20542042
#[rustc_const_unstable(feature = "const_int_conversion")]
20552043
#[inline]
20562044
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
@@ -3663,12 +3651,10 @@ big-endian (network) byte order.
36633651
# Examples
36643652
36653653
```
3666-
#![feature(int_to_from_bytes)]
3667-
36683654
let bytes = ", $swap_op, stringify!($SelfT), ".to_be_bytes();
36693655
assert_eq!(bytes, ", $be_bytes, ");
36703656
```"),
3671-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3657+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
36723658
#[rustc_const_unstable(feature = "const_int_conversion")]
36733659
#[inline]
36743660
pub const fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -3683,12 +3669,10 @@ little-endian byte order.
36833669
# Examples
36843670
36853671
```
3686-
#![feature(int_to_from_bytes)]
3687-
36883672
let bytes = ", $swap_op, stringify!($SelfT), ".to_le_bytes();
36893673
assert_eq!(bytes, ", $le_bytes, ");
36903674
```"),
3691-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3675+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
36923676
#[rustc_const_unstable(feature = "const_int_conversion")]
36933677
#[inline]
36943678
pub const fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -3711,16 +3695,14 @@ instead.
37113695
# Examples
37123696
37133697
```
3714-
#![feature(int_to_from_bytes)]
3715-
37163698
let bytes = ", $swap_op, stringify!($SelfT), ".to_ne_bytes();
37173699
assert_eq!(bytes, if cfg!(target_endian = \"big\") {
37183700
", $be_bytes, "
37193701
} else {
37203702
", $le_bytes, "
37213703
});
37223704
```"),
3723-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3705+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
37243706
#[rustc_const_unstable(feature = "const_int_conversion")]
37253707
#[inline]
37263708
pub const fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
@@ -3735,12 +3717,10 @@ big endian.
37353717
# Examples
37363718
37373719
```
3738-
#![feature(int_to_from_bytes)]
3739-
37403720
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
37413721
assert_eq!(value, ", $swap_op, ");
37423722
```"),
3743-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3723+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
37443724
#[rustc_const_unstable(feature = "const_int_conversion")]
37453725
#[inline]
37463726
pub const fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
@@ -3756,12 +3736,10 @@ little endian.
37563736
# Examples
37573737
37583738
```
3759-
#![feature(int_to_from_bytes)]
3760-
37613739
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
37623740
assert_eq!(value, ", $swap_op, ");
37633741
```"),
3764-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3742+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
37653743
#[rustc_const_unstable(feature = "const_int_conversion")]
37663744
#[inline]
37673745
pub const fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
@@ -3783,16 +3761,14 @@ appropriate instead.
37833761
# Examples
37843762
37853763
```
3786-
#![feature(int_to_from_bytes)]
3787-
37883764
let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"big\") {
37893765
", $be_bytes, "
37903766
} else {
37913767
", $le_bytes, "
37923768
});
37933769
assert_eq!(value, ", $swap_op, ");
37943770
```"),
3795-
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
3771+
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
37963772
#[rustc_const_unstable(feature = "const_int_conversion")]
37973773
#[inline]
37983774
pub const fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {

src/test/run-pass/const-int-conversion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(const_int_conversion, const_int_ops, reverse_bits, int_to_from_bytes)]
11+
#![feature(const_int_conversion, const_int_ops, reverse_bits)]
1212

1313
const REVERSE: u32 = 0x12345678_u32.reverse_bits();
1414
const FROM_BE_BYTES: i32 = i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]);

src/test/ui/consts/const-int-conversion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(reverse_bits, int_to_from_bytes)]
11+
#![feature(reverse_bits)]
1212

1313
fn main() {
1414
let x: &'static i32 = &(5_i32.reverse_bits());

0 commit comments

Comments
 (0)