about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIago-lito <iago-lito@etak>2021-08-10 09:34:12 +0200
committerIago-lito <iago-lito@etak>2021-09-20 12:01:05 +0200
commit74c4c0172ab1f5c19fef69a163349a0a3f9cd927 (patch)
tree84713785cf60eeaf89c278d211b6bf77913cb035
parentae90dcf0207c57c3034f00b07048d63f8b2363c8 (diff)
downloadrust-74c4c0172ab1f5c19fef69a163349a0a3f9cd927.tar.gz
rust-74c4c0172ab1f5c19fef69a163349a0a3f9cd927.zip
Mark unsafe NonZero*::unchecked_(add|mul) as const
-rw-r--r--library/core/src/num/nonzero.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs
index dd9b9330aee..e44597279ba 100644
--- a/library/core/src/num/nonzero.rs
+++ b/library/core/src/num/nonzero.rs
@@ -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)) }
                 }
@@ -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())) }
                 }