///
/// # Panics
///
- /// When the number is negative, zero, or if the base is not at least 2;
+ /// When the number is zero, or if the base is not at least 2;
/// it panics in debug mode and the return value is 0 in release mode.
///
/// # Examples
///
/// # Panics
///
- /// When the number is negative or zero it panics in debug mode and
+ /// When the number is zero it panics in debug mode and
/// the return value is 0 in release mode.
///
/// # Examples
///
/// # Panics
///
- /// When the number is negative or zero it panics in debug mode and the
+ /// When the number is zero it panics in debug mode and the
/// return value is 0 in release mode.
///
/// # Example
///
/// # Panics
///
- /// This function will panic if `rhs` is 0.
+ /// This function will panic if `rhs` is zero.
///
/// # Examples
///
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline(always)]
- #[rustc_inherit_overflow_checks]
pub const fn div_floor(self, rhs: Self) -> Self {
self / rhs
}
///
/// # Panics
///
- /// This function will panic if `rhs` is 0.
+ /// This function will panic if `rhs` is zero.
+ ///
+ /// ## Overflow behavior
+ ///
+ /// On overflow, this function will panic if overflow checks are enabled (default in debug
+ /// mode) and wrap if overflow checks are disabled (default in release mode).
///
/// # Examples
///
///
/// # Panics
///
- /// This function will panic if `rhs` is 0 or the operation results in overflow.
+ /// This function will panic if `rhs` is zero.
+ ///
+ /// ## Overflow behavior
+ ///
+ /// On overflow, this function will panic if overflow checks are enabled (default in debug
+ /// mode) and wrap if overflow checks are disabled (default in release mode).
///
/// # Examples
///
}
/// Calculates the smallest value greater than or equal to `self` that
- /// is a multiple of `rhs`. Returns `None` is `rhs` is zero or the
+ /// is a multiple of `rhs`. Returns `None` if `rhs` is zero or the
/// operation would result in overflow.
///
/// # Examples
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
- #[rustc_inherit_overflow_checks]
pub const fn checked_next_multiple_of(self, rhs: Self) -> Option<Self> {
match try_opt!(self.checked_rem(rhs)) {
0 => Some(self),