mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
add safety sections to two unsafe methods in NonZero
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user