add safety sections to two unsafe methods in NonZero

This commit is contained in:
aisr
2026-04-20 22:46:10 +08:00
parent d12e1e12ae
commit 0bfdb18855
+8 -2
View File
@@ -1118,7 +1118,10 @@ pub const fn saturating_mul(self, other: Self) -> Self {
/// assuming overflow cannot occur.
/// Overflow is unchecked, and it is undefined behavior to overflow
/// *even if the result would wrap to a non-zero value*.
/// The behavior is undefined as soon as
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = sign_dependent_expr!{
$signedness ?
if signed {
@@ -1695,7 +1698,10 @@ pub const fn saturating_add(self, other: $Int) -> Self {
/// assuming overflow cannot occur.
/// Overflow is unchecked, and it is undefined behavior to overflow
/// *even if the result would wrap to a non-zero value*.
/// The behavior is undefined as soon as
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self + rhs > ", stringify!($Int), "::MAX`.")]
///
/// # Examples