Skip to content

Commit 1b5c239

Browse files
Stabilize int_format_into feature
1 parent b954122 commit 1b5c239

4 files changed

Lines changed: 18 additions & 22 deletions

File tree

library/alloctests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![feature(downcast_unchecked)]
99
#![feature(exact_size_is_empty)]
1010
#![feature(hashmap_internals)]
11-
#![feature(int_format_into)]
1211
#![feature(linked_list_cursors)]
1312
#![feature(map_try_insert)]
1413
#![feature(pattern)]

library/core/src/fmt/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ pub enum Alignment {
3636
Center,
3737
}
3838

39-
#[unstable(feature = "int_format_into", issue = "138215")]
40-
pub use num_buffer::{NumBuffer, NumBufferTrait};
39+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
40+
pub use num_buffer::NumBuffer;
41+
#[unstable(feature = "fmt_internals", issue = "none")]
42+
pub use num_buffer::NumBufferTrait;
4143

4244
#[stable(feature = "debug_builders", since = "1.2.0")]
4345
pub use self::builders::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};

library/core/src/fmt/num.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ macro_rules! impl_Display {
260260
/// # Examples
261261
///
262262
/// ```
263-
/// #![feature(int_format_into)]
264263
/// use core::fmt::NumBuffer;
265264
///
266265
#[doc = concat!("let n = 0", stringify!($Signed), ";")]
@@ -273,7 +272,7 @@ macro_rules! impl_Display {
273272
#[doc = concat!("let n2 = ", stringify!($Signed::MAX), ";")]
274273
#[doc = concat!("assert_eq!(n2.format_into(&mut buf), ", stringify!($Signed::MAX), ".to_string());")]
275274
/// ```
276-
#[unstable(feature = "int_format_into", issue = "138215")]
275+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
277276
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
278277
let mut offset;
279278

@@ -305,7 +304,6 @@ macro_rules! impl_Display {
305304
/// # Examples
306305
///
307306
/// ```
308-
/// #![feature(int_format_into)]
309307
/// use core::fmt::NumBuffer;
310308
///
311309
#[doc = concat!("let n = 0", stringify!($Unsigned), ";")]
@@ -318,7 +316,7 @@ macro_rules! impl_Display {
318316
#[doc = concat!("let n2 = ", stringify!($Unsigned::MAX), ";")]
319317
#[doc = concat!("assert_eq!(n2.format_into(&mut buf), ", stringify!($Unsigned::MAX), ".to_string());")]
320318
/// ```
321-
#[unstable(feature = "int_format_into", issue = "138215")]
319+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
322320
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
323321
let offset;
324322

@@ -744,7 +742,6 @@ impl u128 {
744742
/// # Examples
745743
///
746744
/// ```
747-
/// #![feature(int_format_into)]
748745
/// use core::fmt::NumBuffer;
749746
///
750747
/// let n = 0u128;
@@ -759,7 +756,7 @@ impl u128 {
759756
/// let mut buf2 = NumBuffer::new();
760757
/// assert_eq!(n2.format_into(&mut buf2), u128::MAX.to_string());
761758
/// ```
762-
#[unstable(feature = "int_format_into", issue = "138215")]
759+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
763760
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
764761
let diff = buf.capacity() - U128_MAX_DEC_N;
765762
// FIXME: Once const generics are better, use `NumberBufferTrait::BUF_SIZE` as generic const
@@ -779,7 +776,6 @@ impl i128 {
779776
/// # Examples
780777
///
781778
/// ```
782-
/// #![feature(int_format_into)]
783779
/// use core::fmt::NumBuffer;
784780
///
785781
/// let n = 0i128;
@@ -792,7 +788,7 @@ impl i128 {
792788
/// let n2 = i128::MAX;
793789
/// assert_eq!(n2.format_into(&mut buf), i128::MAX.to_string());
794790
/// ```
795-
#[unstable(feature = "int_format_into", issue = "138215")]
791+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
796792
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
797793
let diff = buf.capacity() - U128_MAX_DEC_N;
798794
// FIXME: Once const generics are better, use `NumberBufferTrait::BUF_SIZE` as generic const

library/core/src/fmt/num_buffer.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
use crate::mem::MaybeUninit;
22

33
/// Trait used to describe the maximum number of digits in decimal base of the implemented integer.
4-
#[unstable(feature = "int_format_into", issue = "138215")]
4+
#[unstable(feature = "fmt_internals", issue = "none")]
55
pub trait NumBufferTrait {
66
/// Maximum number of digits in decimal base of the implemented integer.
7+
#[unstable(feature = "fmt_internals", issue = "none")]
78
const BUF_SIZE: usize;
89
}
910

1011
macro_rules! impl_NumBufferTrait {
1112
($($signed:ident, $unsigned:ident,)*) => {
1213
$(
13-
#[unstable(feature = "int_format_into", issue = "138215")]
14+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
1415
impl NumBufferTrait for $signed {
1516
// `+ 2` and not `+ 1` to include the `-` character.
1617
const BUF_SIZE: usize = $signed::MAX.ilog(10) as usize + 2;
1718
}
18-
#[unstable(feature = "int_format_into", issue = "138215")]
19+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
1920
impl NumBufferTrait for $unsigned {
2021
const BUF_SIZE: usize = $unsigned::MAX.ilog(10) as usize + 1;
2122
}
@@ -38,7 +39,6 @@ impl_NumBufferTrait! {
3839
/// # Examples
3940
///
4041
/// ```
41-
/// #![feature(int_format_into)]
4242
/// use core::fmt::NumBuffer;
4343
///
4444
/// let mut buf = NumBuffer::new();
@@ -50,33 +50,32 @@ impl_NumBufferTrait! {
5050
/// let n2 = -1972i32;
5151
/// assert_eq!(n2.format_into(&mut buf), "-1972");
5252
/// ```
53-
#[unstable(feature = "int_format_into", issue = "138215")]
53+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
5454
pub struct NumBuffer<T: NumBufferTrait> {
5555
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
5656
pub(crate) buf: [MaybeUninit<u8>; 40],
5757
// FIXME: Remove this field once we can actually use `T`.
5858
phantom: core::marker::PhantomData<T>,
5959
}
6060

61-
#[unstable(feature = "int_format_into", issue = "138215")]
61+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
6262
impl<T: NumBufferTrait> core::fmt::Debug for NumBuffer<T> {
6363
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
6464
f.debug_struct("NumBuffer").finish()
6565
}
6666
}
6767

68-
#[unstable(feature = "int_format_into", issue = "138215")]
68+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
6969
impl<T: NumBufferTrait> NumBuffer<T> {
7070
/// Initializes internal buffer.
71-
#[unstable(feature = "int_format_into", issue = "138215")]
71+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
72+
#[rustc_const_stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
7273
pub const fn new() -> Self {
7374
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
7475
NumBuffer { buf: [MaybeUninit::<u8>::uninit(); 40], phantom: core::marker::PhantomData }
7576
}
7677

77-
/// Returns the length of the internal buffer.
78-
#[unstable(feature = "int_format_into", issue = "138215")]
79-
pub const fn capacity(&self) -> usize {
78+
pub(crate) const fn capacity(&self) -> usize {
8079
self.buf.len()
8180
}
8281
}

0 commit comments

Comments
 (0)