Skip to content

Commit 6b8eae0

Browse files
committed
Make saturating_div Docs Consistent with Others
1 parent 724fe8f commit 6b8eae0

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

library/core/src/num/int_macros.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,10 @@ macro_rules! int_impl {
11211121
/// Saturating integer division. Computes `self / rhs`, saturating at the
11221122
/// numeric bounds instead of overflowing.
11231123
///
1124+
/// # Panics
1125+
///
1126+
/// This function will panic if `rhs` is 0.
1127+
///
11241128
/// # Examples
11251129
///
11261130
/// Basic usage:
@@ -1131,11 +1135,6 @@ macro_rules! int_impl {
11311135
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MIN.saturating_div(-1), ", stringify!($SelfT), "::MAX);")]
11321136
///
11331137
/// ```
1134-
///
1135-
/// ```should_panic
1136-
#[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")]
1137-
///
1138-
/// ```
11391138
#[stable(feature = "saturating_div", since = "1.58.0")]
11401139
#[rustc_const_stable(feature = "saturating_div", since = "1.58.0")]
11411140
#[must_use = "this returns the result of the operation, \

library/core/src/num/uint_macros.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,10 @@ macro_rules! uint_impl {
11231123
/// Saturating integer division. Computes `self / rhs`, saturating at the
11241124
/// numeric bounds instead of overflowing.
11251125
///
1126+
/// # Panics
1127+
///
1128+
/// This function will panic if `rhs` is 0.
1129+
///
11261130
/// # Examples
11271131
///
11281132
/// Basic usage:
@@ -1131,11 +1135,6 @@ macro_rules! uint_impl {
11311135
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".saturating_div(2), 2);")]
11321136
///
11331137
/// ```
1134-
///
1135-
/// ```should_panic
1136-
#[doc = concat!("let _ = 1", stringify!($SelfT), ".saturating_div(0);")]
1137-
///
1138-
/// ```
11391138
#[stable(feature = "saturating_div", since = "1.58.0")]
11401139
#[rustc_const_stable(feature = "saturating_div", since = "1.58.0")]
11411140
#[must_use = "this returns the result of the operation, \

0 commit comments

Comments
 (0)