summaryrefslogtreecommitdiffstats
path: root/library/core/src/num/nonzero.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /library/core/src/num/nonzero.rs
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/core/src/num/nonzero.rs')
-rw-r--r--library/core/src/num/nonzero.rs23
1 files changed, 11 insertions, 12 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index fbda8f82b..49d23abee 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -34,6 +34,13 @@ macro_rules! nonzero_integers {
/// use std::mem::size_of;
#[doc = concat!("assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", stringify!($Int), ">());")]
/// ```
+ ///
+ /// # Layout
+ ///
+ #[doc = concat!("`", stringify!($Ty), "` is guaranteed to have the same layout and bit validity as `", stringify!($Int), "`")]
+ /// with the exception that `0` is not a valid instance.
+ #[doc = concat!("`Option<", stringify!($Ty), ">` is guaranteed to be compatible with `", stringify!($Int), "`,")]
+ /// including in FFI.
#[$stability]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(transparent)]
@@ -1147,12 +1154,10 @@ macro_rules! nonzero_min_max_unsigned {
/// # Examples
///
/// ```
- /// #![feature(nonzero_min_max)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
#[doc = concat!("assert_eq!(", stringify!($Ty), "::MIN.get(), 1", stringify!($Int), ");")]
/// ```
- #[unstable(feature = "nonzero_min_max", issue = "89065")]
+ #[stable(feature = "nonzero_min_max", since = "1.70.0")]
pub const MIN: Self = Self::new(1).unwrap();
/// The largest value that can be represented by this non-zero
@@ -1162,12 +1167,10 @@ macro_rules! nonzero_min_max_unsigned {
/// # Examples
///
/// ```
- /// #![feature(nonzero_min_max)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
#[doc = concat!("assert_eq!(", stringify!($Ty), "::MAX.get(), ", stringify!($Int), "::MAX);")]
/// ```
- #[unstable(feature = "nonzero_min_max", issue = "89065")]
+ #[stable(feature = "nonzero_min_max", since = "1.70.0")]
pub const MAX: Self = Self::new(<$Int>::MAX).unwrap();
}
)+
@@ -1189,12 +1192,10 @@ macro_rules! nonzero_min_max_signed {
/// # Examples
///
/// ```
- /// #![feature(nonzero_min_max)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
#[doc = concat!("assert_eq!(", stringify!($Ty), "::MIN.get(), ", stringify!($Int), "::MIN);")]
/// ```
- #[unstable(feature = "nonzero_min_max", issue = "89065")]
+ #[stable(feature = "nonzero_min_max", since = "1.70.0")]
pub const MIN: Self = Self::new(<$Int>::MIN).unwrap();
/// The largest value that can be represented by this non-zero
@@ -1208,12 +1209,10 @@ macro_rules! nonzero_min_max_signed {
/// # Examples
///
/// ```
- /// #![feature(nonzero_min_max)]
- ///
#[doc = concat!("# use std::num::", stringify!($Ty), ";")]
#[doc = concat!("assert_eq!(", stringify!($Ty), "::MAX.get(), ", stringify!($Int), "::MAX);")]
/// ```
- #[unstable(feature = "nonzero_min_max", issue = "89065")]
+ #[stable(feature = "nonzero_min_max", since = "1.70.0")]
pub const MAX: Self = Self::new(<$Int>::MAX).unwrap();
}
)+