From 74c4c0172ab1f5c19fef69a163349a0a3f9cd927 Mon Sep 17 00:00:00 2001 From: Iago-lito Date: Tue, 10 Aug 2021 09:34:12 +0200 Subject: [PATCH] Mark unsafe NonZero*::unchecked_(add|mul) as const --- library/core/src/num/nonzero.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/nonzero.rs b/library/core/src/num/nonzero.rs index dd9b9330aee2b..e44597279baf2 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())) } }