Skip to content
/ rust Public
forked from rust-lang/rust

Commit

Permalink
Rollup merge of rust-lang#137026 - GrigorenkoPV:integer_sign_cast, r=…
Browse files Browse the repository at this point in the history
…Noratrieb

Stabilize (and const-stabilize) `integer_sign_cast`

Tracking issue: rust-lang#125882
Closes: rust-lang#125882
FCP completed: rust-lang#125882 (comment)
  • Loading branch information
jhpratt authored Feb 14, 2025
2 parents ecca7da + e8a4f9d commit 3cbe03f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ macro_rules! int_impl {
/// Basic usage:
///
/// ```
/// #![feature(integer_sign_cast)]
///
#[doc = concat!("let n = -1", stringify!($SelfT), ";")]
///
#[doc = concat!("assert_eq!(n.cast_unsigned(), ", stringify!($UnsignedT), "::MAX);")]
/// ```
#[unstable(feature = "integer_sign_cast", issue = "125882")]
#[stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1633,14 +1633,14 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
/// Basic usage:
///
/// ```
/// #![feature(integer_sign_cast)]
/// # use std::num::NonZero;
///
#[doc = concat!("let n = NonZero::<", stringify!($Int), ">::MAX;")]
///
#[doc = concat!("assert_eq!(n.cast_signed(), NonZero::new(-1", stringify!($Sint), ").unwrap());")]
/// ```
#[unstable(feature = "integer_sign_cast", issue = "125882")]
#[stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
Expand Down Expand Up @@ -2072,14 +2072,14 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
/// Basic usage:
///
/// ```
/// #![feature(integer_sign_cast)]
/// # use std::num::NonZero;
///
#[doc = concat!("let n = NonZero::new(-1", stringify!($Int), ").unwrap();")]
///
#[doc = concat!("assert_eq!(n.cast_unsigned(), NonZero::<", stringify!($Uint), ">::MAX);")]
/// ```
#[unstable(feature = "integer_sign_cast", issue = "125882")]
#[stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
Expand Down
5 changes: 2 additions & 3 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,12 @@ macro_rules! uint_impl {
/// Basic usage:
///
/// ```
/// #![feature(integer_sign_cast)]
///
#[doc = concat!("let n = ", stringify!($SelfT), "::MAX;")]
///
#[doc = concat!("assert_eq!(n.cast_signed(), -1", stringify!($SignedT), ");")]
/// ```
#[unstable(feature = "integer_sign_cast", issue = "125882")]
#[stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "integer_sign_cast", since = "CURRENT_RUSTC_VERSION")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
Expand Down

0 comments on commit 3cbe03f

Please sign in to comment.