Skip to content

Stabilize feature nonzero_negation_ops #111044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -734,7 +732,8 @@ macro_rules! nonzero_signed_operations {
/// ```
#[must_use]
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn is_positive(self) -> bool {
self.get().is_positive()
}
Expand All @@ -745,8 +744,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -760,7 +757,8 @@ macro_rules! nonzero_signed_operations {
/// ```
#[must_use]
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn is_negative(self) -> bool {
self.get().is_negative()
}
Expand All @@ -770,8 +768,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -786,7 +782,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn checked_neg(self) -> Option<$Ty> {
if let Some(result) = self.get().checked_neg() {
// SAFETY: negation of nonzero cannot yield zero values.
Expand All @@ -803,8 +800,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -819,7 +814,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn overflowing_neg(self) -> ($Ty, bool) {
let (result, overflow) = self.get().overflowing_neg();
// SAFETY: negation of nonzero cannot yield zero values.
Expand All @@ -832,8 +828,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -853,7 +847,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn saturating_neg(self) -> $Ty {
if let Some(result) = self.checked_neg() {
return result;
Expand All @@ -870,8 +865,6 @@ macro_rules! nonzero_signed_operations {
/// # Example
///
/// ```
/// #![feature(nonzero_negation_ops)]
///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
/// # fn main() { test().unwrap(); }
/// # fn test() -> Option<()> {
Expand All @@ -886,7 +879,8 @@ macro_rules! nonzero_signed_operations {
/// # }
/// ```
#[inline]
#[unstable(feature = "nonzero_negation_ops", issue = "102443")]
#[stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "nonzero_negation_ops", since = "CURRENT_RUSTC_VERSION")]
pub const fn wrapping_neg(self) -> $Ty {
let result = self.get().wrapping_neg();
// SAFETY: negation of nonzero cannot yield zero values.
Expand Down