Skip to content

Commit

Permalink
Mark unsafe NonZero*::unchecked_(add|mul) as const
Browse files Browse the repository at this point in the history
  • Loading branch information
iago-lito committed Sep 20, 2021
1 parent ae90dcf commit 74c4c01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ macro_rules! nonzero_unsigned_operations {
/// ```
#[unstable(feature = "nonzero_ops", issue = "84186")]
#[inline]
pub unsafe fn unchecked_add(self, other: $Int) -> $Ty {
pub const unsafe fn unchecked_add(self, other: $Int) -> $Ty {
// SAFETY: The caller ensures there is no overflow.
unsafe { $Ty::new_unchecked(self.get().unchecked_add(other)) }
}
Expand Down Expand Up @@ -750,7 +750,7 @@ macro_rules! nonzero_unsigned_signed_operations {
/// ```
#[unstable(feature = "nonzero_ops", issue = "84186")]
#[inline]
pub unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
pub const unsafe fn unchecked_mul(self, other: $Ty) -> $Ty {
// SAFETY: The caller ensures there is no overflow.
unsafe { $Ty::new_unchecked(self.get().unchecked_mul(other.get())) }
}
Expand Down

0 comments on commit 74c4c01

Please sign in to comment.