Skip to content

Commit

Permalink
docs: correct panic conditions for rem_euclid and similar functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lolbinarycat committed Aug 23, 2024
1 parent 2168ce3 commit f3a198e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2826,8 +2826,8 @@ macro_rules! int_impl {
///
/// # Panics
///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
///
/// # Examples
///
Expand Down Expand Up @@ -2865,8 +2865,8 @@ macro_rules! int_impl {
///
/// # Panics
///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN` and
/// `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
///
/// # Examples
///
Expand All @@ -2881,6 +2881,11 @@ macro_rules! int_impl {
/// assert_eq!(a.rem_euclid(-b), 3);
/// assert_eq!((-a).rem_euclid(-b), 1);
/// ```
///
/// This will panic:
/// ```should_panic
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.rem_euclid(-1);")]
/// ```
#[doc(alias = "modulo", alias = "mod")]
#[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")]
Expand Down Expand Up @@ -2909,8 +2914,8 @@ macro_rules! int_impl {
///
/// # Panics
///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
///
/// # Examples
///
Expand Down Expand Up @@ -2945,8 +2950,8 @@ macro_rules! int_impl {
///
/// # Panics
///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
///
/// # Examples
///
Expand Down

0 comments on commit f3a198e

Please sign in to comment.