Skip to content

Commit 84973ef

Browse files
Stabilize int_format_into feature
1 parent 7ad4e69 commit 84973ef

3 files changed

Lines changed: 12 additions & 16 deletions

File tree

library/core/src/fmt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum Alignment {
3636
Center,
3737
}
3838

39-
#[unstable(feature = "int_format_into", issue = "138215")]
39+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
4040
pub use num_buffer::{NumBuffer, NumBufferTrait};
4141

4242
#[stable(feature = "debug_builders", since = "1.2.0")]

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

@@ -742,7 +740,6 @@ impl u128 {
742740
/// # Examples
743741
///
744742
/// ```
745-
/// #![feature(int_format_into)]
746743
/// use core::fmt::NumBuffer;
747744
///
748745
/// let n = 0u128;
@@ -757,7 +754,7 @@ impl u128 {
757754
/// let mut buf2 = NumBuffer::new();
758755
/// assert_eq!(n2.format_into(&mut buf2), u128::MAX.to_string());
759756
/// ```
760-
#[unstable(feature = "int_format_into", issue = "138215")]
757+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
761758
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
762759
let diff = buf.capacity() - U128_MAX_DEC_N;
763760
// FIXME: Once const generics are better, use `NumberBufferTrait::BUF_SIZE` as generic const
@@ -777,7 +774,6 @@ impl i128 {
777774
/// # Examples
778775
///
779776
/// ```
780-
/// #![feature(int_format_into)]
781777
/// use core::fmt::NumBuffer;
782778
///
783779
/// let n = 0i128;
@@ -790,7 +786,7 @@ impl i128 {
790786
/// let n2 = i128::MAX;
791787
/// assert_eq!(n2.format_into(&mut buf), i128::MAX.to_string());
792788
/// ```
793-
#[unstable(feature = "int_format_into", issue = "138215")]
789+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
794790
pub fn format_into(self, buf: &mut NumBuffer<Self>) -> &str {
795791
let diff = buf.capacity() - U128_MAX_DEC_N;
796792
// FIXME: Once const generics are better, use `NumberBufferTrait::BUF_SIZE` as generic const

library/core/src/fmt/num_buffer.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
55
pub trait NumBufferTrait {
66
/// Maximum number of digits in decimal base of the implemented integer.
77
const BUF_SIZE: usize;
@@ -10,12 +10,12 @@ pub trait NumBufferTrait {
1010
macro_rules! impl_NumBufferTrait {
1111
($($signed:ident, $unsigned:ident,)*) => {
1212
$(
13-
#[unstable(feature = "int_format_into", issue = "138215")]
13+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
1414
impl NumBufferTrait for $signed {
1515
// `+ 2` and not `+ 1` to include the `-` character.
1616
const BUF_SIZE: usize = $signed::MAX.ilog(10) as usize + 2;
1717
}
18-
#[unstable(feature = "int_format_into", issue = "138215")]
18+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
1919
impl NumBufferTrait for $unsigned {
2020
const BUF_SIZE: usize = $unsigned::MAX.ilog(10) as usize + 1;
2121
}
@@ -34,7 +34,7 @@ impl_NumBufferTrait! {
3434

3535
/// A buffer wrapper of which the internal size is based on the maximum
3636
/// number of digits the associated integer can have.
37-
#[unstable(feature = "int_format_into", issue = "138215")]
37+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
3838
#[derive(Debug)]
3939
pub struct NumBuffer<T: NumBufferTrait> {
4040
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
@@ -43,17 +43,17 @@ pub struct NumBuffer<T: NumBufferTrait> {
4343
phantom: core::marker::PhantomData<T>,
4444
}
4545

46-
#[unstable(feature = "int_format_into", issue = "138215")]
46+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
4747
impl<T: NumBufferTrait> NumBuffer<T> {
4848
/// Initializes internal buffer.
49-
#[unstable(feature = "int_format_into", issue = "138215")]
49+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
5050
pub const fn new() -> Self {
5151
// FIXME: Once const generics feature is working, use `T::BUF_SIZE` instead of 40.
5252
NumBuffer { buf: [MaybeUninit::<u8>::uninit(); 40], phantom: core::marker::PhantomData }
5353
}
5454

5555
/// Returns the length of the internal buffer.
56-
#[unstable(feature = "int_format_into", issue = "138215")]
56+
#[stable(feature = "int_format_into", since = "CURRENT_RUSTC_VERSION")]
5757
pub const fn capacity(&self) -> usize {
5858
self.buf.len()
5959
}

0 commit comments

Comments
 (0)