Skip to content
Merged
Show file tree
Hide file tree
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
15 changes: 6 additions & 9 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,8 @@ macro_rules! int_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self + rhs > ", stringify!($SelfT), "::MAX` or `self + rhs < ", stringify!($SelfT), "::MIN`,")]
/// i.e. when [`checked_add`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_add`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_add`]: ", stringify!($SelfT), "::checked_add")]
Expand Down Expand Up @@ -778,9 +777,8 @@ macro_rules! int_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self - rhs > ", stringify!($SelfT), "::MAX` or `self - rhs < ", stringify!($SelfT), "::MIN`,")]
/// i.e. when [`checked_sub`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_sub`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_sub`]: ", stringify!($SelfT), "::checked_sub")]
Expand Down Expand Up @@ -918,9 +916,8 @@ macro_rules! int_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self * rhs > ", stringify!($SelfT), "::MAX` or `self * rhs < ", stringify!($SelfT), "::MIN`,")]
/// i.e. when [`checked_mul`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_mul`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_mul`]: ", stringify!($SelfT), "::checked_mul")]
Expand Down
21 changes: 8 additions & 13 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,17 +1274,8 @@ macro_rules! nonzero_integer {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = sign_dependent_expr!{
$signedness ?
if signed {
concat!("`self * rhs > ", stringify!($Int), "::MAX`, ",
"or `self * rhs < ", stringify!($Int), "::MIN`.")
}
if unsigned {
concat!("`self * rhs > ", stringify!($Int), "::MAX`.")
}
}]
/// This results in undefined behavior when overflow occurs, i.e.
/// when [`checked_mul`] would return `None`.
///
/// # Examples
///
Expand All @@ -1302,6 +1293,8 @@ macro_rules! nonzero_integer {
/// # Some(())
/// # }
/// ```
///
/// [`checked_mul`]: Self::checked_mul
#[unstable(feature = "nonzero_ops", issue = "84186")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
Expand Down Expand Up @@ -1871,8 +1864,8 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self + rhs > ", stringify!($Int), "::MAX`.")]
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_add`] would return `None`.
///
/// # Examples
///
Expand All @@ -1890,6 +1883,8 @@ macro_rules! nonzero_integer_signedness_dependent_methods {
/// # Some(())
/// # }
/// ```
///
/// [`checked_add`]: Self::checked_add
#[unstable(feature = "nonzero_ops", issue = "84186")]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
Expand Down
15 changes: 6 additions & 9 deletions library/core/src/num/uint_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,9 +1009,8 @@ macro_rules! uint_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self + rhs > ", stringify!($SelfT), "::MAX`,")]
/// i.e. when [`checked_add`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_add`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_add`]: ", stringify!($SelfT), "::checked_add")]
Expand Down Expand Up @@ -1188,9 +1187,8 @@ macro_rules! uint_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self - rhs < ", stringify!($SelfT), "::MIN`,")]
/// i.e. when [`checked_sub`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_sub`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_sub`]: ", stringify!($SelfT), "::checked_sub")]
Expand Down Expand Up @@ -1397,9 +1395,8 @@ macro_rules! uint_impl {
///
/// # Safety
///
/// This results in undefined behavior when
#[doc = concat!("`self * rhs > ", stringify!($SelfT), "::MAX`,")]
/// i.e. when [`checked_mul`] would return `None`.
/// This results in undefined behavior when overflow occurs, i.e. when
/// [`checked_mul`] would return `None`.
///
/// [`unwrap_unchecked`]: option/enum.Option.html#method.unwrap_unchecked
#[doc = concat!("[`checked_mul`]: ", stringify!($SelfT), "::checked_mul")]
Expand Down
Loading