Rollup merge of #129480 - lolbinarycat:euclid-docs, r=joboet

docs: correct panic conditions for rem_euclid and similar functions

fixes https://github.com/rust-lang/rust/issues/128857

also fixes the documentation for functions behind the `int_roundings` feature (#88581)
This commit is contained in:
Matthias Krüger 2024-08-28 17:12:12 +02:00 committed by GitHub
commit 56ca2e23fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2888,8 +2888,8 @@ macro_rules! int_impl {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is /// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag. /// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
/// ///
/// # Examples /// # Examples
/// ///
@ -2927,8 +2927,8 @@ macro_rules! int_impl {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is /// This function will panic if `rhs` is 0 or if `self` is `Self::MIN` and
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag. /// `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
/// ///
/// # Examples /// # Examples
/// ///
@ -2943,6 +2943,11 @@ macro_rules! int_impl {
/// assert_eq!(a.rem_euclid(-b), 3); /// assert_eq!(a.rem_euclid(-b), 3);
/// assert_eq!((-a).rem_euclid(-b), 1); /// 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")] #[doc(alias = "modulo", alias = "mod")]
#[stable(feature = "euclidean_division", since = "1.38.0")] #[stable(feature = "euclidean_division", since = "1.38.0")]
#[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")] #[rustc_const_stable(feature = "const_euclidean_int_methods", since = "1.52.0")]
@ -2971,8 +2976,8 @@ macro_rules! int_impl {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is /// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag. /// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
/// ///
/// # Examples /// # Examples
/// ///
@ -3007,8 +3012,8 @@ macro_rules! int_impl {
/// ///
/// # Panics /// # Panics
/// ///
/// This function will panic if `rhs` is 0 or if `self` is -1 and `rhs` is /// This function will panic if `rhs` is 0 or if `self` is `Self::MIN`
/// `Self::MIN`. This behavior is not affected by the `overflow-checks` flag. /// and `rhs` is -1. This behavior is not affected by the `overflow-checks` flag.
/// ///
/// # Examples /// # Examples
/// ///