Skip to content

Commit 74c4c01

Browse files
committed
Mark unsafe NonZero*::unchecked_(add|mul) as const
1 parent ae90dcf commit 74c4c01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/num/nonzero.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ macro_rules! nonzero_unsigned_operations {
379379
/// ```
380380
#[unstable(feature = "nonzero_ops", issue = "84186")]
381381
#[inline]
382-
pub unsafe fn unchecked_add(self, other: $Int) -> $Ty {
382+
pub const unsafe fn unchecked_add(self, other: $Int) -> $Ty {
383383
// SAFETY: The caller ensures there is no overflow.
384384
unsafe { $Ty::new_unchecked(self.get().unchecked_add(other)) }
385385
}
@@ -750,7 +750,7 @@ macro_rules! nonzero_unsigned_signed_operations {
750750
/// ```
751751
#[unstable(feature = "nonzero_ops", issue = "84186")]
752752
#[inline]
753-
pub unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
753+
pub const unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
754754
// SAFETY: The caller ensures there is no overflow.
755755
unsafe { $Ty::new_unchecked(self.get().unchecked_mul(other.get())) }
756756
}

0 commit comments

Comments
 (0)