Skip to content

Commit

Permalink
Rollup merge of rust-lang#129480 - lolbinarycat:euclid-docs, r=joboet
Browse files Browse the repository at this point in the history
docs: correct panic conditions for rem_euclid and similar functions

fixes rust-lang#128857

also fixes the documentation for functions behind the `int_roundings` feature (rust-lang#88581)
  • Loading branch information
matthiaskrgr authored Aug 28, 2024
2 parents a0ea69f + f3a198e commit b0fee98
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 @@ -2888,8 +2888,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 @@ -2927,8 +2927,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 @@ -2943,6 +2943,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 @@ -2971,8 +2976,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 @@ -3007,8 +3012,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 b0fee98

Please sign in to comment.