Commit 2d11559 1 parent 9a1d156 commit 2d11559 Copy full SHA for 2d11559
File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1165,8 +1165,12 @@ macro_rules! nonzero_integer_signedness_dependent_impls {
1165
1165
impl Div <NonZero <$Int>> for $Int {
1166
1166
type Output = $Int;
1167
1167
1168
+ /// Same as `self / other.get()`, but because `other` is a `NonZero<_>`,
1169
+ /// there's never a runtime check for division-by-zero.
1170
+ ///
1168
1171
/// This operation rounds towards zero, truncating any fractional
1169
1172
/// part of the exact result, and cannot panic.
1173
+ #[ doc( alias = "unchecked_div" ) ]
1170
1174
#[ inline]
1171
1175
fn div( self , other: NonZero <$Int>) -> $Int {
1172
1176
// SAFETY: Division by zero is checked because `other` is non-zero,
@@ -1177,6 +1181,9 @@ macro_rules! nonzero_integer_signedness_dependent_impls {
1177
1181
1178
1182
#[ stable( feature = "nonzero_div_assign" , since = "1.79.0" ) ]
1179
1183
impl DivAssign <NonZero <$Int>> for $Int {
1184
+ /// Same as `self /= other.get()`, but because `other` is a `NonZero<_>`,
1185
+ /// there's never a runtime check for division-by-zero.
1186
+ ///
1180
1187
/// This operation rounds towards zero, truncating any fractional
1181
1188
/// part of the exact result, and cannot panic.
1182
1189
#[ inline]
You can’t perform that action at this time.
0 commit comments