Skip to content

Commit 56ca2e2

Browse files
authored
Rollup merge of #129480 - lolbinarycat:euclid-docs, r=joboet
docs: correct panic conditions for rem_euclid and similar functions fixes #128857 also fixes the documentation for functions behind the `int_roundings` feature (#88581)
2 parents 99453ce + d7e7886 commit 56ca2e2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

library/core/src/num/int_macros.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -2888,8 +2888,8 @@ macro_rules! int_impl {
28882888
///
28892889
/// # Panics
28902890
///
2891-
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
2892-
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
2891+
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
2892+
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
28932893
///
28942894
/// # Examples
28952895
///
@@ -2927,8 +2927,8 @@ macro_rules! int_impl {
29272927
///
29282928
/// # Panics
29292929
///
2930-
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
2931-
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
2930+
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN` and
2931+
/// `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
29322932
///
29332933
/// # Examples
29342934
///
@@ -2943,6 +2943,11 @@ macro_rules! int_impl {
29432943
/// assert_eq!(a.rem_euclid(-b), 3);
29442944
/// assert_eq!((-a).rem_euclid(-b), 1);
29452945
/// ```
2946+
///
2947+
/// This will panic:
2948+
/// ```should_panic
2949+
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.rem_euclid(-1);")]
2950+
/// ```
29462951
#[doc(alias = "modulo", alias = "mod")]
29472952
#[stable(feature = "euclidean_division", since = "1.38.0")]
29482953
#[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")]
@@ -2971,8 +2976,8 @@ macro_rules! int_impl {
29712976
///
29722977
/// # Panics
29732978
///
2974-
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
2975-
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
2979+
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
2980+
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
29762981
///
29772982
/// # Examples
29782983
///
@@ -3007,8 +3012,8 @@ macro_rules! int_impl {
30073012
///
30083013
/// # Panics
30093014
///
3010-
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is
3011-
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag.
3015+
/// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
3016+
/// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
30123017
///
30133018
/// # Examples
30143019
///

0 commit comments

Comments
 (0)